Instructions to use zai-org/GLM-OCR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zai-org/GLM-OCR with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # pip install "transformers<5.0.0" from transformers import pipeline pipe = pipeline("image-to-text", model="zai-org/GLM-OCR") 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("zai-org/GLM-OCR") model = AutoModelForMultimodalLM.from_pretrained("zai-org/GLM-OCR", 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]:])) - Notebooks
- Google Colab
- Kaggle
- AMD Developer Cloud
Add ParseBench evaluation results
#53
by boyang-runllama - opened
.eval_results/parsebench.yaml
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
- dataset:
|
| 2 |
+
id: llamaindex/ParseBench
|
| 3 |
+
task_id: mean
|
| 4 |
+
value: 29.6
|
| 5 |
+
date: '2026-04-14'
|
| 6 |
+
source:
|
| 7 |
+
url: https://huggingface.co/datasets/llamaindex/ParseBench
|
| 8 |
+
name: ParseBench
|
| 9 |
+
user: boyang-runllama
|
| 10 |
+
notes: "Pipeline name: glmocr_pipeline"
|
| 11 |
+
- dataset:
|
| 12 |
+
id: llamaindex/ParseBench
|
| 13 |
+
task_id: text_content
|
| 14 |
+
value: 78.0
|
| 15 |
+
date: '2026-04-14'
|
| 16 |
+
source:
|
| 17 |
+
url: https://huggingface.co/datasets/llamaindex/ParseBench
|
| 18 |
+
name: ParseBench
|
| 19 |
+
user: boyang-runllama
|
| 20 |
+
notes: "Pipeline name: glmocr_pipeline"
|
| 21 |
+
- dataset:
|
| 22 |
+
id: llamaindex/ParseBench
|
| 23 |
+
task_id: text_formatting
|
| 24 |
+
value: 2.3
|
| 25 |
+
date: '2026-04-14'
|
| 26 |
+
source:
|
| 27 |
+
url: https://huggingface.co/datasets/llamaindex/ParseBench
|
| 28 |
+
name: ParseBench
|
| 29 |
+
user: boyang-runllama
|
| 30 |
+
notes: "Pipeline name: glmocr_pipeline"
|
| 31 |
+
- dataset:
|
| 32 |
+
id: llamaindex/ParseBench
|
| 33 |
+
task_id: layout
|
| 34 |
+
value: 0.0
|
| 35 |
+
date: '2026-04-14'
|
| 36 |
+
source:
|
| 37 |
+
url: https://huggingface.co/datasets/llamaindex/ParseBench
|
| 38 |
+
name: ParseBench
|
| 39 |
+
user: boyang-runllama
|
| 40 |
+
notes: "Pipeline name: glmocr_pipeline"
|
| 41 |
+
- dataset:
|
| 42 |
+
id: llamaindex/ParseBench
|
| 43 |
+
task_id: chart
|
| 44 |
+
value: 1.7
|
| 45 |
+
date: '2026-04-14'
|
| 46 |
+
source:
|
| 47 |
+
url: https://huggingface.co/datasets/llamaindex/ParseBench
|
| 48 |
+
name: ParseBench
|
| 49 |
+
user: boyang-runllama
|
| 50 |
+
notes: "Pipeline name: glmocr_pipeline"
|
| 51 |
+
- dataset:
|
| 52 |
+
id: llamaindex/ParseBench
|
| 53 |
+
task_id: table
|
| 54 |
+
value: 66.1
|
| 55 |
+
date: '2026-04-14'
|
| 56 |
+
source:
|
| 57 |
+
url: https://huggingface.co/datasets/llamaindex/ParseBench
|
| 58 |
+
name: ParseBench
|
| 59 |
+
user: boyang-runllama
|
| 60 |
+
notes: "Pipeline name: glmocr_pipeline"
|