Instructions to use prism-ml/Ternary-Bonsai-2-27B-gguf 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 prism-ml/Ternary-Bonsai-2-27B-gguf 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 prism-ml/Ternary-Bonsai-2-27B-gguf:F16 # Run inference directly in the terminal: llama cli -hf prism-ml/Ternary-Bonsai-2-27B-gguf:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf prism-ml/Ternary-Bonsai-2-27B-gguf:F16 # Run inference directly in the terminal: llama cli -hf prism-ml/Ternary-Bonsai-2-27B-gguf:F16
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 prism-ml/Ternary-Bonsai-2-27B-gguf:F16 # Run inference directly in the terminal: ./llama-cli -hf prism-ml/Ternary-Bonsai-2-27B-gguf:F16
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 prism-ml/Ternary-Bonsai-2-27B-gguf:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf prism-ml/Ternary-Bonsai-2-27B-gguf:F16
Use Docker
docker model run hf.co/prism-ml/Ternary-Bonsai-2-27B-gguf:F16
- LM Studio
- Jan
- vLLM
How to use prism-ml/Ternary-Bonsai-2-27B-gguf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prism-ml/Ternary-Bonsai-2-27B-gguf" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prism-ml/Ternary-Bonsai-2-27B-gguf", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/prism-ml/Ternary-Bonsai-2-27B-gguf:F16
- Ollama
How to use prism-ml/Ternary-Bonsai-2-27B-gguf with Ollama:
ollama run hf.co/prism-ml/Ternary-Bonsai-2-27B-gguf:F16
- Unsloth Desktop
- Pi
How to use prism-ml/Ternary-Bonsai-2-27B-gguf with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf prism-ml/Ternary-Bonsai-2-27B-gguf:F16
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "prism-ml/Ternary-Bonsai-2-27B-gguf:F16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use prism-ml/Ternary-Bonsai-2-27B-gguf with Docker Model Runner:
docker model run hf.co/prism-ml/Ternary-Bonsai-2-27B-gguf:F16
- Lemonade
How to use prism-ml/Ternary-Bonsai-2-27B-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull prism-ml/Ternary-Bonsai-2-27B-gguf:F16
Run and chat with the model
lemonade run user.Ternary-Bonsai-2-27B-gguf-F16
List all available models
lemonade list
- Hermes Agent
How to use prism-ml/Ternary-Bonsai-2-27B-gguf with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf prism-ml/Ternary-Bonsai-2-27B-gguf:F16
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default prism-ml/Ternary-Bonsai-2-27B-gguf:F16
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use prism-ml/Ternary-Bonsai-2-27B-gguf with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf prism-ml/Ternary-Bonsai-2-27B-gguf:F16
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "prism-ml/Ternary-Bonsai-2-27B-gguf:F16" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
AMD works just wonderfully, here is how:
Predispositions:
() You MUST build; the pre-built executables are not working, they use CPU only (even if you remove the CUDA+HIPs and the script reaches Vulkan)
() Vulkan is faster, as always
Tools that are always helpful:
Git, CMake, and Ninja (Ninja comes with VS; also you may install it separately). Ask your loved one where to get them and how to install, it is straightforward.
For running first time:
git clone https://github.com/PrismML-Eng/llama.cpp.git
Or for updating over Ternary 1:
go to the directory of llama.cpp (the main one) and do
git pull
To run HIPs you need the workstation driver, the game adrenaline driver contains only Vulkan. HIPs maybe have better pp, but Vulkan have better tg (or it was the opposite? don't remember already, as summarized speed Vulkan is better)
Important notice:
Vulkan is multiplatform, you have my encouragement to try it with Intel videocards too!
I try everytime to enable HTTPS, but it doesn't work (with the main llama.cpp is the same), however, here is what I do:
install OpenSSL
Preparation to building:
under PowerShell (under Command prompt you have to use Path):
copy C:\Program Files\OpenSSL-Win64\lib\VC\x64\MD*.* C:\Program Files\OpenSSL-Win64\lib - this is only the 1st time after installing OpenSSL, just to make the libraries 'visible' to the compiler
$env:OPENSSL_ROOT_DIR = "C:\Program Files\OpenSSL-Win64"
$env:GGML_VULKAN_FORCE_COOPMAT="1" - this enables the new matrix cores in RDNA3/4, but also 'may' have effect on RDNA1/2, at least doesn't hurt for sure
$env:GGML_VK_SUBALLOCATION_BLOCK_SIZE="4294967296" - the default was maybe 512MB, setting to 4GB ... have some good effect, yes
cmake -S . -B build.Vulkan -G Ninja -DGGML_VULKAN=ON -DGGML_VULKAN_USE_COOPMAT=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DOPENSSL_ROOT_DIR="C:\Program Files\OpenSSL-Win64" -DGGML_OPENMP=OFF -DLLAMA_BUILD_BORINGSSL=ON -DLLAMA_BUILD_TESTS=OFF
with the current fork of PrismML, the tests=OFF (last parameter) is mandatory, without it the compilation break and can't finish !
() -B build.Vulkan is the directory, where the compiled will go, use whatever you like (or need) here
() you may notice that I duplicate the enviroinment variables as command parameters, and also added BoringSSL for the HTTPS/SSL, and yet no success. Hope for you it will be better, I have no more ideas than to install and include them (as shown in the command).
Build:
cmake --build build.Vulkan --config Release --
after that, as usual in the directory there will be subdir bin\ where all the .exe files reside.
Again why to use this?
Coz the 'official' information is not fully true, just like it was for Ternary1. It works wonderfully, the pre-built executables are unusable for AMD (both ROCm and Vulkan, they have CPU offload only), they generate their own directory tree, and their command prompt is very basic. I think most of the team have no access to AMD hardware.
Here is what you may find useful as starting command for 16GB AMD Radeon card:
.\build.vulkan\bin\llama-server.exe -m "Ternary-Bonsai-2-27B-PQ2_0" -ngl 99 -fa on -c 262144 --host 0.0.0.0 -t 16 --dynatemp-range 0.15 --top-p 0.34 --top-k 12 --min-p 0.45 --repeat-penalty 1.12 --presence-penalty 0.0 -ctk q5_1 -ctv q5_1 --spec-type ngram-mod,ngram-map-k4v -np 1 --spec-draft-n-max 2 --spec-ngram-mod-n-match 20 --spec-ngram-mod-n-min 36 --spec-ngram-mod-n-max 68 --spec-ngram-map-k4v-size-n 10 --cache-ram 4096 --chat-template-file .\Qwen-3.8\Qwen-sharp-chat_template.jinja --reasoning-effort medium --perf --slot-save-path .\cache\ -b 8192 -ub 448 -cms 3172 -ctxcp 56 --lookup-cache-dynamic .\cache\n-gram.cache -lm dio
() --chat-template-file .\Qwen-3.8\Qwen-sharp-chat_template.jinja I'm using the sharp jinja template from peculiar-ragdoll https://huggingface.co/peculiar-ragdoll/Qwen-Sharp-Chat-Templates/tree/main
() -ub 448 is due to AMD RDNA 2 architecture (RX 6xxx cards), no idea how it behaves on RDNA3/4 (it will have benefit to be 768 or even 1024)
() -t 16 is to use 16 CPU threads if anything goes there, not actually needed
() I'm yet to experiment with MTPs, for Ternary1 DSpark was not working, despite it was paired with it.
In my case (RDNA2 with 16GB VRAM) from the dense QWEN 3.8 27B I can use Q3-K-XXS only, this baby here gives 6x pp and slightly lower tg. For some reason currently ngram is not working, only 5% approval, so still on the path to fix it. While with the dense model it was ~83% approval (same topics).
With this default 256K context my vram is 14.4 GB from 16 GB used, CPU usage is most of the time 1% to 3% (despite it shows 0.7 GB shared RAM usage).
So, again: all is working. The model is truly, visibly better than the Q3_XXS dense.
Their efforts (PrismML team) are monumental and their success is much, much more than that!