pcuenq HF staff commited on
Commit
aac571c
·
verified ·
1 Parent(s): 3771818

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +29 -0
  2. config.json +23 -212
  3. special_tokens_map.json +7 -21
  4. tokenizer_config.json +11 -2
README.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: apache-2.0
4
+ datasets:
5
+ - HuggingFaceM4/the_cauldron
6
+ - HuggingFaceM4/Docmatix
7
+ pipeline_tag: video-text-to-text
8
+ language:
9
+ - en
10
+ base_model:
11
+ - HuggingFaceTB/SmolLM2-360M-Instruct
12
+ - google/siglip-base-patch16-512
13
+ - HuggingFaceTB/SmolVLM-500M-Instruct
14
+ tags:
15
+ - mlx
16
+ ---
17
+
18
+ # HuggingFaceTB/SmolVLM2-500M-Video-Instruct-mlx
19
+ This model was converted to MLX format from [`HuggingFaceTB/SmolVLM2-500M-Video-Instruct`]() using mlx-vlm version **0.1.13**.
20
+ Refer to the [original model card](https://huggingface.co/HuggingFaceTB/SmolVLM2-500M-Video-Instruct) for more details on the model.
21
+ ## Use with mlx
22
+
23
+ ```bash
24
+ pip install -U mlx-vlm
25
+ ```
26
+
27
+ ```bash
28
+ python -m mlx_vlm.generate --model HuggingFaceTB/SmolVLM2-500M-Video-Instruct-mlx --max-tokens 100 --temp 0.0 --prompt "Describe this image." --image <path_to_image>
29
+ ```
config.json CHANGED
@@ -1,145 +1,27 @@
1
  {
2
- "_attn_implementation_autoset": false,
3
- "add_cross_attention": false,
4
  "architectures": [
5
  "SmolVLMForConditionalGeneration"
6
  ],
7
- "bad_words_ids": null,
8
- "begin_suppress_tokens": null,
9
- "bos_token_id": null,
10
- "chunk_size_feed_forward": 0,
11
- "cross_attention_hidden_size": null,
12
- "decoder_start_token_id": null,
13
- "diversity_penalty": 0.0,
14
- "do_sample": false,
15
- "early_stopping": false,
16
- "encoder_no_repeat_ngram_size": 0,
17
- "eos_token_id": null,
18
- "exponential_decay_length_penalty": null,
19
- "finetuning_task": null,
20
- "forced_bos_token_id": null,
21
- "forced_eos_token_id": null,
22
- "id2label": {
23
- "0": "LABEL_0",
24
- "1": "LABEL_1"
25
- },
26
  "image_token_id": 49190,
27
- "is_decoder": false,
28
- "is_encoder_decoder": false,
29
- "label2id": {
30
- "LABEL_0": 0,
31
- "LABEL_1": 1
32
- },
33
- "length_penalty": 1.0,
34
- "max_length": 20,
35
- "min_length": 0,
36
- "model_type": "idefics3",
37
- "no_repeat_ngram_size": 0,
38
- "num_beam_groups": 1,
39
- "num_beams": 1,
40
- "num_return_sequences": 1,
41
- "output_attentions": false,
42
- "output_hidden_states": false,
43
- "output_scores": false,
44
  "pad_token_id": 128002,
45
- "prefix": null,
46
- "problem_type": null,
47
- "pruned_heads": {},
48
- "remove_invalid_values": false,
49
- "repetition_penalty": 1.0,
50
- "return_dict": true,
51
- "return_dict_in_generate": false,
52
  "scale_factor": 4,
53
- "sep_token_id": null,
54
- "suppress_tokens": null,
55
- "task_specific_params": null,
56
- "temperature": 1.0,
57
  "text_config": {
58
- "vocab_size": 49280,
59
- "max_position_embeddings": 8192,
60
- "hidden_size": 960,
61
- "intermediate_size": 2560,
62
- "num_hidden_layers": 32,
63
- "num_attention_heads": 15,
64
- "num_key_value_heads": 5,
65
- "hidden_act": "silu",
66
- "initializer_range": 0.02,
67
- "rms_norm_eps": 1e-05,
68
- "pretraining_tp": 1,
69
- "use_cache": true,
70
- "rope_theta": 100000,
71
- "rope_scaling": null,
72
- "attention_bias": false,
73
- "attention_dropout": 0.0,
74
- "mlp_bias": false,
75
- "head_dim": 64,
76
- "return_dict": true,
77
- "output_hidden_states": false,
78
- "output_attentions": false,
79
- "torchscript": false,
80
- "torch_dtype": "bfloat16",
81
- "use_bfloat16": false,
82
- "tf_legacy_loss": false,
83
- "pruned_heads": {},
84
- "tie_word_embeddings": false,
85
- "chunk_size_feed_forward": 0,
86
- "is_encoder_decoder": false,
87
- "is_decoder": false,
88
- "cross_attention_hidden_size": null,
89
- "add_cross_attention": false,
90
- "tie_encoder_decoder": false,
91
- "max_length": 20,
92
- "min_length": 0,
93
- "do_sample": false,
94
- "early_stopping": false,
95
- "num_beams": 1,
96
- "num_beam_groups": 1,
97
- "diversity_penalty": 0.0,
98
- "temperature": 1.0,
99
- "top_k": 50,
100
- "top_p": 1.0,
101
- "typical_p": 1.0,
102
- "repetition_penalty": 1.0,
103
- "length_penalty": 1.0,
104
- "no_repeat_ngram_size": 0,
105
- "encoder_no_repeat_ngram_size": 0,
106
- "bad_words_ids": null,
107
- "num_return_sequences": 1,
108
- "output_scores": false,
109
- "return_dict_in_generate": false,
110
- "forced_bos_token_id": null,
111
- "forced_eos_token_id": null,
112
- "remove_invalid_values": false,
113
- "exponential_decay_length_penalty": null,
114
- "suppress_tokens": null,
115
- "begin_suppress_tokens": null,
116
  "architectures": [
117
  "VLlama3ForCausalLM"
118
  ],
119
- "finetuning_task": null,
120
- "id2label": {
121
- "0": "LABEL_0",
122
- "1": "LABEL_1"
123
- },
124
- "label2id": {
125
- "LABEL_0": 0,
126
- "LABEL_1": 1
127
- },
128
- "tokenizer_class": null,
129
- "prefix": null,
130
- "bos_token_id": 1,
131
- "pad_token_id": 2,
132
- "eos_token_id": 2,
133
- "sep_token_id": null,
134
- "decoder_start_token_id": null,
135
- "task_specific_params": null,
136
- "problem_type": null,
137
- "_name_or_path": "None",
138
- "_attn_implementation_autoset": false,
139
- "_flash_attn_2_enabled": true,
140
  "is_llama_config": true,
 
141
  "model_type": "llama",
142
  "neftune_noise_alpha": 0.0,
 
 
 
143
  "perceiver_config": {
144
  "_attn_implementation_autoset": false,
145
  "_name_or_path": "",
@@ -215,115 +97,44 @@
215
  },
216
  "pixel_shuffle_factor": 4,
217
  "qk_layer_norms": false,
 
218
  "rope_interleaved": false,
 
 
219
  "transformers.js_config": {
220
  "kv_cache_dtype": {
221
  "fp16": "float16",
222
  "q4f16": "float16"
223
  }
224
  },
225
- "use_resampler": false
 
226
  },
227
- "tf_legacy_loss": false,
228
- "tie_encoder_decoder": false,
229
  "tie_word_embeddings": false,
230
- "tokenizer_class": null,
231
- "top_k": 50,
232
- "top_p": 1.0,
233
  "torch_dtype": "float32",
234
- "torchscript": false,
235
  "transformers.js_config": {
236
  "kv_cache_dtype": {
237
  "fp16": "float16",
238
  "q4f16": "float16"
239
  }
240
  },
241
- "transformers_version": "4.49.0.dev0",
242
- "typical_p": 1.0,
243
- "use_bfloat16": false,
244
  "use_cache": false,
245
  "use_reentrant_checkpointing": false,
246
  "vision_config": {
247
- "return_dict": true,
248
- "output_hidden_states": false,
249
- "output_attentions": false,
250
- "torchscript": false,
251
- "torch_dtype": null,
252
- "use_bfloat16": false,
253
- "tf_legacy_loss": false,
254
- "pruned_heads": {},
255
- "tie_word_embeddings": false,
256
- "chunk_size_feed_forward": 0,
257
- "is_encoder_decoder": false,
258
- "is_decoder": false,
259
- "cross_attention_hidden_size": null,
260
- "add_cross_attention": false,
261
- "tie_encoder_decoder": false,
262
- "max_length": 20,
263
- "min_length": 0,
264
- "do_sample": false,
265
- "early_stopping": false,
266
- "num_beams": 1,
267
- "num_beam_groups": 1,
268
- "diversity_penalty": 0.0,
269
- "temperature": 1.0,
270
- "top_k": 50,
271
- "top_p": 1.0,
272
- "typical_p": 1.0,
273
- "repetition_penalty": 1.0,
274
- "length_penalty": 1.0,
275
- "no_repeat_ngram_size": 0,
276
- "encoder_no_repeat_ngram_size": 0,
277
- "bad_words_ids": null,
278
- "num_return_sequences": 1,
279
- "output_scores": false,
280
- "return_dict_in_generate": false,
281
- "forced_bos_token_id": null,
282
- "forced_eos_token_id": null,
283
- "remove_invalid_values": false,
284
- "exponential_decay_length_penalty": null,
285
- "suppress_tokens": null,
286
- "begin_suppress_tokens": null,
287
- "architectures": null,
288
- "finetuning_task": null,
289
- "id2label": {
290
- "0": "LABEL_0",
291
- "1": "LABEL_1"
292
- },
293
- "label2id": {
294
- "LABEL_0": 0,
295
- "LABEL_1": 1
296
- },
297
- "tokenizer_class": null,
298
- "prefix": null,
299
- "bos_token_id": null,
300
- "pad_token_id": null,
301
- "eos_token_id": null,
302
- "sep_token_id": null,
303
- "decoder_start_token_id": null,
304
- "task_specific_params": null,
305
- "problem_type": null,
306
- "_name_or_path": "",
307
- "_attn_implementation_autoset": false,
308
  "max_image_size": {
309
  "longest_edge": 512
310
  },
311
- "model_type": "idefics3_vision",
 
 
312
  "size": {
313
  "longest_edge": 2048
314
  },
315
- "use_base_siglip": false,
316
- "hidden_size": 768,
317
- "intermediate_size": 3072,
318
- "num_hidden_layers": 12,
319
- "num_attention_heads": 12,
320
- "num_channels": 3,
321
- "patch_size": 16,
322
- "image_size": 512,
323
- "attention_dropout": 0.0,
324
- "layer_norm_eps": 1e-06,
325
- "hidden_act": "gelu_pytorch_tanh",
326
- "initializer_range": 0.02
327
  },
328
  "vocab_size": 49280
329
  }
 
1
  {
 
 
2
  "architectures": [
3
  "SmolVLMForConditionalGeneration"
4
  ],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  "image_token_id": 49190,
6
+ "model_type": "smolvlm",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  "pad_token_id": 128002,
 
 
 
 
 
 
 
8
  "scale_factor": 4,
 
 
 
 
9
  "text_config": {
10
+ "_flash_attn_2_enabled": true,
11
+ "_name_or_path": "None",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  "architectures": [
13
  "VLlama3ForCausalLM"
14
  ],
15
+ "head_dim": 64,
16
+ "hidden_size": 960,
17
+ "intermediate_size": 2560,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  "is_llama_config": true,
19
+ "max_position_embeddings": 8192,
20
  "model_type": "llama",
21
  "neftune_noise_alpha": 0.0,
22
+ "num_attention_heads": 15,
23
+ "num_key_value_heads": 5,
24
+ "pad_token_id": 2,
25
  "perceiver_config": {
26
  "_attn_implementation_autoset": false,
27
  "_name_or_path": "",
 
97
  },
98
  "pixel_shuffle_factor": 4,
99
  "qk_layer_norms": false,
100
+ "rms_norm_eps": 1e-05,
101
  "rope_interleaved": false,
102
+ "rope_theta": 100000,
103
+ "torch_dtype": "bfloat16",
104
  "transformers.js_config": {
105
  "kv_cache_dtype": {
106
  "fp16": "float16",
107
  "q4f16": "float16"
108
  }
109
  },
110
+ "use_resampler": false,
111
+ "vocab_size": 49280
112
  },
 
 
113
  "tie_word_embeddings": false,
 
 
 
114
  "torch_dtype": "float32",
 
115
  "transformers.js_config": {
116
  "kv_cache_dtype": {
117
  "fp16": "float16",
118
  "q4f16": "float16"
119
  }
120
  },
121
+ "transformers_version": "4.47.1",
 
 
122
  "use_cache": false,
123
  "use_reentrant_checkpointing": false,
124
  "vision_config": {
125
+ "hidden_size": 768,
126
+ "image_size": 512,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  "max_image_size": {
128
  "longest_edge": 512
129
  },
130
+ "model_type": "smolvlm_vision",
131
+ "num_attention_heads": 12,
132
+ "patch_size": 16,
133
  "size": {
134
  "longest_edge": 2048
135
  },
136
+ "tie_word_embeddings": false,
137
+ "use_base_siglip": false
 
 
 
 
 
 
 
 
 
 
138
  },
139
  "vocab_size": 49280
140
  }
special_tokens_map.json CHANGED
@@ -1,26 +1,8 @@
1
  {
2
  "additional_special_tokens": [
3
- {
4
- "content": "<fake_token_around_image>",
5
- "lstrip": false,
6
- "normalized": false,
7
- "rstrip": false,
8
- "single_word": false
9
- },
10
- {
11
- "content": "<image>",
12
- "lstrip": false,
13
- "normalized": false,
14
- "rstrip": false,
15
- "single_word": false
16
- },
17
- {
18
- "content": "<end_of_utterance>",
19
- "lstrip": false,
20
- "normalized": false,
21
- "rstrip": false,
22
- "single_word": false
23
- }
24
  ],
25
  "bos_token": {
26
  "content": "<|im_start|>",
@@ -29,6 +11,7 @@
29
  "rstrip": false,
30
  "single_word": false
31
  },
 
32
  "eos_token": {
33
  "content": "<end_of_utterance>",
34
  "lstrip": false,
@@ -36,6 +19,9 @@
36
  "rstrip": false,
37
  "single_word": false
38
  },
 
 
 
39
  "pad_token": {
40
  "content": "<|im_end|>",
41
  "lstrip": false,
 
1
  {
2
  "additional_special_tokens": [
3
+ "<fake_token_around_image>",
4
+ "<image>",
5
+ "<end_of_utterance>"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  ],
7
  "bos_token": {
8
  "content": "<|im_start|>",
 
11
  "rstrip": false,
12
  "single_word": false
13
  },
14
+ "end_of_utterance_token": "<end_of_utterance>",
15
  "eos_token": {
16
  "content": "<end_of_utterance>",
17
  "lstrip": false,
 
19
  "rstrip": false,
20
  "single_word": false
21
  },
22
+ "fake_image_token": "<fake_token_around_image>",
23
+ "global_image_token": "<global-img>",
24
+ "image_token": "<image>",
25
  "pad_token": {
26
  "content": "<|im_end|>",
27
  "lstrip": false,
tokenizer_config.json CHANGED
@@ -1170,12 +1170,21 @@
1170
  "bos_token": "<|im_start|>",
1171
  "chat_template": "<|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>\n{% endfor %}{% if add_generation_prompt %}{{ 'Assistant:' }}{% endif %}",
1172
  "clean_up_tokenization_spaces": false,
 
1173
  "eos_token": "<end_of_utterance>",
1174
- "extra_special_tokens": {},
 
 
 
 
 
 
 
 
1175
  "legacy": false,
1176
  "model_max_length": 8192,
1177
  "pad_token": "<|im_end|>",
1178
- "processor_class": "Idefics3Processor",
1179
  "tokenizer_class": "GPT2Tokenizer",
1180
  "truncation_side": "left",
1181
  "unk_token": "<|endoftext|>",
 
1170
  "bos_token": "<|im_start|>",
1171
  "chat_template": "<|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>\n{% endfor %}{% if add_generation_prompt %}{{ 'Assistant:' }}{% endif %}",
1172
  "clean_up_tokenization_spaces": false,
1173
+ "end_of_utterance_token": "<end_of_utterance>",
1174
  "eos_token": "<end_of_utterance>",
1175
+ "extra_special_tokens": {
1176
+ "end_of_utterance_token": "<end_of_utterance>",
1177
+ "fake_image_token": "<fake_token_around_image>",
1178
+ "global_image_token": "<global-img>",
1179
+ "image_token": "<image>"
1180
+ },
1181
+ "fake_image_token": "<fake_token_around_image>",
1182
+ "global_image_token": "<global-img>",
1183
+ "image_token": "<image>",
1184
  "legacy": false,
1185
  "model_max_length": 8192,
1186
  "pad_token": "<|im_end|>",
1187
+ "processor_class": "SmolVLMProcessor",
1188
  "tokenizer_class": "GPT2Tokenizer",
1189
  "truncation_side": "left",
1190
  "unk_token": "<|endoftext|>",