Instructions to use useful-quants/GLM-4.6V-Flash-W4A16-BF16Vision with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use useful-quants/GLM-4.6V-Flash-W4A16-BF16Vision with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="useful-quants/GLM-4.6V-Flash-W4A16-BF16Vision") 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("useful-quants/GLM-4.6V-Flash-W4A16-BF16Vision") model = AutoModelForMultimodalLM.from_pretrained("useful-quants/GLM-4.6V-Flash-W4A16-BF16Vision", 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use useful-quants/GLM-4.6V-Flash-W4A16-BF16Vision with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "useful-quants/GLM-4.6V-Flash-W4A16-BF16Vision" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "useful-quants/GLM-4.6V-Flash-W4A16-BF16Vision", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/useful-quants/GLM-4.6V-Flash-W4A16-BF16Vision
- SGLang
How to use useful-quants/GLM-4.6V-Flash-W4A16-BF16Vision with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "useful-quants/GLM-4.6V-Flash-W4A16-BF16Vision" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "useful-quants/GLM-4.6V-Flash-W4A16-BF16Vision", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
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 "useful-quants/GLM-4.6V-Flash-W4A16-BF16Vision" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "useful-quants/GLM-4.6V-Flash-W4A16-BF16Vision", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use useful-quants/GLM-4.6V-Flash-W4A16-BF16Vision with Docker Model Runner:
docker model run hf.co/useful-quants/GLM-4.6V-Flash-W4A16-BF16Vision
GLM-4.6V-Flash W4A16 BF16-Vision
Ampere-oriented quantized serving build of zai-org/GLM-4.6V-Flash.
This repo packages a local-serving variant where:
- the text / MoE weights are stored as
compressed-tensorsW4A16 - the vision tower remains BF16
- serving is validated through the provided Dockerfile
- the Dockerfile applies a required vLLM loader patch for this package
This is intended as a practical RTX 30xx / 40xx local serving artifact, not as a general “drop into any vLLM install” checkpoint.
Why the Dockerfile is required
This package currently depends on a patched vLLM runtime.
The included Dockerfile applies a loader patch needed for this checkpoint layout, specifically to support loading split Q/K/V vision weights into combined qkv_proj parameters used by the runtime.
Use the provided Docker image unless you have independently applied and validated the same patch in your own vLLM environment.
Recommended serving path
From the root of this model repo:
docker build -t vllm-glm46v-bf16vision .
docker run --rm -it \
--gpus all \
--ipc=host \
-p 8001:8000 \
-v "$(pwd):/model" \
vllm-glm46v-bf16vision \
--model /model \
--served-model-name GLM-4.6V-Flash-W4A16-BF16Vision \
--trust-remote-code \
--dtype bfloat16 \
--quantization compressed-tensors \
--max-model-len 8000 \
--limit-mm-per-prompt '{"image":1}' \
--allowed-local-media-path /
The --max-model-len 8000 value is the recommended local serving default for this package. It is not a statement about the upstream model’s full trained context length.
Smoke test
After the server is running:
python examples/smoke_image_data_url.py \
--url http://localhost:8001/v1/chat/completions \
--model GLM-4.6V-Flash-W4A16-BF16Vision
The smoke test sends an image as a data URL to the OpenAI-compatible /v1/chat/completions endpoint and checks that the model returns a text response.
Expected use
Best fit:
- RTX 30xx / 40xx GPUs
- local multimodal inference
- OpenAI-compatible vLLM serving
- one image per prompt
- moderate context serving defaults
Not the best fit:
- CPU inference
- Apple Silicon inference
- unpatched vLLM installs
- generic Transformers pipeline usage without testing
- long-context stress testing without adjusting memory settings
Notes
- The base model is
zai-org/GLM-4.6V-Flash. - This repo is a quantized serving package derived from the base model.
- Text / MoE weights use W4A16 compressed-tensors.
- Vision weights remain BF16.
- Runtime validation is tied to the supplied Dockerfile.
- If you use a different serving stack, treat it as unsupported until independently smoke-tested.
Files
Expected repo layout:
.
├── README.md
├── LICENSE
├── Dockerfile
├── patches/
│ └── vllm_glm46v_qkv_loader.patch
├── examples/
│ └── smoke_image_data_url.py
├── config.json
├── generation_config.json
├── tokenizer.json
├── tokenizer_config.json
├── preprocessor_config.json
├── chat_template.jinja
├── model.safetensors.index.json
└── *.safetensors
Attribution
This package is derived from zai-org/GLM-4.6V-Flash.
- Downloads last month
- 43
Model tree for useful-quants/GLM-4.6V-Flash-W4A16-BF16Vision
Base model
zai-org/GLM-4.6V-Flash