Sensen02 commited on
Commit
20bb626
·
1 Parent(s): 04878ea

Upload Fast-dVLM 3B W8A8 FP8 quantized weights (language + vision)

Browse files
README.md CHANGED
@@ -1,3 +1,130 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ base_model:
6
+ - Efficient-Large-Model/Fast_dVLM_3B
7
+ tags:
8
+ - diffusion
9
+ - vlm
10
+ - block-diffusion
11
+ - parallel-decoding
12
+ - quantization
13
+ - fp8
14
+ - smoothquant
15
+ ---
16
+
17
+ # Fast-dVLM (3B) — W8A8 FP8 Quantized
18
+
19
+ [[Paper](https://arxiv.org/abs/2604.06832)] [[Project Page](https://nvlabs.github.io/Fast-dLLM/fast_dvlm/)] [[Code](https://github.com/NVlabs/Fast-dLLM)] [[BF16 Base](https://huggingface.co/Efficient-Large-Model/Fast_dVLM_3B)]
20
+
21
+ ## Introduction
22
+
23
+ This repository hosts the **W8A8 FP8 quantized** version of [`Fast_dVLM_3B`](https://huggingface.co/Efficient-Large-Model/Fast_dVLM_3B), produced via SmoothQuant offline calibration.
24
+
25
+ Both the language tower **and** the vision encoder are quantized to **FP8 (E4M3)** weights with per-channel static scales and per-token dynamic FP8 activations. Combined with SGLang block-diffusion serving, this checkpoint reaches **350 TPS (6.18× over the AR baseline)** while keeping MMMU-Pro-V within 0.3 of the BF16 result.
26
+
27
+ ### Key Highlights
28
+
29
+ - **6.18× Speedup** over the Qwen2.5-VL-3B AR baseline (350 TPS vs 56.7 TPS).
30
+ - **Near-Lossless Quality**: 23.8 vs 24.1 MMMU-Pro-V vs the BF16 block-diffusion model.
31
+ - **Full-Model FP8**: Language + vision both quantized; only norms, embeddings, and `lm_head` remain in BF16.
32
+
33
+ ---
34
+
35
+ ## Model Overview
36
+
37
+ | Property | Value |
38
+ |---|---|
39
+ | **Type** | Block Diffusion Vision-Language Model (FP8 quantized) |
40
+ | **Base Model** | [`Efficient-Large-Model/Fast_dVLM_3B`](https://huggingface.co/Efficient-Large-Model/Fast_dVLM_3B) |
41
+ | **Quantization** | SmoothQuant W8A8 FP8 (E4M3), per-channel static weight / per-token dynamic activation |
42
+ | **Calibration** | 512 samples × 1024 tokens on C4, SmoothQuant α=0.5 |
43
+ | **Text Layers** | 36 |
44
+ | **Vision Depth** | 32 |
45
+ | **Text Hidden Size** | 2048 |
46
+ | **Attention Heads** | 16 (Q), 2 (KV, GQA) |
47
+ | **Block Diffusion Size** | 32 |
48
+
49
+ **Hardware requirement**: NVIDIA GPU with **SM89+ (Compute Capability ≥ 8.9)** — RTX 4090, L40, H100, H200. FP8 tensor cores are not available on A100 (SM80) or older.
50
+
51
+ ---
52
+
53
+ ## Quickstart (SGLang)
54
+
55
+ Load this checkpoint with the customized SGLang shipped in the [Fast-dLLM repo](https://github.com/NVlabs/Fast-dLLM):
56
+
57
+ ```bash
58
+ # Install the customized SGLang (one-time)
59
+ git clone https://github.com/NVlabs/Fast-dLLM
60
+ cd Fast-dLLM/fast_dvlm/sglang/python
61
+ pip install -e .
62
+
63
+ # Run the chatbot with FP8 quantization
64
+ cd ../..
65
+ python run_chatbot_sglang.py \
66
+ --algorithm spec \
67
+ --model-path Sensen02/Fast_dVLM_3B_W8A8_FP8 \
68
+ --quantization w8a8_fp8 \
69
+ --prompt "Describe this image." \
70
+ --image path/to/image.jpg
71
+ ```
72
+
73
+ SGLang reads the `quantization_config` in `config.json` automatically:
74
+
75
+ ```json
76
+ "quantization_config": {
77
+ "quant_method": "w8a8_fp8",
78
+ "is_dynamic": false,
79
+ "ignore": []
80
+ }
81
+ ```
82
+
83
+ The `ignore` list is empty because every linear layer — including the vision encoder — is FP8 quantized in this release.
84
+
85
+ ---
86
+
87
+ ## Benchmark Results
88
+
89
+ ### Quality (MMMU-Pro-V)
90
+
91
+ | Variant | MMMU-Pro-V |
92
+ |---|---|
93
+ | Qwen2.5-VL-3B (AR baseline) | 26.3 |
94
+ | Fast-dVLM (MDM, τ=0.9) | 21.4 |
95
+ | Fast-dVLM (spec.) — BF16 | 24.1 |
96
+ | **Fast-dVLM (spec.) — W8A8 FP8 (this repo)** | **23.8** |
97
+
98
+ ### Inference Acceleration
99
+
100
+ | Setting | MMMU-Pro-V | TPS | SpeedUp |
101
+ |---|---|---|---|
102
+ | AR baseline | 26.3 | 56.7 | 1.00x |
103
+ | Fast-dVLM (MDM, τ=0.9) | 21.4 | 82.2 | 1.45x |
104
+ | + Spec. decoding (linear) | 24.6 | 112.7 | 1.98x |
105
+ | + SGLang serving | 24.1 | 319.0 | 5.63x |
106
+ | **+ SmoothQuant-W8A8 (FP8)** | **23.8** | **350.3** | **6.18x** |
107
+
108
+ ---
109
+
110
+ ## Citation
111
+
112
+ If you use Fast-dVLM in your research, please cite:
113
+
114
+ ```bibtex
115
+ @misc{wu2026fastdvlmefficientblockdiffusionvlm,
116
+ title={Fast-dVLM: Efficient Block-Diffusion VLM via Direct Conversion from Autoregressive VLM},
117
+ author={Chengyue Wu and Shiyi Lan and Yonggan Fu and Sensen Gao and Jin Wang and Jincheng Yu and Jose M. Alvarez and Pavlo Molchanov and Ping Luo and Song Han and Ligeng Zhu and Enze Xie},
118
+ year={2026},
119
+ eprint={2604.06832},
120
+ archivePrefix={arXiv},
121
+ primaryClass={cs.CL},
122
+ url={https://arxiv.org/abs/2604.06832},
123
+ }
124
+ ```
125
+
126
+ ---
127
+
128
+ ## License
129
+
130
+ Released under **Apache 2.0**, following the base Qwen2.5-VL license.
added_tokens.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</tool_call>": 151658,
3
+ "<tool_call>": 151657,
4
+ "<|box_end|>": 151649,
5
+ "<|box_start|>": 151648,
6
+ "<|endoftext|>": 151643,
7
+ "<|file_sep|>": 151664,
8
+ "<|fim_middle|>": 151660,
9
+ "<|fim_pad|>": 151662,
10
+ "<|fim_prefix|>": 151659,
11
+ "<|fim_suffix|>": 151661,
12
+ "<|im_end|>": 151645,
13
+ "<|im_start|>": 151644,
14
+ "<|image_pad|>": 151655,
15
+ "<|object_ref_end|>": 151647,
16
+ "<|object_ref_start|>": 151646,
17
+ "<|quad_end|>": 151651,
18
+ "<|quad_start|>": 151650,
19
+ "<|repo_name|>": 151663,
20
+ "<|video_pad|>": 151656,
21
+ "<|vision_end|>": 151653,
22
+ "<|vision_pad|>": 151654,
23
+ "<|vision_start|>": 151652,
24
+ "|<MASK>|": 151665
25
+ }
chat_template.jinja ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
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 %}<|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' 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|>
6
+ {% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant
7
+ {% endif %}
config.json ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "always_mask_im_end": true,
3
+ "anneal_block_size": true,
4
+ "architectures": [
5
+ "Fast_dVLMForConditionalGeneration"
6
+ ],
7
+ "attention_dropout": 0.0,
8
+ "auto_map": {
9
+ "AutoConfig": "configuration.Fast_dVLMConfig",
10
+ "AutoModel": "modeling.Fast_dVLMForConditionalGeneration",
11
+ "AutoModelForCausalLM": "modeling.Fast_dVLMForConditionalGeneration"
12
+ },
13
+ "bd_size": 32,
14
+ "block_causal_no_dynamic": false,
15
+ "complementary_mask": true,
16
+ "dtype": "bfloat16",
17
+ "enable_efficient_vision_embed": false,
18
+ "entropy_loss": false,
19
+ "entropy_loss_weight": 1.0,
20
+ "eos_token_id": 151645,
21
+ "flexible_bd_size": false,
22
+ "hidden_act": "silu",
23
+ "hidden_size": 2048,
24
+ "image_token_id": 151655,
25
+ "initializer_range": 0.02,
26
+ "intermediate_size": 11008,
27
+ "max_position_embeddings": 128000,
28
+ "max_window_layers": 70,
29
+ "minimum_noise_level": 0.001,
30
+ "model_type": "fast_dvlm",
31
+ "num_attention_heads": 16,
32
+ "num_hidden_layers": 36,
33
+ "num_key_value_heads": 2,
34
+ "pad_token_id": 151643,
35
+ "rms_norm_eps": 1e-06,
36
+ "rope_scaling": {
37
+ "mrope_section": [
38
+ 16,
39
+ 24,
40
+ 24
41
+ ],
42
+ "rope_type": "default",
43
+ "type": "default"
44
+ },
45
+ "rope_theta": 1000000.0,
46
+ "sliding_window": 32768,
47
+ "text_config": {
48
+ "architectures": [
49
+ "Fast_dVLMForConditionalGeneration"
50
+ ],
51
+ "attention_dropout": 0.0,
52
+ "auto_map": {
53
+ "AutoConfig": "configuration.Fast_dVLMConfig",
54
+ "AutoModel": "modeling.Fast_dVLMForConditionalGeneration",
55
+ "AutoModelForCausalLM": "modeling.Fast_dVLMForConditionalGeneration"
56
+ },
57
+ "bd_size": 8,
58
+ "block_causal_no_dynamic": false,
59
+ "bos_token_id": 151643,
60
+ "complementary_mask": true,
61
+ "dtype": "float32",
62
+ "entropy_loss": false,
63
+ "entropy_loss_weight": 1.0,
64
+ "eos_token_id": 151645,
65
+ "hidden_act": "silu",
66
+ "hidden_size": 2048,
67
+ "image_token_id": null,
68
+ "initializer_range": 0.02,
69
+ "intermediate_size": 11008,
70
+ "layer_types": [
71
+ "full_attention",
72
+ "full_attention",
73
+ "full_attention",
74
+ "full_attention",
75
+ "full_attention",
76
+ "full_attention",
77
+ "full_attention",
78
+ "full_attention",
79
+ "full_attention",
80
+ "full_attention",
81
+ "full_attention",
82
+ "full_attention",
83
+ "full_attention",
84
+ "full_attention",
85
+ "full_attention",
86
+ "full_attention",
87
+ "full_attention",
88
+ "full_attention",
89
+ "full_attention",
90
+ "full_attention",
91
+ "full_attention",
92
+ "full_attention",
93
+ "full_attention",
94
+ "full_attention",
95
+ "full_attention",
96
+ "full_attention",
97
+ "full_attention",
98
+ "full_attention",
99
+ "full_attention",
100
+ "full_attention",
101
+ "full_attention",
102
+ "full_attention",
103
+ "full_attention",
104
+ "full_attention",
105
+ "full_attention",
106
+ "full_attention"
107
+ ],
108
+ "max_position_embeddings": 128000,
109
+ "max_window_layers": 70,
110
+ "minimum_noise_level": 0.001,
111
+ "model_type": "fast_dvlm_for_causal_lm",
112
+ "num_attention_heads": 16,
113
+ "num_hidden_layers": 36,
114
+ "num_key_value_heads": 2,
115
+ "rms_norm_eps": 1e-06,
116
+ "rope_scaling": {
117
+ "mrope_section": [
118
+ 16,
119
+ 24,
120
+ 24
121
+ ],
122
+ "rope_type": "default",
123
+ "type": "default"
124
+ },
125
+ "rope_theta": 1000000.0,
126
+ "sliding_window": null,
127
+ "tie_word_embeddings": true,
128
+ "use_block_causal_mask": false,
129
+ "use_cache": true,
130
+ "use_sliding_window": false,
131
+ "video_token_id": null,
132
+ "vision_end_token_id": 151653,
133
+ "vision_start_token_id": 151652,
134
+ "vision_token_id": 151654,
135
+ "vocab_size": 151936
136
+ },
137
+ "transformers_version": "4.57.1",
138
+ "use_block_causal_mask": true,
139
+ "use_cache": true,
140
+ "use_sliding_window": false,
141
+ "video_token_id": 151656,
142
+ "vision_config": {
143
+ "depth": 32,
144
+ "dtype": "float32",
145
+ "fullatt_block_indexes": [
146
+ 7,
147
+ 15,
148
+ 23,
149
+ 31
150
+ ],
151
+ "hidden_act": "silu",
152
+ "hidden_size": 1280,
153
+ "in_channels": 3,
154
+ "in_chans": 3,
155
+ "initializer_range": 0.02,
156
+ "intermediate_size": 3420,
157
+ "model_type": "fast_dvlm",
158
+ "num_heads": 16,
159
+ "out_hidden_size": 2048,
160
+ "patch_size": 14,
161
+ "spatial_merge_size": 2,
162
+ "spatial_patch_size": 14,
163
+ "temporal_patch_size": 2,
164
+ "tokens_per_second": 2,
165
+ "window_size": 112
166
+ },
167
+ "vision_end_token_id": 151653,
168
+ "vision_start_token_id": 151652,
169
+ "vision_token_id": 151654,
170
+ "vocab_size": 151936,
171
+ "quantization_config": {
172
+ "quant_method": "w8a8_fp8",
173
+ "is_dynamic": false,
174
+ "ignore": []
175
+ }
176
+ }
configuration.py ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # limitations under the License.
3
+ from transformers.configuration_utils import PretrainedConfig, layer_type_validation
4
+ from transformers.modeling_rope_utils import rope_config_validation
5
+
6
+
7
+ class Fast_dVLMVisionConfig(PretrainedConfig):
8
+ model_type = "fast_dvlm"
9
+ base_config_key = "vision_config"
10
+
11
+ def __init__(
12
+ self,
13
+ depth=32,
14
+ hidden_size=3584,
15
+ hidden_act="silu",
16
+ intermediate_size=3420,
17
+ num_heads=16,
18
+ in_channels=3,
19
+ patch_size=14,
20
+ spatial_merge_size=2,
21
+ temporal_patch_size=2,
22
+ tokens_per_second=4,
23
+ window_size=112,
24
+ out_hidden_size=3584,
25
+ fullatt_block_indexes=[7, 15, 23, 31],
26
+ initializer_range=0.02,
27
+ **kwargs,
28
+ ):
29
+ super().__init__(**kwargs)
30
+
31
+ self.depth = depth
32
+ self.hidden_size = hidden_size
33
+ self.hidden_act = hidden_act
34
+ self.intermediate_size = intermediate_size
35
+ self.num_heads = num_heads
36
+ self.in_channels = in_channels
37
+ self.patch_size = patch_size
38
+ self.spatial_merge_size = spatial_merge_size
39
+ self.temporal_patch_size = temporal_patch_size
40
+ self.tokens_per_second = tokens_per_second
41
+ self.window_size = window_size
42
+ self.fullatt_block_indexes = fullatt_block_indexes
43
+ self.out_hidden_size = out_hidden_size
44
+ self.initializer_range = initializer_range
45
+
46
+
47
+ class Fast_dVLMTextConfig(PretrainedConfig):
48
+
49
+ model_type = "fast_dvlm_for_causal_lm"
50
+ base_config_key = "text_config"
51
+ keys_to_ignore_at_inference = ["past_key_values"]
52
+ base_model_tp_plan = {
53
+ "layers.*.self_attn.q_proj": "colwise",
54
+ "layers.*.self_attn.k_proj": "colwise",
55
+ "layers.*.self_attn.v_proj": "colwise",
56
+ "layers.*.self_attn.o_proj": "rowwise",
57
+ "layers.*.mlp.gate_proj": "colwise",
58
+ "layers.*.mlp.up_proj": "colwise",
59
+ "layers.*.mlp.down_proj": "rowwise",
60
+ }
61
+ base_model_pp_plan = {
62
+ "embed_tokens": (["input_ids"], ["inputs_embeds"]),
63
+ "layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
64
+ "norm": (["hidden_states"], ["hidden_states"]),
65
+ }
66
+
67
+ def __init__(
68
+ self,
69
+ vocab_size=152064,
70
+ hidden_size=8192,
71
+ intermediate_size=29568,
72
+ num_hidden_layers=80,
73
+ num_attention_heads=64,
74
+ num_key_value_heads=8,
75
+ hidden_act="silu",
76
+ max_position_embeddings=32768,
77
+ initializer_range=0.02,
78
+ rms_norm_eps=1e-05,
79
+ use_cache=True,
80
+ tie_word_embeddings=False,
81
+ rope_theta=1000000.0,
82
+ use_sliding_window=False,
83
+ sliding_window=4096,
84
+ max_window_layers=80,
85
+ layer_types=None,
86
+ attention_dropout=0.0,
87
+ rope_scaling=None,
88
+ image_token_id=None,
89
+ video_token_id=None,
90
+ bd_size=8,
91
+ self_spec_inference_mode=None,
92
+ block_length=None,
93
+ use_block_causal_mask=False,
94
+ complementary_mask=True,
95
+ minimum_noise_level=1e-3,
96
+ entropy_loss=False,
97
+ entropy_loss_weight=1.0,
98
+ block_causal_no_dynamic=False,
99
+ **kwargs,
100
+ ):
101
+ self.vocab_size = vocab_size
102
+ self.max_position_embeddings = max_position_embeddings
103
+ self.hidden_size = hidden_size
104
+ self.intermediate_size = intermediate_size
105
+ self.num_hidden_layers = num_hidden_layers
106
+ self.num_attention_heads = num_attention_heads
107
+ self.use_sliding_window = use_sliding_window
108
+ self.sliding_window = sliding_window if self.use_sliding_window else None
109
+ self.max_window_layers = max_window_layers
110
+
111
+ # for backward compatibility
112
+ if num_key_value_heads is None:
113
+ num_key_value_heads = num_attention_heads
114
+
115
+ self.num_key_value_heads = num_key_value_heads
116
+ self.hidden_act = hidden_act
117
+ self.initializer_range = initializer_range
118
+ self.rms_norm_eps = rms_norm_eps
119
+ self.use_cache = use_cache
120
+ self.rope_theta = rope_theta
121
+ self.attention_dropout = attention_dropout
122
+ self.rope_scaling = rope_scaling
123
+ self.bd_size = bd_size
124
+ self.layer_types = layer_types
125
+ self.use_block_causal_mask = use_block_causal_mask
126
+ self.complementary_mask = complementary_mask
127
+ self.minimum_noise_level = minimum_noise_level
128
+ self.entropy_loss = entropy_loss
129
+ self.entropy_loss_weight = entropy_loss_weight
130
+ self.block_causal_no_dynamic = block_causal_no_dynamic
131
+ self.self_spec_inference_mode = self_spec_inference_mode
132
+ self.block_length = block_length
133
+ if self.layer_types is None:
134
+ self.layer_types = [
135
+ "sliding_attention"
136
+ if self.sliding_window is not None and i >= self.max_window_layers
137
+ else "full_attention"
138
+ for i in range(self.num_hidden_layers)
139
+ ]
140
+ layer_type_validation(self.layer_types)
141
+
142
+ # Validate the correctness of rotary position embeddings parameters
143
+ # BC: if there is a 'type' field, move it to 'rope_type'.
144
+ # and change type from 'mrope' to 'default' because `mrope` does default RoPE calculations
145
+ # one can set it to "linear"/"dynamic" etc. to have scaled RoPE
146
+ # TODO: @raushan update config in the hub
147
+ if self.rope_scaling is not None and "type" in self.rope_scaling:
148
+ if self.rope_scaling["type"] == "mrope":
149
+ self.rope_scaling["type"] = "default"
150
+ self.rope_scaling["rope_type"] = self.rope_scaling["type"]
151
+ rope_config_validation(self, ignore_keys={"mrope_section"})
152
+ self.image_token_id = image_token_id
153
+ self.video_token_id = video_token_id
154
+ super().__init__(tie_word_embeddings=tie_word_embeddings, **kwargs)
155
+
156
+
157
+ class Fast_dVLMConfig(PretrainedConfig):
158
+
159
+ model_type = "fast_dvlm"
160
+ sub_configs = {"vision_config": Fast_dVLMVisionConfig, "text_config": Fast_dVLMTextConfig}
161
+ keys_to_ignore_at_inference = ["past_key_values"]
162
+
163
+ def __init__(
164
+ self,
165
+ text_config=None,
166
+ vision_config=None,
167
+ image_token_id=151655,
168
+ video_token_id=151656,
169
+ enable_efficient_vision_embed=False,
170
+ **kwargs,
171
+ ):
172
+ if isinstance(vision_config, dict):
173
+ self.vision_config = self.sub_configs["vision_config"](**vision_config)
174
+ elif vision_config is None:
175
+ self.vision_config = self.sub_configs["vision_config"]()
176
+
177
+ if isinstance(text_config, dict):
178
+ self.text_config = self.sub_configs["text_config"](**text_config)
179
+ elif text_config is None:
180
+ # For BC use all kwargs to init `TextConfig`
181
+ self.text_config = self.sub_configs["text_config"](**kwargs)
182
+
183
+ self.image_token_id = image_token_id
184
+ self.video_token_id = video_token_id
185
+ self.enable_efficient_vision_embed = enable_efficient_vision_embed
186
+
187
+ super().__init__(**kwargs)
188
+
189
+
190
+ __all__ = ["Fast_dVLMConfig", "Fast_dVLMTextConfig"]
generation_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_sample": true,
3
+ "eos_token_id": [
4
+ 151645,
5
+ 151643
6
+ ],
7
+ "pad_token_id": 151643,
8
+ "repetition_penalty": 1.05,
9
+ "temperature": 1e-06,
10
+ "transformers_version": "4.57.1"
11
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model-00001-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f5b214663a8acabe37b0087f5bdd8968a4b2d9e53ea585d2e8c23efcd282e23
3
+ size 2816274784
model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ce63fa22bac05f0e81e9a008154deb2371f586aa71b7e162485f7885fa8b095
3
+ size 1880108072
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
modeling.py ADDED
The diff for this file is too large to render. See raw diff
 
preprocessor_config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "min_pixels": 3136,
3
+ "max_pixels": 12845056,
4
+ "patch_size": 14,
5
+ "temporal_patch_size": 2,
6
+ "merge_size": 2,
7
+ "image_mean": [
8
+ 0.48145466,
9
+ 0.4578275,
10
+ 0.40821073
11
+ ],
12
+ "image_std": [
13
+ 0.26862954,
14
+ 0.26130258,
15
+ 0.27577711
16
+ ],
17
+ "image_processor_type": "Qwen2VLImageProcessor",
18
+ "processor_class": "Qwen2_5_VLProcessor"
19
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ {
4
+ "content": "|<MASK>|",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false
9
+ }
10
+ ],
11
+ "eos_token": {
12
+ "content": "<|im_end|>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false
17
+ },
18
+ "pad_token": {
19
+ "content": "<|endoftext|>",
20
+ "lstrip": false,
21
+ "normalized": false,
22
+ "rstrip": false,
23
+ "single_word": false
24
+ }
25
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cb2105b66192c5a532e2a098dc899df86eca233b4faa48461211e4312c8b3568
3
+ size 11422081
tokenizer_config.json ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": "|<MASK>|",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": true
188
+ }
189
+ },
190
+ "additional_special_tokens": [
191
+ "|<MASK>|"
192
+ ],
193
+ "bos_token": null,
194
+ "clean_up_tokenization_spaces": false,
195
+ "eos_token": "<|im_end|>",
196
+ "errors": "replace",
197
+ "extra_special_tokens": {},
198
+ "model_max_length": 131072,
199
+ "pad_token": "<|endoftext|>",
200
+ "padding_side": "right",
201
+ "split_special_tokens": false,
202
+ "tokenizer_class": "Qwen2Tokenizer",
203
+ "unk_token": null
204
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff