AI SeedbankHelp preserve open and free AI for humanity's future

← All models

zai-org_GLM-OCR

zai-org · View on Hugging Face ↗

Get this model

Download TorrentMagnet Link

Seeders: · Leechers:

Model card

The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.


license: mit language:

  • zh
  • en
  • fr
  • es
  • ru
  • de
  • ja
  • ko library_name: transformers

GLM-OCR

👋 Join our WeChat and Discord community
📍 Use GLM-OCR's API
👉 GLM-OCR SDK Recommended
📖 Technical Report

Introduction

GLM-OCR is a multimodal OCR model for complex document understanding, built on the GLM-V encoder–decoder architecture. It introduces Multi-Token Prediction (MTP) loss and stable full-task reinforcement learning to improve training efficiency, recognition accuracy, and generalization. The model integrates the CogViT visual encoder pre-trained on large-scale image–text data, a lightweight cross-modal connector with efficient token downsampling, and a GLM-0.5B language decoder. Combined with a two-stage pipeline of layout analysis and parallel recognition based on PP-DocLayout-V3, GLM-OCR delivers robust and high-quality OCR performance across diverse document layouts.

Key Features

  • State-of-the-Art Performance: Achieves a score of 94.62 on OmniDocBench V1.5, ranking #1 overall, and delivers state-of-the-art results across major document understanding benchmarks, including formula recognition, table recognition, and information extraction.

  • Optimized for Real-World Scenarios: Designed and optimized for practical business use cases, maintaining robust performance on complex tables, code-heavy documents, seals, and other challenging real-world layouts.

  • Efficient Inference: With only 0.9B parameters, GLM-OCR supports deployment via vLLM, SGLang, and Ollama, significantly reducing inference latency and compute cost, making it ideal for high-concurrency services and edge deployments.

  • Easy to Use: Fully open-sourced and equipped with a comprehensive SDK and inference toolchain, offering simple installation, one-line invocation, and smooth integration into existing production pipelines.

Performance

  • Document Parsing & Information Extraction

  • Real-World Scenarios Performance

  • Speed Test

For speed, we compared different OCR methods under identical hardware and testing conditions (single replica, single concurrency), evaluating their performance in parsing and exporting Markdown files from both image and PDF inputs. Results show GLM-OCR achieves a throughput of 1.86 pages/second for PDF documents and 0.67 images/second for images, significantly outperforming comparable models.

Usage

Official SDK

For document parsing tasks, we strongly recommend using our official SDK. Compared with model-only inference, the SDK integrates PP-DocLayoutV3 and provides a complete, easy-to-use pipeline for document parsing, including layout analysis and structured output generation. This significantly reduces the engineering overhead required to build end-to-end document intelligence systems.

Note that the SDK is currently designed for document parsing tasks only. For information extraction tasks, please refer to the following section and run inference directly with the model.

vLLM

  1. run
pip install -U vllm --extra-index-url https://wheels.vllm.ai/nightly

or using docker with:

docker pull vllm/vllm-openai:nightly
  1. run with:
pip install git+https://github.com/huggingface/transformers.git
vllm serve zai-org/GLM-OCR  --allowed-local-media-path /  --port 8080

SGLang

  1. using docker with:
docker pull lmsysorg/sglang:dev

or build it from source with:

pip install git+https://github.com/sgl-project/sglang.git#subdirectory=python
  1. run with:
pip install git+https://github.com/huggingface/transformers.git
python -m sglang.launch_server --model zai-org/GLM-OCR --port 8080

Ollama

  1. Download Ollama.
  2. run with:
ollama run glm-ocr

Ollama will automatically use image file path when an image is dragged into the terminal:

ollama run glm-ocr Text Recognition: ./image.png

Transformers

pip install git+https://github.com/huggingface/transformers.git
from transformers import AutoProcessor, AutoModelForImageTextToText
import torch

MODEL_PATH = "zai-org/GLM-OCR"
messages = [
    {
        "role": "user",
        "content": [
            {
                "type": "image",
                "url": "test_image.png"
            },
            {
                "type": "text",
                "text": "Text Recognition:"
            }
        ],
    }
]
processor = AutoProcessor.from_pretrained(MODEL_PATH)
model = AutoModelForImageTextToText.from_pretrained(
    pretrained_model_name_or_path=MODEL_PATH,
    torch_dtype="auto",
    device_map="auto",
)
inputs = processor.apply_chat_template(
    messages,
    tokenize=True,
    add_generation_prompt=True,
    return_dict=True,
    return_tensors="pt"
).to(model.device)
inputs.pop("token_type_ids", None)
generated_ids = model.generate(**inputs, max_new_tokens=8192)
output_text = processor.decode(generated_ids[0][inputs["input_ids"].shape[1]:], skip_special_tokens=False)
print(output_text)

Prompt Limited

