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.

Tareas
ocr
Instalación
pip install "libreyolo[vlm]"
Nivel de compatibilidad
Nivel hermano, desde v1.8.0. Una superficie de producto independiente con su propia factoría y su propio contrato.
Proyecto original
GLM-OCR de Z.ai (zai-org), MIT (recognizer); Apache-2.0 (layout detector). Artículo, fuente
Licencias
Código Apache-2.0, pesos MIT (GLM-OCR recognizer); Apache-2.0 (PP-DocLayoutV3 layout detector). Uso comercial

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

Comprueba la licencia en el repositorio de Hugging Face de los pesos concretos que descargues. Cada checkpoint de la organización de LibreYOLO incluye una, y no siempre es la misma en toda una familia. Ese repositorio es la fuente autorizada; el resumen siguiente describe qué se aplicaba cuando se verificó esta página por última vez.

Esta es una descripción de las licencias implicadas, no asesoramiento legal. Si la respuesta es importante a nivel comercial, lee las licencias y busca tu propio asesoramiento.

Trabajo original
GLM-OCR, Z.ai (zai-org)
Licencia del proyecto original
MIT (recognizer); Apache-2.0 (layout detector)
Fuente del proyecto original
github.com/zai-org/GLM-OCR
Código de LibreYOLO
MIT
Pesos
MIT (GLM-OCR recognizer); Apache-2.0 (PP-DocLayoutV3 layout detector), republicados en huggingface.co/LibreYOLO
Interpretación
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},
}

Copiado del bloque de cita de los autores en github.com/zai-org/GLM-OCR#citation.

Verificado con LibreYOLO v1.8.0. Las tablas de compatibilidad, los checkpoints y las cifras de rendimiento de esta página se generan a partir de la biblioteca publicada y los pesos publicados; no se escriben a mano.