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
Update .eval_results/olmocrbench.yaml
Browse files
.eval_results/olmocrbench.yaml
CHANGED
|
@@ -4,6 +4,7 @@
|
|
| 4 |
value: 75.2
|
| 5 |
notes: "Excluding Headers & Footers category. Using ZAI API."
|
| 6 |
source:
|
|
|
|
| 7 |
name: GLM-OCR API evaluation
|
| 8 |
user: staghado
|
| 9 |
- dataset:
|
|
@@ -11,6 +12,7 @@
|
|
| 11 |
task_id: arxiv_math
|
| 12 |
value: 80.7
|
| 13 |
source:
|
|
|
|
| 14 |
name: GLM-OCR API evaluation
|
| 15 |
user: staghado
|
| 16 |
- dataset:
|
|
@@ -18,6 +20,7 @@
|
|
| 18 |
task_id: old_scans_math
|
| 19 |
value: 68.3
|
| 20 |
source:
|
|
|
|
| 21 |
name: GLM-OCR API evaluation
|
| 22 |
user: staghado
|
| 23 |
- dataset:
|
|
@@ -25,6 +28,7 @@
|
|
| 25 |
task_id: table_tests
|
| 26 |
value: 77.6
|
| 27 |
source:
|
|
|
|
| 28 |
name: GLM-OCR API evaluation
|
| 29 |
user: staghado
|
| 30 |
- dataset:
|
|
@@ -32,6 +36,7 @@
|
|
| 32 |
task_id: old_scans
|
| 33 |
value: 37.6
|
| 34 |
source:
|
|
|
|
| 35 |
name: GLM-OCR API evaluation
|
| 36 |
user: staghado
|
| 37 |
- dataset:
|
|
@@ -39,6 +44,7 @@
|
|
| 39 |
task_id: multi_column
|
| 40 |
value: 76.7
|
| 41 |
source:
|
|
|
|
| 42 |
name: GLM-OCR API evaluation
|
| 43 |
user: staghado
|
| 44 |
- dataset:
|
|
@@ -46,6 +52,7 @@
|
|
| 46 |
task_id: long_tiny_text
|
| 47 |
value: 86.9
|
| 48 |
source:
|
|
|
|
| 49 |
name: GLM-OCR API evaluation
|
| 50 |
user: staghado
|
| 51 |
- dataset:
|
|
@@ -53,6 +60,7 @@
|
|
| 53 |
task_id: headers_footers
|
| 54 |
value: 95.8
|
| 55 |
source:
|
|
|
|
| 56 |
name: GLM-OCR API evaluation
|
| 57 |
user: staghado
|
| 58 |
- dataset:
|
|
@@ -60,5 +68,6 @@
|
|
| 60 |
task_id: baseline
|
| 61 |
value: 98.8
|
| 62 |
source:
|
|
|
|
| 63 |
name: GLM-OCR API evaluation
|
| 64 |
user: staghado
|
|
|
|
| 4 |
value: 75.2
|
| 5 |
notes: "Excluding Headers & Footers category. Using ZAI API."
|
| 6 |
source:
|
| 7 |
+
url: https://huggingface.co/zai-org/GLM-OCR
|
| 8 |
name: GLM-OCR API evaluation
|
| 9 |
user: staghado
|
| 10 |
- dataset:
|
|
|
|
| 12 |
task_id: arxiv_math
|
| 13 |
value: 80.7
|
| 14 |
source:
|
| 15 |
+
url: https://huggingface.co/zai-org/GLM-OCR
|
| 16 |
name: GLM-OCR API evaluation
|
| 17 |
user: staghado
|
| 18 |
- dataset:
|
|
|
|
| 20 |
task_id: old_scans_math
|
| 21 |
value: 68.3
|
| 22 |
source:
|
| 23 |
+
url: https://huggingface.co/zai-org/GLM-OCR
|
| 24 |
name: GLM-OCR API evaluation
|
| 25 |
user: staghado
|
| 26 |
- dataset:
|
|
|
|
| 28 |
task_id: table_tests
|
| 29 |
value: 77.6
|
| 30 |
source:
|
| 31 |
+
url: https://huggingface.co/zai-org/GLM-OCR
|
| 32 |
name: GLM-OCR API evaluation
|
| 33 |
user: staghado
|
| 34 |
- dataset:
|
|
|
|
| 36 |
task_id: old_scans
|
| 37 |
value: 37.6
|
| 38 |
source:
|
| 39 |
+
url: https://huggingface.co/zai-org/GLM-OCR
|
| 40 |
name: GLM-OCR API evaluation
|
| 41 |
user: staghado
|
| 42 |
- dataset:
|
|
|
|
| 44 |
task_id: multi_column
|
| 45 |
value: 76.7
|
| 46 |
source:
|
| 47 |
+
url: https://huggingface.co/zai-org/GLM-OCR
|
| 48 |
name: GLM-OCR API evaluation
|
| 49 |
user: staghado
|
| 50 |
- dataset:
|
|
|
|
| 52 |
task_id: long_tiny_text
|
| 53 |
value: 86.9
|
| 54 |
source:
|
| 55 |
+
url: https://huggingface.co/zai-org/GLM-OCR
|
| 56 |
name: GLM-OCR API evaluation
|
| 57 |
user: staghado
|
| 58 |
- dataset:
|
|
|
|
| 60 |
task_id: headers_footers
|
| 61 |
value: 95.8
|
| 62 |
source:
|
| 63 |
+
url: https://huggingface.co/zai-org/GLM-OCR
|
| 64 |
name: GLM-OCR API evaluation
|
| 65 |
user: staghado
|
| 66 |
- dataset:
|
|
|
|
| 68 |
task_id: baseline
|
| 69 |
value: 98.8
|
| 70 |
source:
|
| 71 |
+
url: https://huggingface.co/zai-org/GLM-OCR
|
| 72 |
name: GLM-OCR API evaluation
|
| 73 |
user: staghado
|