shubhrapandit commited on
Commit
d6431c3
·
1 Parent(s): bdb28ef

Update files to add image token and update chat template

Browse files
added_tokens.json CHANGED
@@ -12,6 +12,7 @@
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,
 
12
  "<|im_end|>": 151645,
13
  "<|im_start|>": 151644,
14
  "<|image_pad|>": 151655,
15
+ "<|image|>": 151665,
16
  "<|object_ref_end|>": 151647,
17
  "<|object_ref_start|>": 151646,
18
  "<|quad_end|>": 151651,
chat_template.json CHANGED
@@ -1,3 +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
  }
 
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 %}<|image|>{% 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 CHANGED
@@ -8,7 +8,8 @@
8
  "eos_token_id": 151645,
9
  "hidden_act": "silu",
10
  "hidden_size": 2048,
11
- "image_token_id": 151655,
 
12
  "initializer_range": 0.02,
13
  "intermediate_size": 11008,
14
  "max_position_embeddings": 128000,
 
8
  "eos_token_id": 151645,
9
  "hidden_act": "silu",
10
  "hidden_size": 2048,
11
+ "image_token_id": 151665,
12
+ "image_placeholder": "<|image|>",
13
  "initializer_range": 0.02,
14
  "intermediate_size": 11008,
15
  "max_position_embeddings": 128000,
special_tokens_map.json CHANGED
@@ -12,7 +12,8 @@
12
  "<|vision_end|>",
13
  "<|vision_pad|>",
14
  "<|image_pad|>",
15
- "<|video_pad|>"
 
16
  ],
17
  "eos_token": {
18
  "content": "<|im_end|>",
 
12
  "<|vision_end|>",
13
  "<|vision_pad|>",
14
  "<|image_pad|>",
15
+ "<|video_pad|>",
16
+ "<|image|>"
17
  ],
18
  "eos_token": {
19
  "content": "<|im_end|>",
tokenizer.json CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:913950e4971737031da511cdd1b410daae4566f62eb845b3975bca5a102323d8
3
- size 11421995
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d439b26a73396e5655f4aab02cff9b00f59ad6102f9915263d074065762204c9
3
+ size 11422181
tokenizer_config.json CHANGED
@@ -177,6 +177,14 @@
177
  "rstrip": false,
178
  "single_word": false,
179
  "special": false
 
 
 
 
 
 
 
 
180
  }
181
  },
182
  "additional_special_tokens": [
@@ -192,17 +200,22 @@
192
  "<|vision_end|>",
193
  "<|vision_pad|>",
194
  "<|image_pad|>",
195
- "<|video_pad|>"
 
196
  ],
197
  "bos_token": null,
198
- "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 %}",
199
  "clean_up_tokenization_spaces": false,
200
  "eos_token": "<|im_end|>",
201
  "errors": "replace",
202
  "extra_special_tokens": {},
 
203
  "model_max_length": 131072,
204
  "pad_token": "<|endoftext|>",
205
  "split_special_tokens": false,
 
206
  "tokenizer_class": "Qwen2Tokenizer",
 
 
207
  "unk_token": null
208
  }
 
177
  "rstrip": false,
178
  "single_word": false,
179
  "special": false
180
+ },
181
+ "151665": {
182
+ "content": "<|image|>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": true
188
  }
189
  },
190
  "additional_special_tokens": [
 
200
  "<|vision_end|>",
201
  "<|vision_pad|>",
202
  "<|image_pad|>",
203
+ "<|video_pad|>",
204
+ "<|image|>"
205
  ],
206
  "bos_token": null,
207
+ "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 %}<|image|>{% 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 %}",
208
  "clean_up_tokenization_spaces": false,
209
  "eos_token": "<|im_end|>",
210
  "errors": "replace",
211
  "extra_special_tokens": {},
212
+ "max_length": 2048,
213
  "model_max_length": 131072,
214
  "pad_token": "<|endoftext|>",
215
  "split_special_tokens": false,
216
+ "stride": 0,
217
  "tokenizer_class": "Qwen2Tokenizer",
218
+ "truncation_side": "right",
219
+ "truncation_strategy": "longest_first",
220
  "unk_token": null
221
  }