Instructions to use onicai/llama_cpp_canister_models 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 onicai/llama_cpp_canister_models 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 onicai/llama_cpp_canister_models # Run inference directly in the terminal: llama cli -hf onicai/llama_cpp_canister_models
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf onicai/llama_cpp_canister_models # Run inference directly in the terminal: llama cli -hf onicai/llama_cpp_canister_models
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf onicai/llama_cpp_canister_models # Run inference directly in the terminal: ./build/bin/llama cli -hf onicai/llama_cpp_canister_models
Use Docker
docker model run hf.co/onicai/llama_cpp_canister_models
- Llama new
- LM Studio
- Jan
- Ollama
How to use onicai/llama_cpp_canister_models with Ollama:
ollama run hf.co/onicai/llama_cpp_canister_models
- Unsloth Desktop
- Docker Model Runner
How to use onicai/llama_cpp_canister_models with Docker Model Runner:
docker model run hf.co/onicai/llama_cpp_canister_models
- Lemonade
How to use onicai/llama_cpp_canister_models with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull onicai/llama_cpp_canister_models
Run and chat with the model
lemonade run user.llama_cpp_canister_models-{{QUANT_TAG}}List all available models
lemonade list
- Atomic Chat
|
Download README.md from onicai/llama_cpp_canister_models: direct link, hf CLI and curl.
- Browser
- Download file 2.8 kB
-
https://huggingface.co/onicai/llama_cpp_canister_models/resolve/main/README.md
- Command line
-
hf download hf://onicai/llama_cpp_canister_models/README.md
-
curl -L -o README.md https://huggingface.co/onicai/llama_cpp_canister_models/resolve/main/README.md
2.8 kB
| license: mit | |
| language: | |
| - en | |
| # On-chain llama.cpp - Internet Computer | |
| You can run any *.gguf file in a llama_cpp_canister, but these are smaller models you can use for testing [onicai/llama_cpp_canister](https://github.com/onicai/llama_cpp_canister) | |
| Notes: | |
| - Try them out at [ICGPT](https://icgpt.icpp.world/) | |
| - To use on the Internet Computer, follow instructions of [onicai/llama_cpp_canister](https://github.com/onicai/llama_cpp_canister) | |
| - Run local with [ggerganov/llama.cpp](https://github.com/ggerganov/llama.cpp) | |
| - The models were created with the training procedure outlined in [karpathy/llama2.c](https://github.com/karpathy/llama2.c) and then converted into *.gguf format as described below. | |
| ## Setup local git with lfs | |
| See: [Getting Started: set-up](https://huggingface.co/docs/hub/repositories-getting-started#set-up) | |
| ```bash | |
| # install git lfs | |
| # Ubuntu | |
| git lfs install | |
| # Mac | |
| brew install git-lfs | |
| # install huggingface CLI tools in a python environment | |
| pip install huggingface-hub | |
| # Clone this repo | |
| # https | |
| git clone https://huggingface.co/onicai/llama_cpp_canister_models | |
| # ssh | |
| git clone git@hf.co:onicai/llama_cpp_canister_models | |
| cd llama_cpp_canister_models | |
| # configure lfs for local repo | |
| huggingface-cli lfs-enable-largefiles . | |
| # tell lfs what files to track (.gitattributes) | |
| git lfs track "*.gguf" | |
| # add, commit & push as usual with git | |
| git add <file-name> | |
| git commit -m "Adding <file-name>" | |
| git push -u origin main | |
| ``` | |
| ## Model creation | |
| We used [convert-llama2c-to-ggml](https://github.com/ggerganov/llama.cpp/tree/32c8486e1f0297393cb22ac0a0d26a6b17ad4d54/examples/convert-llama2c-to-ggml) to convert the llama2.c model+tokenizer to llama.cpp gguf format. | |
| - Good read: [lama : add support for llama2.c models](https://github.com/ggerganov/llama.cpp/issues/2379) | |
| For example: | |
| ```bash | |
| # From llama.cpp root folder | |
| # Build everything | |
| make -j | |
| # Convert a llama2c model+tokenizer to gguf | |
| convert-llama2c-to-ggml --llama2c-model stories260Ktok512.bin --copy-vocab-from-model tok512.bin --llama2c-output-model stories260Ktok512.gguf | |
| convert-llama2c-to-ggml --llama2c-model stories15Mtok4096.bin --copy-vocab-from-model tok4096.bin --llama2c-output-model stories15Mtok4096.gguf | |
| convert-llama2c-to-ggml --llama2c-model stories42Mtok4096.bin --copy-vocab-from-model tok4096.bin --llama2c-output-model stories42Mtok4096.gguf | |
| convert-llama2c-to-ggml --llama2c-model stories110Mtok32000.bin --copy-vocab-from-model models/ggml-vocab-llama.gguf --llama2c-output-model stories110Mtok32000.gguf | |
| convert-llama2c-to-ggml --llama2c-model stories42Mtok32000.bin --copy-vocab-from-model models/ggml-vocab-llama.gguf --llama2c-output-model stories42Mtok32000.gguf | |
| # Run it local, like this | |
| ./llama-cli -m stories15Mtok4096.gguf -p "Joe loves writing stories" -n 600 -c 128 | |
| ``` | |