ternary-models: VLMs, Multimodal & Audio
Collection
Ternary-quantized models for architectures GGUF can't handle. tritplane3 scheme. • 16 items • Updated • 2
How to use AsadIsmail/Qwen2.5-VL-7B-Instruct-ternary with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-text-to-text", model="AsadIsmail/Qwen2.5-VL-7B-Instruct-ternary") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("AsadIsmail/Qwen2.5-VL-7B-Instruct-ternary", dtype="auto")How to use AsadIsmail/Qwen2.5-VL-7B-Instruct-ternary with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "AsadIsmail/Qwen2.5-VL-7B-Instruct-ternary"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "AsadIsmail/Qwen2.5-VL-7B-Instruct-ternary",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/AsadIsmail/Qwen2.5-VL-7B-Instruct-ternary
How to use AsadIsmail/Qwen2.5-VL-7B-Instruct-ternary with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "AsadIsmail/Qwen2.5-VL-7B-Instruct-ternary" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "AsadIsmail/Qwen2.5-VL-7B-Instruct-ternary",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "AsadIsmail/Qwen2.5-VL-7B-Instruct-ternary" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "AsadIsmail/Qwen2.5-VL-7B-Instruct-ternary",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use AsadIsmail/Qwen2.5-VL-7B-Instruct-ternary with Docker Model Runner:
docker model run hf.co/AsadIsmail/Qwen2.5-VL-7B-Instruct-ternary
Ternary-quantized version of Qwen/Qwen2.5-VL-7B-Instruct, produced with ternary-quant.
Qwen2.5-VL is one of the most capable open-weight vision-language models. This ternary-quantized version targets lower memory use while preserving multimodal behavior in a HuggingFace-native, component-aware PTQ workflow.
| Metric | Value |
|---|---|
| Scheme | tritplane3 (3-plane progressive ternary) |
| Components quantized | text_backbone, multimodal_connector (196 linear layers) |
| Vision encoder | Kept in FP16 |
| Stored size | 7341 MB (~7.2 GB) |
| FP16 size | 13051 MB (~12.7 GB) |
| Compression ratio | 1.8x |
from ternary_quant.inference import load_ternary_model
model, processor = load_ternary_model(
"AsadIsmail/Qwen2.5-VL-7B-Instruct-ternary",
runtime_mode="metal" # "cached" for NVIDIA/CPU
)
from PIL import Image
image = Image.open("photo.jpg")
inputs = processor(text="What is shown in this image?", images=image, return_tensors="pt")
inputs = {k: v.to(model.device) for k, v in inputs.items()}
outputs = model.generate(**inputs, max_new_tokens=256)
print(processor.decode(outputs[0], skip_special_tokens=True))
pip install ternary-quant
ternary-quant quantize-broad Qwen/Qwen2.5-VL-7B-Instruct \
--output ./Qwen2.5-VL-7B-Instruct-ternary \
--components text_backbone multimodal_connector \
--scheme tritplane3 --dtype float16 --eval
Base model
Qwen/Qwen2.5-VL-7B-Instruct