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 Real5-OmniDocBench evaluation results for GLM-OCR
Browse files# Real5-OmniDocBench evaluation results for GLM-OCR
This PR adds the evaluation file for GLM-OCR under the Hugging Face
evaluation-results workflow.
This is based on the new evaluation results feature: https://huggingface.co/docs/hub/eval-results.
## Dataset
- [PaddlePaddle/Real5-OmniDocBench](https://huggingface.co/datasets/PaddlePaddle/Real5-OmniDocBench)
## File
- `.eval_results/real5_omnidocbench.yaml`
## Tasks
- overall
- scanning
- warping
- screen_photography
- illumination
- skew
.eval_results/real5_omnidocbench.yaml
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
- dataset:
|
| 2 |
+
id: PaddlePaddle/Real5-OmniDocBench
|
| 3 |
+
task_id: overall
|
| 4 |
+
value: 90.32
|
| 5 |
+
source:
|
| 6 |
+
url: https://paddle-model-ecology.bj.bcebos.com/PPOCRVL/AIStudio/real5_omnidocbench/leaderboard_data.json
|
| 7 |
+
name: Real5-OmniDocBench leaderboard data
|
| 8 |
+
user: PaddlePaddle
|
| 9 |
+
notes: GLM-OCR; official Real5-OmniDocBench result
|
| 10 |
+
- dataset:
|
| 11 |
+
id: PaddlePaddle/Real5-OmniDocBench
|
| 12 |
+
task_id: scanning
|
| 13 |
+
value: 92.67
|
| 14 |
+
source:
|
| 15 |
+
url: https://paddle-model-ecology.bj.bcebos.com/PPOCRVL/AIStudio/real5_omnidocbench/leaderboard_data.json
|
| 16 |
+
name: Real5-OmniDocBench leaderboard data
|
| 17 |
+
user: PaddlePaddle
|
| 18 |
+
notes: GLM-OCR; official Real5-OmniDocBench result
|
| 19 |
+
- dataset:
|
| 20 |
+
id: PaddlePaddle/Real5-OmniDocBench
|
| 21 |
+
task_id: warping
|
| 22 |
+
value: 90.68
|
| 23 |
+
source:
|
| 24 |
+
url: https://paddle-model-ecology.bj.bcebos.com/PPOCRVL/AIStudio/real5_omnidocbench/leaderboard_data.json
|
| 25 |
+
name: Real5-OmniDocBench leaderboard data
|
| 26 |
+
user: PaddlePaddle
|
| 27 |
+
notes: GLM-OCR; official Real5-OmniDocBench result
|
| 28 |
+
- dataset:
|
| 29 |
+
id: PaddlePaddle/Real5-OmniDocBench
|
| 30 |
+
task_id: screen_photography
|
| 31 |
+
value: 91.75
|
| 32 |
+
source:
|
| 33 |
+
url: https://paddle-model-ecology.bj.bcebos.com/PPOCRVL/AIStudio/real5_omnidocbench/leaderboard_data.json
|
| 34 |
+
name: Real5-OmniDocBench leaderboard data
|
| 35 |
+
user: PaddlePaddle
|
| 36 |
+
notes: GLM-OCR; official Real5-OmniDocBench result
|
| 37 |
+
- dataset:
|
| 38 |
+
id: PaddlePaddle/Real5-OmniDocBench
|
| 39 |
+
task_id: illumination
|
| 40 |
+
value: 91.12
|
| 41 |
+
source:
|
| 42 |
+
url: https://paddle-model-ecology.bj.bcebos.com/PPOCRVL/AIStudio/real5_omnidocbench/leaderboard_data.json
|
| 43 |
+
name: Real5-OmniDocBench leaderboard data
|
| 44 |
+
user: PaddlePaddle
|
| 45 |
+
notes: GLM-OCR; official Real5-OmniDocBench result
|
| 46 |
+
- dataset:
|
| 47 |
+
id: PaddlePaddle/Real5-OmniDocBench
|
| 48 |
+
task_id: skew
|
| 49 |
+
value: 85.39
|
| 50 |
+
source:
|
| 51 |
+
url: https://paddle-model-ecology.bj.bcebos.com/PPOCRVL/AIStudio/real5_omnidocbench/leaderboard_data.json
|
| 52 |
+
name: Real5-OmniDocBench leaderboard data
|
| 53 |
+
user: PaddlePaddle
|
| 54 |
+
notes: GLM-OCR; official Real5-OmniDocBench result
|