KaedeTai commited on
Commit
ca7a1ba
·
verified ·
1 Parent(s): 15856fe

Upload folder using huggingface_hub

Browse files
ATTRIBUTIONS.md ADDED
The diff for this file is too large to render. See raw diff
 
LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: qvac/VisionPsy-Nano-460M
4
+ tags:
5
+ - mlx
6
+ - vlm
7
+ - vision-language-model
8
+ - apple-silicon
9
+ - siglip2
10
+ - smollm2
11
+ language:
12
+ - en
13
+ - zh
14
+ library_name: mlx
15
+ pipeline_tag: image-text-to-text
16
+ ---
17
+
18
+ # VisionPsy-Nano-460M-MLX
19
+
20
+ MLX port of [**qvac/VisionPsy-Nano-460M**](https://huggingface.co/qvac/VisionPsy-Nano-460M), a compact 460M-parameter vision-language model from Tether AI Research, converted to run natively on Apple Silicon.
21
+
22
+ - **Architecture:** SigLIP2-base-patch16-512 vision encoder + pixel-shuffle modality projector + SmolLM2-360M-Instruct decoder
23
+ - **Parameters:** ~460M
24
+ - **Precision:** bfloat16 (~1.0 GB on disk, down from 2.0 GB fp32)
25
+ - **Runtime:** MLX on Apple Silicon (M-series)
26
+ - **License:** Apache-2.0
27
+
28
+ ## Benchmarks (MLX bf16, M-series)
29
+
30
+ Measured across 7 images x 5 prompts, 64 max new tokens, greedy decode:
31
+
32
+ | Metric | Standard | Flash |
33
+ |---|---|---|
34
+ | Avg decode tok/s | 99 | 152 |
35
+ | Median decode tok/s | 90 | 157 |
36
+ | Avg peak GPU memory | 2.64 GB | 2.64 GB |
37
+ | Load time | ~0.4 s | ~0.7 s |
38
+
39
+ Per-prompt-type medians (Standard):
40
+
41
+ | Prompt type | Median tok/s | Example |
42
+ |---|---|---|
43
+ | Describe (EN, 1 sentence) | 158.7 | "A smiling man in a white lab coat gestures with his right hand..." |
44
+ | What text appears? | 90.3 | "OICOMELVANG" |
45
+ | Count objects/people | 40.0 | "There are 3 people in the image." |
46
+ | Main subject | 59.2 | "The main subject is a man wearing a white lab coat." |
47
+ | Describe (ZH) | 130.4 | "他說:\"OICOMELVANG, 25158\"" |
48
+
49
+ Full 70-run matrix (Standard + Flash) is at [github.com/KaedeTai/mlx-video/tree/visionpsy-mlx-port](https://github.com/KaedeTai/mlx-video/tree/visionpsy-mlx-port).
50
+
51
+ ## Usage
52
+
53
+ This repo uses the mlx-vlm-style layout (`text_config` + `vision_config` top-level, `language_model.*` / `vision_tower.*` / `multi_modal_projector.*` tensor prefixes) so it slots cleanly into `mlx-vlm` once a `visionpsy_nano` handler lands there. Until then, load it via the MLX port bundled in **mlx-video** (branch `visionpsy-mlx-port`):
54
+
55
+ ```bash
56
+ pip install mlx safetensors transformers pillow
57
+ git clone -b visionpsy-mlx-port https://github.com/KaedeTai/mlx-video.git
58
+ cd mlx-video
59
+ ```
60
+
61
+ ```python
62
+ from huggingface_hub import snapshot_download
63
+ from mlx_video.models.visionpsy_nano import load_visionpsy_nano
64
+ from mlx_video.models.visionpsy_nano.processor import load_processor
65
+ from PIL import Image
66
+
67
+ # Snapshot from HF (or point at your local folder)
68
+ path = snapshot_download("KaedeTai/VisionPsy-Nano-460M-MLX")
69
+
70
+ model, cfg = load_visionpsy_nano(path)
71
+ proc = load_processor(path, cfg=cfg)
72
+
73
+ img = Image.open("photo.jpg").convert("RGB")
74
+ batch = proc("Describe this image in one sentence.", image=img)
75
+
76
+ tokens = list(model.generate(
77
+ batch["input_ids"],
78
+ pixel_values=batch["pixel_values"],
79
+ image_token_id=batch["image_token_id"],
80
+ max_new_tokens=64,
81
+ eos_token_id=proc.tokenizer.eos_token_id,
82
+ ))
83
+ print(proc.decode(tokens, skip_special_tokens=True))
84
+ ```
85
+
86
+ *Note:* the port's `load_visionpsy_nano` reads the repacked config via a compat shim; the original `_original_config` block is retained inside `config.json` for round-tripping.
87
+
88
+ ## What changed vs the original
89
+
90
+ - **fp32 -> bf16.** Weights cast to bfloat16. Outputs verified byte-identical on greedy decode for both variants.
91
+ - **Prefix rename.** Tensor names moved from `decoder.*` / `vision_encoder.*` / `MP.*` to `language_model.*` / `vision_tower.*` / `multi_modal_projector.*` to match mlx-vlm conventions.
92
+ - **Config reshape.** Flat `lm_*` / `vit_*` keys refactored into nested `text_config` / `vision_config` blocks with standard field names (`hidden_size`, `num_hidden_layers`, etc.).
93
+ - **Stale buffers dropped.** `decoder.rotary_embd.*` buffers removed — MLX's `nn.RoPE` computes frequencies on the fly.
94
+
95
+ ## Attribution
96
+
97
+ - **Original model:** Tether AI Research / QVAC — [qvac/VisionPsy-Nano-460M](https://huggingface.co/qvac/VisionPsy-Nano-460M) (Apache-2.0)
98
+ - **MLX port + weight repack:** [KaedeTai](https://huggingface.co/KaedeTai)
99
+ - **Base components:** SigLIP2 (Google), SmolLM2 (Hugging Face)
100
+
101
+ If you use these weights, please also cite the original QVAC release and the base model authors.
102
+
103
+ ## See also
104
+
105
+ - Flash variant: [KaedeTai/VisionPsy-Nano-460M-Flash-MLX](https://huggingface.co/KaedeTai/VisionPsy-Nano-460M-Flash-MLX)
106
+ - Original release blog + benchmarks: [qvac/VisionPsy-Nano-460M](https://huggingface.co/qvac/VisionPsy-Nano-460M)
107
+ - MLX port source: [github.com/KaedeTai/mlx-video @ visionpsy-mlx-port](https://github.com/KaedeTai/mlx-video/tree/visionpsy-mlx-port)
chat_template.jinja ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {% for message in messages %}{{'<|im_start|>' + message['role'] + '
2
+ ' + message['content'] + '<|im_end|>' + '
3
+ '}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant
4
+ ' }}{% endif %}
config.json ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "visionpsy_nano",
3
+ "architectures": [
4
+ "VisionPsyNanoForConditionalGeneration"
5
+ ],
6
+ "image_token_id": null,
7
+ "image_token_index": null,
8
+ "pad_token_id": null,
9
+ "eos_token_id": null,
10
+ "torch_dtype": "bfloat16",
11
+ "original_hf_repo": "qvac/VisionPsy-Nano-460M",
12
+ "is_flash": false,
13
+ "mp_image_token_length": 64,
14
+ "mp_pixel_shuffle_factor": 4,
15
+ "vlm_extra_tokens": {
16
+ "global_image_token": "<|global_image|>",
17
+ "image_token": "<|image|>",
18
+ "r1c1": "<row_1_col_1>",
19
+ "r1c2": "<row_1_col_2>",
20
+ "r1c3": "<row_1_col_3>",
21
+ "r1c4": "<row_1_col_4>",
22
+ "r1c5": "<row_1_col_5>",
23
+ "r1c6": "<row_1_col_6>",
24
+ "r1c7": "<row_1_col_7>",
25
+ "r1c8": "<row_1_col_8>",
26
+ "r2c1": "<row_2_col_1>",
27
+ "r2c2": "<row_2_col_2>",
28
+ "r2c3": "<row_2_col_3>",
29
+ "r2c4": "<row_2_col_4>",
30
+ "r2c5": "<row_2_col_5>",
31
+ "r2c6": "<row_2_col_6>",
32
+ "r2c7": "<row_2_col_7>",
33
+ "r2c8": "<row_2_col_8>",
34
+ "r3c1": "<row_3_col_1>",
35
+ "r3c2": "<row_3_col_2>",
36
+ "r3c3": "<row_3_col_3>",
37
+ "r3c4": "<row_3_col_4>",
38
+ "r3c5": "<row_3_col_5>",
39
+ "r3c6": "<row_3_col_6>",
40
+ "r3c7": "<row_3_col_7>",
41
+ "r3c8": "<row_3_col_8>",
42
+ "r4c1": "<row_4_col_1>",
43
+ "r4c2": "<row_4_col_2>",
44
+ "r4c3": "<row_4_col_3>",
45
+ "r4c4": "<row_4_col_4>",
46
+ "r4c5": "<row_4_col_5>",
47
+ "r4c6": "<row_4_col_6>",
48
+ "r4c7": "<row_4_col_7>",
49
+ "r4c8": "<row_4_col_8>",
50
+ "r5c1": "<row_5_col_1>",
51
+ "r5c2": "<row_5_col_2>",
52
+ "r5c3": "<row_5_col_3>",
53
+ "r5c4": "<row_5_col_4>",
54
+ "r5c5": "<row_5_col_5>",
55
+ "r5c6": "<row_5_col_6>",
56
+ "r5c7": "<row_5_col_7>",
57
+ "r5c8": "<row_5_col_8>",
58
+ "r6c1": "<row_6_col_1>",
59
+ "r6c2": "<row_6_col_2>",
60
+ "r6c3": "<row_6_col_3>",
61
+ "r6c4": "<row_6_col_4>",
62
+ "r6c5": "<row_6_col_5>",
63
+ "r6c6": "<row_6_col_6>",
64
+ "r6c7": "<row_6_col_7>",
65
+ "r6c8": "<row_6_col_8>",
66
+ "r7c1": "<row_7_col_1>",
67
+ "r7c2": "<row_7_col_2>",
68
+ "r7c3": "<row_7_col_3>",
69
+ "r7c4": "<row_7_col_4>",
70
+ "r7c5": "<row_7_col_5>",
71
+ "r7c6": "<row_7_col_6>",
72
+ "r7c7": "<row_7_col_7>",
73
+ "r7c8": "<row_7_col_8>",
74
+ "r8c1": "<row_8_col_1>",
75
+ "r8c2": "<row_8_col_2>",
76
+ "r8c3": "<row_8_col_3>",
77
+ "r8c4": "<row_8_col_4>",
78
+ "r8c5": "<row_8_col_5>",
79
+ "r8c6": "<row_8_col_6>",
80
+ "r8c7": "<row_8_col_7>",
81
+ "r8c8": "<row_8_col_8>"
82
+ },
83
+ "text_config": {
84
+ "model_type": "smollm2",
85
+ "hidden_size": 960,
86
+ "intermediate_size": 2560,
87
+ "num_hidden_layers": 32,
88
+ "num_attention_heads": 15,
89
+ "num_key_value_heads": 5,
90
+ "max_position_embeddings": 8192,
91
+ "rope_theta": 100000,
92
+ "rms_norm_eps": 1e-05,
93
+ "tie_word_embeddings": true,
94
+ "vocab_size": 49218,
95
+ "base_vocab_size": 49152,
96
+ "attention_scaling": 1.0,
97
+ "hf_backbone": "HuggingFaceTB/SmolLM2-360M-Instruct"
98
+ },
99
+ "vision_config": {
100
+ "model_type": "siglip2_vision_model",
101
+ "hidden_size": 768,
102
+ "intermediate_size": 3072,
103
+ "num_hidden_layers": 12,
104
+ "num_attention_heads": 12,
105
+ "image_size": 512,
106
+ "patch_size": 16,
107
+ "layer_norm_eps": 1e-06,
108
+ "cls_flag": false,
109
+ "max_img_size": 2048,
110
+ "hf_backbone": "google/siglip2-base-patch16-512"
111
+ },
112
+ "_original_config": {
113
+ "architectures": [
114
+ "VisionPsyNanoForConditionalGeneration"
115
+ ],
116
+ "auto_map": {
117
+ "AutoConfig": "configuration_visionpsynano.VisionPsyNanoConfig",
118
+ "AutoModel": "modeling_visionpsynano.VisionPsyNanoForConditionalGeneration",
119
+ "AutoModelForImageTextToText": "modeling_visionpsynano.VisionPsyNanoForConditionalGeneration",
120
+ "AutoProcessor": "processing_visionpsynano.VisionPsyNanoProcessor"
121
+ },
122
+ "compile_inference": true,
123
+ "compile_inference_mode": "default",
124
+ "cuda_graphs_cache_quantum": 128,
125
+ "eos_check_interval": 16,
126
+ "extra_token_amount": 66,
127
+ "hf_repo_name": "qvac/VisionPsy-Nano-460M",
128
+ "inference_max_img_size": null,
129
+ "is_flash": false,
130
+ "lm_attn_scaling": 1.0,
131
+ "lm_base_vocab_size": 49152,
132
+ "lm_chat_template": "{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
133
+ "lm_dropout": 0.0,
134
+ "lm_hidden_dim": 960,
135
+ "lm_inter_dim": 2560,
136
+ "lm_max_length": 8192,
137
+ "lm_max_position_embeddings": 8192,
138
+ "lm_model_type": "HuggingFaceTB/SmolLM2-360M-Instruct",
139
+ "lm_n_blocks": 32,
140
+ "lm_n_heads": 15,
141
+ "lm_n_kv_heads": 5,
142
+ "lm_re_base": 100000,
143
+ "lm_rms_eps": 1e-05,
144
+ "lm_tie_weights": true,
145
+ "lm_tokenizer": "HuggingFaceTB/SmolLM2-360M-Instruct",
146
+ "lm_use_tokens": false,
147
+ "lm_vocab_size": 49218,
148
+ "max_img_size": 2048,
149
+ "model_type": "visionpsynano",
150
+ "mp_image_token_length": 64,
151
+ "mp_pixel_shuffle_factor": 4,
152
+ "resize_min_side_len": null,
153
+ "resize_to_max_side_len": true,
154
+ "transformers_version": "5.14.1",
155
+ "vit_cls_flag": false,
156
+ "vit_dropout": 0.0,
157
+ "vit_hidden_dim": 768,
158
+ "vit_img_size": 512,
159
+ "vit_inter_dim": 3072,
160
+ "vit_ln_eps": 1e-06,
161
+ "vit_model_type": "google/siglip2-base-patch16-512",
162
+ "vit_n_blocks": 12,
163
+ "vit_n_heads": 12,
164
+ "vit_patch_size": 16,
165
+ "vlm_checkpoint_path": null,
166
+ "vlm_extra_tokens": {
167
+ "global_image_token": "<|global_image|>",
168
+ "image_token": "<|image|>",
169
+ "r1c1": "<row_1_col_1>",
170
+ "r1c2": "<row_1_col_2>",
171
+ "r1c3": "<row_1_col_3>",
172
+ "r1c4": "<row_1_col_4>",
173
+ "r1c5": "<row_1_col_5>",
174
+ "r1c6": "<row_1_col_6>",
175
+ "r1c7": "<row_1_col_7>",
176
+ "r1c8": "<row_1_col_8>",
177
+ "r2c1": "<row_2_col_1>",
178
+ "r2c2": "<row_2_col_2>",
179
+ "r2c3": "<row_2_col_3>",
180
+ "r2c4": "<row_2_col_4>",
181
+ "r2c5": "<row_2_col_5>",
182
+ "r2c6": "<row_2_col_6>",
183
+ "r2c7": "<row_2_col_7>",
184
+ "r2c8": "<row_2_col_8>",
185
+ "r3c1": "<row_3_col_1>",
186
+ "r3c2": "<row_3_col_2>",
187
+ "r3c3": "<row_3_col_3>",
188
+ "r3c4": "<row_3_col_4>",
189
+ "r3c5": "<row_3_col_5>",
190
+ "r3c6": "<row_3_col_6>",
191
+ "r3c7": "<row_3_col_7>",
192
+ "r3c8": "<row_3_col_8>",
193
+ "r4c1": "<row_4_col_1>",
194
+ "r4c2": "<row_4_col_2>",
195
+ "r4c3": "<row_4_col_3>",
196
+ "r4c4": "<row_4_col_4>",
197
+ "r4c5": "<row_4_col_5>",
198
+ "r4c6": "<row_4_col_6>",
199
+ "r4c7": "<row_4_col_7>",
200
+ "r4c8": "<row_4_col_8>",
201
+ "r5c1": "<row_5_col_1>",
202
+ "r5c2": "<row_5_col_2>",
203
+ "r5c3": "<row_5_col_3>",
204
+ "r5c4": "<row_5_col_4>",
205
+ "r5c5": "<row_5_col_5>",
206
+ "r5c6": "<row_5_col_6>",
207
+ "r5c7": "<row_5_col_7>",
208
+ "r5c8": "<row_5_col_8>",
209
+ "r6c1": "<row_6_col_1>",
210
+ "r6c2": "<row_6_col_2>",
211
+ "r6c3": "<row_6_col_3>",
212
+ "r6c4": "<row_6_col_4>",
213
+ "r6c5": "<row_6_col_5>",
214
+ "r6c6": "<row_6_col_6>",
215
+ "r6c7": "<row_6_col_7>",
216
+ "r6c8": "<row_6_col_8>",
217
+ "r7c1": "<row_7_col_1>",
218
+ "r7c2": "<row_7_col_2>",
219
+ "r7c3": "<row_7_col_3>",
220
+ "r7c4": "<row_7_col_4>",
221
+ "r7c5": "<row_7_col_5>",
222
+ "r7c6": "<row_7_col_6>",
223
+ "r7c7": "<row_7_col_7>",
224
+ "r7c8": "<row_7_col_8>",
225
+ "r8c1": "<row_8_col_1>",
226
+ "r8c2": "<row_8_col_2>",
227
+ "r8c3": "<row_8_col_3>",
228
+ "r8c4": "<row_8_col_4>",
229
+ "r8c5": "<row_8_col_5>",
230
+ "r8c6": "<row_8_col_6>",
231
+ "r8c7": "<row_8_col_7>",
232
+ "r8c8": "<row_8_col_8>"
233
+ },
234
+ "vlm_load_backbone_weights": false,
235
+ "torch_dtype": "float32"
236
+ }
237
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0cc93c1027a58aec26c4350115b5eca02a836aba06277fe700de854ff078572f
3
+ size 1014772920
preprocessor_config.json ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "processor_class": "VisionPsyNanoProcessor",
3
+ "auto_map": {
4
+ "AutoProcessor": "processing_visionpsynano.VisionPsyNanoProcessor"
5
+ },
6
+ "is_flash": false,
7
+ "vit_img_size": 512,
8
+ "max_img_size": 2048,
9
+ "inference_max_img_size": null,
10
+ "resize_to_max_side_len": true,
11
+ "resize_min_side_len": null,
12
+ "mp_image_token_length": 64,
13
+ "lm_max_position_embeddings": 8192,
14
+ "lm_tokenizer": "HuggingFaceTB/SmolLM2-360M-Instruct",
15
+ "lm_chat_template": "{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
16
+ "vlm_extra_tokens": {
17
+ "image_token": "<|image|>",
18
+ "global_image_token": "<|global_image|>",
19
+ "r1c1": "<row_1_col_1>",
20
+ "r1c2": "<row_1_col_2>",
21
+ "r1c3": "<row_1_col_3>",
22
+ "r1c4": "<row_1_col_4>",
23
+ "r1c5": "<row_1_col_5>",
24
+ "r1c6": "<row_1_col_6>",
25
+ "r1c7": "<row_1_col_7>",
26
+ "r1c8": "<row_1_col_8>",
27
+ "r2c1": "<row_2_col_1>",
28
+ "r2c2": "<row_2_col_2>",
29
+ "r2c3": "<row_2_col_3>",
30
+ "r2c4": "<row_2_col_4>",
31
+ "r2c5": "<row_2_col_5>",
32
+ "r2c6": "<row_2_col_6>",
33
+ "r2c7": "<row_2_col_7>",
34
+ "r2c8": "<row_2_col_8>",
35
+ "r3c1": "<row_3_col_1>",
36
+ "r3c2": "<row_3_col_2>",
37
+ "r3c3": "<row_3_col_3>",
38
+ "r3c4": "<row_3_col_4>",
39
+ "r3c5": "<row_3_col_5>",
40
+ "r3c6": "<row_3_col_6>",
41
+ "r3c7": "<row_3_col_7>",
42
+ "r3c8": "<row_3_col_8>",
43
+ "r4c1": "<row_4_col_1>",
44
+ "r4c2": "<row_4_col_2>",
45
+ "r4c3": "<row_4_col_3>",
46
+ "r4c4": "<row_4_col_4>",
47
+ "r4c5": "<row_4_col_5>",
48
+ "r4c6": "<row_4_col_6>",
49
+ "r4c7": "<row_4_col_7>",
50
+ "r4c8": "<row_4_col_8>",
51
+ "r5c1": "<row_5_col_1>",
52
+ "r5c2": "<row_5_col_2>",
53
+ "r5c3": "<row_5_col_3>",
54
+ "r5c4": "<row_5_col_4>",
55
+ "r5c5": "<row_5_col_5>",
56
+ "r5c6": "<row_5_col_6>",
57
+ "r5c7": "<row_5_col_7>",
58
+ "r5c8": "<row_5_col_8>",
59
+ "r6c1": "<row_6_col_1>",
60
+ "r6c2": "<row_6_col_2>",
61
+ "r6c3": "<row_6_col_3>",
62
+ "r6c4": "<row_6_col_4>",
63
+ "r6c5": "<row_6_col_5>",
64
+ "r6c6": "<row_6_col_6>",
65
+ "r6c7": "<row_6_col_7>",
66
+ "r6c8": "<row_6_col_8>",
67
+ "r7c1": "<row_7_col_1>",
68
+ "r7c2": "<row_7_col_2>",
69
+ "r7c3": "<row_7_col_3>",
70
+ "r7c4": "<row_7_col_4>",
71
+ "r7c5": "<row_7_col_5>",
72
+ "r7c6": "<row_7_col_6>",
73
+ "r7c7": "<row_7_col_7>",
74
+ "r7c8": "<row_7_col_8>",
75
+ "r8c1": "<row_8_col_1>",
76
+ "r8c2": "<row_8_col_2>",
77
+ "r8c3": "<row_8_col_3>",
78
+ "r8c4": "<row_8_col_4>",
79
+ "r8c5": "<row_8_col_5>",
80
+ "r8c6": "<row_8_col_6>",
81
+ "r8c7": "<row_8_col_7>",
82
+ "r8c8": "<row_8_col_8>"
83
+ }
84
+ }
processor_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "processor_class": "VisionPsyNanoProcessor",
3
+ "auto_map": {
4
+ "AutoProcessor": "processing_visionpsynano.VisionPsyNanoProcessor"
5
+ }
6
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|im_start|>",
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "global_image_token": "<|global_image|>",
9
+ "image_token": "<|image|>",
10
+ "is_local": false,
11
+ "local_files_only": false,
12
+ "model_max_length": 8192,
13
+ "model_specific_special_tokens": {
14
+ "global_image_token": "<|global_image|>",
15
+ "image_token": "<|image|>",
16
+ "r1c1": "<row_1_col_1>",
17
+ "r1c2": "<row_1_col_2>",
18
+ "r1c3": "<row_1_col_3>",
19
+ "r1c4": "<row_1_col_4>",
20
+ "r1c5": "<row_1_col_5>",
21
+ "r1c6": "<row_1_col_6>",
22
+ "r1c7": "<row_1_col_7>",
23
+ "r1c8": "<row_1_col_8>",
24
+ "r2c1": "<row_2_col_1>",
25
+ "r2c2": "<row_2_col_2>",
26
+ "r2c3": "<row_2_col_3>",
27
+ "r2c4": "<row_2_col_4>",
28
+ "r2c5": "<row_2_col_5>",
29
+ "r2c6": "<row_2_col_6>",
30
+ "r2c7": "<row_2_col_7>",
31
+ "r2c8": "<row_2_col_8>",
32
+ "r3c1": "<row_3_col_1>",
33
+ "r3c2": "<row_3_col_2>",
34
+ "r3c3": "<row_3_col_3>",
35
+ "r3c4": "<row_3_col_4>",
36
+ "r3c5": "<row_3_col_5>",
37
+ "r3c6": "<row_3_col_6>",
38
+ "r3c7": "<row_3_col_7>",
39
+ "r3c8": "<row_3_col_8>",
40
+ "r4c1": "<row_4_col_1>",
41
+ "r4c2": "<row_4_col_2>",
42
+ "r4c3": "<row_4_col_3>",
43
+ "r4c4": "<row_4_col_4>",
44
+ "r4c5": "<row_4_col_5>",
45
+ "r4c6": "<row_4_col_6>",
46
+ "r4c7": "<row_4_col_7>",
47
+ "r4c8": "<row_4_col_8>",
48
+ "r5c1": "<row_5_col_1>",
49
+ "r5c2": "<row_5_col_2>",
50
+ "r5c3": "<row_5_col_3>",
51
+ "r5c4": "<row_5_col_4>",
52
+ "r5c5": "<row_5_col_5>",
53
+ "r5c6": "<row_5_col_6>",
54
+ "r5c7": "<row_5_col_7>",
55
+ "r5c8": "<row_5_col_8>",
56
+ "r6c1": "<row_6_col_1>",
57
+ "r6c2": "<row_6_col_2>",
58
+ "r6c3": "<row_6_col_3>",
59
+ "r6c4": "<row_6_col_4>",
60
+ "r6c5": "<row_6_col_5>",
61
+ "r6c6": "<row_6_col_6>",
62
+ "r6c7": "<row_6_col_7>",
63
+ "r6c8": "<row_6_col_8>",
64
+ "r7c1": "<row_7_col_1>",
65
+ "r7c2": "<row_7_col_2>",
66
+ "r7c3": "<row_7_col_3>",
67
+ "r7c4": "<row_7_col_4>",
68
+ "r7c5": "<row_7_col_5>",
69
+ "r7c6": "<row_7_col_6>",
70
+ "r7c7": "<row_7_col_7>",
71
+ "r7c8": "<row_7_col_8>",
72
+ "r8c1": "<row_8_col_1>",
73
+ "r8c2": "<row_8_col_2>",
74
+ "r8c3": "<row_8_col_3>",
75
+ "r8c4": "<row_8_col_4>",
76
+ "r8c5": "<row_8_col_5>",
77
+ "r8c6": "<row_8_col_6>",
78
+ "r8c7": "<row_8_col_7>",
79
+ "r8c8": "<row_8_col_8>"
80
+ },
81
+ "pad_token": "<|im_end|>",
82
+ "processor_class": "VisionPsyNanoProcessor",
83
+ "r1c1": "<row_1_col_1>",
84
+ "r1c2": "<row_1_col_2>",
85
+ "r1c3": "<row_1_col_3>",
86
+ "r1c4": "<row_1_col_4>",
87
+ "r1c5": "<row_1_col_5>",
88
+ "r1c6": "<row_1_col_6>",
89
+ "r1c7": "<row_1_col_7>",
90
+ "r1c8": "<row_1_col_8>",
91
+ "r2c1": "<row_2_col_1>",
92
+ "r2c2": "<row_2_col_2>",
93
+ "r2c3": "<row_2_col_3>",
94
+ "r2c4": "<row_2_col_4>",
95
+ "r2c5": "<row_2_col_5>",
96
+ "r2c6": "<row_2_col_6>",
97
+ "r2c7": "<row_2_col_7>",
98
+ "r2c8": "<row_2_col_8>",
99
+ "r3c1": "<row_3_col_1>",
100
+ "r3c2": "<row_3_col_2>",
101
+ "r3c3": "<row_3_col_3>",
102
+ "r3c4": "<row_3_col_4>",
103
+ "r3c5": "<row_3_col_5>",
104
+ "r3c6": "<row_3_col_6>",
105
+ "r3c7": "<row_3_col_7>",
106
+ "r3c8": "<row_3_col_8>",
107
+ "r4c1": "<row_4_col_1>",
108
+ "r4c2": "<row_4_col_2>",
109
+ "r4c3": "<row_4_col_3>",
110
+ "r4c4": "<row_4_col_4>",
111
+ "r4c5": "<row_4_col_5>",
112
+ "r4c6": "<row_4_col_6>",
113
+ "r4c7": "<row_4_col_7>",
114
+ "r4c8": "<row_4_col_8>",
115
+ "r5c1": "<row_5_col_1>",
116
+ "r5c2": "<row_5_col_2>",
117
+ "r5c3": "<row_5_col_3>",
118
+ "r5c4": "<row_5_col_4>",
119
+ "r5c5": "<row_5_col_5>",
120
+ "r5c6": "<row_5_col_6>",
121
+ "r5c7": "<row_5_col_7>",
122
+ "r5c8": "<row_5_col_8>",
123
+ "r6c1": "<row_6_col_1>",
124
+ "r6c2": "<row_6_col_2>",
125
+ "r6c3": "<row_6_col_3>",
126
+ "r6c4": "<row_6_col_4>",
127
+ "r6c5": "<row_6_col_5>",
128
+ "r6c6": "<row_6_col_6>",
129
+ "r6c7": "<row_6_col_7>",
130
+ "r6c8": "<row_6_col_8>",
131
+ "r7c1": "<row_7_col_1>",
132
+ "r7c2": "<row_7_col_2>",
133
+ "r7c3": "<row_7_col_3>",
134
+ "r7c4": "<row_7_col_4>",
135
+ "r7c5": "<row_7_col_5>",
136
+ "r7c6": "<row_7_col_6>",
137
+ "r7c7": "<row_7_col_7>",
138
+ "r7c8": "<row_7_col_8>",
139
+ "r8c1": "<row_8_col_1>",
140
+ "r8c2": "<row_8_col_2>",
141
+ "r8c3": "<row_8_col_3>",
142
+ "r8c4": "<row_8_col_4>",
143
+ "r8c5": "<row_8_col_5>",
144
+ "r8c6": "<row_8_col_6>",
145
+ "r8c7": "<row_8_col_7>",
146
+ "r8c8": "<row_8_col_8>",
147
+ "tokenizer_class": "GPT2Tokenizer",
148
+ "unk_token": "<|endoftext|>",
149
+ "vocab_size": 49152
150
+ }