OCR Quantized
Collection
Quantized OCR / document VLMs (GLM-OCR, PaddleOCR-VL) — compressed-tensors + GGUF for vLLM / llama.cpp. By axteam. • 4 items • Updated
How to use axteam/GLM-OCR-FP8-dynamic with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-text-to-text", model="axteam/GLM-OCR-FP8-dynamic")
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) # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForMultimodalLM
tokenizer = AutoTokenizer.from_pretrained("axteam/GLM-OCR-FP8-dynamic")
model = AutoModelForMultimodalLM.from_pretrained("axteam/GLM-OCR-FP8-dynamic", 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 = tokenizer.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=256)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use axteam/GLM-OCR-FP8-dynamic with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "axteam/GLM-OCR-FP8-dynamic"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "axteam/GLM-OCR-FP8-dynamic",
"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 run hf.co/axteam/GLM-OCR-FP8-dynamic
How to use axteam/GLM-OCR-FP8-dynamic with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "axteam/GLM-OCR-FP8-dynamic" \
--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": "axteam/GLM-OCR-FP8-dynamic",
"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 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 "axteam/GLM-OCR-FP8-dynamic" \
--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": "axteam/GLM-OCR-FP8-dynamic",
"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"
}
}
]
}
]
}'How to use axteam/GLM-OCR-FP8-dynamic with Docker Model Runner:
docker model run hf.co/axteam/GLM-OCR-FP8-dynamic
8-bit quantization of zai-org/GLM-OCR for vLLM serving. Quantized by axteam.
| Base model | zai-org/GLM-OCR |
| Method | FP8 (dynamic) |
| Format | compressed-tensors FP8_DYNAMIC |
| Weights / activations | W8A8 — FP8 E4M3 weights (per-channel), dynamic per-token FP8 activations |
| Architecture | Dense · GLM text backbone + vision encoder · MTP head · document/OCR VLM |
| Size on disk | ~2.0 GB |
| Calibration | None (data-free) |
| License | mit |
FP8_DYNAMIC.model.visual.*), the multi-token-prediction layer, token embeddings, the LM head, and all RMSNorms (a small fraction of parameters). Only the language-model backbone's attention & MLP projections are quantized, so the OCR/vision path is untouched.chat_template / processor identical to the original.Fidelity to the BF16 original on an internal mixed EN/KO set (100 prompts, text next-token scoring).
| Metric | This model | BF16 original |
|---|---|---|
| Perplexity (lower = closer) | 1.3726 | 1.3599 (+0.9%) |
| Top-1 next-token agreement | 96.5% | 99.4% |
vllm serve axteam/GLM-OCR-FP8-dynamic --trust-remote-code
Quantized derivative of zai-org/GLM-OCR (mit). Original weights & processor belong to the upstream authors.
zai-org/GLM-OCR 를 FP8 (dynamic) 로 양자화한 서빙용(8-bit) OCR 모델입니다. 작성: axteam.
FP8_DYNAMIC.model.visual.*)·MTP 레이어·토큰 임베딩·LM 헤드·모든 norm. 언어모델 백본의 attention·MLP projection 만 양자화(비전/OCR 경로 그대로).vllm serve axteam/GLM-OCR-FP8-dynamic --trust-remote-code. 라이선스 mit.Base model
zai-org/GLM-OCR