update model weights
Browse files- .gitattributes +1 -0
- README.md +160 -0
- adapter_config.json +43 -0
- adapter_model.bin +3 -0
- added_tokens.json +16 -0
- chat_template.json +3 -0
- config.json +59 -0
- images/SaHa_logo.png +3 -0
- merges.txt +0 -0
- preprocessor_config.json +29 -0
- special_tokens_map.json +31 -0
- tokenizer.json +3 -0
- tokenizer_config.json +145 -0
- vocab.json +0 -0
.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
|
README.md
CHANGED
@@ -1,3 +1,163 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- TIGER-Lab/MMEB-train
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
metrics:
|
8 |
+
- precision
|
9 |
+
base_model:
|
10 |
+
- Qwen/Qwen2-VL-7B-Instruct
|
11 |
+
pipeline_tag: sentence-similarity
|
12 |
+
library_name: transformers
|
13 |
+
tags:
|
14 |
+
- Qwen2-VL
|
15 |
+
- qwen2-vl
|
16 |
+
- MMEB
|
17 |
---
|
18 |
+
|
19 |
+
<p align="center">
|
20 |
+
<img src="images/SaHa_logo.png" alt="SaHa Logo" style="width: 100%; max-width: 450px;">
|
21 |
+
</p>
|
22 |
+
|
23 |
+
# SaHa-Qwen2-VL-7B-Instruct
|
24 |
+
|
25 |
+
## Model Summary
|
26 |
+
|
27 |
+
**SaHa-Qwen2-VL-7B-Instruct** is a state-of-the-art universal multimodal embedding model based on the **Qwen2-VL-7B-Instruct** architecture. This model has been fine-tuned using our innovative Self-aware Hard Negative Sampling (SaHa) strategy, which is designed to efficiently adapt generative Multimodal Large Language Models (MLLMs) for discriminative embedding tasks.
|
28 |
+
|
29 |
+
Our approach leverages a hierarchical embedding prompt to unlock the powerful zero-shot capabilities of MLLMs and then fine-tunes the model with SaHa to achieve superior performance on universal multimodal retrieval benchmarks. This model significantly reduces the computational costs associated with traditional contrastive pre-training while delivering state-of-the-art results.
|
30 |
+
|
31 |
+
For more details, please refer to our paper: [From Generator to Embedder: Harnessing Innate Abilities of Multimodal LLMs via Building Zero-Shot Discriminative Embedding Model](https://arxiv.org/abs/2508.00955) and our [GitHub repository](https://github.com/yeongjoonJu/Gen2Embed).
|
32 |
+
|
33 |
+
## How to Use
|
34 |
+
|
35 |
+
You can easily use this model with the `transformers` library for sentence and image similarity tasks. Make sure you have the latest version of `transformers`, `torch`, and `Pillow` installed.
|
36 |
+
|
37 |
+
```bash
|
38 |
+
pip install transformers>=4.46.1 torch pillow
|
39 |
+
```
|
40 |
+
|
41 |
+
### Get Embeddings from Text or Image
|
42 |
+
|
43 |
+
Here's how to get embeddings for text or image inputs. The model uses a specific prompt structure to generate high-quality embeddings.
|
44 |
+
|
45 |
+
**Load Model**
|
46 |
+
|
47 |
+
```python
|
48 |
+
import torch
|
49 |
+
from transformers import AutoProcessor, AutoConfig, Qwen2VLForConditionalGeneration
|
50 |
+
|
51 |
+
# Load the model and tokenizer
|
52 |
+
model_id = "Y-J-Ju/SaHa-Qwen2-VL-7B-Instruct"
|
53 |
+
|
54 |
+
config = AutoConfig.from_pretrained(model_id, trust_remote_code=True)
|
55 |
+
config._attn_implementation = "flash_attention_2"
|
56 |
+
config.vision_config._attn_implementation = "flash_attention_2"
|
57 |
+
|
58 |
+
model = Qwen2VLForConditionalGeneration.from_pretrained(
|
59 |
+
model_id, torch_dtype=torch.bfloat16, config=config, device_map="cuda:0"
|
60 |
+
)
|
61 |
+
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True,
|
62 |
+
min_pixels=256 * 28 * 28, max_pixels=1280 * 28 * 28)
|
63 |
+
```
|
64 |
+
|
65 |
+
**Data Preparation and Prompting**
|
66 |
+
```python
|
67 |
+
texts = [
|
68 |
+
"The Tesla Cybertruck is a battery electric pickup truck built by Tesla, Inc. since 2023.",
|
69 |
+
"Korea University",
|
70 |
+
]
|
71 |
+
images = [
|
72 |
+
'https://upload.wikimedia.org/wikipedia/commons/e/e9/Tesla_Cybertruck_damaged_window.jpg',
|
73 |
+
'https://upload.wikimedia.org/wikipedia/commons/thumb/7/74/Korea_University.jpg/960px-Korea_University.jpg',
|
74 |
+
]
|
75 |
+
task_instruction = 'Find an image that matches the given text.'
|
76 |
+
|
77 |
+
system_prompt = "Given an image, summarize the provided image in one word. Given only text, describe the text in one word."
|
78 |
+
represent_prompt = "Represent the given text in one word."
|
79 |
+
|
80 |
+
query_form = '<|im_start|>system\n{system_prompt}<|im_end|>\n<|im_start|>user\n{task_instruction}\n{query}\n{represent_prompt}<|im_end|>\n<|im_start|>assistant\n'
|
81 |
+
candidate_form = '<|im_start|>system\n{system_prompt}<|im_end|>\n<|im_start|>user\n{cand}<|im_end|>\n<|im_start|>assistant\n'
|
82 |
+
|
83 |
+
queries = [
|
84 |
+
query_form.format(system_prompt=system_prompt, task_instruction=task_instruction, query=text, represent_prompt=represent_prompt)
|
85 |
+
for text in texts
|
86 |
+
]
|
87 |
+
candidates = [
|
88 |
+
candidate_form.format(system_prompt=system_prompt, cand='<|image_pad|>')
|
89 |
+
for _ in images
|
90 |
+
]
|
91 |
+
```
|
92 |
+
|
93 |
+
**Get Embeddings**
|
94 |
+
```python
|
95 |
+
from PIL import Image
|
96 |
+
import io
|
97 |
+
from urllib import request
|
98 |
+
import torch.nn.functional as F
|
99 |
+
|
100 |
+
## Query (Text)
|
101 |
+
inputs = processor(text=queries, images=None, return_tensors="pt", padding=True)
|
102 |
+
model_input = {k: v if isinstance(v, list) else v.to(model.device) for k, v in inputs.items()}
|
103 |
+
outputs = model(**model_input, return_dict=True, output_hidden_states=True)
|
104 |
+
hidden_states = outputs.hidden_states[-1]
|
105 |
+
query_embed = hidden_states[:,-1]
|
106 |
+
|
107 |
+
## Candidate (Image)
|
108 |
+
pil_images = [Image.open(io.BytesIO(request.urlopen(url).read())) for url in images]
|
109 |
+
inputs = processor(text=candidates, images=pil_images, return_tensors="pt", padding=True)
|
110 |
+
model_input = {k: v if isinstance(v, list) else v.to(model.device) for k, v in inputs.items()}
|
111 |
+
outputs = model(**model_input, return_dict=True, output_hidden_states=True)
|
112 |
+
cand_embed = outputs.hidden_states[-1][:,-1]
|
113 |
+
|
114 |
+
query_embed = F.normalize(query_embed, p=2, dim=-1)
|
115 |
+
cand_embed = F.normalize(cand_embed, p=2, dim=-1)
|
116 |
+
print(query_embed @ cand_embed.T)
|
117 |
+
```
|
118 |
+
|
119 |
+
**Outputs (Similarity)**
|
120 |
+
|
121 |
+
~~~python
|
122 |
+
tensor([[ 0.3848, -0.0197],
|
123 |
+
[-0.0221, 0.2949]], device='cuda:0', dtype=torch.bfloat16)
|
124 |
+
~~~
|
125 |
+
|
126 |
+
## Training and Evaluation
|
127 |
+
|
128 |
+
### Training Data
|
129 |
+
|
130 |
+
The model was fine-tuned on the **Massive Multimodal Embedding Benchmark (MMEB)** training set, which consists of approximately 829,000 pairs from 20 in-domain datasets.
|
131 |
+
|
132 |
+
* **Training Data:** [TIGER-Lab/MMEB-train](https://huggingface.co/datasets/TIGER-Lab/MMEB-train)
|
133 |
+
|
134 |
+
### Evaluation Data
|
135 |
+
|
136 |
+
The model's performance was evaluated on the MMEB evaluation set, which includes 36 datasets covering four meta-tasks: Classification, Visual Question Answering (VQA), Retrieval, and Visual Grounding.
|
137 |
+
|
138 |
+
* **Evaluation Data:** [TIGER-Lab/MMEB-eval](https://huggingface.co/datasets/TIGER-Lab/MMEB-eval)
|
139 |
+
|
140 |
+
### Performance
|
141 |
+
|
142 |
+
The SaHa-Qwen2-VL-7B-Instruct model achieves state-of-the-art performance in its parameter class on the MMEB benchmark, outperforming methods that rely on large-scale contrastive pre-training.
|
143 |
+
|
144 |
+
| Model | Params | Classification | Retrieval | VQA | Grounding | **IND** | **OND** | **Overall Avg.** |
|
145 |
+
| :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
146 |
+
| Ours (SaHa-Qwen2-VL-2B) | 8.3B | 69.1 | 74.1 | 67.3 | 88.1 | **76.4** | **67.4** | **72.4** |
|
147 |
+
|
148 |
+
|
149 |
+
## Citation
|
150 |
+
|
151 |
+
If you find this model useful in your research, please cite our paper:
|
152 |
+
|
153 |
+
```bibtex
|
154 |
+
@misc{ju2025generatorembedder,
|
155 |
+
title={From Generator to Embedder: Harnessing Innate Abilities of Multimodal LLMs via Building Zero-Shot Discriminative Embedding Model},
|
156 |
+
author={Yeong-Joon Ju and Seong-Whan Lee},
|
157 |
+
year={2025},
|
158 |
+
eprint={2508.00955},
|
159 |
+
archivePrefix={arXiv},
|
160 |
+
primaryClass={cs.LG},
|
161 |
+
url={https://arxiv.org/abs/2508.00955},
|
162 |
+
}
|
163 |
+
```
|
adapter_config.json
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"alpha_pattern": {},
|
3 |
+
"auto_mapping": {
|
4 |
+
"base_model_class": "Qwen2VLForConditionalGeneration",
|
5 |
+
"parent_library": "src.vlm_backbone.qwen2_vl.modeling_qwen2_vl"
|
6 |
+
},
|
7 |
+
"base_model_name_or_path": "Qwen/Qwen2-VL-7B-Instruct",
|
8 |
+
"bias": "none",
|
9 |
+
"corda_config": null,
|
10 |
+
"eva_config": null,
|
11 |
+
"exclude_modules": null,
|
12 |
+
"fan_in_fan_out": false,
|
13 |
+
"inference_mode": true,
|
14 |
+
"init_lora_weights": "gaussian",
|
15 |
+
"layer_replication": null,
|
16 |
+
"layers_pattern": null,
|
17 |
+
"layers_to_transform": null,
|
18 |
+
"loftq_config": {},
|
19 |
+
"lora_alpha": 64,
|
20 |
+
"lora_bias": false,
|
21 |
+
"lora_dropout": 0.1,
|
22 |
+
"megatron_config": null,
|
23 |
+
"megatron_core": "megatron.core",
|
24 |
+
"modules_to_save": null,
|
25 |
+
"peft_type": "LORA",
|
26 |
+
"r": 8,
|
27 |
+
"rank_pattern": {},
|
28 |
+
"revision": null,
|
29 |
+
"target_modules": [
|
30 |
+
"q_proj",
|
31 |
+
"gate_up_proj",
|
32 |
+
"v_proj",
|
33 |
+
"k_proj",
|
34 |
+
"down_proj",
|
35 |
+
"o_proj",
|
36 |
+
"qkv_proj",
|
37 |
+
"out_proj"
|
38 |
+
],
|
39 |
+
"task_type": null,
|
40 |
+
"trainable_token_indices": null,
|
41 |
+
"use_dora": true,
|
42 |
+
"use_rslora": false
|
43 |
+
}
|
adapter_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0ad4b04241fa2bb5b35831424237b521a8810eea085c566809cfa1cbb3bdf38c
|
3 |
+
size 41841050
|
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.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,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_attn_implementation_autoset": true,
|
3 |
+
"architectures": [
|
4 |
+
"Qwen2VLForConditionalGeneration"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 151643,
|
8 |
+
"eos_token_id": 151645,
|
9 |
+
"hidden_act": "silu",
|
10 |
+
"hidden_size": 3584,
|
11 |
+
"image_token_id": 151655,
|
12 |
+
"initializer_range": 0.02,
|
13 |
+
"intermediate_size": 18944,
|
14 |
+
"max_position_embeddings": 32768,
|
15 |
+
"max_window_layers": 28,
|
16 |
+
"model_type": "qwen2_vl",
|
17 |
+
"num_attention_heads": 28,
|
18 |
+
"num_hidden_layers": 28,
|
19 |
+
"num_key_value_heads": 4,
|
20 |
+
"padding_side": "left",
|
21 |
+
"rms_norm_eps": 1e-06,
|
22 |
+
"rope_scaling": {
|
23 |
+
"mrope_section": [
|
24 |
+
16,
|
25 |
+
24,
|
26 |
+
24
|
27 |
+
],
|
28 |
+
"rope_type": "default",
|
29 |
+
"type": "default"
|
30 |
+
},
|
31 |
+
"rope_theta": 1000000.0,
|
32 |
+
"sliding_window": 32768,
|
33 |
+
"tie_word_embeddings": false,
|
34 |
+
"torch_dtype": "bfloat16",
|
35 |
+
"transformers_version": "4.51.0",
|
36 |
+
"use_cache": false,
|
37 |
+
"use_sliding_window": false,
|
38 |
+
"video_token_id": 151656,
|
39 |
+
"vision_config": {
|
40 |
+
"depth": 32,
|
41 |
+
"embed_dim": 1280,
|
42 |
+
"hidden_act": "quick_gelu",
|
43 |
+
"hidden_size": 3584,
|
44 |
+
"in_channels": 3,
|
45 |
+
"in_chans": 3,
|
46 |
+
"mlp_ratio": 4,
|
47 |
+
"model_type": "qwen2_vl",
|
48 |
+
"num_heads": 16,
|
49 |
+
"patch_size": 14,
|
50 |
+
"spatial_merge_size": 2,
|
51 |
+
"spatial_patch_size": 14,
|
52 |
+
"temporal_patch_size": 2,
|
53 |
+
"torch_dtype": "bfloat16"
|
54 |
+
},
|
55 |
+
"vision_end_token_id": 151653,
|
56 |
+
"vision_start_token_id": 151652,
|
57 |
+
"vision_token_id": 151654,
|
58 |
+
"vocab_size": 152064
|
59 |
+
}
|
images/SaHa_logo.png
ADDED
![]() |
Git LFS Details
|
merges.txt
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": 12845056,
|
18 |
+
"merge_size": 2,
|
19 |
+
"min_pixels": 3136,
|
20 |
+
"patch_size": 14,
|
21 |
+
"processor_class": "Qwen2VLProcessor",
|
22 |
+
"resample": 3,
|
23 |
+
"rescale_factor": 0.00392156862745098,
|
24 |
+
"size": {
|
25 |
+
"max_pixels": 12845056,
|
26 |
+
"min_pixels": 3136
|
27 |
+
},
|
28 |
+
"temporal_patch_size": 2
|
29 |
+
}
|
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:49a5b72e53f421c7c77ff9c9a0462a914dc50ca236e811c3bf13a06f77c5d799
|
3 |
+
size 11420469
|
tokenizer_config.json
ADDED
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_prefix_space": false,
|
3 |
+
"added_tokens_decoder": {
|
4 |
+
"151643": {
|
5 |
+
"content": "<|endoftext|>",
|
6 |
+
"lstrip": false,
|
7 |
+
"normalized": false,
|
8 |
+
"rstrip": false,
|
9 |
+
"single_word": false,
|
10 |
+
"special": true
|
11 |
+
},
|
12 |
+
"151644": {
|
13 |
+
"content": "<|im_start|>",
|
14 |
+
"lstrip": false,
|
15 |
+
"normalized": false,
|
16 |
+
"rstrip": false,
|
17 |
+
"single_word": false,
|
18 |
+
"special": true
|
19 |
+
},
|
20 |
+
"151645": {
|
21 |
+
"content": "<|im_end|>",
|
22 |
+
"lstrip": false,
|
23 |
+
"normalized": false,
|
24 |
+
"rstrip": false,
|
25 |
+
"single_word": false,
|
26 |
+
"special": true
|
27 |
+
},
|
28 |
+
"151646": {
|
29 |
+
"content": "<|object_ref_start|>",
|
30 |
+
"lstrip": false,
|
31 |
+
"normalized": false,
|
32 |
+
"rstrip": false,
|
33 |
+
"single_word": false,
|
34 |
+
"special": true
|
35 |
+
},
|
36 |
+
"151647": {
|
37 |
+
"content": "<|object_ref_end|>",
|
38 |
+
"lstrip": false,
|
39 |
+
"normalized": false,
|
40 |
+
"rstrip": false,
|
41 |
+
"single_word": false,
|
42 |
+
"special": true
|
43 |
+
},
|
44 |
+
"151648": {
|
45 |
+
"content": "<|box_start|>",
|
46 |
+
"lstrip": false,
|
47 |
+
"normalized": false,
|
48 |
+
"rstrip": false,
|
49 |
+
"single_word": false,
|
50 |
+
"special": true
|
51 |
+
},
|
52 |
+
"151649": {
|
53 |
+
"content": "<|box_end|>",
|
54 |
+
"lstrip": false,
|
55 |
+
"normalized": false,
|
56 |
+
"rstrip": false,
|
57 |
+
"single_word": false,
|
58 |
+
"special": true
|
59 |
+
},
|
60 |
+
"151650": {
|
61 |
+
"content": "<|quad_start|>",
|
62 |
+
"lstrip": false,
|
63 |
+
"normalized": false,
|
64 |
+
"rstrip": false,
|
65 |
+
"single_word": false,
|
66 |
+
"special": true
|
67 |
+
},
|
68 |
+
"151651": {
|
69 |
+
"content": "<|quad_end|>",
|
70 |
+
"lstrip": false,
|
71 |
+
"normalized": false,
|
72 |
+
"rstrip": false,
|
73 |
+
"single_word": false,
|
74 |
+
"special": true
|
75 |
+
},
|
76 |
+
"151652": {
|
77 |
+
"content": "<|vision_start|>",
|
78 |
+
"lstrip": false,
|
79 |
+
"normalized": false,
|
80 |
+
"rstrip": false,
|
81 |
+
"single_word": false,
|
82 |
+
"special": true
|
83 |
+
},
|
84 |
+
"151653": {
|
85 |
+
"content": "<|vision_end|>",
|
86 |
+
"lstrip": false,
|
87 |
+
"normalized": false,
|
88 |
+
"rstrip": false,
|
89 |
+
"single_word": false,
|
90 |
+
"special": true
|
91 |
+
},
|
92 |
+
"151654": {
|
93 |
+
"content": "<|vision_pad|>",
|
94 |
+
"lstrip": false,
|
95 |
+
"normalized": false,
|
96 |
+
"rstrip": false,
|
97 |
+
"single_word": false,
|
98 |
+
"special": true
|
99 |
+
},
|
100 |
+
"151655": {
|
101 |
+
"content": "<|image_pad|>",
|
102 |
+
"lstrip": false,
|
103 |
+
"normalized": false,
|
104 |
+
"rstrip": false,
|
105 |
+
"single_word": false,
|
106 |
+
"special": true
|
107 |
+
},
|
108 |
+
"151656": {
|
109 |
+
"content": "<|video_pad|>",
|
110 |
+
"lstrip": false,
|
111 |
+
"normalized": false,
|
112 |
+
"rstrip": false,
|
113 |
+
"single_word": false,
|
114 |
+
"special": true
|
115 |
+
}
|
116 |
+
},
|
117 |
+
"additional_special_tokens": [
|
118 |
+
"<|im_start|>",
|
119 |
+
"<|im_end|>",
|
120 |
+
"<|object_ref_start|>",
|
121 |
+
"<|object_ref_end|>",
|
122 |
+
"<|box_start|>",
|
123 |
+
"<|box_end|>",
|
124 |
+
"<|quad_start|>",
|
125 |
+
"<|quad_end|>",
|
126 |
+
"<|vision_start|>",
|
127 |
+
"<|vision_end|>",
|
128 |
+
"<|vision_pad|>",
|
129 |
+
"<|image_pad|>",
|
130 |
+
"<|video_pad|>"
|
131 |
+
],
|
132 |
+
"bos_token": null,
|
133 |
+
"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 %}",
|
134 |
+
"clean_up_tokenization_spaces": false,
|
135 |
+
"eos_token": "<|im_end|>",
|
136 |
+
"errors": "replace",
|
137 |
+
"extra_special_tokens": {},
|
138 |
+
"model_max_length": 32768,
|
139 |
+
"pad_token": "<|endoftext|>",
|
140 |
+
"padding_side": "left",
|
141 |
+
"processor_class": "Qwen2VLProcessor",
|
142 |
+
"split_special_tokens": false,
|
143 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
144 |
+
"unk_token": null
|
145 |
+
}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|