GLM-OCR

GLM-OCR is Z.ai's two-stage document parser. PP-DocLayoutV3 finds the layout regions and their reading order, and the 0.9B GLM-OCR recognizer reads each region as text, a table in HTML or a formula in LaTeX. LibreYOLO ports the official SDK pipeline around both networks for the ocr task.

Task
ocr
Instalasi
pip install "libreyolo[vlm]"
Tier dukungan
Tier sejajar, sejak v1.8.0. Permukaan produk terpisah dengan factory dan kontraknya sendiri.
Proyek upstream
GLM-OCR oleh Z.ai (zai-org), MIT (recognizer); Apache-2.0 (layout detector). Makalah, sumber
Lisensi
Kode Apache-2.0, bobot MIT (GLM-OCR recognizer); Apache-2.0 (PP-DocLayoutV3 layout detector). Penggunaan komersial

Install

GLM-OCR belongs to LibreYOLO's VLM tier and needs the vlm extra. Both networks load through native transformers classes, which needs transformers 5.3 or newer.

bash
pip install "libreyolo[vlm]"

Predict

Weights for both networks download on first use from one pinned mirror, LibreYOLO/LibreGLMOCR0.9b. No remote code runs.

Python
from libreyolo import LibreVLM model = LibreVLM("glm-ocr")            # weights download on first useresult = model.predict("page.png")      # a scanned or rendered page for label, text in zip(result.ocr.labels, result.ocr.texts):    print(label, text[:60])             # one block per region, reading orderprint(result.ocr.markdown)              # the whole page as markdown
One element
from libreyolo import LibreVLM # Skip layout detection and read a pre-cropped table.model = LibreVLM("glm-ocr", use_layout_detection=False, prompt_label="table")result = model.predict("table.png")print(result.ocr.texts[0])              # HTML table
Extraction
from libreyolo import LibreVLM model = LibreVLM("glm-ocr")reply = model.chat("id_card.png", 'Extract as JSON: {"name": "", "date": ""}')print(reply)

The family loads through LibreVLM(), or the LibreGLMOCR class. Results.ocr holds one block per layout region in reading order: texts, polygons (axis-aligned boxes written as 4-point quads), labels (the layout class, such as text, table or formula) and the page in markdown, formatted as the official SDK does (titles, \tag{} formula numbers, hyphenation and bullet fixes). Headers, footers, page numbers, footnotes and side text are dropped, as upstream does; pictures and charts are not read.

Results.ocr.conf is the geometric mean of the generated tokens' probabilities and det_conf the layout score. conf= does not gate regions; the layout uses the upstream threshold 0.3, which layout_threshold= changes. Decoding follows the SDK: greedy, repetition penalty 1.1, up to 8192 new tokens. Each crop is round-tripped through JPEG before recognition as the SDK sends it; image_format=None skips that.

use_layout_detection=False with prompt_label= (text, table or formula) reads a pre-cropped element. It is a LibreYOLO convenience with no SDK counterpart. chat() covers the JSON information-extraction prompts.

Variants

One size, 0.9b: a CogViT vision encoder and a GLM-0.5B decoder. The layout stage runs at 800 px. CUDA runs the recognizer in bf16 (fp16 without bf16 support) and the layout detector in fp32; CPU and MPS run both in fp32. PDF input, polygon crops, picture export and the hosted-API client are not ported.

Validate

val() runs the shared OCR validator through the model's own predict.

Python
from libreyolo import LibreVLM model = LibreVLM("glm-ocr")metrics = model.val(data="ocr_dataset/")   # det hmean, end-to-end F1, 1-NED

Export

Inference only: train() and export() raise.

Licensing

Periksa lisensi di repositori Hugging Face untuk bobot tertentu yang diunduh. Setiap checkpoint di organisasi LibreYOLO memiliki lisensi, dan lisensinya tidak selalu sama dalam satu family. Repositori tersebut adalah sumber resmi. Ringkasan di bawah menjelaskan ketentuan yang berlaku saat halaman ini terakhir diverifikasi.

Ini adalah deskripsi lisensi yang terlibat, bukan nasihat hukum. Jika jawabannya penting secara komersial, baca sendiri lisensinya dan mintalah nasihat dari penasihat hukum Anda.

Karya asli
GLM-OCR, Z.ai (zai-org)
Lisensi upstream
MIT (recognizer); Apache-2.0 (layout detector)
Kode LibreYOLO
MIT
Bobot
MIT (GLM-OCR recognizer); Apache-2.0 (PP-DocLayoutV3 layout detector), dipublikasikan ulang di huggingface.co/LibreYOLO
Interpretasi
Both networks are under permissive licences that allow commercial and closed-source use. The GLM-OCR recognizer is MIT, as declared by its model card (upstream ships no license file or copyright line); keep the license notice with copies. The PP-DocLayoutV3 layout detector is Apache-2.0 (Copyright PaddlePaddle Authors): keep the license text and notices, and it grants a patent license. Both networks run through the Apache-2.0 Hugging Face Transformers classes; LibreYOLO ports only the document-parsing pipeline (layout post-processing, region crops, result formatting) from the GLM-OCR SDK at commit 0288f96bb9e78cb439883eaa725eeae90bd177c5, which is Apache-2.0 (libreyolo/models/glmocr/NOTICE), and the rest of the adapter is MIT. The weights are an unmodified, ungated mirror at LibreYOLO/LibreGLMOCR0.9b of zai-org/GLM-OCR (revision 2e85a62840ccac27daa451df36c736c4636b8628) with PaddlePaddle/PP-DocLayoutV3_safetensors (revision e4f489dc536556fc1be02b973ba06756e0d4a2ac) under layout/, shipping LICENSE and NOTICE.

The GLM-OCR recognizer weights are MIT, as declared by the Z.ai model card. The PP-DocLayoutV3 layout detector is Apache-2.0 (PaddlePaddle Authors), and the SDK pipeline LibreYOLO ports is Apache-2.0. Commercial use is allowed. The weights are an ungated mirror.

Citation

@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},
}

Disalin dari blok sitasi penulis di github.com/zai-org/GLM-OCR#citation.

Diverifikasi dengan LibreYOLO v1.8.0. Tabel dukungan, checkpoint, dan angka benchmark di halaman ini dihasilkan dari library yang telah dirilis dan bobot yang dipublikasikan, bukan ditulis manual.