How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("image-text-to-text", model="prism-ml/Ternary-Bonsai-27B-AWQ-4bit")
messages = [
    {
        "role": "user",
        "content": [
            {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
            {"type": "text", "text": "What animal is on the candy?"}
        ]
    },
]
pipe(text=messages)
# Load model directly
from transformers import AutoProcessor, AutoModelForMultimodalLM

processor = AutoProcessor.from_pretrained("prism-ml/Ternary-Bonsai-27B-AWQ-4bit")
model = AutoModelForMultimodalLM.from_pretrained("prism-ml/Ternary-Bonsai-27B-AWQ-4bit", device_map="auto")
messages = [
    {
        "role": "user",
        "content": [
            {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
            {"type": "text", "text": "What animal is on the candy?"}
        ]
    },
]
inputs = processor.apply_chat_template(
	messages,
	add_generation_prompt=True,
	tokenize=True,
	return_dict=True,
	return_tensors="pt",
).to(model.device)

outputs = model.generate(**inputs, max_new_tokens=40)
print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Quick Links

Ternary-Bonsai-27B — AWQ 4-bit

Serve (sglang)

pip install sglang

python -m sglang.launch_server \
    --model prism-ml/Ternary-Bonsai-27B-AWQ-4bit \
    --port 8000 \
    --dtype bfloat16

Use

curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"prism-ml/Ternary-Bonsai-27B-AWQ-4bit","messages":[{"role":"user","content":"Who are you?"}],"max_tokens":100}'

Multi-GPU (8× H100)

# TP=2 DP=4 — 4 replicas, each split across 2 GPUs (throughput sweet spot)
python -m sglang.launch_server \
    --model prism-ml/Ternary-Bonsai-27B-AWQ-4bit \
    --tp-size 2 --dp-size 4 \
    --load-balance-method total_tokens \
    --port 8000 --dtype bfloat16

# TP=2 — single replica split across 2 GPUs
python -m sglang.launch_server \
    --model prism-ml/Ternary-Bonsai-27B-AWQ-4bit \
    --tp-size 2 \
    --port 8000 --dtype bfloat16
Downloads last month
4,362
Safetensors
Model size
27B params
Tensor type
BF16
·
I32
·
Inference Providers NEW
Input a message to start chatting with prism-ml/Ternary-Bonsai-27B-AWQ-4bit.

Collection including prism-ml/Ternary-Bonsai-27B-AWQ-4bit