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.

작업
ocr
설치
pip install "libreyolo[vlm]"
지원 티어
별도 티어, v1.8.0부터 지원. 자체 팩토리와 계약을 갖춘 별도의 제품 영역입니다.
업스트림
Z.ai (zai-org)의 GLM-OCR, MIT (recognizer); Apache-2.0 (layout detector). 논문, 소스
라이선스
코드 Apache-2.0, 가중치 MIT (GLM-OCR recognizer); Apache-2.0 (PP-DocLayoutV3 layout detector). 상업적 사용

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

내려받는 특정 가중치의 Hugging Face 저장소에서 라이선스를 확인하십시오. LibreYOLO 조직의 모든 체크포인트에는 라이선스가 있으며 한 계열 안에서도 항상 같지는 않습니다. 해당 저장소가 신뢰할 수 있는 기준입니다. 아래 요약은 이 페이지를 마지막으로 검증했을 때 적용된 내용을 설명합니다.

관련 라이선스에 관한 설명이며 법률 자문이 아닙니다. 상업적으로 중요한 사안이라면 라이선스를 직접 읽고 별도의 법률 자문을 받으십시오.

원작
GLM-OCR, Z.ai (zai-org)
업스트림 라이선스
MIT (recognizer); Apache-2.0 (layout detector)
업스트림 소스
github.com/zai-org/GLM-OCR
LibreYOLO 코드
MIT
가중치
MIT (GLM-OCR recognizer); Apache-2.0 (PP-DocLayoutV3 layout detector), huggingface.co/LibreYOLO에 다시 게시됨
해석
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},
}

github.com/zai-org/GLM-OCR#citation에 있는 저자의 인용 블록에서 복사했습니다.

LibreYOLO v1.8.0에서 검증되었습니다. 이 페이지의 지원 표, 체크포인트, 벤치마크 수치는 출시된 라이브러리와 공개된 가중치에서 생성되며 수동으로 작성되지 않습니다.