Azaz666 commited on
Commit
113fe69
·
verified ·
1 Parent(s): b9cd234

INT4 quantization of HuggingFaceTB/SmolVLM-Instruct (LLM backbone quantized, vision encoder fp16)

Browse files
chat_template.jinja ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ <|im_start|>{% for message in messages %}{{message['role'] | capitalize}}{% if message['content'][0]['type'] == 'image' %}{{':'}}{% else %}{{': '}}{% endif %}{% for line in message['content'] %}{% if line['type'] == 'text' %}{{line['text']}}{% elif line['type'] == 'image' %}{{ '<image>' }}{% endif %}{% endfor %}<end_of_utterance>
2
+ {% endfor %}{% if add_generation_prompt %}{{ 'Assistant:' }}{% endif %}
config.json ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Idefics3ForConditionalGeneration"
4
+ ],
5
+ "dtype": "float16",
6
+ "image_seq_len": 81,
7
+ "image_token_id": 49153,
8
+ "model_type": "idefics3",
9
+ "scale_factor": 3,
10
+ "text_config": {
11
+ "_attn_implementation_autoset": false,
12
+ "_flash_attn_2_enabled": true,
13
+ "_name_or_path": "/fsx/m4/experiments/local_experiment_dir/s3_async_temporary_checkpoint_folder/tr_324_opt_400/unwrapped_model",
14
+ "add_cross_attention": false,
15
+ "architectures": [
16
+ "VLlama3ForCausalLM"
17
+ ],
18
+ "attention_bias": false,
19
+ "attention_dropout": 0.0,
20
+ "bos_token_id": 0,
21
+ "cross_attention_hidden_size": null,
22
+ "decoder_start_token_id": null,
23
+ "dtype": "float16",
24
+ "eos_token_id": 0,
25
+ "finetuning_task": null,
26
+ "head_dim": 64,
27
+ "hidden_act": "silu",
28
+ "hidden_size": 2048,
29
+ "initializer_range": 0.02,
30
+ "intermediate_size": 8192,
31
+ "is_decoder": false,
32
+ "max_position_embeddings": 16384,
33
+ "mlp_bias": false,
34
+ "model_type": "llama",
35
+ "neftune_noise_alpha": 0.0,
36
+ "num_attention_heads": 32,
37
+ "num_hidden_layers": 24,
38
+ "num_key_value_heads": 32,
39
+ "pad_token_id": 2,
40
+ "perceiver_config": {
41
+ "_attn_implementation_autoset": false,
42
+ "_name_or_path": "",
43
+ "add_cross_attention": false,
44
+ "architectures": null,
45
+ "attention_dropout": 0.0,
46
+ "bad_words_ids": null,
47
+ "begin_suppress_tokens": null,
48
+ "bos_token_id": null,
49
+ "chunk_size_feed_forward": 0,
50
+ "cross_attention_hidden_size": null,
51
+ "decoder_start_token_id": null,
52
+ "diversity_penalty": 0.0,
53
+ "do_sample": false,
54
+ "early_stopping": false,
55
+ "encoder_no_repeat_ngram_size": 0,
56
+ "eos_token_id": null,
57
+ "exponential_decay_length_penalty": null,
58
+ "finetuning_task": null,
59
+ "forced_bos_token_id": null,
60
+ "forced_eos_token_id": null,
61
+ "hidden_act": "silu",
62
+ "id2label": {
63
+ "0": "LABEL_0",
64
+ "1": "LABEL_1"
65
+ },
66
+ "is_decoder": false,
67
+ "is_encoder_decoder": false,
68
+ "label2id": {
69
+ "LABEL_0": 0,
70
+ "LABEL_1": 1
71
+ },
72
+ "length_penalty": 1.0,
73
+ "max_length": 20,
74
+ "min_length": 0,
75
+ "model_type": "vllama3",
76
+ "no_repeat_ngram_size": 0,
77
+ "num_beam_groups": 1,
78
+ "num_beams": 1,
79
+ "num_key_value_heads": 1,
80
+ "num_return_sequences": 1,
81
+ "output_attentions": false,
82
+ "output_hidden_states": false,
83
+ "output_scores": false,
84
+ "pad_token_id": null,
85
+ "prefix": null,
86
+ "problem_type": null,
87
+ "pruned_heads": {},
88
+ "qk_layer_norms_perceiver": false,
89
+ "remove_invalid_values": false,
90
+ "repetition_penalty": 1.0,
91
+ "resampler_depth": 6,
92
+ "resampler_head_dim": 96,
93
+ "resampler_n_heads": 16,
94
+ "resampler_n_latents": 64,
95
+ "return_dict": true,
96
+ "return_dict_in_generate": false,
97
+ "sep_token_id": null,
98
+ "suppress_tokens": null,
99
+ "task_specific_params": null,
100
+ "temperature": 1.0,
101
+ "tf_legacy_loss": false,
102
+ "tie_encoder_decoder": false,
103
+ "tie_word_embeddings": true,
104
+ "tokenizer_class": null,
105
+ "top_k": 50,
106
+ "top_p": 1.0,
107
+ "torch_dtype": null,
108
+ "torchscript": false,
109
+ "transformers_version": "4.46.0",
110
+ "typical_p": 1.0,
111
+ "use_bfloat16": false
112
+ },
113
+ "prefix": null,
114
+ "pretraining_tp": 1,
115
+ "pruned_heads": {},
116
+ "qk_layer_norms": false,
117
+ "rms_norm_eps": 1e-05,
118
+ "rope_parameters": {
119
+ "rope_theta": 273768.0,
120
+ "rope_type": "default"
121
+ },
122
+ "sep_token_id": null,
123
+ "task_specific_params": null,
124
+ "tf_legacy_loss": false,
125
+ "tie_encoder_decoder": false,
126
+ "tie_word_embeddings": false,
127
+ "tokenizer_class": null,
128
+ "torchscript": false,
129
+ "use_bfloat16": false,
130
+ "use_cache": true,
131
+ "use_resampler": false,
132
+ "vocab_size": 49155
133
+ },
134
+ "tie_word_embeddings": false,
135
+ "transformers.js_config": {
136
+ "dtype": {
137
+ "decoder_model_merged": "q4",
138
+ "embed_tokens": "auto",
139
+ "vision_encoder": "auto"
140
+ },
141
+ "kv_cache_dtype": {
142
+ "fp16": "float16",
143
+ "q4f16": "float16"
144
+ },
145
+ "use_external_data_format": {
146
+ "decoder_model_merged.onnx": true,
147
+ "decoder_model_merged_fp16.onnx": true
148
+ }
149
+ },
150
+ "transformers_version": "5.3.0",
151
+ "use_cache": true,
152
+ "vision_config": {
153
+ "_attn_implementation_autoset": false,
154
+ "add_cross_attention": false,
155
+ "attention_dropout": 0.0,
156
+ "bos_token_id": null,
157
+ "cross_attention_hidden_size": null,
158
+ "decoder_start_token_id": null,
159
+ "dtype": "float16",
160
+ "eos_token_id": null,
161
+ "finetuning_task": null,
162
+ "hidden_act": "gelu_pytorch_tanh",
163
+ "hidden_size": 1152,
164
+ "image_size": 384,
165
+ "initializer_range": 0.02,
166
+ "intermediate_size": 4304,
167
+ "is_decoder": false,
168
+ "layer_norm_eps": 1e-06,
169
+ "max_image_size": {
170
+ "longest_edge": 384
171
+ },
172
+ "model_type": "idefics3_vision",
173
+ "num_attention_heads": 16,
174
+ "num_channels": 3,
175
+ "num_hidden_layers": 27,
176
+ "pad_token_id": null,
177
+ "patch_size": 14,
178
+ "prefix": null,
179
+ "pruned_heads": {},
180
+ "sep_token_id": null,
181
+ "size": {
182
+ "longest_edge": 1920
183
+ },
184
+ "task_specific_params": null,
185
+ "tf_legacy_loss": false,
186
+ "tie_encoder_decoder": false,
187
+ "tie_word_embeddings": false,
188
+ "tokenizer_class": null,
189
+ "torchscript": false,
190
+ "use_bfloat16": false
191
+ },
192
+ "vocab_size": 49155
193
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "eos_token_id": 49154,
5
+ "pad_token_id": 2,
6
+ "transformers_version": "5.3.0"
7
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2daaf4a4dc7b62d137f094d9c8ad180b2a7a4c9686dcbc1e98336e2cdc01ad71
3
+ size 4492630256
processor_config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "do_convert_rgb": true,
4
+ "do_image_splitting": true,
5
+ "do_normalize": true,
6
+ "do_pad": true,
7
+ "do_rescale": true,
8
+ "do_resize": true,
9
+ "image_mean": [
10
+ 0.5,
11
+ 0.5,
12
+ 0.5
13
+ ],
14
+ "image_processor_type": "Idefics3ImageProcessor",
15
+ "image_std": [
16
+ 0.5,
17
+ 0.5,
18
+ 0.5
19
+ ],
20
+ "max_image_size": {
21
+ "longest_edge": 384
22
+ },
23
+ "resample": 1,
24
+ "rescale_factor": 0.00392156862745098,
25
+ "size": {
26
+ "longest_edge": 1536
27
+ }
28
+ },
29
+ "image_seq_len": 81,
30
+ "processor_class": "Idefics3Processor"
31
+ }
quantization_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "base_model": "HuggingFaceTB/SmolVLM-Instruct",
3
+ "quantization": "int4_per_group_symmetric",
4
+ "group_size": 128,
5
+ "bits": 4,
6
+ "method": "static_int4_dequantized",
7
+ "description": "INT4 per-group symmetric quantization of LLM backbone weights. Vision encoder kept in fp16. Weights stored as dequantized fp16 for maximum compatibility.",
8
+ "quantized_layers": 170,
9
+ "skipped_vision_layers": 162
10
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|im_start|>",
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<end_of_utterance>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<fake_token_around_image>",
10
+ "<image>",
11
+ "<end_of_utterance>"
12
+ ],
13
+ "is_local": false,
14
+ "legacy": false,
15
+ "model_max_length": 16384,
16
+ "pad_token": "<|im_end|>",
17
+ "processor_class": "Idefics3Processor",
18
+ "tokenizer_class": "GPT2Tokenizer",
19
+ "truncation_side": "left",
20
+ "unk_token": "<|endoftext|>",
21
+ "vocab_size": 49152
22
+ }