viavicdev commited on
Commit
99d176c
·
verified ·
1 Parent(s): 21d855b

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* 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
 
 
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
LICENSE ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Derivative
95
+ 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, excluding
103
+ those notices that do not pertain to any part of the Derivative
104
+ 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 of
111
+ the following places: within a NOTICE text file distributed as
112
+ 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 do
117
+ not modify the License. You may add Your own attribution notices
118
+ within Derivative Works that You distribute, alongside or as an
119
+ addendum to the NOTICE text from the Work, provided that such
120
+ additional attribution notices cannot be construed as modifying
121
+ 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 2024 omni-research (Tarsier2-Recap-7b, original model)
190
+ Copyright 2026 viavicdev (MLX 4-bit conversion)
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
203
+
204
+ ------------------------------------------------------------------------------
205
+
206
+ NOTICE
207
+
208
+ This repository, "Tarsier2-Recap-7b-MLX-4bit", is a derivative work: an MLX
209
+ 4-bit quantized conversion of "omni-research/Tarsier2-Recap-7b".
210
+
211
+ All credit for the underlying model belongs to the original Tarsier2 authors
212
+ (omni-research). This repository contributes only a format conversion:
213
+ a weight-key remap into native Qwen2-VL layout followed by MLX 4-bit
214
+ quantization. No model weights were retrained or otherwise altered in
215
+ substance beyond quantization.
216
+
217
+ Original model: https://huggingface.co/omni-research/Tarsier2-Recap-7b
218
+ Conversion by: viavicdev
README.md ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: omni-research/Tarsier2-Recap-7b
4
+ pipeline_tag: video-text-to-text
5
+ library_name: mlx
6
+ language:
7
+ - en
8
+ tags:
9
+ - mlx
10
+ - apple-silicon
11
+ - video-captioning
12
+ - qwen2-vl
13
+ - tarsier
14
+ ---
15
+
16
+ # Tarsier2-Recap-7b-MLX-4bit
17
+
18
+ A 4-bit [MLX](https://github.com/ml-explore/mlx) conversion of
19
+ [omni-research/Tarsier2-Recap-7b](https://huggingface.co/omni-research/Tarsier2-Recap-7b),
20
+ so it runs natively and fast on Apple Silicon.
21
+
22
+ Tarsier2 is one of the most detailed open video captioners available, but no
23
+ official MLX build exists. This repo fills that gap: same model, quantized to
24
+ 4-bit, ~5.3 GB, running on the Mac GPU through MLX.
25
+
26
+ - **Base model:** omni-research/Tarsier2-Recap-7b (Apache-2.0)
27
+ - **Format:** MLX, 4-bit affine quantization (group size 64)
28
+ - **Size on disk:** ~5.3 GB
29
+ - **Underlying architecture:** Qwen2-VL 7B (see conversion notes below)
30
+ - **Runs on:** Apple Silicon (tested on an M4 Pro, 24 GB unified memory)
31
+
32
+ ## Why this exists
33
+
34
+ Tarsier2-Recap-7b produces unusually specific, grounded video descriptions —
35
+ it reads small details (a sail number, an object in someone's hand,
36
+ architectural features) rather than generic scene summaries. On Apple Silicon
37
+ the only practical way to run a 7B vision-language model at usable speed is
38
+ MLX 4-bit; the full bf16 weights via `transformers` on MPS are far too slow
39
+ (hundreds of seconds per clip). This conversion gets it to roughly
40
+ **7 seconds per short clip** on an M4 Pro.
41
+
42
+ ## Usage
43
+
44
+ Run with [`mlx-vlm`](https://github.com/Blaizzy/mlx-vlm) (0.6.3 or newer).
45
+
46
+ ```python
47
+ from mlx_vlm import load, generate
48
+ from mlx_vlm.prompt_utils import apply_chat_template
49
+
50
+ model, processor = load("viavicdev/Tarsier2-Recap-7b-MLX-4bit")
51
+
52
+ # NOTE: feed video as a list of extracted frame images (see gotcha #1 below)
53
+ frames = ["frame_00.jpg", "frame_01.jpg", "frame_02.jpg", "frame_03.jpg"]
54
+ prompt = apply_chat_template(
55
+ processor, model.config,
56
+ "Describe this video in detail.",
57
+ num_images=len(frames),
58
+ )
59
+ out = generate(
60
+ model, processor, prompt,
61
+ image=frames, # note: image= (not images=)
62
+ max_tokens=300,
63
+ temperature=0.3,
64
+ repetition_penalty=1.3, # see gotcha #3
65
+ repetition_context_size=40,
66
+ )
67
+ print(out)
68
+ ```
69
+
70
+ ### Gotchas (learned the hard way)
71
+
72
+ 1. **Feed frames as images, not a video file.** The `mlx-vlm` 0.6.3 video
73
+ decoder path is unreliable and can hallucinate. Extract frames with ffmpeg
74
+ and pass them as a list of images (`image=[...]` with
75
+ `num_images=N`). This delivers the real frames to the model.
76
+ 2. **The chat template is included** in this repo (`chat_template.json` /
77
+ `chat_template.jinja`). Some MLX repacks ship without it, which breaks
78
+ `apply_chat_template`.
79
+ 3. **Use a repetition penalty.** At 4-bit the model can occasionally loop.
80
+ `repetition_penalty=1.3`, `repetition_context_size=40`, `temperature=0.3`
81
+ keeps output clean. In testing, 1 of 22 clips degenerated without it; none with it.
82
+
83
+ ## How it was converted
84
+
85
+ Tarsier2 ships as `TarsierForConditionalGeneration` with `model_type: llava`,
86
+ but its text and vision towers **are Qwen2-VL weights under different key
87
+ names**. The `mlx-vlm` llava handler does not support Qwen2-VL's mRoPE
88
+ (it errors with `rope_scaling type only supports linear`); the `qwen2_vl`
89
+ handler does. So the conversion is just a key-remap into native Qwen2-VL layout,
90
+ followed by a standard MLX quantize.
91
+
92
+ Only three key prefixes need remapping:
93
+
94
+ ```
95
+ language_model.model.* -> model.*
96
+ language_model.lm_head.* -> lm_head.*
97
+ vision_tower.* -> visual.*
98
+ ```
99
+
100
+ Then a flat `qwen2_vl` config is built from Tarsier's `text_config` +
101
+ `vision_config` (preserving `rope_scaling: mrope`, the vision/image/video token
102
+ ids, etc.), and the remapped weights are quantized:
103
+
104
+ ```bash
105
+ mlx_vlm.convert --hf-path ./tarsier2-qwen2vl-hf -q --q-bits 4
106
+ ```
107
+
108
+ This is a general pattern: **custom Qwen2-VL-based models (Tarsier and
109
+ similar) that lack an official MLX or HF remote-code path can often be run on
110
+ MLX via a key-remap**, as long as you route them through the `qwen2_vl` handler
111
+ so mRoPE is respected.
112
+
113
+ ## Limitations
114
+
115
+ - 4-bit quantization trades some fidelity for size/speed; for maximum quality
116
+ use the original bf16 weights on a CUDA machine.
117
+ - English captioning model — it describes in English regardless of spoken
118
+ language in the clip.
119
+ - Vision only (no audio). It captions what is *seen*, not heard.
120
+ - Follows free-form description better than rigid output schemas; best used as
121
+ a captioner rather than a strict classifier.
122
+
123
+ ## License and attribution
124
+
125
+ This conversion inherits the **Apache-2.0** license of the base model. All
126
+ credit for the model itself goes to the Tarsier2 authors
127
+ ([omni-research/Tarsier2-Recap-7b](https://huggingface.co/omni-research/Tarsier2-Recap-7b)).
128
+ This repository only provides a format conversion (weight key-remap + MLX 4-bit
129
+ quantization) for the Apple Silicon community.
130
+
131
+ If you cite Tarsier2, cite the original authors.
added_tokens.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "<|box_end|>": 151649,
3
+ "<|box_start|>": 151648,
4
+ "<|endoftext|>": 151643,
5
+ "<|im_end|>": 151645,
6
+ "<|im_start|>": 151644,
7
+ "<|image_pad|>": 151655,
8
+ "<|object_ref_end|>": 151647,
9
+ "<|object_ref_start|>": 151646,
10
+ "<|quad_end|>": 151651,
11
+ "<|quad_start|>": 151650,
12
+ "<|video_pad|>": 151656,
13
+ "<|vision_end|>": 151653,
14
+ "<|vision_pad|>": 151654,
15
+ "<|vision_start|>": 151652
16
+ }
chat_template.jinja ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system
2
+ You are a helpful assistant.<|im_end|>
3
+ {% endif %}{% if (message['role'] != 'assistant') %}<|im_start|>{{ message['role'] }}
4
+ {% if message['content'] is string %}{{ message['content'] }}<|im_end|>
5
+ {% else %}{% for content in message['content'] %}{% if content['type'] == 'image' %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_start|>{{'<|image_pad|>' * content['num_vision_tokens']}}<|vision_end|>{% elif content['type'] == 'video' %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_start|>{{'<|image_pad|>' * content['num_vision_tokens']}}<|vision_end|>{% elif content['type'] == 'text' %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>
6
+ {% endif %}{% elif (message['role'] == 'assistant') %}<|im_start|>{{ message['role'] }}
7
+ {% generation %}{% if message['content'] is string %}{{ message['content'] }}<|im_end|>
8
+ {% else %}{% for content in message['content'] %}{% if content['type'] == 'image' %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_start|>{{'<|image_pad|>' * content['num_vision_tokens']}}<|vision_end|>{% elif content['type'] == 'video' %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_start|>{{'<|image_pad|>' * content['num_vision_tokens']}}<|vision_end|>{% elif content['type'] == 'text' %}{{ content['text'] }}{% endif %}{% endfor %}{% if not loop.last or not strip_final_eos %}<|im_end|>
9
+ {% endif %}{% endif %}{% endgeneration %}{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant
10
+ {% endif %}
chat_template.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "chat_template": "{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n{% endif %}<|im_start|>{{ message['role'] }}\n{% if message['content'] is string %}{{ message['content'] }}<|im_end|>\n{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_start|><|image_pad|><|vision_end|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_start|><|video_pad|><|vision_end|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>\n{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant\n{% endif %}"
3
+ }
config.json ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen2VLForConditionalGeneration"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "bos_token_id": 151643,
7
+ "eos_token_id": 151645,
8
+ "generation_config": {
9
+ "_from_model_config": true,
10
+ "bos_token_id": 151643,
11
+ "eos_token_id": 151645,
12
+ "transformers_version": "4.47.0",
13
+ "use_cache": true
14
+ },
15
+ "hidden_act": "silu",
16
+ "hidden_size": 3584,
17
+ "image_token_id": 151655,
18
+ "intermediate_size": 18944,
19
+ "max_position_embeddings": 32768,
20
+ "max_window_layers": 28,
21
+ "model_type": "qwen2_vl",
22
+ "num_attention_heads": 28,
23
+ "num_hidden_layers": 28,
24
+ "num_key_value_heads": 4,
25
+ "quantization": {
26
+ "group_size": 64,
27
+ "bits": 4,
28
+ "mode": "affine"
29
+ },
30
+ "quantization_config": {
31
+ "group_size": 64,
32
+ "bits": 4,
33
+ "mode": "affine"
34
+ },
35
+ "rms_norm_eps": 1e-06,
36
+ "rope_scaling": {
37
+ "type": "mrope",
38
+ "mrope_section": [
39
+ 16,
40
+ 24,
41
+ 24
42
+ ]
43
+ },
44
+ "rope_theta": 1000000.0,
45
+ "sliding_window": 32768,
46
+ "tie_word_embeddings": false,
47
+ "use_cache": true,
48
+ "use_sliding_window": false,
49
+ "video_token_id": 151656,
50
+ "vision_config": {
51
+ "_attn_implementation_autoset": false,
52
+ "_name_or_path": "",
53
+ "add_cross_attention": false,
54
+ "architectures": null,
55
+ "attn_implementation": "flash_attention_2",
56
+ "auto_map": {
57
+ "AutoConfig": "models--modeling_qwen2_vl_fast.Qwen2VLVisionConfig",
58
+ "AutoModel": "models--modeling_qwen2_vl_fast.Qwen2VisionTransformerPretrainedModel"
59
+ },
60
+ "bad_words_ids": null,
61
+ "begin_suppress_tokens": null,
62
+ "bos_token_id": null,
63
+ "chunk_size_feed_forward": 0,
64
+ "cross_attention_hidden_size": null,
65
+ "decoder_start_token_id": null,
66
+ "depth": 32,
67
+ "diversity_penalty": 0.0,
68
+ "do_sample": false,
69
+ "early_stopping": false,
70
+ "embed_dim": 1280,
71
+ "encoder_no_repeat_ngram_size": 0,
72
+ "eos_token_id": null,
73
+ "exponential_decay_length_penalty": null,
74
+ "finetuning_task": null,
75
+ "forced_bos_token_id": null,
76
+ "forced_eos_token_id": null,
77
+ "hidden_act": "quick_gelu",
78
+ "hidden_size": 3584,
79
+ "id2label": {
80
+ "0": "LABEL_0",
81
+ "1": "LABEL_1"
82
+ },
83
+ "in_channels": 3,
84
+ "in_chans": 3,
85
+ "is_decoder": false,
86
+ "is_encoder_decoder": false,
87
+ "label2id": {
88
+ "LABEL_0": 0,
89
+ "LABEL_1": 1
90
+ },
91
+ "length_penalty": 1.0,
92
+ "max_length": 20,
93
+ "min_length": 0,
94
+ "mlp_ratio": 4,
95
+ "model_type": "qwen2_vl",
96
+ "no_repeat_ngram_size": 0,
97
+ "num_beam_groups": 1,
98
+ "num_beams": 1,
99
+ "num_heads": 16,
100
+ "num_return_sequences": 1,
101
+ "output_attentions": false,
102
+ "output_hidden_states": false,
103
+ "output_scores": false,
104
+ "pad_token_id": null,
105
+ "patch_size": 14,
106
+ "prefix": null,
107
+ "problem_type": null,
108
+ "pruned_heads": {},
109
+ "remove_invalid_values": false,
110
+ "repetition_penalty": 1.0,
111
+ "return_dict": true,
112
+ "return_dict_in_generate": false,
113
+ "sep_token_id": null,
114
+ "spatial_merge_size": 2,
115
+ "spatial_patch_size": 14,
116
+ "suppress_tokens": null,
117
+ "task_specific_params": null,
118
+ "temperature": 1.0,
119
+ "temporal_patch_size": 2,
120
+ "tf_legacy_loss": false,
121
+ "tie_encoder_decoder": false,
122
+ "tie_word_embeddings": true,
123
+ "tokenizer_class": null,
124
+ "top_k": 50,
125
+ "top_p": 1.0,
126
+ "torch_dtype": null,
127
+ "torchscript": false,
128
+ "typical_p": 1.0,
129
+ "use_bfloat16": false
130
+ },
131
+ "vision_end_token_id": 151653,
132
+ "vision_start_token_id": 151652,
133
+ "vision_token_id": 151654,
134
+ "vocab_size": 152064
135
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 151643,
4
+ "eos_token_id": 151645,
5
+ "transformers_version": "4.47.0",
6
+ "use_cache": true
7
+ }
model-00001-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:90a52da51d31b2561381a93fb9b63f8da3d9092260de469c83c3775043ebee76
3
+ size 5329357921
model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3254a4e13f2495304eccbf038b511cd8481abe340612cad5221878992fd7aa24
3
+ size 306561371
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
preprocessor_config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_convert_rgb": true,
3
+ "do_normalize": true,
4
+ "do_rescale": true,
5
+ "do_resize": true,
6
+ "image_mean": [
7
+ 0.48145466,
8
+ 0.4578275,
9
+ 0.40821073
10
+ ],
11
+ "image_processor_type": "Qwen2VLImageProcessor",
12
+ "image_std": [
13
+ 0.26862954,
14
+ 0.26130258,
15
+ 0.27577711
16
+ ],
17
+ "max_pixels": 2073600,
18
+ "merge_size": 2,
19
+ "min_pixels": 3136,
20
+ "patch_size": 14,
21
+ "processor_class": "TarsierProcessor",
22
+ "resample": 3,
23
+ "rescale_factor": 0.00392156862745098,
24
+ "size": {
25
+ "max_pixels": 2073600,
26
+ "min_pixels": 3136
27
+ },
28
+ "temporal_patch_size": 2
29
+ }
processor_config.json ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "do_convert_rgb": true,
4
+ "do_normalize": true,
5
+ "do_rescale": true,
6
+ "image_mean": [
7
+ 0.48145466,
8
+ 0.4578275,
9
+ 0.40821073
10
+ ],
11
+ "image_processor_type": "Qwen3VLImageProcessor",
12
+ "image_std": [
13
+ 0.26862954,
14
+ 0.26130258,
15
+ 0.27577711
16
+ ],
17
+ "max_pixels": 2073600,
18
+ "merge_size": 2,
19
+ "min_pixels": 3136,
20
+ "patch_size": 14,
21
+ "rescale_factor": 0.00392156862745098,
22
+ "temporal_patch_size": 2
23
+ },
24
+ "processor_class": "Qwen2VLProcessor",
25
+ "video_processor": {
26
+ "do_convert_rgb": true,
27
+ "do_normalize": true,
28
+ "do_rescale": true,
29
+ "fps": 2.0,
30
+ "image_mean": [
31
+ 0.48145466,
32
+ 0.4578275,
33
+ 0.40821073
34
+ ],
35
+ "image_std": [
36
+ 0.26862954,
37
+ 0.26130258,
38
+ 0.27577711
39
+ ],
40
+ "max_frames": 768,
41
+ "max_pixels": 2073600,
42
+ "merge_size": 2,
43
+ "min_frames": 4,
44
+ "min_pixels": 3136,
45
+ "patch_size": 14,
46
+ "rescale_factor": 0.00392156862745098,
47
+ "temporal_patch_size": 2,
48
+ "video_processor_type": "Qwen3VLVideoProcessor"
49
+ }
50
+ }
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:ff8cce547abc110590d19c6b5b6e0c6a7b4c8d1012d78b9c42131bae7f494a02
3
+ size 11420367
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"add_prefix_space": false, "backend": "tokenizers", "bos_token": null, "clean_up_tokenization_spaces": false, "eos_token": "<|im_end|>", "errors": "replace", "is_local": true, "local_files_only": false, "model_max_length": 32768, "pad_token": "<|endoftext|>", "padding_side": "left", "processor_class": "Qwen2VLProcessor", "split_special_tokens": false, "tokenizer_class": "Qwen2Tokenizer", "unk_token": null, "chat_template": "{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n{% endif %}<|im_start|>{{ message['role'] }}\n{% if message['content'] is string %}{{ message['content'] }}<|im_end|>\n{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_start|><|image_pad|><|vision_end|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_start|><|video_pad|><|vision_end|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>\n{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant\n{% endif %}"}
vocab.json ADDED
The diff for this file is too large to render. See raw diff