Update README.md
Browse files
README.md
CHANGED
@@ -1,6 +1,148 @@
|
|
1 |
---
|
|
|
|
|
2 |
base_model:
|
3 |
- Qwen/Qwen2.5-VL-7B-Instruct
|
4 |
-
library_name: transformers
|
5 |
pipeline_tag: image-text-to-text
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
base_model:
|
5 |
- Qwen/Qwen2.5-VL-7B-Instruct
|
|
|
6 |
pipeline_tag: image-text-to-text
|
7 |
+
library_name: transformers
|
8 |
+
tags:
|
9 |
+
- Document
|
10 |
+
- KIE
|
11 |
+
- OCR
|
12 |
+
- VL
|
13 |
+
- Camel
|
14 |
+
- Openpdf
|
15 |
+
- text-generation-inference
|
16 |
+
- Extraction
|
17 |
+
- Linking
|
18 |
+
- Markdown
|
19 |
+
- .Md
|
20 |
+
datasets:
|
21 |
+
- prithivMLmods/OpenDoc-Pdf-Preview
|
22 |
+
- prithivMLmods/Opendoc1-Analysis-Recognition
|
23 |
+
- allenai/olmOCR-mix-0225
|
24 |
+
- prithivMLmods/Openpdf-Analysis-Recognition
|
25 |
+
license: apache-2.0
|
26 |
+
---
|
27 |
+
|
28 |
+
# **Camel-Doc-OCR-080125**
|
29 |
+
|
30 |
+
> The **Camel-Doc-OCR-080125** model is a fine-tuned version of **Qwen2.5-VL-7B-Instruct**, optimized for **Document Retrieval**, **Content Extraction**, and **Analysis Recognition**. Built on top of the Qwen2.5-VL architecture, this model enhances document comprehension capabilities with focused training on the Opendoc2-Analysis-Recognition dataset for superior document analysis and information extraction tasks.
|
31 |
+
|
32 |
+
## Key Enhancements
|
33 |
+
|
34 |
+
* **Context-Aware Multimodal Extraction and Linking for Documents**: Advanced capability for understanding document context and establishing connections between multimodal elements within documents.
|
35 |
+
|
36 |
+
* **Enhanced Document Retrieval**: Designed to efficiently locate and extract relevant information from complex document structures and layouts.
|
37 |
+
|
38 |
+
* **Superior Content Extraction**: Optimized for precise extraction of structured and unstructured content from diverse document formats.
|
39 |
+
|
40 |
+
* **Analysis Recognition**: Specialized in recognizing and interpreting analytical content, charts, tables, and visual data representations.
|
41 |
+
|
42 |
+
* **State-of-the-Art Performance Across Resolutions**: Achieves competitive results on OCR and visual QA benchmarks such as DocVQA, MathVista, RealWorldQA, and MTVQA.
|
43 |
+
|
44 |
+
* **Video Understanding up to 20+ minutes**: Supports detailed comprehension of long-duration videos for content summarization, question answering, and multi-modal reasoning.
|
45 |
+
|
46 |
+
* **Visually-Grounded Device Interaction**: Enables mobile or robotic device operation via visual inputs and text-based instructions using contextual understanding and decision-making logic.
|
47 |
+
|
48 |
+
## Quick Start with Transformers
|
49 |
+
|
50 |
+
```python
|
51 |
+
from transformers import Qwen2_5_VLForConditionalGeneration, AutoTokenizer, AutoProcessor
|
52 |
+
from qwen_vl_utils import process_vision_info
|
53 |
+
|
54 |
+
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
55 |
+
"prithivMLmods/Camel-Doc-OCR-080125", torch_dtype="auto", device_map="auto"
|
56 |
+
)
|
57 |
+
|
58 |
+
processor = AutoProcessor.from_pretrained("prithivMLmods/Camel-Doc-OCR-080125")
|
59 |
+
|
60 |
+
messages = [
|
61 |
+
{
|
62 |
+
"role": "user",
|
63 |
+
"content": [
|
64 |
+
{
|
65 |
+
"type": "image",
|
66 |
+
"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
|
67 |
+
},
|
68 |
+
{"type": "text", "text": "Describe this image."},
|
69 |
+
],
|
70 |
+
}
|
71 |
+
]
|
72 |
+
|
73 |
+
text = processor.apply_chat_template(
|
74 |
+
messages, tokenize=False, add_generation_prompt=True
|
75 |
+
)
|
76 |
+
image_inputs, video_inputs = process_vision_info(messages)
|
77 |
+
inputs = processor(
|
78 |
+
text=[text],
|
79 |
+
images=image_inputs,
|
80 |
+
videos=video_inputs,
|
81 |
+
padding=True,
|
82 |
+
return_tensors="pt",
|
83 |
+
)
|
84 |
+
inputs = inputs.to("cuda")
|
85 |
+
|
86 |
+
generated_ids = model.generate(**inputs, max_new_tokens=128)
|
87 |
+
generated_ids_trimmed = [
|
88 |
+
out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
89 |
+
]
|
90 |
+
output_text = processor.batch_decode(
|
91 |
+
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
92 |
+
)
|
93 |
+
print(output_text)
|
94 |
+
```
|
95 |
+
|
96 |
+
## Intended Use
|
97 |
+
|
98 |
+
This model is intended for:
|
99 |
+
|
100 |
+
* Context-aware multimodal extraction and linking for complex document structures.
|
101 |
+
* High-fidelity document retrieval and content extraction from various document formats.
|
102 |
+
* Analysis recognition of charts, graphs, tables, and visual data representations.
|
103 |
+
* Document-based question answering for educational and enterprise applications.
|
104 |
+
* Extraction and LaTeX formatting of mathematical expressions from printed or handwritten content.
|
105 |
+
* Retrieval and summarization from long documents, slides, and multi-modal inputs.
|
106 |
+
* Multilingual document analysis and structured content extraction for global use cases.
|
107 |
+
* Robotic or mobile automation with vision-guided contextual interaction.
|
108 |
+
|
109 |
+
## Limitations
|
110 |
+
|
111 |
+
* May show degraded performance on extremely low-quality or occluded images.
|
112 |
+
* Not optimized for real-time applications on low-resource or edge devices due to computational demands.
|
113 |
+
* Variable accuracy on uncommon or low-resource languages or scripts.
|
114 |
+
* Long video processing may require substantial memory and is not optimized for streaming applications.
|
115 |
+
* Visual token settings affect performance; suboptimal configurations can impact results.
|
116 |
+
* In rare cases, outputs may contain hallucinated or contextually misaligned information.
|
117 |
+
|
118 |
+
---
|
119 |
+
|
120 |
+
## Training Details
|
121 |
+
|
122 |
+
| Parameter | Value |
|
123 |
+
| ---------------------- | --------------------------------------------- |
|
124 |
+
| **Dataset Size** | 230K samples (Modular Combustion of Datasets) |
|
125 |
+
| **Model Architecture** | `Qwen2_5_VLForConditionalGeneration` |
|
126 |
+
| **Total Disk Volume** | 400,000 MB |
|
127 |
+
| **Training Time** | approx. 9,360 seconds (\~2.60 hours) |
|
128 |
+
| **Warmup Steps** | 750 |
|
129 |
+
| **Precision** | bfloat16 |
|
130 |
+
|
131 |
+
---
|
132 |
+
|
133 |
+
## References
|
134 |
+
|
135 |
+
* **DocVLM: Make Your VLM an Efficient Reader**
|
136 |
+
[https://arxiv.org/pdf/2412.08746v1](https://arxiv.org/pdf/2412.08746v1)
|
137 |
+
|
138 |
+
* **YaRN: Efficient Context Window Extension of Large Language Models**
|
139 |
+
[https://arxiv.org/pdf/2309.00071](https://arxiv.org/pdf/2309.00071)
|
140 |
+
|
141 |
+
* **Qwen2-VL: Enhancing Vision-Language Model's Perception of the World at Any Resolution**
|
142 |
+
[https://arxiv.org/pdf/2409.12191](https://arxiv.org/pdf/2409.12191)
|
143 |
+
|
144 |
+
* **Qwen-VL: A Versatile Vision-Language Model for Understanding, Localization, Text Reading, and Beyond**
|
145 |
+
[https://arxiv.org/pdf/2308.12966](https://arxiv.org/pdf/2308.12966)
|
146 |
+
|
147 |
+
* **A Comprehensive and Challenging OCR Benchmark for Evaluating Large Multimodal Models in Literacy**
|
148 |
+
[https://arxiv.org/pdf/2412.02210](https://arxiv.org/pdf/2412.02210)
|