Instructions to use AJKADZ/PHI_CODER with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use AJKADZ/PHI_CODER with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf AJKADZ/PHI_CODER:Q4_K_M # Run inference directly in the terminal: llama cli -hf AJKADZ/PHI_CODER:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf AJKADZ/PHI_CODER:Q4_K_M # Run inference directly in the terminal: llama cli -hf AJKADZ/PHI_CODER:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf AJKADZ/PHI_CODER:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf AJKADZ/PHI_CODER:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf AJKADZ/PHI_CODER:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf AJKADZ/PHI_CODER:Q4_K_M
Use Docker
docker model run hf.co/AJKADZ/PHI_CODER:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use AJKADZ/PHI_CODER with Ollama:
ollama run hf.co/AJKADZ/PHI_CODER:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use AJKADZ/PHI_CODER with Docker Model Runner:
docker model run hf.co/AJKADZ/PHI_CODER:Q4_K_M
- Lemonade
How to use AJKADZ/PHI_CODER with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull AJKADZ/PHI_CODER:Q4_K_M
Run and chat with the model
lemonade run user.PHI_CODER-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Download phi-coder-hf/llama.cpp/examples/training/finetune.cpp from AJKADZ/PHI_CODER: direct link, hf CLI and curl.
- Browser
- Download file 3.21 kB
-
https://huggingface.co/AJKADZ/PHI_CODER/resolve/main/phi-coder-hf/llama.cpp/examples/training/finetune.cpp
- Command line
-
hf download hf://AJKADZ/PHI_CODER/phi-coder-hf/llama.cpp/examples/training/finetune.cpp
-
curl -L -o finetune.cpp https://huggingface.co/AJKADZ/PHI_CODER/resolve/main/phi-coder-hf/llama.cpp/examples/training/finetune.cpp
3.21 kB
| int main(int argc, char ** argv) { | |
| common_params params; | |
| params.escape = false; | |
| if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_PERPLEXITY)) { | |
| return 1; | |
| } | |
| if (params.use_mmap) { | |
| LOG_INF("%s: force disabling memory mapping because it would result in-read-only pointers to the weights\n", __func__); | |
| params.use_mmap = false; | |
| } | |
| if (params.cache_type_k != GGML_TYPE_F32) { | |
| LOG_INF("%s: force changing k cache type to f32 due to a lack of f16 support for OUT_PROD\n", __func__); | |
| params.cache_type_k = GGML_TYPE_F32; | |
| } | |
| if (params.cache_type_v != GGML_TYPE_F32) { | |
| LOG_INF("%s: force changing v cache type to f32 due to a lack of f16 support for OUT_PROD\n", __func__); | |
| params.cache_type_v = GGML_TYPE_F32; | |
| } | |
| common_init(); | |
| llama_backend_init(); | |
| llama_numa_init(params.numa); | |
| // load the model and apply lora adapter, if any | |
| common_init_result llama_init = common_init_from_params(params); | |
| llama_model_ptr & model = llama_init.model; | |
| llama_context_ptr & ctx = llama_init.context; | |
| if (model == NULL) { | |
| LOG_ERR("%s: unable to load model\n", __func__); | |
| return 1; | |
| } | |
| // print system information | |
| { | |
| LOG_INF("\n"); | |
| LOG_INF("%s\n", common_params_get_system_info(params).c_str()); | |
| } | |
| constexpr float val_split = 0.05f; | |
| std::vector<llama_token> tokens = common_tokenize(ctx.get(), params.prompt, true); | |
| ggml_opt_dataset_t dataset = common_opt_dataset_init(ctx.get(), tokens, llama_n_ctx(ctx.get())/2); | |
| struct ggml_opt_optimizer_params optimizer_params = ggml_opt_get_default_optimizer_params(nullptr); | |
| optimizer_params.adamw.alpha = 1e-7f; // learning rate | |
| struct llama_opt_params lopt_params { | |
| /*n_ctx_train =*/ 0, | |
| /*param_filter =*/ llama_opt_param_filter_all, | |
| /*param_filter_ud =*/ nullptr, | |
| /*get_opt_pars =*/ ggml_opt_get_constant_optimizer_params, | |
| /*get_opt_pars_ud =*/ &optimizer_params, | |
| }; | |
| llama_opt_init(ctx.get(), model.get(), lopt_params); | |
| const int64_t idata_split = ggml_opt_dataset_ndata(dataset) * (1.0f - val_split); | |
| ggml_opt_result_t result_train = ggml_opt_result_init(); | |
| ggml_opt_result_t result_eval = ggml_opt_result_init(); | |
| for (int epoch = 0; epoch < 2; ++epoch) { | |
| llama_opt_epoch(ctx.get(), dataset, result_train, result_eval, idata_split, | |
| ggml_opt_epoch_callback_progress_bar, ggml_opt_epoch_callback_progress_bar); | |
| fprintf(stderr, "\n"); | |
| ggml_opt_result_reset(result_train); | |
| ggml_opt_result_reset(result_eval); | |
| } | |
| ggml_opt_result_free(result_train); | |
| ggml_opt_result_free(result_eval); | |
| llama_model_save_to_file(model.get(), "finetuned-model.gguf"); | |
| llama_backend_free(); | |
| return 0; | |
| } | |