初始化项目,由ModelHub XC社区提供模型
Model: zhibinlan/UME-R1-2B Source: Original Platform
This commit is contained in:
38
.gitattributes
vendored
Executable file
38
.gitattributes
vendored
Executable file
@@ -0,0 +1,38 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||||
328
README.md
Executable file
328
README.md
Executable file
@@ -0,0 +1,328 @@
|
|||||||
|
---
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
library_name: transformers
|
||||||
|
license: apache-2.0
|
||||||
|
pipeline_tag: image-text-to-text
|
||||||
|
tags:
|
||||||
|
- Sentence Similarity
|
||||||
|
- Embedding
|
||||||
|
- zero-shot-image-classification
|
||||||
|
- video-text-to-text
|
||||||
|
---
|
||||||
|
|
||||||
|
# UME-R1-2B
|
||||||
|
|
||||||
|
## Model Summary
|
||||||
|
|
||||||
|
The model has undergone a cold-start SFT stage and an RL stage of training, and is capable of embedding text, images, multiple images, and videos. In particular, UME-R1 can generate either discriminative or generative embeddings as needed, and the generative embeddings possess the potential for test-time scaling.
|
||||||
|
|
||||||
|
- **Repository:** [UME-R1](https://github.com/XMUDeepLIT/UME-R1)
|
||||||
|
- **Paper:** [UME-R1](https://arxiv.org/abs/2511.00405)
|
||||||
|
|
||||||
|
## Train/Eval Data
|
||||||
|
- Train data: https://huggingface.co/datasets/zhibinlan/UME-sft-train
|
||||||
|
- Eval data: https://huggingface.co/datasets/TIGER-Lab/MMEB-V2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Model Performance
|
||||||
|
UME-R1 significantly outperforms discriminative embeddings and can provide discriminative or generative representations as needed. Its oracle performance—selecting the best between discriminative and generative—far exceeds using either mode alone.
|
||||||
|
|
||||||
|
|
||||||
|
<img src="./figures/main_result.png" alt="MMEB-V2" width="1200" height="auto">
|
||||||
|
<!--  -->
|
||||||
|
|
||||||
|
In addition, UME-R1 can produce improved embedding representations through repeated sampling, indicating that generative embeddings also hold strong promise for inference-time scaling.
|
||||||
|
|
||||||
|
<img src="./figures/scaling.png" alt="pass@k" width="1200" height="auto">
|
||||||
|
|
||||||
|
### Quick Start
|
||||||
|
|
||||||
|
First clone our github
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/DeepLearnXMU/UME-R1
|
||||||
|
cd UME-R1
|
||||||
|
bash setup.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Below, we provide simple examples to show how to use UME-R1 with 🤗 Transformers.
|
||||||
|
|
||||||
|
Example of obtaining generative embeddings:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from transformers import Qwen2VLForConditionalGeneration,AutoProcessor
|
||||||
|
from qwen_vl_utils import process_vision_info
|
||||||
|
import torch
|
||||||
|
|
||||||
|
model = Qwen2VLForConditionalGeneration.from_pretrained(
|
||||||
|
"zhibinlan/UME-R1-2B",
|
||||||
|
torch_dtype=torch.bfloat16,
|
||||||
|
attn_implementation="flash_attention_2",
|
||||||
|
device_map="cuda:0",
|
||||||
|
)
|
||||||
|
|
||||||
|
processor = AutoProcessor.from_pretrained("zhibinlan/UME-R1-2B")
|
||||||
|
|
||||||
|
prompt = '''Represent the above input text, images, videos, or any combination of the three as embeddings.
|
||||||
|
First output the thinking process in <think> </think> tags and then summarize the entire input in a word or sentence.
|
||||||
|
Finally, use the <gen_emb> tag to represent the entire input.'''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
messages = [
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "image",
|
||||||
|
"image": "assets/example.jpg",
|
||||||
|
},
|
||||||
|
{"type": "text", "text": "Represent the given image with the following question: What is in the image?\n<disc_emb>\n" + prompt},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
# Preparation for inference
|
||||||
|
text = processor.apply_chat_template(
|
||||||
|
messages, tokenize=False, add_generation_prompt=True
|
||||||
|
)
|
||||||
|
|
||||||
|
image_inputs, video_inputs = process_vision_info(messages)
|
||||||
|
inputs = processor(
|
||||||
|
text=[text],
|
||||||
|
images=image_inputs,
|
||||||
|
videos=video_inputs,
|
||||||
|
padding=True,
|
||||||
|
return_tensors="pt",
|
||||||
|
)
|
||||||
|
inputs = inputs.to(model.device)
|
||||||
|
|
||||||
|
# Inference: Generation of the output
|
||||||
|
generated_output = model.generate(**inputs, max_new_tokens=8192, output_hidden_states=True, return_dict_in_generate=True, use_cache=True)
|
||||||
|
# Post-process the output
|
||||||
|
generated_ids = generated_output.sequences
|
||||||
|
hidden_states = generated_output.hidden_states
|
||||||
|
|
||||||
|
generated_ids_trimmed = [
|
||||||
|
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
||||||
|
]
|
||||||
|
|
||||||
|
def get_embedding_idx(generated_ids_trimmed, EMBEDDING_TOKEN_ID):
|
||||||
|
|
||||||
|
embedding_idx = []
|
||||||
|
for i, out_ids in enumerate(generated_ids_trimmed):
|
||||||
|
embed_exist = False
|
||||||
|
for j in range(len(out_ids) - 1, -1, -1):
|
||||||
|
if out_ids[j] == EMBEDDING_TOKEN_ID:
|
||||||
|
embedding_idx.append(j + 1)
|
||||||
|
embed_exist = True
|
||||||
|
break
|
||||||
|
if not embed_exist:
|
||||||
|
embedding_idx.append(-1)
|
||||||
|
|
||||||
|
return embedding_idx
|
||||||
|
|
||||||
|
def normalize_reps(reps):
|
||||||
|
reps = torch.nn.functional.normalize(reps, p=2, dim=-1)
|
||||||
|
return reps
|
||||||
|
|
||||||
|
# Get the last hidden state of the <gen_emb> token
|
||||||
|
embedding_idx = get_embedding_idx(generated_ids_trimmed, processor.tokenizer.get_vocab()["<gen_emb>"])
|
||||||
|
embedding_reps = hidden_states[embedding_idx[0]][-1].squeeze(1)
|
||||||
|
|
||||||
|
# Normalize the representations
|
||||||
|
embedding_reps = normalize_reps(embedding_reps)
|
||||||
|
|
||||||
|
output_text = processor.batch_decode(
|
||||||
|
generated_ids_trimmed, skip_special_tokens=False, clean_up_tokenization_spaces=False
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Example of obtaining discriminative embeddings</summary>
|
||||||
|
|
||||||
|
```python
|
||||||
|
from transformers import Qwen2VLForConditionalGeneration,AutoProcessor
|
||||||
|
from qwen_vl_utils import process_vision_info
|
||||||
|
import torch
|
||||||
|
|
||||||
|
pretrained_path = "zhibinlan/UME-R1-2B"
|
||||||
|
|
||||||
|
# We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
|
||||||
|
model = Qwen2VLForConditionalGeneration.from_pretrained(
|
||||||
|
pretrained_path,
|
||||||
|
torch_dtype=torch.bfloat16,
|
||||||
|
attn_implementation="flash_attention_2",
|
||||||
|
device_map="cuda:0",
|
||||||
|
)
|
||||||
|
|
||||||
|
# default processor
|
||||||
|
processor = AutoProcessor.from_pretrained(pretrained_path)
|
||||||
|
|
||||||
|
messages = [
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "image",
|
||||||
|
"image": "UME-R1/assets/example.jpg",
|
||||||
|
},
|
||||||
|
{"type": "text", "text": "Represent the given image with the following question: What is in the image?\n<disc_emb>\n"},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
# Preparation for inference
|
||||||
|
text = processor.apply_chat_template(
|
||||||
|
messages, tokenize=False, add_generation_prompt=True
|
||||||
|
)
|
||||||
|
|
||||||
|
image_inputs, video_inputs = process_vision_info(messages)
|
||||||
|
inputs = processor(
|
||||||
|
text=[text],
|
||||||
|
images=image_inputs,
|
||||||
|
videos=video_inputs,
|
||||||
|
padding=True,
|
||||||
|
return_tensors="pt",
|
||||||
|
)
|
||||||
|
inputs = inputs.to(model.device)
|
||||||
|
|
||||||
|
def get_embedding_idx(generated_ids_trimmed, EMBEDDING_TOKEN_ID):
|
||||||
|
|
||||||
|
embedding_idx = []
|
||||||
|
# Search from the last token forward
|
||||||
|
for i, out_ids in enumerate(generated_ids_trimmed):
|
||||||
|
embed_exist = False
|
||||||
|
for j in range(len(out_ids) - 1, -1, -1):
|
||||||
|
if out_ids[j] == EMBEDDING_TOKEN_ID:
|
||||||
|
embedding_idx.append(j)
|
||||||
|
embed_exist = True
|
||||||
|
break
|
||||||
|
if not embed_exist:
|
||||||
|
embedding_idx.append(-1)
|
||||||
|
|
||||||
|
return embedding_idx
|
||||||
|
|
||||||
|
def normalize_reps(reps):
|
||||||
|
# Normalize the representations
|
||||||
|
reps = torch.nn.functional.normalize(reps, p=2, dim=-1)
|
||||||
|
return reps
|
||||||
|
|
||||||
|
output = model(**inputs, output_hidden_states=True, return_dict=True)
|
||||||
|
hidden_states = output.hidden_states[-1][0]
|
||||||
|
# print("output.hidden_states shape: ", hidden_states.shape)
|
||||||
|
embedding_idx = get_embedding_idx(inputs['input_ids'], processor.tokenizer.get_vocab()["<disc_emb>"])
|
||||||
|
|
||||||
|
# Get the last hidden state of the <gen_emb> token
|
||||||
|
embedding_reps = hidden_states[embedding_idx[0]]
|
||||||
|
|
||||||
|
# Normalize the representations
|
||||||
|
embedding_reps = normalize_reps(embedding_reps)
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Multi image inference</summary>
|
||||||
|
|
||||||
|
```python
|
||||||
|
# Messages containing multiple images and a text query
|
||||||
|
messages = [
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": [
|
||||||
|
{"type": "image", "image": "file:///path/to/image1.jpg"},
|
||||||
|
{"type": "image", "image": "file:///path/to/image2.jpg"},
|
||||||
|
{"type": "text", "text": "Represent the given images."},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Video inference</summary>
|
||||||
|
|
||||||
|
```python
|
||||||
|
# Messages containing a images list as a video and a text query
|
||||||
|
messages = [
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "video",
|
||||||
|
"video": [
|
||||||
|
"file:///path/to/frame1.jpg",
|
||||||
|
"file:///path/to/frame2.jpg",
|
||||||
|
"file:///path/to/frame3.jpg",
|
||||||
|
"file:///path/to/frame4.jpg",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{"type": "text", "text": "Represent this video."},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
# Messages containing a local video path and a text query
|
||||||
|
messages = [
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "video",
|
||||||
|
"video": "file:///path/to/video1.mp4",
|
||||||
|
"max_pixels": 360 * 420,
|
||||||
|
"fps": 1.0,
|
||||||
|
},
|
||||||
|
{"type": "text", "text": "Represent this video."},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
# Messages containing a video url and a text query
|
||||||
|
messages = [
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "video",
|
||||||
|
"video": "https://path/to/video.mp4",
|
||||||
|
"min_pixels": 4 * 28 * 28,
|
||||||
|
"max_pixels": 256 * 28 * 28,
|
||||||
|
"total_pixels": 20480 * 28 * 28,
|
||||||
|
},
|
||||||
|
{"type": "text", "text": "Represent this video."},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
image_inputs, video_inputs, video_kwargs = process_vision_info(messages, return_video_kwargs=True)
|
||||||
|
inputs = processor(
|
||||||
|
text=[text],
|
||||||
|
images=image_inputs,
|
||||||
|
videos=video_inputs,
|
||||||
|
fps=fps,
|
||||||
|
padding=True,
|
||||||
|
return_tensors="pt",
|
||||||
|
**video_kwargs,
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
|
For more usage tips, please refer to our [Github page](https://github.com/DeepLearnXMU/UME-R1).
|
||||||
|
|
||||||
|
|
||||||
|
## Citation
|
||||||
|
If you find our work useful, please consider citing it.
|
||||||
|
```
|
||||||
|
@article{lan2025ume,
|
||||||
|
title={UME-R1: Exploring Reasoning-Driven Generative Multimodal Embeddings},
|
||||||
|
author={Lan, Zhibin and Niu, Liqiang and Meng, Fandong and Zhou, Jie and Su, Jinsong},
|
||||||
|
journal={arXiv preprint arXiv:2511.00405},
|
||||||
|
year={2025}
|
||||||
|
}
|
||||||
|
```
|
||||||
18
added_tokens.json
Normal file
18
added_tokens.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"<disc_emb>": 151658,
|
||||||
|
"<gen_emb>": 151657,
|
||||||
|
"<|box_end|>": 151649,
|
||||||
|
"<|box_start|>": 151648,
|
||||||
|
"<|endoftext|>": 151643,
|
||||||
|
"<|im_end|>": 151645,
|
||||||
|
"<|im_start|>": 151644,
|
||||||
|
"<|image_pad|>": 151655,
|
||||||
|
"<|object_ref_end|>": 151647,
|
||||||
|
"<|object_ref_start|>": 151646,
|
||||||
|
"<|quad_end|>": 151651,
|
||||||
|
"<|quad_start|>": 151650,
|
||||||
|
"<|video_pad|>": 151656,
|
||||||
|
"<|vision_end|>": 151653,
|
||||||
|
"<|vision_pad|>": 151654,
|
||||||
|
"<|vision_start|>": 151652
|
||||||
|
}
|
||||||
3
chat_template.json
Normal file
3
chat_template.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"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 %}"
|
||||||
|
}
|
||||||
49
config.json
Normal file
49
config.json
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
"_name_or_path": "zhibinlan/UME-R1-2B",
|
||||||
|
"architectures": [
|
||||||
|
"Qwen2VLForConditionalGeneration"
|
||||||
|
],
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"bos_token_id": 151643,
|
||||||
|
"eos_token_id": 151645,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 1536,
|
||||||
|
"image_token_id": 151655,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 8960,
|
||||||
|
"max_position_embeddings": 32768,
|
||||||
|
"max_window_layers": 28,
|
||||||
|
"model_type": "qwen2_vl",
|
||||||
|
"num_attention_heads": 12,
|
||||||
|
"num_hidden_layers": 28,
|
||||||
|
"num_key_value_heads": 2,
|
||||||
|
"rms_norm_eps": 1e-06,
|
||||||
|
"rope_scaling": {
|
||||||
|
"mrope_section": [
|
||||||
|
16,
|
||||||
|
24,
|
||||||
|
24
|
||||||
|
],
|
||||||
|
"rope_type": "default",
|
||||||
|
"type": "default"
|
||||||
|
},
|
||||||
|
"rope_theta": 1000000.0,
|
||||||
|
"sliding_window": 32768,
|
||||||
|
"tie_word_embeddings": true,
|
||||||
|
"torch_dtype": "bfloat16",
|
||||||
|
"transformers_version": "4.49.0",
|
||||||
|
"use_cache": false,
|
||||||
|
"use_sliding_window": false,
|
||||||
|
"video_token_id": 151656,
|
||||||
|
"vision_config": {
|
||||||
|
"hidden_size": 1536,
|
||||||
|
"in_chans": 3,
|
||||||
|
"model_type": "qwen2_vl",
|
||||||
|
"spatial_patch_size": 14,
|
||||||
|
"torch_dtype": "bfloat16"
|
||||||
|
},
|
||||||
|
"vision_end_token_id": 151653,
|
||||||
|
"vision_start_token_id": 151652,
|
||||||
|
"vision_token_id": 151654,
|
||||||
|
"vocab_size": 151936
|
||||||
|
}
|
||||||
3
figures/main_result.png
Executable file
3
figures/main_result.png
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:6e1f7225c42487f587fec7fd03db9e1818a6193db83ab196bf49fa8ab8da17af
|
||||||
|
size 270714
|
||||||
3
figures/scaling.png
Executable file
3
figures/scaling.png
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:a1ebb391fd4aa2e9c44718b464c2a80051de8fdbd34c0fdab159bc390add8133
|
||||||
|
size 294729
|
||||||
6
generation_config.json
Normal file
6
generation_config.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"_from_model_config": true,
|
||||||
|
"bos_token_id": 151643,
|
||||||
|
"eos_token_id": 151645,
|
||||||
|
"transformers_version": "4.49.0"
|
||||||
|
}
|
||||||
151388
merges.txt
Normal file
151388
merges.txt
Normal file
File diff suppressed because it is too large
Load Diff
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:ad6536ef701debe1be798a5dc7a71dce6facefd8390f9f8955dbe75b8f6c0f90
|
||||||
|
size 4418050848
|
||||||
29
preprocessor_config.json
Normal file
29
preprocessor_config.json
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"do_convert_rgb": true,
|
||||||
|
"do_normalize": true,
|
||||||
|
"do_rescale": true,
|
||||||
|
"do_resize": true,
|
||||||
|
"image_mean": [
|
||||||
|
0.48145466,
|
||||||
|
0.4578275,
|
||||||
|
0.40821073
|
||||||
|
],
|
||||||
|
"image_processor_type": "Qwen2VLImageProcessor",
|
||||||
|
"image_std": [
|
||||||
|
0.26862954,
|
||||||
|
0.26130258,
|
||||||
|
0.27577711
|
||||||
|
],
|
||||||
|
"max_pixels": 2359296,
|
||||||
|
"merge_size": 2,
|
||||||
|
"min_pixels": 784,
|
||||||
|
"patch_size": 14,
|
||||||
|
"processor_class": "Qwen2VLProcessor",
|
||||||
|
"resample": 3,
|
||||||
|
"rescale_factor": 0.00392156862745098,
|
||||||
|
"size": {
|
||||||
|
"longest_edge": 2359296,
|
||||||
|
"shortest_edge": 784
|
||||||
|
},
|
||||||
|
"temporal_patch_size": 2
|
||||||
|
}
|
||||||
31
special_tokens_map.json
Normal file
31
special_tokens_map.json
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"additional_special_tokens": [
|
||||||
|
"<|im_start|>",
|
||||||
|
"<|im_end|>",
|
||||||
|
"<|object_ref_start|>",
|
||||||
|
"<|object_ref_end|>",
|
||||||
|
"<|box_start|>",
|
||||||
|
"<|box_end|>",
|
||||||
|
"<|quad_start|>",
|
||||||
|
"<|quad_end|>",
|
||||||
|
"<|vision_start|>",
|
||||||
|
"<|vision_end|>",
|
||||||
|
"<|vision_pad|>",
|
||||||
|
"<|image_pad|>",
|
||||||
|
"<|video_pad|>"
|
||||||
|
],
|
||||||
|
"eos_token": {
|
||||||
|
"content": "<|im_end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"pad_token": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
}
|
||||||
|
}
|
||||||
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:5287235572b0af97db0b322e328806b84a3a1a89754e473c31c022af0a7122ee
|
||||||
|
size 11420905
|
||||||
161
tokenizer_config.json
Normal file
161
tokenizer_config.json
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
{
|
||||||
|
"add_prefix_space": false,
|
||||||
|
"added_tokens_decoder": {
|
||||||
|
"151643": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151644": {
|
||||||
|
"content": "<|im_start|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151645": {
|
||||||
|
"content": "<|im_end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151646": {
|
||||||
|
"content": "<|object_ref_start|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151647": {
|
||||||
|
"content": "<|object_ref_end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151648": {
|
||||||
|
"content": "<|box_start|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151649": {
|
||||||
|
"content": "<|box_end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151650": {
|
||||||
|
"content": "<|quad_start|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151651": {
|
||||||
|
"content": "<|quad_end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151652": {
|
||||||
|
"content": "<|vision_start|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151653": {
|
||||||
|
"content": "<|vision_end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151654": {
|
||||||
|
"content": "<|vision_pad|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151655": {
|
||||||
|
"content": "<|image_pad|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151656": {
|
||||||
|
"content": "<|video_pad|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151657": {
|
||||||
|
"content": "<gen_emb>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": true,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151658": {
|
||||||
|
"content": "<disc_emb>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": true,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additional_special_tokens": [
|
||||||
|
"<|im_start|>",
|
||||||
|
"<|im_end|>",
|
||||||
|
"<|object_ref_start|>",
|
||||||
|
"<|object_ref_end|>",
|
||||||
|
"<|box_start|>",
|
||||||
|
"<|box_end|>",
|
||||||
|
"<|quad_start|>",
|
||||||
|
"<|quad_end|>",
|
||||||
|
"<|vision_start|>",
|
||||||
|
"<|vision_end|>",
|
||||||
|
"<|vision_pad|>",
|
||||||
|
"<|image_pad|>",
|
||||||
|
"<|video_pad|>"
|
||||||
|
],
|
||||||
|
"bos_token": null,
|
||||||
|
"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 %}",
|
||||||
|
"clean_up_tokenization_spaces": false,
|
||||||
|
"eos_token": "<|im_end|>",
|
||||||
|
"errors": "replace",
|
||||||
|
"extra_special_tokens": {},
|
||||||
|
"model_max_length": 12288,
|
||||||
|
"pad_token": "<|endoftext|>",
|
||||||
|
"padding_side": "right",
|
||||||
|
"processor_class": "Qwen2VLProcessor",
|
||||||
|
"split_special_tokens": false,
|
||||||
|
"tokenizer_class": "Qwen2Tokenizer",
|
||||||
|
"unk_token": null
|
||||||
|
}
|
||||||
1
vocab.json
Normal file
1
vocab.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user