staghado Bapt120 commited on
Commit
23d5440
·
0 Parent(s):

LightOnOCR-3 release

Browse files

Co-authored-by: Bapt120 <Bapt120@users.noreply.huggingface.co>

.eval_results/olmocrbench.yaml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ - dataset:
2
+ id: allenai/olmOCR-bench
3
+ task_id: overall
4
+ value: 84.5
5
+ date: '2026-10-08'
6
+ source:
7
+ url: https://huggingface.co/blog/lightonai/lightonocr-3
8
+ name: LightOnOCR-3 results
9
+ user: staghado
10
+ - dataset:
11
+ id: allenai/olmOCR-bench
12
+ task_id: arxiv_math
13
+ value: 90.4
14
+ date: '2026-10-08'
15
+ source:
16
+ url: https://huggingface.co/blog/lightonai/lightonocr-3
17
+ name: LightOnOCR-3 results
18
+ user: staghado
19
+ - dataset:
20
+ id: allenai/olmOCR-bench
21
+ task_id: old_scans_math
22
+ value: 80.6
23
+ date: '2026-10-08'
24
+ source:
25
+ url: https://huggingface.co/blog/lightonai/lightonocr-3
26
+ name: LightOnOCR-3 results
27
+ user: staghado
28
+ - dataset:
29
+ id: allenai/olmOCR-bench
30
+ task_id: table_tests
31
+ value: 89.9
32
+ date: '2026-10-08'
33
+ source:
34
+ url: https://huggingface.co/blog/lightonai/lightonocr-3
35
+ name: LightOnOCR-3 results
36
+ user: staghado
37
+ - dataset:
38
+ id: allenai/olmOCR-bench
39
+ task_id: old_scans
40
+ value: 48.3
41
+ date: '2026-10-08'
42
+ source:
43
+ url: https://huggingface.co/blog/lightonai/lightonocr-3
44
+ name: LightOnOCR-3 results
45
+ user: staghado
46
+ - dataset:
47
+ id: allenai/olmOCR-bench
48
+ task_id: headers_footers
49
+ value: 87.6
50
+ date: '2026-10-08'
51
+ source:
52
+ url: https://huggingface.co/blog/lightonai/lightonocr-3
53
+ name: LightOnOCR-3 results
54
+ user: staghado
55
+ - dataset:
56
+ id: allenai/olmOCR-bench
57
+ task_id: multi_column
58
+ value: 85.9
59
+ date: '2026-10-08'
60
+ source:
61
+ url: https://huggingface.co/blog/lightonai/lightonocr-3
62
+ name: LightOnOCR-3 results
63
+ user: staghado
64
+ - dataset:
65
+ id: allenai/olmOCR-bench
66
+ task_id: long_tiny_text
67
+ value: 93.7
68
+ date: '2026-10-08'
69
+ source:
70
+ url: https://huggingface.co/blog/lightonai/lightonocr-3
71
+ name: LightOnOCR-3 results
72
+ user: staghado
73
+ - dataset:
74
+ id: allenai/olmOCR-bench
75
+ task_id: baseline
76
+ value: 99.5
77
+ date: '2026-10-08'
78
+ source:
79
+ url: https://huggingface.co/blog/lightonai/lightonocr-3
80
+ name: LightOnOCR-3 results
81
+ user: staghado
.eval_results/parsebench.yaml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ - dataset:
2
+ id: llamaindex/ParseBench
3
+ task_id: mean
4
+ value: 71.4
5
+ date: '2026-10-08'
6
+ source:
7
+ url: https://huggingface.co/blog/lightonai/lightonocr-3
8
+ name: LightOnOCR-3 results
9
+ user: staghado
10
+ - dataset:
11
+ id: llamaindex/ParseBench
12
+ task_id: table
13
+ value: 84.8
14
+ date: '2026-10-08'
15
+ source:
16
+ url: https://huggingface.co/blog/lightonai/lightonocr-3
17
+ name: LightOnOCR-3 results
18
+ user: staghado
19
+ - dataset:
20
+ id: llamaindex/ParseBench
21
+ task_id: chart
22
+ value: 57.3
23
+ date: '2026-10-08'
24
+ source:
25
+ url: https://huggingface.co/blog/lightonai/lightonocr-3
26
+ name: LightOnOCR-3 results
27
+ user: staghado
28
+ - dataset:
29
+ id: llamaindex/ParseBench
30
+ task_id: text_content
31
+ value: 88.6
32
+ date: '2026-10-08'
33
+ source:
34
+ url: https://huggingface.co/blog/lightonai/lightonocr-3
35
+ name: LightOnOCR-3 results
36
+ user: staghado
37
+ - dataset:
38
+ id: llamaindex/ParseBench
39
+ task_id: text_formatting
40
+ value: 64.5
41
+ date: '2026-10-08'
42
+ source:
43
+ url: https://huggingface.co/blog/lightonai/lightonocr-3
44
+ name: LightOnOCR-3 results
45
+ user: staghado
46
+ - dataset:
47
+ id: llamaindex/ParseBench
48
+ task_id: layout
49
+ value: 61.7
50
+ date: '2026-10-08'
51
+ source:
52
+ url: https://huggingface.co/blog/lightonai/lightonocr-3
53
+ name: LightOnOCR-3 results
54
+ user: staghado
.gitattributes ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
37
+ lightonocr3_logo.png filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ pipeline_tag: image-text-to-text
4
+ library_name: transformers
5
+ tags:
6
+ - ocr
7
+ - document-understanding
8
+ - visual-grounding
9
+ - vision-language
10
+ - tables
11
+ - forms
12
+ ---
13
+
14
+ <div align="center">
15
+
16
+ <img src="https://huggingface.co/lightonai/LightOnOCR-3-1B/resolve/main/lightonocr3_logo.png" alt="LightOnOCR-3 logo" width="600">
17
+
18
+ [![Website](https://img.shields.io/badge/LightOn-Website-blue?logo=google-chrome)](https://lighton.ai)
19
+ [![LinkedIn](https://img.shields.io/badge/LightOn-LinkedIn-0A66C2?logo=linkedin)](https://www.linkedin.com/company/lighton/)
20
+ [![X](https://img.shields.io/badge/@LightOnIO-X-black?logo=x)](https://x.com/LightOnIO)
21
+
22
+ 📄 [Paper](https://arxiv.org/pdf/2601.14251) | 📝 [Blog](https://huggingface.co/blog/lightonai/lightonocr-3) | 🚀 [Demo](https://huggingface.co/spaces/lightonai/LightOnOCR-3-Demo) | 💻 [GitHub](https://github.com/lightonai/LightOnOCR) | 🤗 [LightOnOCR-2-1B](https://huggingface.co/lightonai/LightOnOCR-2-1B)
23
+
24
+ </div>
25
+
26
+ # LightOnOCR-3-1B
27
+
28
+ **Same architecture as LightOnOCR-2-1B, new capabilities.** LightOnOCR-3-1B keeps the architecture of **[LightOn's](https://lighton.ai)** previous LightOnOCR-2 models, so switching requires no change, and adds the new grounding, image description and chart extraction features.
29
+
30
+ ## About LightOnOCR-3
31
+
32
+ LightOnOCR-3 is a new family of highly performant lightweight OCR models. Compared to the previous generation, they bring significant improvements in speed and transcription quality and introduce new visual understanding features: the models now output bounding box coordinates with labels for all visual elements of a document, short descriptions of images, and the numerical data of figures and charts. With these capabilities, they offer a ready-to-use, easier-to-maintain alternative to complex document understanding pipelines.
33
+
34
+ The models come in three sizes. The 1B keeps the LightOnOCR-2-1B architecture, while the 0.8B and 4B adopt the Qwen3.5 vision-language architecture, which simplifies integration with existing tools and brings a significant speed-up. All models are released under the Apache 2.0 license for research and commercial use.
35
+
36
+ ## Highlights
37
+
38
+ * 📝 **Transcription mode:** call the model with an empty prompt and get the full page text, as before. Switching from LightOnOCR-2 requires no change
39
+ * 📍 **Grounding mode:** call it with the `grounding` prompt and every block comes back with a label and a bounding box
40
+ * 🖼️ **Visual understanding:** images get a short description, charts become a table of their data points
41
+ * 🧠 **End-to-End:** one model instead of a document understanding pipeline, easier to deploy and maintain
42
+ * 🧾 **Versatile:** handles tables, receipts, forms, charts, multi-column layouts, handwriting, and math notation
43
+
44
+ ---
45
+
46
+ ## Model Variants
47
+
48
+ | Variant | Description |
49
+ |---------|-------------|
50
+ | **[LightOnOCR-3-4B](https://huggingface.co/lightonai/LightOnOCR-3-4B)** | Best OCR model, recommended for most tasks |
51
+ | **[LightOnOCR-3-1B](https://huggingface.co/lightonai/LightOnOCR-3-1B)** | LightOnOCR-2 architecture, drop-in upgrade for existing deployments |
52
+ | **[LightOnOCR-3-0.8B](https://huggingface.co/lightonai/LightOnOCR-3-0.8B)** | Fast and Efficient model |
53
+
54
+ ---
55
+
56
+ ## Prompt Modes
57
+
58
+ The models can be used as before in a **transcription-only mode**: called with an empty prompt (`""`; the image only), they output all textual elements of the page as markdown. If you are currently using our previous models, switching to LightOnOCR-3 requires no change, as this is the default behavior.
59
+
60
+ The new usage mode is to call the models with the `grounding` prompt. They then output the new vision features alongside the transcribed text. Each block of content is prepended with a placeholder giving its type and its bounding box, in page coordinates normalized to 0–1000:
61
+
62
+ ```
63
+ ![title](80,70,920,140)
64
+ # Company report 2025
65
+
66
+ ![text](80,175,920,225)
67
+ Revenue rose 20%.
68
+
69
+ ![image](80,285,460,545)
70
+ A solar-powered factory.
71
+
72
+ ![chart](540,285,920,545)
73
+ <table>
74
+ <tr><th>Year</th><th>Revenue</th></tr>
75
+ <tr><td>2024</td><td>€10M</td></tr>
76
+ <tr><td>2025</td><td>€12M</td></tr>
77
+ </table>
78
+ ```
79
+
80
+ * **Text blocks** contain the transcribed content of paragraphs, titles and other text elements.
81
+ * **Image blocks** pair a bounding box with a short description, making visual content accessible to retrieval and question-answering pipelines.
82
+ * **Chart blocks** contain an HTML table of the data points extracted from the figure, turning visual information into structured data.
83
+
84
+ The placeholder label is one of:
85
+
86
+ | Label | Definition |
87
+ |---|---|
88
+ | `text` | Ordinary body text and paragraphs. |
89
+ | `title` | Document, section, or paragraph headings. |
90
+ | `list` | Bulleted or numbered-list content. |
91
+ | `header` | Text in the page header. |
92
+ | `footer` | Text in the page footer. |
93
+ | `page_number` | Page-number regions. |
94
+ | `footnote` | Footnote text. |
95
+ | `caption` | Captions associated with figures, tables, or other visual elements. |
96
+ | `formula` | Mathematical formulas and equations. |
97
+ | `code` | Code blocks or code-like text. |
98
+ | `table` | Table regions and their content. |
99
+ | `image` | Illustrations, photographs, and other image regions. |
100
+ | `chart` | Charts, graphs, and plotted visual data. |
101
+ | `header_image` | Image regions in page headers, such as logos. |
102
+ | `footer_image` | Image regions in page footers. |
103
+ | `aside_text` | Marginal or side text outside the main text flow. |
104
+ | `+` suffix | Marks a continuation block, not a separate semantic class. |
105
+
106
+ Grounding adds about 25% output tokens over plain transcription (1,433 vs 1,158 tokens per page on average for the 4B). Other instructions are out of distribution: use the empty prompt (`""`) or `grounding`.
107
+
108
+ ---
109
+
110
+ ## Usage with Transformers
111
+
112
+ > **Note:** LightOnOCR-3-1B shares the LightOnOCR-2 architecture and loads with the `LightOnOcr` classes available in Transformers since v5.
113
+
114
+ ```bash
115
+ uv pip install transformers pillow pypdfium2
116
+ ```
117
+
118
+ ```python
119
+ import torch
120
+ from transformers import LightOnOcrForConditionalGeneration, LightOnOcrProcessor
121
+
122
+ model_id = "lightonai/LightOnOCR-3-1B"
123
+ device = "mps" if torch.backends.mps.is_available() else "cuda" if torch.cuda.is_available() else "cpu"
124
+ dtype = torch.float32 if device == "mps" else torch.bfloat16
125
+
126
+ model = LightOnOcrForConditionalGeneration.from_pretrained(model_id, dtype=dtype).to(device)
127
+ processor = LightOnOcrProcessor.from_pretrained(model_id)
128
+
129
+ url = "https://huggingface.co/datasets/hf-internal-testing/fixtures_ocr/resolve/main/SROIE-receipt.jpeg"
130
+ prompt = "grounding" # or "" for transcription-only
131
+
132
+ content = [{"type": "image", "url": url}]
133
+ if prompt:
134
+ content.append({"type": "text", "text": prompt})
135
+ conversation = [{"role": "user", "content": content}]
136
+
137
+ inputs = processor.apply_chat_template(
138
+ conversation,
139
+ add_generation_prompt=True,
140
+ tokenize=True,
141
+ return_dict=True,
142
+ return_tensors="pt",
143
+ )
144
+ inputs = {k: v.to(device=device, dtype=dtype) if v.is_floating_point() else v.to(device) for k, v in inputs.items()}
145
+
146
+ output_ids = model.generate(**inputs, max_new_tokens=1024)
147
+ generated_ids = output_ids[0, inputs["input_ids"].shape[1]:]
148
+ print(processor.decode(generated_ids, skip_special_tokens=True))
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Usage with vLLM
154
+
155
+ ```bash
156
+ vllm serve lightonai/LightOnOCR-3-1B \
157
+ --limit-mm-per-prompt '{"image": 1}' --mm-processor-cache-gb 0 --no-enable-prefix-caching
158
+ ```
159
+
160
+ ```python
161
+ import base64
162
+ import io
163
+
164
+ import pypdfium2 as pdfium
165
+ import requests
166
+
167
+ ENDPOINT = "http://localhost:8000/v1/chat/completions"
168
+ MODEL = "lightonai/LightOnOCR-3-1B"
169
+ PROMPT = "grounding" # or "" for transcription-only
170
+
171
+ # Render the first page of a PDF at 200 DPI (scale factor = 200/72 ≈ 2.77)
172
+ pdf = pdfium.PdfDocument(requests.get("https://arxiv.org/pdf/2412.13663").content)
173
+ pil_image = pdf[0].render(scale=2.77).to_pil()
174
+
175
+ buffer = io.BytesIO()
176
+ pil_image.save(buffer, format="PNG")
177
+ image_base64 = base64.b64encode(buffer.getvalue()).decode("utf-8")
178
+
179
+ content = [{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{image_base64}"}}]
180
+ if PROMPT:
181
+ content.append({"type": "text", "text": PROMPT})
182
+
183
+ payload = {
184
+ "model": MODEL,
185
+ "messages": [{"role": "user", "content": content}],
186
+ "max_tokens": 4096,
187
+ "temperature": 0.2,
188
+ "top_p": 0.9,
189
+ }
190
+
191
+ response = requests.post(ENDPOINT, json=payload)
192
+ print(response.json()["choices"][0]["message"]["content"])
193
+ ```
194
+
195
+ The [LightOnOCR repository](https://github.com/lightonai/LightOnOCR) on GitHub provides a minimal client, CLI and viewer for the models served with vLLM, plus the code to reproduce our benchmarks.
196
+
197
+ ---
198
+
199
+ ## Rendering and Preprocessing Tips
200
+
201
+ * Render PDFs at 200 DPI to images using a target longest dimension of **1540px**
202
+ * Maintain aspect ratio to preserve text geometry
203
+
204
+ ---
205
+
206
+ ## License
207
+
208
+ Apache License 2.0
209
+
210
+ ---
211
+
212
+ ## Citation
213
+
214
+ ```bibtex
215
+ @misc{lightonocr2_2026,
216
+ title = {LightOnOCR: A 1B End-to-End Multilingual Vision-Language Model for State-of-the-Art OCR},
217
+ author = {Said Taghadouini and Adrien Cavaill\`{e}s and Baptiste Aubertin},
218
+ year = {2026},
219
+ howpublished = {\url{https://arxiv.org/abs/2601.14251}}
220
+ }
221
+ ```
222
+
223
+ [![Downloads](https://img.shields.io/badge/dynamic/json?url=https://huggingface.co/api/models/lightonai/LightOnOCR-3-1B&query=downloads&label=Downloads&color=blue)](https://huggingface.co/lightonai/LightOnOCR-3-1B)
224
+ [![EU](https://img.shields.io/badge/🇪🇺%20Made%20in-Europe-blue)](https://huggingface.co/lightonai)
chat_template.jinja ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% set image_count = namespace(value=0) %}
2
+ {% for message in messages %}
3
+ {% if loop.first and message['role'] != 'system' %}
4
+ <|im_start|>system<|im_end|>
5
+ {% endif %}
6
+ <|im_start|>{{ message['role'] }}
7
+ {% if message['content'] is string %}
8
+ {{ message['content'] }}<|im_end|>
9
+ {% else %}
10
+ {% for content in message['content'] %}
11
+ {% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}
12
+ {% set image_count.value = image_count.value + 1 %}
13
+ {% if add_vision_id %}
14
+ Picture {{ image_count.value }}:
15
+ {% endif -%}
16
+ <|image_pad|>
17
+ {%- elif 'text' in content %}
18
+ {{ content['text'] }}
19
+ {% endif %}
20
+ {% endfor %}
21
+ <|im_end|>
22
+ {% endif %}
23
+ {% endfor %}
24
+ {% if add_generation_prompt %}
25
+ <|im_start|>assistant
26
+ {% endif %}
config.json ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LightOnOCRForConditionalGeneration"
4
+ ],
5
+ "dtype": "bfloat16",
6
+ "eos_token_id": 151645,
7
+ "image_token_id": 151655,
8
+ "model_type": "mistral3",
9
+ "multimodal_projector_bias": false,
10
+ "pad_token_id": 151643,
11
+ "projector_hidden_act": "gelu",
12
+ "spatial_merge_size": 2,
13
+ "text_config": {
14
+ "architectures": [
15
+ "Qwen3ForCausalLM"
16
+ ],
17
+ "attention_bias": false,
18
+ "attention_dropout": 0,
19
+ "dtype": "bfloat16",
20
+ "head_dim": 128,
21
+ "hidden_act": "silu",
22
+ "hidden_size": 1024,
23
+ "initializer_range": 0.02,
24
+ "intermediate_size": 3072,
25
+ "layer_types": [
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention",
44
+ "full_attention",
45
+ "full_attention",
46
+ "full_attention",
47
+ "full_attention",
48
+ "full_attention",
49
+ "full_attention",
50
+ "full_attention",
51
+ "full_attention",
52
+ "full_attention",
53
+ "full_attention"
54
+ ],
55
+ "max_position_embeddings": 16384,
56
+ "max_window_layers": 28,
57
+ "model_type": "qwen3",
58
+ "num_attention_heads": 16,
59
+ "num_hidden_layers": 28,
60
+ "num_key_value_heads": 8,
61
+ "rms_norm_eps": 1e-06,
62
+ "rope_parameters": {
63
+ "rope_theta": 1000000,
64
+ "rope_type": "default"
65
+ },
66
+ "rope_theta": 1000000,
67
+ "sliding_window": null,
68
+ "use_cache": true,
69
+ "use_sliding_window": false,
70
+ "tie_word_embeddings": true,
71
+ "vocab_size": 151936,
72
+ "use_qk_norm": true
73
+ },
74
+ "transformers_version": "5.0.0.dev0",
75
+ "use_cache": false,
76
+ "vision_config": {
77
+ "attention_dropout": 0,
78
+ "dtype": "bfloat16",
79
+ "head_dim": 64,
80
+ "hidden_act": "silu",
81
+ "hidden_size": 1024,
82
+ "image_size": 1540,
83
+ "initializer_range": 0.02,
84
+ "intermediate_size": 4096,
85
+ "model_type": "pixtral",
86
+ "num_attention_heads": 16,
87
+ "num_channels": 3,
88
+ "num_hidden_layers": 24,
89
+ "patch_size": 14,
90
+ "rope_parameters": {
91
+ "rope_theta": 10000,
92
+ "rope_type": "default"
93
+ },
94
+ "rope_theta": 10000
95
+ },
96
+ "vision_feature_layer": -1
97
+ }
generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "temperature": 0.2,
10
+ "top_k": 0,
11
+ "top_p": 0.9,
12
+ "transformers_version": "5.0.0.dev0"
13
+ }
lightonocr3_logo.png ADDED

Git LFS Details

  • SHA256: 768eee79d378518cfea9ed8d81ba3a53a0cff17ccf4b12c22a9e5ebedde32bcf
  • Pointer size: 132 Bytes
  • Size of remote file: 1.65 MB
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:32879861d5cdc3b2c3909d3f9a47dc8f7338685d13113c8c98c144f68b358dbb
3
+ size 2011367464
processor_config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_break_token": "<|vision_pad|>",
3
+ "image_end_token": "<|vision_end|>",
4
+ "image_processor": {
5
+ "crop_size": null,
6
+ "data_format": "channels_first",
7
+ "default_to_square": true,
8
+ "device": null,
9
+ "disable_grouping": null,
10
+ "do_center_crop": null,
11
+ "do_convert_rgb": true,
12
+ "do_normalize": true,
13
+ "do_pad": null,
14
+ "do_rescale": true,
15
+ "do_resize": true,
16
+ "image_mean": [
17
+ 0.48145466,
18
+ 0.4578275,
19
+ 0.40821073
20
+ ],
21
+ "image_processor_type": "PixtralImageProcessorFast",
22
+ "image_seq_length": null,
23
+ "image_std": [
24
+ 0.26862954,
25
+ 0.26130258,
26
+ 0.27577711
27
+ ],
28
+ "input_data_format": null,
29
+ "pad_size": null,
30
+ "patch_size": 14,
31
+ "processor_class": "PixtralProcessor",
32
+ "resample": 3,
33
+ "rescale_factor": 0.00392156862745098,
34
+ "return_tensors": null,
35
+ "size": {
36
+ "longest_edge": 1540
37
+ }
38
+ },
39
+ "image_token": "<|image_pad|>",
40
+ "patch_size": 14,
41
+ "processor_class": "PixtralProcessor",
42
+ "spatial_merge_size": 2
43
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|im_end|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": {
25
+ "content": "<|endoftext|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ }
31
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f54b55fa0c3aba0c91ce09ea79ae4e62da24e2a1a630f96c4bae34aba25e234a
3
+ size 11422822
tokenizer_config.json ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "151665": {
182
+ "content": "<tool_response>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": false
188
+ },
189
+ "151666": {
190
+ "content": "</tool_response>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": false
196
+ },
197
+ "151667": {
198
+ "content": "<think>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": false
204
+ },
205
+ "151668": {
206
+ "content": "</think>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": false
212
+ }
213
+ },
214
+ "additional_special_tokens": [
215
+ "<|im_start|>",
216
+ "<|im_end|>",
217
+ "<|object_ref_start|>",
218
+ "<|object_ref_end|>",
219
+ "<|box_start|>",
220
+ "<|box_end|>",
221
+ "<|quad_start|>",
222
+ "<|quad_end|>",
223
+ "<|vision_start|>",
224
+ "<|vision_end|>",
225
+ "<|vision_pad|>",
226
+ "<|image_pad|>",
227
+ "<|video_pad|>"
228
+ ],
229
+ "bos_token": null,
230
+ "clean_up_tokenization_spaces": false,
231
+ "eos_token": "<|im_end|>",
232
+ "errors": "replace",
233
+ "extra_special_tokens": {},
234
+ "model_max_length": 131072,
235
+ "pad_token": "<|endoftext|>",
236
+ "processor_class": "LightOnOCRProcessor",
237
+ "split_special_tokens": false,
238
+ "tokenizer_class": "Qwen2Tokenizer",
239
+ "unk_token": null,
240
+ "image_token": "<|image_pad|>",
241
+ "image_break_token": "<|vision_pad|>",
242
+ "image_end_token": "<|vision_end|>",
243
+ "fix_mistral_regex": true
244
+ }