GLM-OCR currently supports two types of prompt scenarios:

  1. Document Parsing – extract raw content from documents. Supported tasks include:
{
    "text": "Text Recognition:",
    "formula": "Formula Recognition:",
    "table": "Table Recognition:"
}
  1. Information Extraction – extract structured information from documents. Prompts must follow a strict JSON schema. For example, to extract personal ID information:
请按下列JSON格式输出图中信息:
{
    "id_number": "",
    "last_name": "",
    "first_name": "",
    "date_of_birth": "",
    "address": {
        "street": "",
        "city": "",
        "state": "",
        "zip_code": ""
    },
    "dates": {
        "issue_date": "",
        "expiration_date": ""
    },
    "sex": ""
}

⚠️ Note: When using information extraction, the output must strictly adhere to the defined JSON schema to ensure downstream processing compatibility.

Acknowledgement

This project is inspired by the excellent work of the following projects and communities:

License

The GLM-OCR model is released under the MIT License.

The complete OCR pipeline integrates PP-DocLayoutV3 for document layout analysis, which is licensed under the Apache License 2.0. Users should comply with both licenses when using this project.

Citation

If you find GLM-OCR useful in your research, please cite our technical report:

@misc{duan2026glmocrtechnicalreport,
      title={GLM-OCR Technical Report},
      author={Shuaiqi Duan and Yadong Xue and Weihan Wang and Zhe Su and Huan Liu and Sheng Yang and Guobing Gan and Guo Wang and Zihan Wang and Shengdong Yan and Dexin Jin and Yuxuan Zhang and Guohong Wen and Yanfeng Wang and Yutao Zhang and Xiaohan Zhang and Wenyi Hong and Yukuo Cen and Da Yin and Bin Chen and Wenmeng Yu and Xiaotao Gu and Jie Tang},
      year={2026},
      eprint={2603.10910},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2603.10910},
}

Magnet link

Opens the swarm directly in your torrent client — no file download needed. Copy-paste works too:

magnet:?xt=urn:btih:6c5a509de9b216138cc66683de963e5d5aee3967&dn=zai-org_GLM-OCR

Open magnet in torrent client · infohash 6c5a509de9b216138cc66683de963e5d5aee3967

Files & hashes

PathSizesha1sha256
README.md8.1 KB (8,277 B)2dcab5a6ed326dd7db202569c79c2244654ca028e8e84b75857428ba5c152b561b5af0e607c991240ecf8dfa31cb616f8a1c61ff
chat_template.jinja4.5 KB (4,606 B)8f3b7224cc22edcb813a59ca438efc92f15749a9062e7ee4cc8defa88a5938b5d456dc60366ffd80647f918946ee747bf09ddc7c
config.json1.5 KB (1,570 B)46fbd1c232b7d9d0fc261cf10361350ef3af02c34e1daf0d8a3f63e58960ac14bcb58b7be96758cad231fb7a1e5fec60f42dcd8c
generation_config.json165 B (165 B)0de866e8cc29b4479b56bf68300da9353bc63a714e2a3412f65b2a21d315d928986c55723d3e60dfb92c3982a5b9fd56835b0aa5
model.safetensors2.47 GB (2,650,579,464 B)9549e2fa6db690cc290fb6625380f41e2bc36854a16eb0de98d199293371c560f95f83130d2a2c9612449df16839f08ff9498815
preprocessor_config.json367 B (367 B)308553695af766b3e3d05e68279d2c690e73273e02cc50c36240882ae35e8cd4077a25a379664108185d728d261cb785aefeccff
tokenizer.json6.5 MB (6,838,609 B)9f4a549a14a96217569648aa7627c6674ad94fe9aa0fd058c73a5718bb191f6672dc16d122ee0147b20c123d1726514298f9968a
tokenizer_config.json1.0 KB (1,066 B)18f2106a5124ac945ee5526ac60fa75e09e97e1123404f517abeb2893f1c175c6d7c539f733f6fca287414a2ce9ab569d99a1c06

Cite this release

Canonical URL
https://aiseedbank.org/models/zai-org_GLM-OCR/
Slug
zai-org_GLM-OCR
Infohash
6c5a509de9b216138cc66683de963e5d5aee3967
License
mit
Signing key fingerprint
85a3b32c3712427b

Every file carries a locally computed sha256 — verify a download against the signed sums: zai-org_GLM-OCR.SHA256SUMS (+ minisign signature).

Provenance

Upstream repositoryzai-org/GLM-OCR
Revision (pinned)ca5d8b3e287e52589e37c28385d9655ee4372f9d
Fetched at2026-09-04T06:55:34Z
License at fetchmit
Snapshot toolhuggingface · seedbank 0.1.0

Trackers

✓ verified · rehash-vs-hf-metadata at 2026-09-04T06:56:00Z

mit2.47 GB (2,657,434,124 bytes)transformerssafetensorsglm_ocrimage-text-to-textconversationaleval-resultsendpoints_compatible8 languages (zh, en, fr …)paper: 2603.10910