yafitzdev commited on
Commit
bd773d3
·
verified ·
1 Parent(s): 195c157

Add files using upload-large-folder tool

Browse files
README.md ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: mixed-source-research-preview
4
+ base_model: yafitzdev/pyrrho-opsis-v1-nano-g1
5
+ library_name: transformers
6
+ pipeline_tag: image-text-to-text
7
+ language:
8
+ - en
9
+ tags:
10
+ - pyrrho
11
+ - opsis
12
+ - rag
13
+ - image-to-text
14
+ - document-ai
15
+ - table-recognition
16
+ - onnx
17
+ - cpu
18
+ ---
19
+
20
+ # Pyrrho Opsis v1 nano g2
21
+
22
+ Pyrrho Opsis is a small local visual-ingestion co-processor for RAG systems. It converts one image
23
+ into either concise discovery text or a GitHub-flavored Markdown table. Charts and diagrams are
24
+ described with visible labels, values, and relationships. It is designed to let retrieval systems
25
+ index visual PDF regions without a hosted VLM API or inference GPU.
26
+
27
+ This is a research preview, not an authoritative OCR or financial/scientific extraction system.
28
+
29
+ ## Intended use
30
+
31
+ - enrich image, chart, diagram, and table crops with searchable RAG text;
32
+ - run locally through ONNX Runtime on CPU;
33
+ - route native PDF text around the model and send only visual regions through Opsis;
34
+ - preserve the source image/page alongside generated text for verification.
35
+
36
+ Do not treat generated numbers or table cells as ground truth. Do not use it for safety-critical
37
+ decisions without independent source verification.
38
+
39
+ ## Output contract
40
+
41
+ Input: one raster image.
42
+
43
+ Output:
44
+
45
+ - `<description>concise factual text</description>` for ordinary images, charts, and diagrams;
46
+ - `<table>...Markdown table...</table>` for table images.
47
+
48
+ The packaged parser strips the wrapper tags from its public result.
49
+
50
+ ## Model
51
+
52
+ - base architecture: SmolVLM-256M-Instruct;
53
+ - immediate parent checkpoint: Pyrrho Opsis v1 nano g1;
54
+ - generation: Pyrrho Opsis v1 nano g2;
55
+ - total parameters: 258,099,264;
56
+ - adapted parameters: 1,614,336 (0.625%);
57
+ - LoRA targets: text attention, vision attention, and the vision-to-text connector;
58
+ - training resolution: 1024-pixel longest edge.
59
+
60
+ G2 retains the v1 capability and output contract. It is generation 2 because it changes data
61
+ balance and vision adaptation, not the fundamental task or heads.
62
+
63
+ ## CPU usage
64
+
65
+ With the `rag-image-parser` project installed:
66
+
67
+ ```powershell
68
+ uv run rag-image-parse parse .\image.png `
69
+ --model yafitzdev/pyrrho-opsis-v1-nano-g2 `
70
+ --backend onnx `
71
+ --onnx-variant fp32 `
72
+ --threads 8 `
73
+ --image-longest-edge 1024
74
+ ```
75
+
76
+ FP32 ONNX is the recommended and packaged artifact. Mixed INT8 reduced routing and Markdown
77
+ validity in evaluation and is not included in this repository.
78
+
79
+ ## Evaluation
80
+
81
+ On a 50-case, source-held-out automatic comparison containing ten examples each from tables,
82
+ charts, diagrams, ordinary images, and PDF-domain crops:
83
+
84
+ | Metric | G1 | G2 |
85
+ |---|---:|---:|
86
+ | Kind accuracy | 100% | 100% |
87
+ | Valid Markdown tables | 100% | 100% |
88
+ | Exact tables | 0% | 7.1% |
89
+ | Correct table shape | 21.4% | 42.9% |
90
+ | Mean table cell F1 | 31.0% | 50.5% |
91
+ | Required-term recall | 53.8% | 57.7% |
92
+ | Directed-relation recall | 34.0% | 48.7% |
93
+ | Median CPU latency | 3.71 s | 3.72 s |
94
+ | p95 CPU latency | 16.74 s | 10.95 s |
95
+ | Peak process RSS | 2,377 MiB | 2,382 MiB |
96
+
97
+ This benchmark is automatically labeled and too small for a product-quality claim. Exact table
98
+ accuracy remains low.
99
+
100
+ ## Training data
101
+
102
+ G2 trained on 50,000 rendered files:
103
+
104
+ - 12,500 clean tables;
105
+ - 6,250 clean charts;
106
+ - 6,250 clean diagrams;
107
+ - 12,500 clean ordinary images;
108
+ - 12,500 PDF-style crops balanced across the four content types.
109
+
110
+ Sources include PubTabNet, ChartQA, AI2D, and DOCCI. Charts, diagrams, and ordinary images use
111
+ deterministic label-preserving variants because their strict unique-source pools are smaller than
112
+ the rendered file counts.
113
+
114
+ ## License
115
+
116
+ Mixed-source research preview. The training mixture includes research-restricted AI2D data and
117
+ sources with separate attribution, redistribution, or underlying-image terms. This package must
118
+ not be represented as commercially cleared. Review and satisfy every source obligation before
119
+ making the repository public or using the weights commercially.
SHA256SUMS ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ b8e6497f118a586d02594d0dadf4d7316df3b5a4e35d54df5afab051dee9b30a onnx/vision_encoder.onnx
2
+ a68ea4058524059ed0e2873fdbc4f33b93e13ae3d3204938d32d0566d390ae00 onnx/embed_tokens.onnx
3
+ 322b33decff7518392dc915377f6a11d33a4570e5f7b58c46017b4d892ee9a74 onnx/decoder_model_merged.onnx
chat_template.jinja ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ <|im_start|>{% for message in messages %}{{message['role'] | capitalize}}{% if message['content'][0]['type'] == 'image' %}{{':'}}{% else %}{{': '}}{% endif %}{% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% elif line['type'] == 'image' %}{{ '<image>' }}{% endif %}{% endfor %}<end_of_utterance>
2
+ {% endfor %}{% if add_generation_prompt %}{{ 'Assistant:' }}{% endif %}
config.json ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Idefics3ForConditionalGeneration"
4
+ ],
5
+ "dtype": "float32",
6
+ "image_token_id": 49190,
7
+ "model_type": "idefics3",
8
+ "pad_token_id": 128002,
9
+ "scale_factor": 4,
10
+ "text_config": {
11
+ "_attn_implementation_autoset": false,
12
+ "_flash_attn_2_enabled": true,
13
+ "_name_or_path": "None",
14
+ "add_cross_attention": false,
15
+ "architectures": [
16
+ "VLlama3ForCausalLM"
17
+ ],
18
+ "attention_bias": false,
19
+ "attention_dropout": 0.0,
20
+ "bos_token_id": 1,
21
+ "cross_attention_hidden_size": null,
22
+ "decoder_start_token_id": null,
23
+ "dtype": "float32",
24
+ "eos_token_id": 2,
25
+ "finetuning_task": null,
26
+ "head_dim": 64,
27
+ "hidden_act": "silu",
28
+ "hidden_size": 576,
29
+ "initializer_range": 0.041666666666666664,
30
+ "intermediate_size": 1536,
31
+ "is_decoder": false,
32
+ "is_llama_config": true,
33
+ "max_position_embeddings": 8192,
34
+ "mlp_bias": false,
35
+ "model_type": "llama",
36
+ "neftune_noise_alpha": 0.0,
37
+ "num_attention_heads": 9,
38
+ "num_hidden_layers": 30,
39
+ "num_key_value_heads": 3,
40
+ "pad_token_id": 2,
41
+ "perceiver_config": {
42
+ "_attn_implementation_autoset": false,
43
+ "_name_or_path": "",
44
+ "add_cross_attention": false,
45
+ "architectures": null,
46
+ "attention_dropout": 0.0,
47
+ "bad_words_ids": null,
48
+ "begin_suppress_tokens": null,
49
+ "bos_token_id": null,
50
+ "chunk_size_feed_forward": 0,
51
+ "cross_attention_hidden_size": null,
52
+ "decoder_start_token_id": null,
53
+ "diversity_penalty": 0.0,
54
+ "do_sample": false,
55
+ "early_stopping": false,
56
+ "encoder_no_repeat_ngram_size": 0,
57
+ "eos_token_id": null,
58
+ "exponential_decay_length_penalty": null,
59
+ "finetuning_task": null,
60
+ "forced_bos_token_id": null,
61
+ "forced_eos_token_id": null,
62
+ "hidden_act": "silu",
63
+ "id2label": {
64
+ "0": "LABEL_0",
65
+ "1": "LABEL_1"
66
+ },
67
+ "is_decoder": false,
68
+ "is_encoder_decoder": false,
69
+ "label2id": {
70
+ "LABEL_0": 0,
71
+ "LABEL_1": 1
72
+ },
73
+ "length_penalty": 1.0,
74
+ "max_length": 20,
75
+ "min_length": 0,
76
+ "model_type": "vllama3",
77
+ "no_repeat_ngram_size": 0,
78
+ "num_beam_groups": 1,
79
+ "num_beams": 1,
80
+ "num_key_value_heads": 1,
81
+ "num_return_sequences": 1,
82
+ "output_attentions": false,
83
+ "output_hidden_states": false,
84
+ "output_scores": false,
85
+ "pad_token_id": null,
86
+ "prefix": null,
87
+ "problem_type": null,
88
+ "pruned_heads": {},
89
+ "qk_layer_norms_perceiver": false,
90
+ "remove_invalid_values": false,
91
+ "repetition_penalty": 1.0,
92
+ "resampler_depth": 6,
93
+ "resampler_head_dim": 96,
94
+ "resampler_n_heads": 16,
95
+ "resampler_n_latents": 64,
96
+ "return_dict": true,
97
+ "return_dict_in_generate": false,
98
+ "sep_token_id": null,
99
+ "suppress_tokens": null,
100
+ "task_specific_params": null,
101
+ "temperature": 1.0,
102
+ "tf_legacy_loss": false,
103
+ "tie_encoder_decoder": false,
104
+ "tie_word_embeddings": true,
105
+ "tokenizer_class": null,
106
+ "top_k": 50,
107
+ "top_p": 1.0,
108
+ "torch_dtype": null,
109
+ "torchscript": false,
110
+ "transformers_version": "4.46.0",
111
+ "typical_p": 1.0,
112
+ "use_bfloat16": false
113
+ },
114
+ "pixel_shuffle_factor": 4,
115
+ "prefix": null,
116
+ "pretraining_tp": 1,
117
+ "pruned_heads": {},
118
+ "qk_layer_norms": false,
119
+ "rms_norm_eps": 1e-05,
120
+ "rope_interleaved": false,
121
+ "rope_parameters": {
122
+ "rope_theta": 100000,
123
+ "rope_type": "default"
124
+ },
125
+ "sep_token_id": null,
126
+ "task_specific_params": null,
127
+ "tf_legacy_loss": false,
128
+ "tie_encoder_decoder": false,
129
+ "tie_word_embeddings": false,
130
+ "tokenizer_class": null,
131
+ "torchscript": false,
132
+ "transformers.js_config": {
133
+ "kv_cache_dtype": {
134
+ "fp16": "float16",
135
+ "q4f16": "float16"
136
+ }
137
+ },
138
+ "use_bfloat16": false,
139
+ "use_cache": true,
140
+ "use_resampler": false,
141
+ "vocab_size": 49280
142
+ },
143
+ "tie_word_embeddings": false,
144
+ "transformers.js_config": {
145
+ "kv_cache_dtype": {
146
+ "fp16": "float16",
147
+ "q4f16": "float16"
148
+ }
149
+ },
150
+ "transformers_version": "5.15.1",
151
+ "use_cache": true,
152
+ "vision_config": {
153
+ "_attn_implementation_autoset": false,
154
+ "add_cross_attention": false,
155
+ "attention_dropout": 0.0,
156
+ "bos_token_id": null,
157
+ "cross_attention_hidden_size": null,
158
+ "decoder_start_token_id": null,
159
+ "dtype": "float32",
160
+ "eos_token_id": null,
161
+ "finetuning_task": null,
162
+ "hidden_act": "gelu_pytorch_tanh",
163
+ "hidden_size": 768,
164
+ "image_size": 512,
165
+ "initializer_range": 0.02,
166
+ "intermediate_size": 3072,
167
+ "is_decoder": false,
168
+ "layer_norm_eps": 1e-06,
169
+ "max_image_size": {
170
+ "longest_edge": 512
171
+ },
172
+ "model_type": "idefics3_vision",
173
+ "num_attention_heads": 12,
174
+ "num_channels": 3,
175
+ "num_hidden_layers": 12,
176
+ "pad_token_id": null,
177
+ "patch_size": 16,
178
+ "prefix": null,
179
+ "pruned_heads": {},
180
+ "sep_token_id": null,
181
+ "size": {
182
+ "longest_edge": 2048
183
+ },
184
+ "task_specific_params": null,
185
+ "tf_legacy_loss": false,
186
+ "tie_encoder_decoder": false,
187
+ "tie_word_embeddings": false,
188
+ "tokenizer_class": null,
189
+ "torchscript": false,
190
+ "use_base_siglip": true,
191
+ "use_bfloat16": false
192
+ },
193
+ "vocab_size": 49280
194
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "eos_token_id": 49279,
5
+ "pad_token_id": 2,
6
+ "transformers_version": "5.15.1"
7
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3c6a4e43d52279e72e8b652da487b56e1865dcdea013bac3fd645c0d539cf96
3
+ size 1025998224
onnx/decoder_model_merged.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:322b33decff7518392dc915377f6a11d33a4570e5f7b58c46017b4d892ee9a74
3
+ size 540640062
onnx/embed_tokens.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a68ea4058524059ed0e2873fdbc4f33b93e13ae3d3204938d32d0566d390ae00
3
+ size 113541419
onnx/vision_encoder.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8e6497f118a586d02594d0dadf4d7316df3b5a4e35d54df5afab051dee9b30a
3
+ size 374316497
processor_config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "do_convert_rgb": true,
4
+ "do_image_splitting": true,
5
+ "do_normalize": true,
6
+ "do_pad": true,
7
+ "do_rescale": true,
8
+ "do_resize": true,
9
+ "image_mean": [
10
+ 0.5,
11
+ 0.5,
12
+ 0.5
13
+ ],
14
+ "image_processor_type": "Idefics3ImageProcessor",
15
+ "image_std": [
16
+ 0.5,
17
+ 0.5,
18
+ 0.5
19
+ ],
20
+ "max_image_size": {
21
+ "longest_edge": 512
22
+ },
23
+ "resample": 1,
24
+ "rescale_factor": 0.00392156862745098,
25
+ "size": {
26
+ "longest_edge": 1024
27
+ }
28
+ },
29
+ "image_seq_len": 64,
30
+ "processor_class": "Idefics3Processor"
31
+ }
rag_image_parser_config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format": "rag-image-parser-split-onnx-v1",
3
+ "checkpoint": "yafitzdev/pyrrho-opsis-v1-nano-g2",
4
+ "parent_checkpoint": "yafitzdev/pyrrho-opsis-v1-nano-g1",
5
+ "base_architecture": "HuggingFaceTB/SmolVLM-256M-Instruct",
6
+ "prompt_version": "rag-image-v3",
7
+ "image_longest_edge": 1024,
8
+ "recommended_backend": "onnxruntime-cpu",
9
+ "variants": [
10
+ "fp32"
11
+ ],
12
+ "patched_connector_weights": 1,
13
+ "patched_vision_weights": 48,
14
+ "patched_decoder_weights": 120,
15
+ "training": {
16
+ "rendered_files": 50000,
17
+ "epochs": 1.0,
18
+ "learning_rate": 0.0001,
19
+ "trainable_parameters": 1614336,
20
+ "total_parameters": 258099264,
21
+ "lora_rank": 8,
22
+ "lora_alpha": 16,
23
+ "vision_lora": true
24
+ }
25
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|im_start|>",
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<end_of_utterance>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<fake_token_around_image>",
10
+ "<image>",
11
+ "<end_of_utterance>"
12
+ ],
13
+ "is_local": true,
14
+ "legacy": false,
15
+ "local_files_only": false,
16
+ "max_length": null,
17
+ "model_max_length": 8192,
18
+ "pad_to_multiple_of": null,
19
+ "pad_token": "<|im_end|>",
20
+ "pad_token_type_id": 0,
21
+ "padding_side": "right",
22
+ "processor_class": "Idefics3Processor",
23
+ "size": {
24
+ "longest_edge": 1024
25
+ },
26
+ "tokenizer_class": "GPT2Tokenizer",
27
+ "truncation_side": "left",
28
+ "unk_token": "<|endoftext|>",
29
+ "vocab_size": 49152
30
+ }