Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +1 -1
- added_tokens.json +32 -0
- chat_template.jinja +7 -0
- config.json +154 -0
- configuration_eo1.py +72 -0
- generation_config.json +8 -0
- merges.txt +0 -0
- model-00001-of-00002.safetensors +3 -0
- model-00002-of-00002.safetensors +3 -0
- model.safetensors.index.json +844 -0
- modeling_eo1.py +480 -0
- modeling_qwen2_5_vl.py +1655 -0
- preprocessor_config.json +40 -0
- processing_eo1.py +389 -0
- processor_config.json +16 -0
- special_tokens_map.json +31 -0
- tokenizer.json +3 -0
- tokenizer_config.json +277 -0
- trainer_state.json +0 -0
- video_preprocessor_config.json +47 -0
- vocab.json +0 -0
.gitattributes
CHANGED
|
@@ -36,3 +36,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 36 |
assets/arch.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
assets/embodiments.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
assets/logo.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 36 |
assets/arch.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
assets/embodiments.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
assets/logo.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -190,7 +190,7 @@ If you find this project useful, please consider citing:
|
|
| 190 |
|
| 191 |
```bibtex
|
| 192 |
@article{eo-1,
|
| 193 |
-
title={
|
| 194 |
author={Delin Qu and Haoming Song and Qizhi Chen and Zhaoqing Chen and Xianqiang Gao and Xinyi Ye and Qi Lv and Modi Shi and Guanghui Ren and Cheng Ruan and Maoqing Yao and Haoran Yang and Jiacheng Bao and Bin Zhao and Dong Wang},
|
| 195 |
journal={arXiv preprint},
|
| 196 |
year={2025},
|
|
|
|
| 190 |
|
| 191 |
```bibtex
|
| 192 |
@article{eo-1,
|
| 193 |
+
title={EO-1: Interleaved Vision-Text-Action Pretraining for General Robot Control},
|
| 194 |
author={Delin Qu and Haoming Song and Qizhi Chen and Zhaoqing Chen and Xianqiang Gao and Xinyi Ye and Qi Lv and Modi Shi and Guanghui Ren and Cheng Ruan and Maoqing Yao and Haoran Yang and Jiacheng Bao and Bin Zhao and Dong Wang},
|
| 195 |
journal={arXiv preprint},
|
| 196 |
year={2025},
|
added_tokens.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"</tool_call>": 151658,
|
| 3 |
+
"<tool_call>": 151657,
|
| 4 |
+
"<|action_end|>": 151667,
|
| 5 |
+
"<|action_pad|>": 151666,
|
| 6 |
+
"<|action_pass|>": 151672,
|
| 7 |
+
"<|action_start|>": 151665,
|
| 8 |
+
"<|box_end|>": 151649,
|
| 9 |
+
"<|box_start|>": 151648,
|
| 10 |
+
"<|endoftext|>": 151643,
|
| 11 |
+
"<|file_sep|>": 151664,
|
| 12 |
+
"<|fim_middle|>": 151660,
|
| 13 |
+
"<|fim_pad|>": 151662,
|
| 14 |
+
"<|fim_prefix|>": 151659,
|
| 15 |
+
"<|fim_suffix|>": 151661,
|
| 16 |
+
"<|im_end|>": 151645,
|
| 17 |
+
"<|im_start|>": 151644,
|
| 18 |
+
"<|image_pad|>": 151655,
|
| 19 |
+
"<|object_ref_end|>": 151647,
|
| 20 |
+
"<|object_ref_start|>": 151646,
|
| 21 |
+
"<|quad_end|>": 151651,
|
| 22 |
+
"<|quad_start|>": 151650,
|
| 23 |
+
"<|repo_name|>": 151663,
|
| 24 |
+
"<|state_end|>": 151670,
|
| 25 |
+
"<|state_pad|>": 151669,
|
| 26 |
+
"<|state_start|>": 151668,
|
| 27 |
+
"<|video_pad|>": 151656,
|
| 28 |
+
"<|vision_end|>": 151653,
|
| 29 |
+
"<|vision_pad|>": 151654,
|
| 30 |
+
"<|vision_start|>": 151652,
|
| 31 |
+
"<|vla|>": 151671
|
| 32 |
+
}
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% set state_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system
|
| 2 |
+
You are a helpful assistant.<|im_end|>
|
| 3 |
+
{% endif %}<|im_start|>{{ message['role'] }}
|
| 4 |
+
{% if message['content'] is string %}{{ message['content'] }}<|im_end|>
|
| 5 |
+
{% 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 content['type'] == 'state' or 'state' in content %}{% set state_count.value = state_count.value + 1 %}<|state_start|><|state_pad|><|state_end|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>
|
| 6 |
+
{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant
|
| 7 |
+
{% endif %}{{ noise_prompt }}
|
config.json
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"action_act": "linear",
|
| 3 |
+
"action_chunk_size": 16,
|
| 4 |
+
"action_pass_id": 151672,
|
| 5 |
+
"action_token_id": 151666,
|
| 6 |
+
"architectures": [
|
| 7 |
+
"EO1VisionFlowMatchingModel"
|
| 8 |
+
],
|
| 9 |
+
"attention_dropout": 0.0,
|
| 10 |
+
"auto_map": {
|
| 11 |
+
"AutoConfig": "configuration_eo1.EO1VisionFlowMatchingConfig",
|
| 12 |
+
"AutoModel": "modeling_eo1.EO1VisionFlowMatchingModel"
|
| 13 |
+
},
|
| 14 |
+
"dtype": "bfloat16",
|
| 15 |
+
"eos_token_id": 151645,
|
| 16 |
+
"hidden_act": "silu",
|
| 17 |
+
"hidden_size": 2048,
|
| 18 |
+
"image_token_id": 151655,
|
| 19 |
+
"initializer_range": 0.02,
|
| 20 |
+
"intermediate_size": 11008,
|
| 21 |
+
"max_action_dim": 32,
|
| 22 |
+
"max_position_embeddings": 128000,
|
| 23 |
+
"max_window_layers": 70,
|
| 24 |
+
"model_type": "eo1",
|
| 25 |
+
"num_action_layers": 2,
|
| 26 |
+
"num_attention_heads": 16,
|
| 27 |
+
"num_denoise_steps": 10,
|
| 28 |
+
"num_hidden_layers": 36,
|
| 29 |
+
"num_key_value_heads": 2,
|
| 30 |
+
"pad_token_id": 151643,
|
| 31 |
+
"rms_norm_eps": 1e-06,
|
| 32 |
+
"rope_scaling": {
|
| 33 |
+
"mrope_section": [
|
| 34 |
+
16,
|
| 35 |
+
24,
|
| 36 |
+
24
|
| 37 |
+
],
|
| 38 |
+
"rope_type": "default",
|
| 39 |
+
"type": "default"
|
| 40 |
+
},
|
| 41 |
+
"rope_theta": 1000000.0,
|
| 42 |
+
"sliding_window": 32768,
|
| 43 |
+
"state_token_id": 151669,
|
| 44 |
+
"text_config": {
|
| 45 |
+
"architectures": [
|
| 46 |
+
"Qwen2_5_VLForConditionalGeneration"
|
| 47 |
+
],
|
| 48 |
+
"attention_dropout": 0.0,
|
| 49 |
+
"bos_token_id": 151643,
|
| 50 |
+
"dtype": "bfloat16",
|
| 51 |
+
"eos_token_id": 151645,
|
| 52 |
+
"hidden_act": "silu",
|
| 53 |
+
"hidden_size": 2048,
|
| 54 |
+
"image_token_id": null,
|
| 55 |
+
"initializer_range": 0.02,
|
| 56 |
+
"intermediate_size": 11008,
|
| 57 |
+
"layer_types": [
|
| 58 |
+
"full_attention",
|
| 59 |
+
"full_attention",
|
| 60 |
+
"full_attention",
|
| 61 |
+
"full_attention",
|
| 62 |
+
"full_attention",
|
| 63 |
+
"full_attention",
|
| 64 |
+
"full_attention",
|
| 65 |
+
"full_attention",
|
| 66 |
+
"full_attention",
|
| 67 |
+
"full_attention",
|
| 68 |
+
"full_attention",
|
| 69 |
+
"full_attention",
|
| 70 |
+
"full_attention",
|
| 71 |
+
"full_attention",
|
| 72 |
+
"full_attention",
|
| 73 |
+
"full_attention",
|
| 74 |
+
"full_attention",
|
| 75 |
+
"full_attention",
|
| 76 |
+
"full_attention",
|
| 77 |
+
"full_attention",
|
| 78 |
+
"full_attention",
|
| 79 |
+
"full_attention",
|
| 80 |
+
"full_attention",
|
| 81 |
+
"full_attention",
|
| 82 |
+
"full_attention",
|
| 83 |
+
"full_attention",
|
| 84 |
+
"full_attention",
|
| 85 |
+
"full_attention",
|
| 86 |
+
"full_attention",
|
| 87 |
+
"full_attention",
|
| 88 |
+
"full_attention",
|
| 89 |
+
"full_attention",
|
| 90 |
+
"full_attention",
|
| 91 |
+
"full_attention",
|
| 92 |
+
"full_attention",
|
| 93 |
+
"full_attention"
|
| 94 |
+
],
|
| 95 |
+
"max_position_embeddings": 128000,
|
| 96 |
+
"max_window_layers": 70,
|
| 97 |
+
"model_type": "qwen2_5_vl_text",
|
| 98 |
+
"num_attention_heads": 16,
|
| 99 |
+
"num_hidden_layers": 36,
|
| 100 |
+
"num_key_value_heads": 2,
|
| 101 |
+
"rms_norm_eps": 1e-06,
|
| 102 |
+
"rope_scaling": {
|
| 103 |
+
"mrope_section": [
|
| 104 |
+
16,
|
| 105 |
+
24,
|
| 106 |
+
24
|
| 107 |
+
],
|
| 108 |
+
"rope_type": "default",
|
| 109 |
+
"type": "default"
|
| 110 |
+
},
|
| 111 |
+
"rope_theta": 1000000.0,
|
| 112 |
+
"sliding_window": null,
|
| 113 |
+
"tie_word_embeddings": true,
|
| 114 |
+
"use_cache": true,
|
| 115 |
+
"use_sliding_window": false,
|
| 116 |
+
"video_token_id": null,
|
| 117 |
+
"vision_end_token_id": 151653,
|
| 118 |
+
"vision_start_token_id": 151652,
|
| 119 |
+
"vision_token_id": 151654,
|
| 120 |
+
"vocab_size": 151936
|
| 121 |
+
},
|
| 122 |
+
"transformers_version": "4.56.0",
|
| 123 |
+
"use_cache": false,
|
| 124 |
+
"use_sliding_window": false,
|
| 125 |
+
"video_token_id": 151656,
|
| 126 |
+
"vision_config": {
|
| 127 |
+
"depth": 32,
|
| 128 |
+
"fullatt_block_indexes": [
|
| 129 |
+
7,
|
| 130 |
+
15,
|
| 131 |
+
23,
|
| 132 |
+
31
|
| 133 |
+
],
|
| 134 |
+
"hidden_act": "silu",
|
| 135 |
+
"hidden_size": 1280,
|
| 136 |
+
"in_channels": 3,
|
| 137 |
+
"in_chans": 3,
|
| 138 |
+
"initializer_range": 0.02,
|
| 139 |
+
"intermediate_size": 3420,
|
| 140 |
+
"model_type": "qwen2_5_vl",
|
| 141 |
+
"num_heads": 16,
|
| 142 |
+
"out_hidden_size": 2048,
|
| 143 |
+
"patch_size": 14,
|
| 144 |
+
"spatial_merge_size": 2,
|
| 145 |
+
"spatial_patch_size": 14,
|
| 146 |
+
"temporal_patch_size": 2,
|
| 147 |
+
"tokens_per_second": 2,
|
| 148 |
+
"window_size": 112
|
| 149 |
+
},
|
| 150 |
+
"vision_end_token_id": 151653,
|
| 151 |
+
"vision_start_token_id": 151652,
|
| 152 |
+
"vision_token_id": 151654,
|
| 153 |
+
"vocab_size": 151936
|
| 154 |
+
}
|
configuration_eo1.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2025 EO-Robotics Team. All rights reserved.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
from transformers.configuration_utils import PretrainedConfig
|
| 16 |
+
from transformers.models.qwen2_5_vl.configuration_qwen2_5_vl import (
|
| 17 |
+
Qwen2_5_VLTextConfig,
|
| 18 |
+
Qwen2_5_VLVisionConfig,
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class EO1VisionFlowMatchingConfig(PretrainedConfig):
|
| 23 |
+
model_type = "eo1"
|
| 24 |
+
sub_configs = {"vision_config": Qwen2_5_VLVisionConfig, "text_config": Qwen2_5_VLTextConfig}
|
| 25 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
| 26 |
+
|
| 27 |
+
def __init__(
|
| 28 |
+
self,
|
| 29 |
+
text_config=None,
|
| 30 |
+
vision_config=None,
|
| 31 |
+
image_token_id=151655,
|
| 32 |
+
video_token_id=151656,
|
| 33 |
+
action_chunk_size=50,
|
| 34 |
+
max_action_dim=32,
|
| 35 |
+
num_denoise_steps=10,
|
| 36 |
+
action_act="linear",
|
| 37 |
+
num_action_layers=2,
|
| 38 |
+
state_token_id=151669,
|
| 39 |
+
action_token_id=151666,
|
| 40 |
+
action_pass_id=151672,
|
| 41 |
+
**kwargs,
|
| 42 |
+
):
|
| 43 |
+
if isinstance(vision_config, dict):
|
| 44 |
+
self.vision_config = self.sub_configs["vision_config"](**vision_config)
|
| 45 |
+
elif vision_config is None:
|
| 46 |
+
self.vision_config = self.sub_configs["vision_config"](
|
| 47 |
+
hidden_size=1280,
|
| 48 |
+
out_hidden_size=2048,
|
| 49 |
+
tokens_per_second=2,
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
if isinstance(text_config, dict):
|
| 53 |
+
self.text_config = self.sub_configs["text_config"](**text_config)
|
| 54 |
+
elif text_config is None:
|
| 55 |
+
self.text_config = self.sub_configs["text_config"](**kwargs)
|
| 56 |
+
|
| 57 |
+
self.image_token_id = image_token_id
|
| 58 |
+
self.video_token_id = video_token_id
|
| 59 |
+
self.state_token_id = state_token_id
|
| 60 |
+
self.action_token_id = action_token_id
|
| 61 |
+
self.action_pass_id = action_pass_id
|
| 62 |
+
|
| 63 |
+
self.action_chunk_size = action_chunk_size
|
| 64 |
+
self.max_action_dim = max_action_dim
|
| 65 |
+
self.num_denoise_steps = num_denoise_steps
|
| 66 |
+
self.action_act = action_act
|
| 67 |
+
self.num_action_layers = num_action_layers
|
| 68 |
+
|
| 69 |
+
super().__init__(**kwargs)
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
EO1VisionFlowMatchingConfig.register_for_auto_class()
|
generation_config.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"eos_token_id": [
|
| 4 |
+
151645
|
| 5 |
+
],
|
| 6 |
+
"pad_token_id": 151643,
|
| 7 |
+
"transformers_version": "4.56.0"
|
| 8 |
+
}
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model-00001-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1a3fdefd3fae5e9f83370fd175580a2dc4cfeb19ba4460bc84f72a5bd55fa9ef
|
| 3 |
+
size 4997758920
|
model-00002-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d85331f8f3409925009b6c205efaf07a666ad62e6318afa643d34f111cfcb48a
|
| 3 |
+
size 2579527248
|
model.safetensors.index.json
ADDED
|
@@ -0,0 +1,844 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"metadata": {
|
| 3 |
+
"total_parameters": 3771607072,
|
| 4 |
+
"total_size": 7577182336
|
| 5 |
+
},
|
| 6 |
+
"weight_map": {
|
| 7 |
+
"action_in_proj.bias": "model-00002-of-00002.safetensors",
|
| 8 |
+
"action_in_proj.weight": "model-00002-of-00002.safetensors",
|
| 9 |
+
"action_out_proj.0.bias": "model-00002-of-00002.safetensors",
|
| 10 |
+
"action_out_proj.0.weight": "model-00002-of-00002.safetensors",
|
| 11 |
+
"action_out_proj.2.bias": "model-00002-of-00002.safetensors",
|
| 12 |
+
"action_out_proj.2.weight": "model-00002-of-00002.safetensors",
|
| 13 |
+
"action_time_mlp_in.bias": "model-00002-of-00002.safetensors",
|
| 14 |
+
"action_time_mlp_in.weight": "model-00002-of-00002.safetensors",
|
| 15 |
+
"action_time_mlp_out.bias": "model-00002-of-00002.safetensors",
|
| 16 |
+
"action_time_mlp_out.weight": "model-00002-of-00002.safetensors",
|
| 17 |
+
"state_proj.bias": "model-00002-of-00002.safetensors",
|
| 18 |
+
"state_proj.weight": "model-00002-of-00002.safetensors",
|
| 19 |
+
"vlm_backbone.model.embed_tokens.weight": "model-00001-of-00002.safetensors",
|
| 20 |
+
"vlm_backbone.model.layers.0.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 21 |
+
"vlm_backbone.model.layers.0.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 22 |
+
"vlm_backbone.model.layers.0.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 23 |
+
"vlm_backbone.model.layers.0.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 24 |
+
"vlm_backbone.model.layers.0.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 25 |
+
"vlm_backbone.model.layers.0.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 26 |
+
"vlm_backbone.model.layers.0.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 27 |
+
"vlm_backbone.model.layers.0.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 28 |
+
"vlm_backbone.model.layers.0.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 29 |
+
"vlm_backbone.model.layers.0.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 30 |
+
"vlm_backbone.model.layers.0.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 31 |
+
"vlm_backbone.model.layers.0.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 32 |
+
"vlm_backbone.model.layers.1.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 33 |
+
"vlm_backbone.model.layers.1.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 34 |
+
"vlm_backbone.model.layers.1.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 35 |
+
"vlm_backbone.model.layers.1.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 36 |
+
"vlm_backbone.model.layers.1.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 37 |
+
"vlm_backbone.model.layers.1.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 38 |
+
"vlm_backbone.model.layers.1.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 39 |
+
"vlm_backbone.model.layers.1.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 40 |
+
"vlm_backbone.model.layers.1.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 41 |
+
"vlm_backbone.model.layers.1.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 42 |
+
"vlm_backbone.model.layers.1.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 43 |
+
"vlm_backbone.model.layers.1.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 44 |
+
"vlm_backbone.model.layers.10.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 45 |
+
"vlm_backbone.model.layers.10.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 46 |
+
"vlm_backbone.model.layers.10.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 47 |
+
"vlm_backbone.model.layers.10.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 48 |
+
"vlm_backbone.model.layers.10.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 49 |
+
"vlm_backbone.model.layers.10.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 50 |
+
"vlm_backbone.model.layers.10.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 51 |
+
"vlm_backbone.model.layers.10.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 52 |
+
"vlm_backbone.model.layers.10.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 53 |
+
"vlm_backbone.model.layers.10.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 54 |
+
"vlm_backbone.model.layers.10.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 55 |
+
"vlm_backbone.model.layers.10.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 56 |
+
"vlm_backbone.model.layers.11.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 57 |
+
"vlm_backbone.model.layers.11.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 58 |
+
"vlm_backbone.model.layers.11.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 59 |
+
"vlm_backbone.model.layers.11.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 60 |
+
"vlm_backbone.model.layers.11.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 61 |
+
"vlm_backbone.model.layers.11.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 62 |
+
"vlm_backbone.model.layers.11.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 63 |
+
"vlm_backbone.model.layers.11.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 64 |
+
"vlm_backbone.model.layers.11.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 65 |
+
"vlm_backbone.model.layers.11.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 66 |
+
"vlm_backbone.model.layers.11.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 67 |
+
"vlm_backbone.model.layers.11.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 68 |
+
"vlm_backbone.model.layers.12.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 69 |
+
"vlm_backbone.model.layers.12.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 70 |
+
"vlm_backbone.model.layers.12.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 71 |
+
"vlm_backbone.model.layers.12.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 72 |
+
"vlm_backbone.model.layers.12.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 73 |
+
"vlm_backbone.model.layers.12.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 74 |
+
"vlm_backbone.model.layers.12.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 75 |
+
"vlm_backbone.model.layers.12.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 76 |
+
"vlm_backbone.model.layers.12.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 77 |
+
"vlm_backbone.model.layers.12.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 78 |
+
"vlm_backbone.model.layers.12.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 79 |
+
"vlm_backbone.model.layers.12.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 80 |
+
"vlm_backbone.model.layers.13.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 81 |
+
"vlm_backbone.model.layers.13.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 82 |
+
"vlm_backbone.model.layers.13.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 83 |
+
"vlm_backbone.model.layers.13.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 84 |
+
"vlm_backbone.model.layers.13.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 85 |
+
"vlm_backbone.model.layers.13.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 86 |
+
"vlm_backbone.model.layers.13.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 87 |
+
"vlm_backbone.model.layers.13.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 88 |
+
"vlm_backbone.model.layers.13.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 89 |
+
"vlm_backbone.model.layers.13.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 90 |
+
"vlm_backbone.model.layers.13.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 91 |
+
"vlm_backbone.model.layers.13.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 92 |
+
"vlm_backbone.model.layers.14.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 93 |
+
"vlm_backbone.model.layers.14.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 94 |
+
"vlm_backbone.model.layers.14.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 95 |
+
"vlm_backbone.model.layers.14.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 96 |
+
"vlm_backbone.model.layers.14.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 97 |
+
"vlm_backbone.model.layers.14.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 98 |
+
"vlm_backbone.model.layers.14.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 99 |
+
"vlm_backbone.model.layers.14.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 100 |
+
"vlm_backbone.model.layers.14.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 101 |
+
"vlm_backbone.model.layers.14.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 102 |
+
"vlm_backbone.model.layers.14.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 103 |
+
"vlm_backbone.model.layers.14.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 104 |
+
"vlm_backbone.model.layers.15.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 105 |
+
"vlm_backbone.model.layers.15.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 106 |
+
"vlm_backbone.model.layers.15.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 107 |
+
"vlm_backbone.model.layers.15.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 108 |
+
"vlm_backbone.model.layers.15.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 109 |
+
"vlm_backbone.model.layers.15.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 110 |
+
"vlm_backbone.model.layers.15.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 111 |
+
"vlm_backbone.model.layers.15.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 112 |
+
"vlm_backbone.model.layers.15.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 113 |
+
"vlm_backbone.model.layers.15.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 114 |
+
"vlm_backbone.model.layers.15.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 115 |
+
"vlm_backbone.model.layers.15.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 116 |
+
"vlm_backbone.model.layers.16.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 117 |
+
"vlm_backbone.model.layers.16.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 118 |
+
"vlm_backbone.model.layers.16.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 119 |
+
"vlm_backbone.model.layers.16.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 120 |
+
"vlm_backbone.model.layers.16.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 121 |
+
"vlm_backbone.model.layers.16.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 122 |
+
"vlm_backbone.model.layers.16.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 123 |
+
"vlm_backbone.model.layers.16.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 124 |
+
"vlm_backbone.model.layers.16.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 125 |
+
"vlm_backbone.model.layers.16.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 126 |
+
"vlm_backbone.model.layers.16.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 127 |
+
"vlm_backbone.model.layers.16.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 128 |
+
"vlm_backbone.model.layers.17.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 129 |
+
"vlm_backbone.model.layers.17.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 130 |
+
"vlm_backbone.model.layers.17.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 131 |
+
"vlm_backbone.model.layers.17.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 132 |
+
"vlm_backbone.model.layers.17.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 133 |
+
"vlm_backbone.model.layers.17.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 134 |
+
"vlm_backbone.model.layers.17.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 135 |
+
"vlm_backbone.model.layers.17.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 136 |
+
"vlm_backbone.model.layers.17.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 137 |
+
"vlm_backbone.model.layers.17.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 138 |
+
"vlm_backbone.model.layers.17.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 139 |
+
"vlm_backbone.model.layers.17.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 140 |
+
"vlm_backbone.model.layers.18.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 141 |
+
"vlm_backbone.model.layers.18.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 142 |
+
"vlm_backbone.model.layers.18.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 143 |
+
"vlm_backbone.model.layers.18.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 144 |
+
"vlm_backbone.model.layers.18.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 145 |
+
"vlm_backbone.model.layers.18.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 146 |
+
"vlm_backbone.model.layers.18.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 147 |
+
"vlm_backbone.model.layers.18.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 148 |
+
"vlm_backbone.model.layers.18.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 149 |
+
"vlm_backbone.model.layers.18.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 150 |
+
"vlm_backbone.model.layers.18.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 151 |
+
"vlm_backbone.model.layers.18.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 152 |
+
"vlm_backbone.model.layers.19.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 153 |
+
"vlm_backbone.model.layers.19.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 154 |
+
"vlm_backbone.model.layers.19.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 155 |
+
"vlm_backbone.model.layers.19.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 156 |
+
"vlm_backbone.model.layers.19.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 157 |
+
"vlm_backbone.model.layers.19.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 158 |
+
"vlm_backbone.model.layers.19.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 159 |
+
"vlm_backbone.model.layers.19.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 160 |
+
"vlm_backbone.model.layers.19.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 161 |
+
"vlm_backbone.model.layers.19.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 162 |
+
"vlm_backbone.model.layers.19.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 163 |
+
"vlm_backbone.model.layers.19.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 164 |
+
"vlm_backbone.model.layers.2.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 165 |
+
"vlm_backbone.model.layers.2.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 166 |
+
"vlm_backbone.model.layers.2.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 167 |
+
"vlm_backbone.model.layers.2.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 168 |
+
"vlm_backbone.model.layers.2.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 169 |
+
"vlm_backbone.model.layers.2.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 170 |
+
"vlm_backbone.model.layers.2.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 171 |
+
"vlm_backbone.model.layers.2.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 172 |
+
"vlm_backbone.model.layers.2.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 173 |
+
"vlm_backbone.model.layers.2.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 174 |
+
"vlm_backbone.model.layers.2.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 175 |
+
"vlm_backbone.model.layers.2.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 176 |
+
"vlm_backbone.model.layers.20.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 177 |
+
"vlm_backbone.model.layers.20.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 178 |
+
"vlm_backbone.model.layers.20.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 179 |
+
"vlm_backbone.model.layers.20.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 180 |
+
"vlm_backbone.model.layers.20.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 181 |
+
"vlm_backbone.model.layers.20.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
|
| 182 |
+
"vlm_backbone.model.layers.20.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 183 |
+
"vlm_backbone.model.layers.20.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 184 |
+
"vlm_backbone.model.layers.20.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
|
| 185 |
+
"vlm_backbone.model.layers.20.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 186 |
+
"vlm_backbone.model.layers.20.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
|
| 187 |
+
"vlm_backbone.model.layers.20.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 188 |
+
"vlm_backbone.model.layers.21.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 189 |
+
"vlm_backbone.model.layers.21.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 190 |
+
"vlm_backbone.model.layers.21.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 191 |
+
"vlm_backbone.model.layers.21.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 192 |
+
"vlm_backbone.model.layers.21.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 193 |
+
"vlm_backbone.model.layers.21.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
|
| 194 |
+
"vlm_backbone.model.layers.21.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 195 |
+
"vlm_backbone.model.layers.21.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 196 |
+
"vlm_backbone.model.layers.21.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
|
| 197 |
+
"vlm_backbone.model.layers.21.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 198 |
+
"vlm_backbone.model.layers.21.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
|
| 199 |
+
"vlm_backbone.model.layers.21.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 200 |
+
"vlm_backbone.model.layers.22.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 201 |
+
"vlm_backbone.model.layers.22.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 202 |
+
"vlm_backbone.model.layers.22.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 203 |
+
"vlm_backbone.model.layers.22.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 204 |
+
"vlm_backbone.model.layers.22.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 205 |
+
"vlm_backbone.model.layers.22.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
|
| 206 |
+
"vlm_backbone.model.layers.22.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 207 |
+
"vlm_backbone.model.layers.22.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 208 |
+
"vlm_backbone.model.layers.22.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
|
| 209 |
+
"vlm_backbone.model.layers.22.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 210 |
+
"vlm_backbone.model.layers.22.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
|
| 211 |
+
"vlm_backbone.model.layers.22.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 212 |
+
"vlm_backbone.model.layers.23.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 213 |
+
"vlm_backbone.model.layers.23.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 214 |
+
"vlm_backbone.model.layers.23.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 215 |
+
"vlm_backbone.model.layers.23.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 216 |
+
"vlm_backbone.model.layers.23.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 217 |
+
"vlm_backbone.model.layers.23.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
|
| 218 |
+
"vlm_backbone.model.layers.23.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 219 |
+
"vlm_backbone.model.layers.23.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 220 |
+
"vlm_backbone.model.layers.23.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
|
| 221 |
+
"vlm_backbone.model.layers.23.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 222 |
+
"vlm_backbone.model.layers.23.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
|
| 223 |
+
"vlm_backbone.model.layers.23.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 224 |
+
"vlm_backbone.model.layers.24.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 225 |
+
"vlm_backbone.model.layers.24.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 226 |
+
"vlm_backbone.model.layers.24.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 227 |
+
"vlm_backbone.model.layers.24.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 228 |
+
"vlm_backbone.model.layers.24.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 229 |
+
"vlm_backbone.model.layers.24.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
|
| 230 |
+
"vlm_backbone.model.layers.24.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 231 |
+
"vlm_backbone.model.layers.24.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 232 |
+
"vlm_backbone.model.layers.24.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
|
| 233 |
+
"vlm_backbone.model.layers.24.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 234 |
+
"vlm_backbone.model.layers.24.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
|
| 235 |
+
"vlm_backbone.model.layers.24.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 236 |
+
"vlm_backbone.model.layers.25.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 237 |
+
"vlm_backbone.model.layers.25.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 238 |
+
"vlm_backbone.model.layers.25.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 239 |
+
"vlm_backbone.model.layers.25.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 240 |
+
"vlm_backbone.model.layers.25.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 241 |
+
"vlm_backbone.model.layers.25.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
|
| 242 |
+
"vlm_backbone.model.layers.25.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 243 |
+
"vlm_backbone.model.layers.25.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 244 |
+
"vlm_backbone.model.layers.25.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
|
| 245 |
+
"vlm_backbone.model.layers.25.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 246 |
+
"vlm_backbone.model.layers.25.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
|
| 247 |
+
"vlm_backbone.model.layers.25.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 248 |
+
"vlm_backbone.model.layers.26.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 249 |
+
"vlm_backbone.model.layers.26.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 250 |
+
"vlm_backbone.model.layers.26.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 251 |
+
"vlm_backbone.model.layers.26.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 252 |
+
"vlm_backbone.model.layers.26.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 253 |
+
"vlm_backbone.model.layers.26.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
|
| 254 |
+
"vlm_backbone.model.layers.26.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 255 |
+
"vlm_backbone.model.layers.26.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 256 |
+
"vlm_backbone.model.layers.26.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
|
| 257 |
+
"vlm_backbone.model.layers.26.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 258 |
+
"vlm_backbone.model.layers.26.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
|
| 259 |
+
"vlm_backbone.model.layers.26.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 260 |
+
"vlm_backbone.model.layers.27.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 261 |
+
"vlm_backbone.model.layers.27.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 262 |
+
"vlm_backbone.model.layers.27.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 263 |
+
"vlm_backbone.model.layers.27.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 264 |
+
"vlm_backbone.model.layers.27.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 265 |
+
"vlm_backbone.model.layers.27.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
|
| 266 |
+
"vlm_backbone.model.layers.27.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 267 |
+
"vlm_backbone.model.layers.27.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 268 |
+
"vlm_backbone.model.layers.27.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
|
| 269 |
+
"vlm_backbone.model.layers.27.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 270 |
+
"vlm_backbone.model.layers.27.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
|
| 271 |
+
"vlm_backbone.model.layers.27.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 272 |
+
"vlm_backbone.model.layers.28.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 273 |
+
"vlm_backbone.model.layers.28.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 274 |
+
"vlm_backbone.model.layers.28.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 275 |
+
"vlm_backbone.model.layers.28.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 276 |
+
"vlm_backbone.model.layers.28.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 277 |
+
"vlm_backbone.model.layers.28.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
|
| 278 |
+
"vlm_backbone.model.layers.28.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 279 |
+
"vlm_backbone.model.layers.28.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 280 |
+
"vlm_backbone.model.layers.28.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
|
| 281 |
+
"vlm_backbone.model.layers.28.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 282 |
+
"vlm_backbone.model.layers.28.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
|
| 283 |
+
"vlm_backbone.model.layers.28.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 284 |
+
"vlm_backbone.model.layers.29.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 285 |
+
"vlm_backbone.model.layers.29.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 286 |
+
"vlm_backbone.model.layers.29.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 287 |
+
"vlm_backbone.model.layers.29.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 288 |
+
"vlm_backbone.model.layers.29.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 289 |
+
"vlm_backbone.model.layers.29.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
|
| 290 |
+
"vlm_backbone.model.layers.29.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 291 |
+
"vlm_backbone.model.layers.29.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 292 |
+
"vlm_backbone.model.layers.29.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
|
| 293 |
+
"vlm_backbone.model.layers.29.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 294 |
+
"vlm_backbone.model.layers.29.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
|
| 295 |
+
"vlm_backbone.model.layers.29.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 296 |
+
"vlm_backbone.model.layers.3.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 297 |
+
"vlm_backbone.model.layers.3.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 298 |
+
"vlm_backbone.model.layers.3.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 299 |
+
"vlm_backbone.model.layers.3.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 300 |
+
"vlm_backbone.model.layers.3.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 301 |
+
"vlm_backbone.model.layers.3.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 302 |
+
"vlm_backbone.model.layers.3.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 303 |
+
"vlm_backbone.model.layers.3.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 304 |
+
"vlm_backbone.model.layers.3.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 305 |
+
"vlm_backbone.model.layers.3.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 306 |
+
"vlm_backbone.model.layers.3.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 307 |
+
"vlm_backbone.model.layers.3.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 308 |
+
"vlm_backbone.model.layers.30.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 309 |
+
"vlm_backbone.model.layers.30.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 310 |
+
"vlm_backbone.model.layers.30.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 311 |
+
"vlm_backbone.model.layers.30.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 312 |
+
"vlm_backbone.model.layers.30.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 313 |
+
"vlm_backbone.model.layers.30.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
|
| 314 |
+
"vlm_backbone.model.layers.30.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 315 |
+
"vlm_backbone.model.layers.30.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 316 |
+
"vlm_backbone.model.layers.30.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
|
| 317 |
+
"vlm_backbone.model.layers.30.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 318 |
+
"vlm_backbone.model.layers.30.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
|
| 319 |
+
"vlm_backbone.model.layers.30.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 320 |
+
"vlm_backbone.model.layers.31.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 321 |
+
"vlm_backbone.model.layers.31.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 322 |
+
"vlm_backbone.model.layers.31.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 323 |
+
"vlm_backbone.model.layers.31.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 324 |
+
"vlm_backbone.model.layers.31.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 325 |
+
"vlm_backbone.model.layers.31.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
|
| 326 |
+
"vlm_backbone.model.layers.31.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 327 |
+
"vlm_backbone.model.layers.31.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 328 |
+
"vlm_backbone.model.layers.31.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
|
| 329 |
+
"vlm_backbone.model.layers.31.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 330 |
+
"vlm_backbone.model.layers.31.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
|
| 331 |
+
"vlm_backbone.model.layers.31.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 332 |
+
"vlm_backbone.model.layers.32.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 333 |
+
"vlm_backbone.model.layers.32.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 334 |
+
"vlm_backbone.model.layers.32.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 335 |
+
"vlm_backbone.model.layers.32.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 336 |
+
"vlm_backbone.model.layers.32.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 337 |
+
"vlm_backbone.model.layers.32.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
|
| 338 |
+
"vlm_backbone.model.layers.32.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 339 |
+
"vlm_backbone.model.layers.32.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 340 |
+
"vlm_backbone.model.layers.32.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
|
| 341 |
+
"vlm_backbone.model.layers.32.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 342 |
+
"vlm_backbone.model.layers.32.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
|
| 343 |
+
"vlm_backbone.model.layers.32.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 344 |
+
"vlm_backbone.model.layers.33.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 345 |
+
"vlm_backbone.model.layers.33.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 346 |
+
"vlm_backbone.model.layers.33.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 347 |
+
"vlm_backbone.model.layers.33.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 348 |
+
"vlm_backbone.model.layers.33.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 349 |
+
"vlm_backbone.model.layers.33.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
|
| 350 |
+
"vlm_backbone.model.layers.33.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 351 |
+
"vlm_backbone.model.layers.33.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 352 |
+
"vlm_backbone.model.layers.33.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
|
| 353 |
+
"vlm_backbone.model.layers.33.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 354 |
+
"vlm_backbone.model.layers.33.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
|
| 355 |
+
"vlm_backbone.model.layers.33.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 356 |
+
"vlm_backbone.model.layers.34.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 357 |
+
"vlm_backbone.model.layers.34.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 358 |
+
"vlm_backbone.model.layers.34.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 359 |
+
"vlm_backbone.model.layers.34.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 360 |
+
"vlm_backbone.model.layers.34.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 361 |
+
"vlm_backbone.model.layers.34.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
|
| 362 |
+
"vlm_backbone.model.layers.34.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 363 |
+
"vlm_backbone.model.layers.34.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 364 |
+
"vlm_backbone.model.layers.34.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
|
| 365 |
+
"vlm_backbone.model.layers.34.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 366 |
+
"vlm_backbone.model.layers.34.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
|
| 367 |
+
"vlm_backbone.model.layers.34.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 368 |
+
"vlm_backbone.model.layers.35.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 369 |
+
"vlm_backbone.model.layers.35.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 370 |
+
"vlm_backbone.model.layers.35.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
| 371 |
+
"vlm_backbone.model.layers.35.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
|
| 372 |
+
"vlm_backbone.model.layers.35.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 373 |
+
"vlm_backbone.model.layers.35.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
|
| 374 |
+
"vlm_backbone.model.layers.35.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
|
| 375 |
+
"vlm_backbone.model.layers.35.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
| 376 |
+
"vlm_backbone.model.layers.35.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
|
| 377 |
+
"vlm_backbone.model.layers.35.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
|
| 378 |
+
"vlm_backbone.model.layers.35.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
|
| 379 |
+
"vlm_backbone.model.layers.35.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
|
| 380 |
+
"vlm_backbone.model.layers.4.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 381 |
+
"vlm_backbone.model.layers.4.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 382 |
+
"vlm_backbone.model.layers.4.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 383 |
+
"vlm_backbone.model.layers.4.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 384 |
+
"vlm_backbone.model.layers.4.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 385 |
+
"vlm_backbone.model.layers.4.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 386 |
+
"vlm_backbone.model.layers.4.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 387 |
+
"vlm_backbone.model.layers.4.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 388 |
+
"vlm_backbone.model.layers.4.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 389 |
+
"vlm_backbone.model.layers.4.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 390 |
+
"vlm_backbone.model.layers.4.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 391 |
+
"vlm_backbone.model.layers.4.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 392 |
+
"vlm_backbone.model.layers.5.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 393 |
+
"vlm_backbone.model.layers.5.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 394 |
+
"vlm_backbone.model.layers.5.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 395 |
+
"vlm_backbone.model.layers.5.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 396 |
+
"vlm_backbone.model.layers.5.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 397 |
+
"vlm_backbone.model.layers.5.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 398 |
+
"vlm_backbone.model.layers.5.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 399 |
+
"vlm_backbone.model.layers.5.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 400 |
+
"vlm_backbone.model.layers.5.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 401 |
+
"vlm_backbone.model.layers.5.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 402 |
+
"vlm_backbone.model.layers.5.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 403 |
+
"vlm_backbone.model.layers.5.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 404 |
+
"vlm_backbone.model.layers.6.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 405 |
+
"vlm_backbone.model.layers.6.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 406 |
+
"vlm_backbone.model.layers.6.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 407 |
+
"vlm_backbone.model.layers.6.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 408 |
+
"vlm_backbone.model.layers.6.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 409 |
+
"vlm_backbone.model.layers.6.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 410 |
+
"vlm_backbone.model.layers.6.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 411 |
+
"vlm_backbone.model.layers.6.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 412 |
+
"vlm_backbone.model.layers.6.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 413 |
+
"vlm_backbone.model.layers.6.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 414 |
+
"vlm_backbone.model.layers.6.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 415 |
+
"vlm_backbone.model.layers.6.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 416 |
+
"vlm_backbone.model.layers.7.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 417 |
+
"vlm_backbone.model.layers.7.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 418 |
+
"vlm_backbone.model.layers.7.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 419 |
+
"vlm_backbone.model.layers.7.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 420 |
+
"vlm_backbone.model.layers.7.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 421 |
+
"vlm_backbone.model.layers.7.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 422 |
+
"vlm_backbone.model.layers.7.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 423 |
+
"vlm_backbone.model.layers.7.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 424 |
+
"vlm_backbone.model.layers.7.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 425 |
+
"vlm_backbone.model.layers.7.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 426 |
+
"vlm_backbone.model.layers.7.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 427 |
+
"vlm_backbone.model.layers.7.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 428 |
+
"vlm_backbone.model.layers.8.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 429 |
+
"vlm_backbone.model.layers.8.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 430 |
+
"vlm_backbone.model.layers.8.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 431 |
+
"vlm_backbone.model.layers.8.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 432 |
+
"vlm_backbone.model.layers.8.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 433 |
+
"vlm_backbone.model.layers.8.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 434 |
+
"vlm_backbone.model.layers.8.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 435 |
+
"vlm_backbone.model.layers.8.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 436 |
+
"vlm_backbone.model.layers.8.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 437 |
+
"vlm_backbone.model.layers.8.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 438 |
+
"vlm_backbone.model.layers.8.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 439 |
+
"vlm_backbone.model.layers.8.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 440 |
+
"vlm_backbone.model.layers.9.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 441 |
+
"vlm_backbone.model.layers.9.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 442 |
+
"vlm_backbone.model.layers.9.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 443 |
+
"vlm_backbone.model.layers.9.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 444 |
+
"vlm_backbone.model.layers.9.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 445 |
+
"vlm_backbone.model.layers.9.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
|
| 446 |
+
"vlm_backbone.model.layers.9.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 447 |
+
"vlm_backbone.model.layers.9.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 448 |
+
"vlm_backbone.model.layers.9.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
|
| 449 |
+
"vlm_backbone.model.layers.9.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 450 |
+
"vlm_backbone.model.layers.9.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
|
| 451 |
+
"vlm_backbone.model.layers.9.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 452 |
+
"vlm_backbone.model.norm.weight": "model-00002-of-00002.safetensors",
|
| 453 |
+
"vlm_backbone.visual.blocks.0.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 454 |
+
"vlm_backbone.visual.blocks.0.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 455 |
+
"vlm_backbone.visual.blocks.0.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 456 |
+
"vlm_backbone.visual.blocks.0.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 457 |
+
"vlm_backbone.visual.blocks.0.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 458 |
+
"vlm_backbone.visual.blocks.0.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 459 |
+
"vlm_backbone.visual.blocks.0.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 460 |
+
"vlm_backbone.visual.blocks.0.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 461 |
+
"vlm_backbone.visual.blocks.0.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 462 |
+
"vlm_backbone.visual.blocks.0.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 463 |
+
"vlm_backbone.visual.blocks.0.norm1.weight": "model-00001-of-00002.safetensors",
|
| 464 |
+
"vlm_backbone.visual.blocks.0.norm2.weight": "model-00001-of-00002.safetensors",
|
| 465 |
+
"vlm_backbone.visual.blocks.1.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 466 |
+
"vlm_backbone.visual.blocks.1.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 467 |
+
"vlm_backbone.visual.blocks.1.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 468 |
+
"vlm_backbone.visual.blocks.1.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 469 |
+
"vlm_backbone.visual.blocks.1.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 470 |
+
"vlm_backbone.visual.blocks.1.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 471 |
+
"vlm_backbone.visual.blocks.1.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 472 |
+
"vlm_backbone.visual.blocks.1.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 473 |
+
"vlm_backbone.visual.blocks.1.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 474 |
+
"vlm_backbone.visual.blocks.1.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 475 |
+
"vlm_backbone.visual.blocks.1.norm1.weight": "model-00001-of-00002.safetensors",
|
| 476 |
+
"vlm_backbone.visual.blocks.1.norm2.weight": "model-00001-of-00002.safetensors",
|
| 477 |
+
"vlm_backbone.visual.blocks.10.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 478 |
+
"vlm_backbone.visual.blocks.10.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 479 |
+
"vlm_backbone.visual.blocks.10.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 480 |
+
"vlm_backbone.visual.blocks.10.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 481 |
+
"vlm_backbone.visual.blocks.10.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 482 |
+
"vlm_backbone.visual.blocks.10.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 483 |
+
"vlm_backbone.visual.blocks.10.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 484 |
+
"vlm_backbone.visual.blocks.10.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 485 |
+
"vlm_backbone.visual.blocks.10.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 486 |
+
"vlm_backbone.visual.blocks.10.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 487 |
+
"vlm_backbone.visual.blocks.10.norm1.weight": "model-00001-of-00002.safetensors",
|
| 488 |
+
"vlm_backbone.visual.blocks.10.norm2.weight": "model-00001-of-00002.safetensors",
|
| 489 |
+
"vlm_backbone.visual.blocks.11.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 490 |
+
"vlm_backbone.visual.blocks.11.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 491 |
+
"vlm_backbone.visual.blocks.11.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 492 |
+
"vlm_backbone.visual.blocks.11.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 493 |
+
"vlm_backbone.visual.blocks.11.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 494 |
+
"vlm_backbone.visual.blocks.11.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 495 |
+
"vlm_backbone.visual.blocks.11.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 496 |
+
"vlm_backbone.visual.blocks.11.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 497 |
+
"vlm_backbone.visual.blocks.11.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 498 |
+
"vlm_backbone.visual.blocks.11.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 499 |
+
"vlm_backbone.visual.blocks.11.norm1.weight": "model-00001-of-00002.safetensors",
|
| 500 |
+
"vlm_backbone.visual.blocks.11.norm2.weight": "model-00001-of-00002.safetensors",
|
| 501 |
+
"vlm_backbone.visual.blocks.12.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 502 |
+
"vlm_backbone.visual.blocks.12.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 503 |
+
"vlm_backbone.visual.blocks.12.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 504 |
+
"vlm_backbone.visual.blocks.12.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 505 |
+
"vlm_backbone.visual.blocks.12.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 506 |
+
"vlm_backbone.visual.blocks.12.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 507 |
+
"vlm_backbone.visual.blocks.12.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 508 |
+
"vlm_backbone.visual.blocks.12.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 509 |
+
"vlm_backbone.visual.blocks.12.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 510 |
+
"vlm_backbone.visual.blocks.12.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 511 |
+
"vlm_backbone.visual.blocks.12.norm1.weight": "model-00001-of-00002.safetensors",
|
| 512 |
+
"vlm_backbone.visual.blocks.12.norm2.weight": "model-00001-of-00002.safetensors",
|
| 513 |
+
"vlm_backbone.visual.blocks.13.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 514 |
+
"vlm_backbone.visual.blocks.13.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 515 |
+
"vlm_backbone.visual.blocks.13.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 516 |
+
"vlm_backbone.visual.blocks.13.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 517 |
+
"vlm_backbone.visual.blocks.13.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 518 |
+
"vlm_backbone.visual.blocks.13.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 519 |
+
"vlm_backbone.visual.blocks.13.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 520 |
+
"vlm_backbone.visual.blocks.13.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 521 |
+
"vlm_backbone.visual.blocks.13.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 522 |
+
"vlm_backbone.visual.blocks.13.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 523 |
+
"vlm_backbone.visual.blocks.13.norm1.weight": "model-00001-of-00002.safetensors",
|
| 524 |
+
"vlm_backbone.visual.blocks.13.norm2.weight": "model-00001-of-00002.safetensors",
|
| 525 |
+
"vlm_backbone.visual.blocks.14.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 526 |
+
"vlm_backbone.visual.blocks.14.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 527 |
+
"vlm_backbone.visual.blocks.14.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 528 |
+
"vlm_backbone.visual.blocks.14.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 529 |
+
"vlm_backbone.visual.blocks.14.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 530 |
+
"vlm_backbone.visual.blocks.14.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 531 |
+
"vlm_backbone.visual.blocks.14.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 532 |
+
"vlm_backbone.visual.blocks.14.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 533 |
+
"vlm_backbone.visual.blocks.14.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 534 |
+
"vlm_backbone.visual.blocks.14.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 535 |
+
"vlm_backbone.visual.blocks.14.norm1.weight": "model-00001-of-00002.safetensors",
|
| 536 |
+
"vlm_backbone.visual.blocks.14.norm2.weight": "model-00001-of-00002.safetensors",
|
| 537 |
+
"vlm_backbone.visual.blocks.15.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 538 |
+
"vlm_backbone.visual.blocks.15.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 539 |
+
"vlm_backbone.visual.blocks.15.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 540 |
+
"vlm_backbone.visual.blocks.15.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 541 |
+
"vlm_backbone.visual.blocks.15.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 542 |
+
"vlm_backbone.visual.blocks.15.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 543 |
+
"vlm_backbone.visual.blocks.15.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 544 |
+
"vlm_backbone.visual.blocks.15.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 545 |
+
"vlm_backbone.visual.blocks.15.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 546 |
+
"vlm_backbone.visual.blocks.15.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 547 |
+
"vlm_backbone.visual.blocks.15.norm1.weight": "model-00001-of-00002.safetensors",
|
| 548 |
+
"vlm_backbone.visual.blocks.15.norm2.weight": "model-00001-of-00002.safetensors",
|
| 549 |
+
"vlm_backbone.visual.blocks.16.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 550 |
+
"vlm_backbone.visual.blocks.16.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 551 |
+
"vlm_backbone.visual.blocks.16.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 552 |
+
"vlm_backbone.visual.blocks.16.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 553 |
+
"vlm_backbone.visual.blocks.16.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 554 |
+
"vlm_backbone.visual.blocks.16.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 555 |
+
"vlm_backbone.visual.blocks.16.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 556 |
+
"vlm_backbone.visual.blocks.16.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 557 |
+
"vlm_backbone.visual.blocks.16.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 558 |
+
"vlm_backbone.visual.blocks.16.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 559 |
+
"vlm_backbone.visual.blocks.16.norm1.weight": "model-00001-of-00002.safetensors",
|
| 560 |
+
"vlm_backbone.visual.blocks.16.norm2.weight": "model-00001-of-00002.safetensors",
|
| 561 |
+
"vlm_backbone.visual.blocks.17.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 562 |
+
"vlm_backbone.visual.blocks.17.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 563 |
+
"vlm_backbone.visual.blocks.17.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 564 |
+
"vlm_backbone.visual.blocks.17.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 565 |
+
"vlm_backbone.visual.blocks.17.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 566 |
+
"vlm_backbone.visual.blocks.17.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 567 |
+
"vlm_backbone.visual.blocks.17.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 568 |
+
"vlm_backbone.visual.blocks.17.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 569 |
+
"vlm_backbone.visual.blocks.17.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 570 |
+
"vlm_backbone.visual.blocks.17.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 571 |
+
"vlm_backbone.visual.blocks.17.norm1.weight": "model-00001-of-00002.safetensors",
|
| 572 |
+
"vlm_backbone.visual.blocks.17.norm2.weight": "model-00001-of-00002.safetensors",
|
| 573 |
+
"vlm_backbone.visual.blocks.18.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 574 |
+
"vlm_backbone.visual.blocks.18.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 575 |
+
"vlm_backbone.visual.blocks.18.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 576 |
+
"vlm_backbone.visual.blocks.18.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 577 |
+
"vlm_backbone.visual.blocks.18.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 578 |
+
"vlm_backbone.visual.blocks.18.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 579 |
+
"vlm_backbone.visual.blocks.18.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 580 |
+
"vlm_backbone.visual.blocks.18.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 581 |
+
"vlm_backbone.visual.blocks.18.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 582 |
+
"vlm_backbone.visual.blocks.18.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 583 |
+
"vlm_backbone.visual.blocks.18.norm1.weight": "model-00001-of-00002.safetensors",
|
| 584 |
+
"vlm_backbone.visual.blocks.18.norm2.weight": "model-00001-of-00002.safetensors",
|
| 585 |
+
"vlm_backbone.visual.blocks.19.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 586 |
+
"vlm_backbone.visual.blocks.19.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 587 |
+
"vlm_backbone.visual.blocks.19.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 588 |
+
"vlm_backbone.visual.blocks.19.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 589 |
+
"vlm_backbone.visual.blocks.19.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 590 |
+
"vlm_backbone.visual.blocks.19.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 591 |
+
"vlm_backbone.visual.blocks.19.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 592 |
+
"vlm_backbone.visual.blocks.19.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 593 |
+
"vlm_backbone.visual.blocks.19.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 594 |
+
"vlm_backbone.visual.blocks.19.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 595 |
+
"vlm_backbone.visual.blocks.19.norm1.weight": "model-00001-of-00002.safetensors",
|
| 596 |
+
"vlm_backbone.visual.blocks.19.norm2.weight": "model-00001-of-00002.safetensors",
|
| 597 |
+
"vlm_backbone.visual.blocks.2.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 598 |
+
"vlm_backbone.visual.blocks.2.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 599 |
+
"vlm_backbone.visual.blocks.2.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 600 |
+
"vlm_backbone.visual.blocks.2.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 601 |
+
"vlm_backbone.visual.blocks.2.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 602 |
+
"vlm_backbone.visual.blocks.2.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 603 |
+
"vlm_backbone.visual.blocks.2.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 604 |
+
"vlm_backbone.visual.blocks.2.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 605 |
+
"vlm_backbone.visual.blocks.2.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 606 |
+
"vlm_backbone.visual.blocks.2.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 607 |
+
"vlm_backbone.visual.blocks.2.norm1.weight": "model-00001-of-00002.safetensors",
|
| 608 |
+
"vlm_backbone.visual.blocks.2.norm2.weight": "model-00001-of-00002.safetensors",
|
| 609 |
+
"vlm_backbone.visual.blocks.20.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 610 |
+
"vlm_backbone.visual.blocks.20.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 611 |
+
"vlm_backbone.visual.blocks.20.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 612 |
+
"vlm_backbone.visual.blocks.20.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 613 |
+
"vlm_backbone.visual.blocks.20.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 614 |
+
"vlm_backbone.visual.blocks.20.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 615 |
+
"vlm_backbone.visual.blocks.20.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 616 |
+
"vlm_backbone.visual.blocks.20.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 617 |
+
"vlm_backbone.visual.blocks.20.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 618 |
+
"vlm_backbone.visual.blocks.20.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 619 |
+
"vlm_backbone.visual.blocks.20.norm1.weight": "model-00001-of-00002.safetensors",
|
| 620 |
+
"vlm_backbone.visual.blocks.20.norm2.weight": "model-00001-of-00002.safetensors",
|
| 621 |
+
"vlm_backbone.visual.blocks.21.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 622 |
+
"vlm_backbone.visual.blocks.21.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 623 |
+
"vlm_backbone.visual.blocks.21.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 624 |
+
"vlm_backbone.visual.blocks.21.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 625 |
+
"vlm_backbone.visual.blocks.21.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 626 |
+
"vlm_backbone.visual.blocks.21.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 627 |
+
"vlm_backbone.visual.blocks.21.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 628 |
+
"vlm_backbone.visual.blocks.21.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 629 |
+
"vlm_backbone.visual.blocks.21.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 630 |
+
"vlm_backbone.visual.blocks.21.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 631 |
+
"vlm_backbone.visual.blocks.21.norm1.weight": "model-00001-of-00002.safetensors",
|
| 632 |
+
"vlm_backbone.visual.blocks.21.norm2.weight": "model-00001-of-00002.safetensors",
|
| 633 |
+
"vlm_backbone.visual.blocks.22.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 634 |
+
"vlm_backbone.visual.blocks.22.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 635 |
+
"vlm_backbone.visual.blocks.22.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 636 |
+
"vlm_backbone.visual.blocks.22.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 637 |
+
"vlm_backbone.visual.blocks.22.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 638 |
+
"vlm_backbone.visual.blocks.22.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 639 |
+
"vlm_backbone.visual.blocks.22.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 640 |
+
"vlm_backbone.visual.blocks.22.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 641 |
+
"vlm_backbone.visual.blocks.22.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 642 |
+
"vlm_backbone.visual.blocks.22.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 643 |
+
"vlm_backbone.visual.blocks.22.norm1.weight": "model-00001-of-00002.safetensors",
|
| 644 |
+
"vlm_backbone.visual.blocks.22.norm2.weight": "model-00001-of-00002.safetensors",
|
| 645 |
+
"vlm_backbone.visual.blocks.23.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 646 |
+
"vlm_backbone.visual.blocks.23.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 647 |
+
"vlm_backbone.visual.blocks.23.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 648 |
+
"vlm_backbone.visual.blocks.23.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 649 |
+
"vlm_backbone.visual.blocks.23.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 650 |
+
"vlm_backbone.visual.blocks.23.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 651 |
+
"vlm_backbone.visual.blocks.23.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 652 |
+
"vlm_backbone.visual.blocks.23.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 653 |
+
"vlm_backbone.visual.blocks.23.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 654 |
+
"vlm_backbone.visual.blocks.23.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 655 |
+
"vlm_backbone.visual.blocks.23.norm1.weight": "model-00001-of-00002.safetensors",
|
| 656 |
+
"vlm_backbone.visual.blocks.23.norm2.weight": "model-00001-of-00002.safetensors",
|
| 657 |
+
"vlm_backbone.visual.blocks.24.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 658 |
+
"vlm_backbone.visual.blocks.24.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 659 |
+
"vlm_backbone.visual.blocks.24.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 660 |
+
"vlm_backbone.visual.blocks.24.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 661 |
+
"vlm_backbone.visual.blocks.24.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 662 |
+
"vlm_backbone.visual.blocks.24.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 663 |
+
"vlm_backbone.visual.blocks.24.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 664 |
+
"vlm_backbone.visual.blocks.24.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 665 |
+
"vlm_backbone.visual.blocks.24.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 666 |
+
"vlm_backbone.visual.blocks.24.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 667 |
+
"vlm_backbone.visual.blocks.24.norm1.weight": "model-00001-of-00002.safetensors",
|
| 668 |
+
"vlm_backbone.visual.blocks.24.norm2.weight": "model-00001-of-00002.safetensors",
|
| 669 |
+
"vlm_backbone.visual.blocks.25.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 670 |
+
"vlm_backbone.visual.blocks.25.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 671 |
+
"vlm_backbone.visual.blocks.25.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 672 |
+
"vlm_backbone.visual.blocks.25.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 673 |
+
"vlm_backbone.visual.blocks.25.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 674 |
+
"vlm_backbone.visual.blocks.25.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 675 |
+
"vlm_backbone.visual.blocks.25.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 676 |
+
"vlm_backbone.visual.blocks.25.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 677 |
+
"vlm_backbone.visual.blocks.25.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 678 |
+
"vlm_backbone.visual.blocks.25.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 679 |
+
"vlm_backbone.visual.blocks.25.norm1.weight": "model-00001-of-00002.safetensors",
|
| 680 |
+
"vlm_backbone.visual.blocks.25.norm2.weight": "model-00001-of-00002.safetensors",
|
| 681 |
+
"vlm_backbone.visual.blocks.26.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 682 |
+
"vlm_backbone.visual.blocks.26.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 683 |
+
"vlm_backbone.visual.blocks.26.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 684 |
+
"vlm_backbone.visual.blocks.26.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 685 |
+
"vlm_backbone.visual.blocks.26.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 686 |
+
"vlm_backbone.visual.blocks.26.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 687 |
+
"vlm_backbone.visual.blocks.26.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 688 |
+
"vlm_backbone.visual.blocks.26.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 689 |
+
"vlm_backbone.visual.blocks.26.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 690 |
+
"vlm_backbone.visual.blocks.26.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 691 |
+
"vlm_backbone.visual.blocks.26.norm1.weight": "model-00001-of-00002.safetensors",
|
| 692 |
+
"vlm_backbone.visual.blocks.26.norm2.weight": "model-00001-of-00002.safetensors",
|
| 693 |
+
"vlm_backbone.visual.blocks.27.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 694 |
+
"vlm_backbone.visual.blocks.27.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 695 |
+
"vlm_backbone.visual.blocks.27.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 696 |
+
"vlm_backbone.visual.blocks.27.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 697 |
+
"vlm_backbone.visual.blocks.27.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 698 |
+
"vlm_backbone.visual.blocks.27.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 699 |
+
"vlm_backbone.visual.blocks.27.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 700 |
+
"vlm_backbone.visual.blocks.27.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 701 |
+
"vlm_backbone.visual.blocks.27.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 702 |
+
"vlm_backbone.visual.blocks.27.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 703 |
+
"vlm_backbone.visual.blocks.27.norm1.weight": "model-00001-of-00002.safetensors",
|
| 704 |
+
"vlm_backbone.visual.blocks.27.norm2.weight": "model-00001-of-00002.safetensors",
|
| 705 |
+
"vlm_backbone.visual.blocks.28.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 706 |
+
"vlm_backbone.visual.blocks.28.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 707 |
+
"vlm_backbone.visual.blocks.28.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 708 |
+
"vlm_backbone.visual.blocks.28.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 709 |
+
"vlm_backbone.visual.blocks.28.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 710 |
+
"vlm_backbone.visual.blocks.28.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 711 |
+
"vlm_backbone.visual.blocks.28.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 712 |
+
"vlm_backbone.visual.blocks.28.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 713 |
+
"vlm_backbone.visual.blocks.28.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 714 |
+
"vlm_backbone.visual.blocks.28.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 715 |
+
"vlm_backbone.visual.blocks.28.norm1.weight": "model-00001-of-00002.safetensors",
|
| 716 |
+
"vlm_backbone.visual.blocks.28.norm2.weight": "model-00001-of-00002.safetensors",
|
| 717 |
+
"vlm_backbone.visual.blocks.29.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 718 |
+
"vlm_backbone.visual.blocks.29.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 719 |
+
"vlm_backbone.visual.blocks.29.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 720 |
+
"vlm_backbone.visual.blocks.29.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 721 |
+
"vlm_backbone.visual.blocks.29.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 722 |
+
"vlm_backbone.visual.blocks.29.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 723 |
+
"vlm_backbone.visual.blocks.29.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 724 |
+
"vlm_backbone.visual.blocks.29.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 725 |
+
"vlm_backbone.visual.blocks.29.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 726 |
+
"vlm_backbone.visual.blocks.29.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 727 |
+
"vlm_backbone.visual.blocks.29.norm1.weight": "model-00001-of-00002.safetensors",
|
| 728 |
+
"vlm_backbone.visual.blocks.29.norm2.weight": "model-00001-of-00002.safetensors",
|
| 729 |
+
"vlm_backbone.visual.blocks.3.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 730 |
+
"vlm_backbone.visual.blocks.3.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 731 |
+
"vlm_backbone.visual.blocks.3.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 732 |
+
"vlm_backbone.visual.blocks.3.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 733 |
+
"vlm_backbone.visual.blocks.3.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 734 |
+
"vlm_backbone.visual.blocks.3.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 735 |
+
"vlm_backbone.visual.blocks.3.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 736 |
+
"vlm_backbone.visual.blocks.3.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 737 |
+
"vlm_backbone.visual.blocks.3.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 738 |
+
"vlm_backbone.visual.blocks.3.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 739 |
+
"vlm_backbone.visual.blocks.3.norm1.weight": "model-00001-of-00002.safetensors",
|
| 740 |
+
"vlm_backbone.visual.blocks.3.norm2.weight": "model-00001-of-00002.safetensors",
|
| 741 |
+
"vlm_backbone.visual.blocks.30.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 742 |
+
"vlm_backbone.visual.blocks.30.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 743 |
+
"vlm_backbone.visual.blocks.30.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 744 |
+
"vlm_backbone.visual.blocks.30.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 745 |
+
"vlm_backbone.visual.blocks.30.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 746 |
+
"vlm_backbone.visual.blocks.30.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 747 |
+
"vlm_backbone.visual.blocks.30.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 748 |
+
"vlm_backbone.visual.blocks.30.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 749 |
+
"vlm_backbone.visual.blocks.30.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 750 |
+
"vlm_backbone.visual.blocks.30.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 751 |
+
"vlm_backbone.visual.blocks.30.norm1.weight": "model-00001-of-00002.safetensors",
|
| 752 |
+
"vlm_backbone.visual.blocks.30.norm2.weight": "model-00001-of-00002.safetensors",
|
| 753 |
+
"vlm_backbone.visual.blocks.31.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 754 |
+
"vlm_backbone.visual.blocks.31.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 755 |
+
"vlm_backbone.visual.blocks.31.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 756 |
+
"vlm_backbone.visual.blocks.31.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 757 |
+
"vlm_backbone.visual.blocks.31.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 758 |
+
"vlm_backbone.visual.blocks.31.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 759 |
+
"vlm_backbone.visual.blocks.31.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 760 |
+
"vlm_backbone.visual.blocks.31.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 761 |
+
"vlm_backbone.visual.blocks.31.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 762 |
+
"vlm_backbone.visual.blocks.31.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 763 |
+
"vlm_backbone.visual.blocks.31.norm1.weight": "model-00001-of-00002.safetensors",
|
| 764 |
+
"vlm_backbone.visual.blocks.31.norm2.weight": "model-00001-of-00002.safetensors",
|
| 765 |
+
"vlm_backbone.visual.blocks.4.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 766 |
+
"vlm_backbone.visual.blocks.4.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 767 |
+
"vlm_backbone.visual.blocks.4.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 768 |
+
"vlm_backbone.visual.blocks.4.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 769 |
+
"vlm_backbone.visual.blocks.4.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 770 |
+
"vlm_backbone.visual.blocks.4.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 771 |
+
"vlm_backbone.visual.blocks.4.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 772 |
+
"vlm_backbone.visual.blocks.4.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 773 |
+
"vlm_backbone.visual.blocks.4.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 774 |
+
"vlm_backbone.visual.blocks.4.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 775 |
+
"vlm_backbone.visual.blocks.4.norm1.weight": "model-00001-of-00002.safetensors",
|
| 776 |
+
"vlm_backbone.visual.blocks.4.norm2.weight": "model-00001-of-00002.safetensors",
|
| 777 |
+
"vlm_backbone.visual.blocks.5.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 778 |
+
"vlm_backbone.visual.blocks.5.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 779 |
+
"vlm_backbone.visual.blocks.5.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 780 |
+
"vlm_backbone.visual.blocks.5.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 781 |
+
"vlm_backbone.visual.blocks.5.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 782 |
+
"vlm_backbone.visual.blocks.5.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 783 |
+
"vlm_backbone.visual.blocks.5.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 784 |
+
"vlm_backbone.visual.blocks.5.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 785 |
+
"vlm_backbone.visual.blocks.5.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 786 |
+
"vlm_backbone.visual.blocks.5.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 787 |
+
"vlm_backbone.visual.blocks.5.norm1.weight": "model-00001-of-00002.safetensors",
|
| 788 |
+
"vlm_backbone.visual.blocks.5.norm2.weight": "model-00001-of-00002.safetensors",
|
| 789 |
+
"vlm_backbone.visual.blocks.6.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 790 |
+
"vlm_backbone.visual.blocks.6.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 791 |
+
"vlm_backbone.visual.blocks.6.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 792 |
+
"vlm_backbone.visual.blocks.6.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 793 |
+
"vlm_backbone.visual.blocks.6.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 794 |
+
"vlm_backbone.visual.blocks.6.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 795 |
+
"vlm_backbone.visual.blocks.6.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 796 |
+
"vlm_backbone.visual.blocks.6.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 797 |
+
"vlm_backbone.visual.blocks.6.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 798 |
+
"vlm_backbone.visual.blocks.6.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 799 |
+
"vlm_backbone.visual.blocks.6.norm1.weight": "model-00001-of-00002.safetensors",
|
| 800 |
+
"vlm_backbone.visual.blocks.6.norm2.weight": "model-00001-of-00002.safetensors",
|
| 801 |
+
"vlm_backbone.visual.blocks.7.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 802 |
+
"vlm_backbone.visual.blocks.7.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 803 |
+
"vlm_backbone.visual.blocks.7.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 804 |
+
"vlm_backbone.visual.blocks.7.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 805 |
+
"vlm_backbone.visual.blocks.7.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 806 |
+
"vlm_backbone.visual.blocks.7.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 807 |
+
"vlm_backbone.visual.blocks.7.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 808 |
+
"vlm_backbone.visual.blocks.7.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 809 |
+
"vlm_backbone.visual.blocks.7.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 810 |
+
"vlm_backbone.visual.blocks.7.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 811 |
+
"vlm_backbone.visual.blocks.7.norm1.weight": "model-00001-of-00002.safetensors",
|
| 812 |
+
"vlm_backbone.visual.blocks.7.norm2.weight": "model-00001-of-00002.safetensors",
|
| 813 |
+
"vlm_backbone.visual.blocks.8.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 814 |
+
"vlm_backbone.visual.blocks.8.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 815 |
+
"vlm_backbone.visual.blocks.8.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 816 |
+
"vlm_backbone.visual.blocks.8.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 817 |
+
"vlm_backbone.visual.blocks.8.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 818 |
+
"vlm_backbone.visual.blocks.8.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 819 |
+
"vlm_backbone.visual.blocks.8.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 820 |
+
"vlm_backbone.visual.blocks.8.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 821 |
+
"vlm_backbone.visual.blocks.8.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 822 |
+
"vlm_backbone.visual.blocks.8.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 823 |
+
"vlm_backbone.visual.blocks.8.norm1.weight": "model-00001-of-00002.safetensors",
|
| 824 |
+
"vlm_backbone.visual.blocks.8.norm2.weight": "model-00001-of-00002.safetensors",
|
| 825 |
+
"vlm_backbone.visual.blocks.9.attn.proj.bias": "model-00001-of-00002.safetensors",
|
| 826 |
+
"vlm_backbone.visual.blocks.9.attn.proj.weight": "model-00001-of-00002.safetensors",
|
| 827 |
+
"vlm_backbone.visual.blocks.9.attn.qkv.bias": "model-00001-of-00002.safetensors",
|
| 828 |
+
"vlm_backbone.visual.blocks.9.attn.qkv.weight": "model-00001-of-00002.safetensors",
|
| 829 |
+
"vlm_backbone.visual.blocks.9.mlp.down_proj.bias": "model-00001-of-00002.safetensors",
|
| 830 |
+
"vlm_backbone.visual.blocks.9.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 831 |
+
"vlm_backbone.visual.blocks.9.mlp.gate_proj.bias": "model-00001-of-00002.safetensors",
|
| 832 |
+
"vlm_backbone.visual.blocks.9.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 833 |
+
"vlm_backbone.visual.blocks.9.mlp.up_proj.bias": "model-00001-of-00002.safetensors",
|
| 834 |
+
"vlm_backbone.visual.blocks.9.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 835 |
+
"vlm_backbone.visual.blocks.9.norm1.weight": "model-00001-of-00002.safetensors",
|
| 836 |
+
"vlm_backbone.visual.blocks.9.norm2.weight": "model-00001-of-00002.safetensors",
|
| 837 |
+
"vlm_backbone.visual.merger.ln_q.weight": "model-00001-of-00002.safetensors",
|
| 838 |
+
"vlm_backbone.visual.merger.mlp.0.bias": "model-00001-of-00002.safetensors",
|
| 839 |
+
"vlm_backbone.visual.merger.mlp.0.weight": "model-00001-of-00002.safetensors",
|
| 840 |
+
"vlm_backbone.visual.merger.mlp.2.bias": "model-00001-of-00002.safetensors",
|
| 841 |
+
"vlm_backbone.visual.merger.mlp.2.weight": "model-00001-of-00002.safetensors",
|
| 842 |
+
"vlm_backbone.visual.patch_embed.proj.weight": "model-00001-of-00002.safetensors"
|
| 843 |
+
}
|
| 844 |
+
}
|
modeling_eo1.py
ADDED
|
@@ -0,0 +1,480 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2025 EO-Robotics Team. All rights reserved.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
import math
|
| 16 |
+
from dataclasses import dataclass
|
| 17 |
+
from typing import Any
|
| 18 |
+
|
| 19 |
+
import torch
|
| 20 |
+
import torch.nn as nn
|
| 21 |
+
import torch.nn.functional as F # noqa: N812
|
| 22 |
+
from torch import Tensor
|
| 23 |
+
from transformers.activations import ACT2FN
|
| 24 |
+
from transformers.generation import GenerationMixin
|
| 25 |
+
from transformers.modeling_outputs import ModelOutput
|
| 26 |
+
from transformers.modeling_utils import PreTrainedModel
|
| 27 |
+
from transformers.utils import logging
|
| 28 |
+
|
| 29 |
+
from .configuration_eo1 import EO1VisionFlowMatchingConfig
|
| 30 |
+
from .modeling_qwen2_5_vl import Qwen2_5_VLForConditionalGeneration
|
| 31 |
+
|
| 32 |
+
logger = logging.get_logger(__name__)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def create_sinusoidal_pos_embedding(
|
| 36 |
+
time: torch.tensor,
|
| 37 |
+
dimension: int,
|
| 38 |
+
min_period: float = 4e-3,
|
| 39 |
+
max_period: float = 4.0,
|
| 40 |
+
device="cpu",
|
| 41 |
+
) -> Tensor:
|
| 42 |
+
"""Computes sine-cosine positional embedding vectors for scalar positions."""
|
| 43 |
+
if dimension % 2 != 0:
|
| 44 |
+
raise ValueError(f"dimension ({dimension}) must be divisible by 2")
|
| 45 |
+
|
| 46 |
+
if time.ndim != 1:
|
| 47 |
+
raise ValueError("The time tensor is expected to be of shape `(batch_size, )`.")
|
| 48 |
+
|
| 49 |
+
fraction = torch.linspace(0.0, 1.0, dimension // 2, device=device)
|
| 50 |
+
period = min_period * (max_period / min_period) ** fraction
|
| 51 |
+
|
| 52 |
+
scaling_factor = 1.0 / period * 2 * math.pi
|
| 53 |
+
sin_input = scaling_factor[None, :] * time[:, None]
|
| 54 |
+
pos_emb = torch.cat([torch.sin(sin_input), torch.cos(sin_input)], dim=1)
|
| 55 |
+
return pos_emb
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
@dataclass
|
| 59 |
+
class EO1VisionFlowMatchingOutputWithPast(ModelOutput):
|
| 60 |
+
loss: torch.FloatTensor | None = None
|
| 61 |
+
fm_loss: torch.FloatTensor | None = None
|
| 62 |
+
ar_loss: torch.FloatTensor | None = None
|
| 63 |
+
|
| 64 |
+
actions: torch.FloatTensor | None = None
|
| 65 |
+
logits: torch.FloatTensor | None = None
|
| 66 |
+
|
| 67 |
+
past_key_values: list[torch.FloatTensor] | None = None
|
| 68 |
+
hidden_states: tuple[torch.FloatTensor] | None = None
|
| 69 |
+
attentions: tuple[torch.FloatTensor] | None = None
|
| 70 |
+
rope_deltas: torch.LongTensor | None = None
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
class EO1VisionActionProjector(torch.nn.Sequential):
|
| 74 |
+
"""This block implements the multi-layer perceptron (MLP) module."""
|
| 75 |
+
|
| 76 |
+
def __init__(
|
| 77 |
+
self,
|
| 78 |
+
in_channels: int,
|
| 79 |
+
out_channels: int,
|
| 80 |
+
num_layers: int = 2,
|
| 81 |
+
activation_layer: str = "linear",
|
| 82 |
+
bias: bool = True,
|
| 83 |
+
device: Any = None,
|
| 84 |
+
dtype: torch.dtype = torch.float32,
|
| 85 |
+
):
|
| 86 |
+
layers = []
|
| 87 |
+
in_dim = in_channels
|
| 88 |
+
hidden_channels = [in_dim] * (num_layers - 1) + [out_channels]
|
| 89 |
+
for hidden_dim in hidden_channels[:-1]:
|
| 90 |
+
layers.append(torch.nn.Linear(in_dim, hidden_dim, bias=bias, dtype=dtype, device=device))
|
| 91 |
+
layers.append(ACT2FN[activation_layer])
|
| 92 |
+
in_dim = hidden_dim
|
| 93 |
+
layers.append(torch.nn.Linear(in_dim, hidden_channels[-1], bias=bias, dtype=dtype, device=device))
|
| 94 |
+
super().__init__(*layers)
|
| 95 |
+
|
| 96 |
+
@property
|
| 97 |
+
def dtype(self):
|
| 98 |
+
return self[0].weight.dtype
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
class EO1VisionFlowMatchingModel(PreTrainedModel, GenerationMixin):
|
| 102 |
+
config_class = EO1VisionFlowMatchingConfig
|
| 103 |
+
supports_gradient_checkpointing = True
|
| 104 |
+
|
| 105 |
+
_supports_flash_attn = True
|
| 106 |
+
_supports_sdpa = True
|
| 107 |
+
_supports_attention_backend = True
|
| 108 |
+
_can_compile_fullgraph = True
|
| 109 |
+
_skip_keys_device_placement = "past_key_values"
|
| 110 |
+
|
| 111 |
+
def __init__(
|
| 112 |
+
self,
|
| 113 |
+
config: EO1VisionFlowMatchingConfig,
|
| 114 |
+
vlm_backbone: Qwen2_5_VLForConditionalGeneration = None,
|
| 115 |
+
):
|
| 116 |
+
super().__init__(config)
|
| 117 |
+
|
| 118 |
+
hidden_size = self.config.text_config.hidden_size
|
| 119 |
+
max_action_dim = self.config.max_action_dim
|
| 120 |
+
self.vlm_backbone = vlm_backbone or Qwen2_5_VLForConditionalGeneration(self.config)
|
| 121 |
+
self.state_proj = nn.Linear(max_action_dim, hidden_size)
|
| 122 |
+
self.action_in_proj = nn.Linear(max_action_dim, hidden_size)
|
| 123 |
+
self.action_out_proj = EO1VisionActionProjector(
|
| 124 |
+
hidden_size,
|
| 125 |
+
max_action_dim,
|
| 126 |
+
self.config.num_action_layers,
|
| 127 |
+
self.config.action_act,
|
| 128 |
+
)
|
| 129 |
+
self.action_time_mlp_in = nn.Linear(hidden_size * 2, hidden_size)
|
| 130 |
+
self.action_time_mlp_out = nn.Linear(hidden_size, hidden_size)
|
| 131 |
+
|
| 132 |
+
self.post_init()
|
| 133 |
+
self.to_float32_flow_matching_head()
|
| 134 |
+
|
| 135 |
+
def get_input_embeddings(self):
|
| 136 |
+
return self.vlm_backbone.get_input_embeddings()
|
| 137 |
+
|
| 138 |
+
def to_float32_flow_matching_head(self):
|
| 139 |
+
self.action_out_proj = self.action_out_proj.to(dtype=torch.float32)
|
| 140 |
+
self.action_time_mlp_in = self.action_time_mlp_in.to(dtype=torch.float32)
|
| 141 |
+
self.action_time_mlp_out = self.action_time_mlp_out.to(dtype=torch.float32)
|
| 142 |
+
self.state_proj = self.state_proj.to(dtype=torch.float32)
|
| 143 |
+
self.action_in_proj = self.action_in_proj.to(dtype=torch.float32)
|
| 144 |
+
|
| 145 |
+
def sample_noise(self, shape, device):
|
| 146 |
+
noise = torch.normal(
|
| 147 |
+
mean=0.0,
|
| 148 |
+
std=1.0,
|
| 149 |
+
size=shape,
|
| 150 |
+
dtype=torch.float32,
|
| 151 |
+
device=device,
|
| 152 |
+
)
|
| 153 |
+
return noise
|
| 154 |
+
|
| 155 |
+
def sample_time(self, bsize, device):
|
| 156 |
+
beta_dist = torch.distributions.Beta(concentration1=1.5, concentration0=1.0)
|
| 157 |
+
time_beta = beta_dist.sample((bsize,)).to(device=device, dtype=torch.float32)
|
| 158 |
+
time = time_beta * 0.999 + 0.001
|
| 159 |
+
return time
|
| 160 |
+
|
| 161 |
+
def replace_special_embeddings(
|
| 162 |
+
self,
|
| 163 |
+
input_ids: torch.LongTensor,
|
| 164 |
+
inputs_embeds: torch.FloatTensor,
|
| 165 |
+
special_features: torch.FloatTensor = None,
|
| 166 |
+
special_token_ids: torch.LongTensor = None,
|
| 167 |
+
) -> torch.LongTensor:
|
| 168 |
+
"""Replace the special embeddings with the special features."""
|
| 169 |
+
if special_features is not None and special_token_ids is not None:
|
| 170 |
+
n_special_tokens = (input_ids == special_token_ids).sum().item()
|
| 171 |
+
n_special_features = special_features.shape[0]
|
| 172 |
+
assert n_special_tokens == n_special_features, (
|
| 173 |
+
f"Special features and special tokens {special_token_ids} do not match: \
|
| 174 |
+
tokens: {n_special_tokens}, features {n_special_features}"
|
| 175 |
+
)
|
| 176 |
+
mask = input_ids == special_token_ids
|
| 177 |
+
mask_unsqueezed = mask.unsqueeze(-1)
|
| 178 |
+
mask_expanded = mask_unsqueezed.expand_as(inputs_embeds)
|
| 179 |
+
special_mask = mask_expanded.to(inputs_embeds.device)
|
| 180 |
+
special_features = special_features.to(inputs_embeds.device, inputs_embeds.dtype)
|
| 181 |
+
inputs_embeds = inputs_embeds.masked_scatter(special_mask, special_features)
|
| 182 |
+
return inputs_embeds, None
|
| 183 |
+
|
| 184 |
+
def embed_prefix(
|
| 185 |
+
self,
|
| 186 |
+
input_ids: torch.LongTensor,
|
| 187 |
+
inputs_embeds: torch.FloatTensor | None = None,
|
| 188 |
+
pixel_values: torch.Tensor | None = None,
|
| 189 |
+
pixel_values_videos: torch.FloatTensor | None = None,
|
| 190 |
+
image_grid_thw: torch.LongTensor | None = None,
|
| 191 |
+
video_grid_thw: torch.LongTensor | None = None,
|
| 192 |
+
states: torch.Tensor | None = None,
|
| 193 |
+
) -> tuple[torch.FloatTensor, torch.Tensor, torch.Tensor]:
|
| 194 |
+
"""Embed the suffix"""
|
| 195 |
+
if inputs_embeds is None:
|
| 196 |
+
inputs_embeds = self.get_input_embeddings()(input_ids)
|
| 197 |
+
|
| 198 |
+
if pixel_values is not None:
|
| 199 |
+
image_embeds = self.vlm_backbone.get_image_features(pixel_values, image_grid_thw)
|
| 200 |
+
image_embeds = torch.cat(image_embeds, dim=0).to(inputs_embeds.device, inputs_embeds.dtype)
|
| 201 |
+
image_mask, _ = self.vlm_backbone.get_placeholder_mask(
|
| 202 |
+
input_ids, inputs_embeds=inputs_embeds, image_features=image_embeds
|
| 203 |
+
)
|
| 204 |
+
inputs_embeds = inputs_embeds.masked_scatter(image_mask, image_embeds)
|
| 205 |
+
|
| 206 |
+
if pixel_values_videos is not None:
|
| 207 |
+
video_embeds = self.vlm_backbone.get_video_features(pixel_values_videos, video_grid_thw)
|
| 208 |
+
video_embeds = torch.cat(video_embeds, dim=0).to(inputs_embeds.device, inputs_embeds.dtype)
|
| 209 |
+
_, video_mask = self.vlm_backbone.get_placeholder_mask(
|
| 210 |
+
input_ids, inputs_embeds=inputs_embeds, video_features=video_embeds
|
| 211 |
+
)
|
| 212 |
+
inputs_embeds = inputs_embeds.masked_scatter(video_mask, video_embeds)
|
| 213 |
+
|
| 214 |
+
if states is not None:
|
| 215 |
+
states = states.type(self.state_proj.weight.dtype)
|
| 216 |
+
state_embs = self.state_proj(states)
|
| 217 |
+
inputs_embeds, _ = self.replace_special_embeddings(
|
| 218 |
+
input_ids, inputs_embeds, state_embs, self.config.state_token_id
|
| 219 |
+
)
|
| 220 |
+
return inputs_embeds
|
| 221 |
+
|
| 222 |
+
def embed_suffix(
|
| 223 |
+
self,
|
| 224 |
+
timestep: torch.Tensor,
|
| 225 |
+
noisy_actions: torch.Tensor,
|
| 226 |
+
) -> torch.FloatTensor:
|
| 227 |
+
"""Embed the suffix"""
|
| 228 |
+
time_embs = create_sinusoidal_pos_embedding(
|
| 229 |
+
timestep,
|
| 230 |
+
self.config.text_config.hidden_size,
|
| 231 |
+
device=noisy_actions.device,
|
| 232 |
+
)
|
| 233 |
+
time_embs = time_embs.type(noisy_actions.dtype)
|
| 234 |
+
noisy_actions = noisy_actions.type(self.action_in_proj.weight.dtype)
|
| 235 |
+
action_embs = self.action_in_proj(noisy_actions)
|
| 236 |
+
time_embs = time_embs[:, None, :].expand_as(action_embs)
|
| 237 |
+
|
| 238 |
+
action_time_embs = torch.cat([action_embs, time_embs], dim=2)
|
| 239 |
+
action_time_embs = self.action_time_mlp_in(action_time_embs)
|
| 240 |
+
action_time_embs = F.silu(action_time_embs)
|
| 241 |
+
action_time_embs = self.action_time_mlp_out(action_time_embs)
|
| 242 |
+
return action_time_embs
|
| 243 |
+
|
| 244 |
+
def forward(
|
| 245 |
+
self,
|
| 246 |
+
input_ids: torch.LongTensor | None = None,
|
| 247 |
+
attention_mask: torch.Tensor | None = None,
|
| 248 |
+
position_ids: torch.LongTensor | None = None,
|
| 249 |
+
past_key_values: list[torch.FloatTensor] | None = None,
|
| 250 |
+
inputs_embeds: torch.FloatTensor | None = None,
|
| 251 |
+
labels: torch.LongTensor | None = None,
|
| 252 |
+
use_cache: bool | None = None,
|
| 253 |
+
output_attentions: bool | None = None,
|
| 254 |
+
output_hidden_states: bool | None = None,
|
| 255 |
+
pixel_values: torch.Tensor | None = None,
|
| 256 |
+
pixel_values_videos: torch.FloatTensor | None = None,
|
| 257 |
+
image_grid_thw: torch.LongTensor | None = None,
|
| 258 |
+
video_grid_thw: torch.LongTensor | None = None,
|
| 259 |
+
rope_deltas: torch.LongTensor | None = None,
|
| 260 |
+
cache_position: torch.LongTensor | None = None,
|
| 261 |
+
second_per_grid_ts: torch.Tensor | None = None,
|
| 262 |
+
logits_to_keep: int | torch.Tensor = 0,
|
| 263 |
+
states: torch.Tensor | None = None,
|
| 264 |
+
actions: torch.Tensor | None = None,
|
| 265 |
+
action_is_pad: torch.Tensor | None = None,
|
| 266 |
+
**kwargs,
|
| 267 |
+
) -> EO1VisionFlowMatchingOutputWithPast:
|
| 268 |
+
"""multi-modal forward pass, including image, video, state, action, and language."""
|
| 269 |
+
inputs_embeds = self.embed_prefix(
|
| 270 |
+
input_ids,
|
| 271 |
+
inputs_embeds,
|
| 272 |
+
pixel_values,
|
| 273 |
+
pixel_values_videos,
|
| 274 |
+
image_grid_thw,
|
| 275 |
+
video_grid_thw,
|
| 276 |
+
states,
|
| 277 |
+
)
|
| 278 |
+
|
| 279 |
+
if actions is not None:
|
| 280 |
+
noise_mask = input_ids == self.config.action_token_id
|
| 281 |
+
pass_mask = input_ids == self.config.action_pass_id
|
| 282 |
+
mask = noise_mask | pass_mask # (b s)
|
| 283 |
+
|
| 284 |
+
pass_mask_in_action = pass_mask[mask] # (n, )
|
| 285 |
+
pass_mask_in_action = pass_mask_in_action.reshape(*actions.shape[:2], 1) # (b, h, 1)
|
| 286 |
+
|
| 287 |
+
time = self.sample_time(actions.shape[0], inputs_embeds.device) # (n,)
|
| 288 |
+
time_expanded = time[:, None, None].repeat(1, actions.shape[1], 1) # (b, h, 1)
|
| 289 |
+
time_expanded[pass_mask_in_action] = 0.0
|
| 290 |
+
|
| 291 |
+
noise = self.sample_noise(actions.shape, inputs_embeds.device)
|
| 292 |
+
x_t = time_expanded * noise + (1 - time_expanded) * actions
|
| 293 |
+
u_t = noise - actions
|
| 294 |
+
|
| 295 |
+
action_time_embs = self.embed_suffix(time, x_t)
|
| 296 |
+
mask_unsqueezed = mask.unsqueeze(-1)
|
| 297 |
+
mask_expanded = mask_unsqueezed.expand_as(inputs_embeds)
|
| 298 |
+
action_mask = mask_expanded.to(inputs_embeds.device)
|
| 299 |
+
|
| 300 |
+
action_time_embs = action_time_embs.to(inputs_embeds.device, inputs_embeds.dtype)
|
| 301 |
+
inputs_embeds = inputs_embeds.masked_scatter(action_mask, action_time_embs)
|
| 302 |
+
|
| 303 |
+
if attention_mask is not None:
|
| 304 |
+
attention_mask = attention_mask.to(inputs_embeds.device)
|
| 305 |
+
|
| 306 |
+
if position_ids is None:
|
| 307 |
+
prefill_noncompiled_stage = (cache_position is not None and cache_position[0] == 0) or (
|
| 308 |
+
past_key_values is None or past_key_values.get_seq_length() == 0
|
| 309 |
+
)
|
| 310 |
+
if prefill_noncompiled_stage or self.vlm_backbone.rope_deltas is None:
|
| 311 |
+
position_ids, rope_deltas = self.vlm_backbone.get_rope_index(
|
| 312 |
+
input_ids,
|
| 313 |
+
image_grid_thw,
|
| 314 |
+
video_grid_thw,
|
| 315 |
+
second_per_grid_ts=second_per_grid_ts,
|
| 316 |
+
attention_mask=attention_mask,
|
| 317 |
+
)
|
| 318 |
+
self.vlm_backbone.rope_deltas = rope_deltas
|
| 319 |
+
else:
|
| 320 |
+
batch_size, seq_length, _ = inputs_embeds.shape
|
| 321 |
+
position_ids = torch.arange(seq_length, device=inputs_embeds.device)
|
| 322 |
+
position_ids = position_ids.view(1, 1, -1).expand(3, batch_size, -1)
|
| 323 |
+
if cache_position is not None:
|
| 324 |
+
delta = (cache_position[0] + self.vlm_backbone.rope_deltas).to(inputs_embeds.device)
|
| 325 |
+
else:
|
| 326 |
+
delta = torch.zeros((batch_size, seq_length), device=inputs_embeds.device)
|
| 327 |
+
delta = delta.repeat_interleave(batch_size // delta.shape[0], dim=1)
|
| 328 |
+
position_ids += delta.to(position_ids.device)
|
| 329 |
+
|
| 330 |
+
# generation
|
| 331 |
+
output_actions = None
|
| 332 |
+
if not (self.training or states is None):
|
| 333 |
+
output_actions, outputs = self.sample_actions(
|
| 334 |
+
input_ids=input_ids,
|
| 335 |
+
position_ids=position_ids,
|
| 336 |
+
attention_mask=attention_mask,
|
| 337 |
+
past_key_values=past_key_values,
|
| 338 |
+
inputs_embeds=inputs_embeds,
|
| 339 |
+
cache_position=cache_position,
|
| 340 |
+
states=states,
|
| 341 |
+
)
|
| 342 |
+
else:
|
| 343 |
+
outputs = self.vlm_backbone.model(
|
| 344 |
+
position_ids=position_ids,
|
| 345 |
+
attention_mask=attention_mask,
|
| 346 |
+
past_key_values=past_key_values,
|
| 347 |
+
inputs_embeds=inputs_embeds,
|
| 348 |
+
use_cache=use_cache,
|
| 349 |
+
output_attentions=output_attentions,
|
| 350 |
+
output_hidden_states=output_hidden_states,
|
| 351 |
+
return_dict=True,
|
| 352 |
+
cache_position=cache_position,
|
| 353 |
+
)
|
| 354 |
+
|
| 355 |
+
hidden_states = outputs[0]
|
| 356 |
+
|
| 357 |
+
# only compute necessary logits, do not upcast to float if not computing loss
|
| 358 |
+
slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
|
| 359 |
+
logits = self.vlm_backbone.lm_head(hidden_states[:, slice_indices, :])
|
| 360 |
+
|
| 361 |
+
loss = None
|
| 362 |
+
fm_loss = None
|
| 363 |
+
v_t = None
|
| 364 |
+
if actions is not None:
|
| 365 |
+
action_time_embs = hidden_states[action_mask[..., 0]]
|
| 366 |
+
action_time_embs = action_time_embs.type(self.action_out_proj.dtype)
|
| 367 |
+
|
| 368 |
+
v_t = self.action_out_proj(action_time_embs)
|
| 369 |
+
u_t = u_t.reshape(v_t.shape)
|
| 370 |
+
v_t = v_t.type(u_t.dtype)
|
| 371 |
+
|
| 372 |
+
losses = F.mse_loss(u_t, v_t, reduction="none")
|
| 373 |
+
if action_is_pad is not None:
|
| 374 |
+
in_episode_bound = (~action_is_pad).reshape(-1, 1)
|
| 375 |
+
losses = losses * in_episode_bound
|
| 376 |
+
|
| 377 |
+
in_denoise_bound = (~pass_mask_in_action).reshape(-1, 1)
|
| 378 |
+
losses = losses * in_denoise_bound
|
| 379 |
+
|
| 380 |
+
fm_loss = losses.mean()
|
| 381 |
+
loss = fm_loss
|
| 382 |
+
|
| 383 |
+
ar_loss = None
|
| 384 |
+
if labels is not None:
|
| 385 |
+
ar_loss = self.vlm_backbone.loss_function(
|
| 386 |
+
logits=logits, labels=labels, vocab_size=self.config.text_config.vocab_size, **kwargs
|
| 387 |
+
)
|
| 388 |
+
loss = loss + ar_loss if loss is not None else ar_loss
|
| 389 |
+
|
| 390 |
+
return EO1VisionFlowMatchingOutputWithPast(
|
| 391 |
+
loss=loss,
|
| 392 |
+
fm_loss=fm_loss,
|
| 393 |
+
ar_loss=ar_loss,
|
| 394 |
+
actions=output_actions,
|
| 395 |
+
logits=logits,
|
| 396 |
+
past_key_values=outputs.past_key_values,
|
| 397 |
+
hidden_states=outputs.hidden_states,
|
| 398 |
+
attentions=outputs.attentions,
|
| 399 |
+
rope_deltas=self.vlm_backbone.rope_deltas,
|
| 400 |
+
)
|
| 401 |
+
|
| 402 |
+
@torch.no_grad()
|
| 403 |
+
def sample_actions(
|
| 404 |
+
self,
|
| 405 |
+
input_ids: torch.LongTensor | None = None,
|
| 406 |
+
attention_mask: torch.Tensor | None = None,
|
| 407 |
+
pixel_values: torch.Tensor | None = None,
|
| 408 |
+
image_grid_thw: torch.LongTensor | None = None,
|
| 409 |
+
states: torch.Tensor | None = None,
|
| 410 |
+
**kwargs,
|
| 411 |
+
) -> Tensor:
|
| 412 |
+
"""Sample actions from the model."""
|
| 413 |
+
|
| 414 |
+
# prepare position_ids and kv_cache
|
| 415 |
+
position_ids, _ = self.vlm_backbone.get_rope_index(
|
| 416 |
+
input_ids,
|
| 417 |
+
image_grid_thw=image_grid_thw,
|
| 418 |
+
attention_mask=attention_mask,
|
| 419 |
+
)
|
| 420 |
+
|
| 421 |
+
# embed prefix
|
| 422 |
+
inputs_embeds = self.embed_prefix(
|
| 423 |
+
input_ids,
|
| 424 |
+
pixel_values=pixel_values,
|
| 425 |
+
image_grid_thw=image_grid_thw,
|
| 426 |
+
states=states,
|
| 427 |
+
)
|
| 428 |
+
|
| 429 |
+
# pass prefix, update kvcache
|
| 430 |
+
seq_len = input_ids.shape[-1]
|
| 431 |
+
chunk_size = self.config.action_chunk_size
|
| 432 |
+
suffix_len = -1 # <|im_end|>
|
| 433 |
+
prefix_len = seq_len - chunk_size - 1
|
| 434 |
+
|
| 435 |
+
outputs = self.vlm_backbone.model(
|
| 436 |
+
position_ids=position_ids[..., :prefix_len],
|
| 437 |
+
attention_mask=attention_mask[:, :prefix_len],
|
| 438 |
+
inputs_embeds=inputs_embeds[:, :prefix_len],
|
| 439 |
+
use_cache=True,
|
| 440 |
+
)
|
| 441 |
+
|
| 442 |
+
# denoising
|
| 443 |
+
device = states.device
|
| 444 |
+
actions_shape = (states.shape[0], chunk_size, self.config.max_action_dim)
|
| 445 |
+
noise = self.sample_noise(actions_shape, device)
|
| 446 |
+
|
| 447 |
+
x_t = noise.type(self.action_in_proj.weight.dtype)
|
| 448 |
+
dt = torch.tensor(-1.0 / self.config.num_denoise_steps, device=device)
|
| 449 |
+
time = torch.ones(inputs_embeds.shape[0], device=device)
|
| 450 |
+
past_key_values = outputs.past_key_values
|
| 451 |
+
|
| 452 |
+
action_mask = input_ids == self.config.action_token_id
|
| 453 |
+
while time >= -dt / 2:
|
| 454 |
+
action_time_embs = self.embed_suffix(time, x_t)
|
| 455 |
+
inputs_embeds[action_mask] = action_time_embs.to(inputs_embeds.dtype)
|
| 456 |
+
|
| 457 |
+
past_key_values.crop(prefix_len)
|
| 458 |
+
outputs = self.vlm_backbone.model(
|
| 459 |
+
position_ids=position_ids[..., prefix_len:suffix_len],
|
| 460 |
+
attention_mask=attention_mask[:, :suffix_len],
|
| 461 |
+
past_key_values=past_key_values,
|
| 462 |
+
inputs_embeds=inputs_embeds[:, prefix_len:suffix_len],
|
| 463 |
+
use_cache=True,
|
| 464 |
+
)
|
| 465 |
+
action_time_embs = outputs.last_hidden_state[:, :chunk_size]
|
| 466 |
+
action_time_embs = action_time_embs.type(self.action_out_proj.dtype)
|
| 467 |
+
v_t = self.action_out_proj(action_time_embs)
|
| 468 |
+
|
| 469 |
+
x_t += dt * v_t.reshape(x_t.shape)
|
| 470 |
+
time += dt
|
| 471 |
+
return x_t
|
| 472 |
+
|
| 473 |
+
def prepare_inputs_for_generation(self, *args, **kwargs):
|
| 474 |
+
return self.vlm_backbone.prepare_inputs_for_generation(*args, **kwargs)
|
| 475 |
+
|
| 476 |
+
def _expand_inputs_for_generation(self, *args, **kwargs):
|
| 477 |
+
return self.vlm_backbone._expand_inputs_for_generation(*args, **kwargs)
|
| 478 |
+
|
| 479 |
+
|
| 480 |
+
EO1VisionFlowMatchingModel.register_for_auto_class()
|
modeling_qwen2_5_vl.py
ADDED
|
@@ -0,0 +1,1655 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
|
| 2 |
+
# This file was automatically generated from src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py.
|
| 3 |
+
# Do NOT edit this file manually as any edits will be overwritten by the generation of
|
| 4 |
+
# the file from the modular. If any change should be done, please apply the change to the
|
| 5 |
+
# modular_qwen2_5_vl.py file directly. One of our CI enforces this.
|
| 6 |
+
# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
|
| 7 |
+
# coding=utf-8
|
| 8 |
+
# Copyright 2025 The Qwen Team and The HuggingFace Inc. team. All rights reserved.
|
| 9 |
+
#
|
| 10 |
+
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
|
| 11 |
+
# and OPT implementations in this library. It has been modified from its
|
| 12 |
+
# original forms to accommodate minor architectural differences compared
|
| 13 |
+
# to GPT-NeoX and OPT used by the Meta AI team that trained the model.
|
| 14 |
+
#
|
| 15 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 16 |
+
# you may not use this file except in compliance with the License.
|
| 17 |
+
# You may obtain a copy of the License at
|
| 18 |
+
#
|
| 19 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 20 |
+
#
|
| 21 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 22 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 23 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 24 |
+
# See the License for the specific language governing permissions and
|
| 25 |
+
# limitations under the License.
|
| 26 |
+
|
| 27 |
+
from collections.abc import Callable
|
| 28 |
+
from dataclasses import dataclass
|
| 29 |
+
from typing import Any
|
| 30 |
+
|
| 31 |
+
import torch
|
| 32 |
+
import torch.nn as nn
|
| 33 |
+
import torch.nn.functional as F # noqa: N812
|
| 34 |
+
from transformers.activations import ACT2FN
|
| 35 |
+
from transformers.cache_utils import Cache, DynamicCache
|
| 36 |
+
from transformers.generation import GenerationMixin
|
| 37 |
+
from transformers.masking_utils import create_causal_mask, create_sliding_window_causal_mask
|
| 38 |
+
from transformers.modeling_flash_attention_utils import FlashAttentionKwargs
|
| 39 |
+
from transformers.modeling_layers import GradientCheckpointingLayer
|
| 40 |
+
from transformers.modeling_outputs import BaseModelOutputWithPast, ModelOutput
|
| 41 |
+
from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
|
| 42 |
+
from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
|
| 43 |
+
from transformers.models.qwen2.modeling_qwen2 import Qwen2RMSNorm
|
| 44 |
+
from transformers.models.qwen2_5_vl.configuration_qwen2_5_vl import (
|
| 45 |
+
Qwen2_5_VLConfig,
|
| 46 |
+
Qwen2_5_VLTextConfig,
|
| 47 |
+
Qwen2_5_VLVisionConfig,
|
| 48 |
+
)
|
| 49 |
+
from transformers.processing_utils import Unpack
|
| 50 |
+
from transformers.utils import (
|
| 51 |
+
TransformersKwargs,
|
| 52 |
+
auto_docstring,
|
| 53 |
+
can_return_tuple,
|
| 54 |
+
is_torchdynamo_compiling,
|
| 55 |
+
logging,
|
| 56 |
+
)
|
| 57 |
+
from transformers.utils.deprecation import deprecate_kwarg
|
| 58 |
+
|
| 59 |
+
logger = logging.get_logger(__name__)
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
class Qwen2_5_VLMLP(nn.Module):
|
| 63 |
+
def __init__(self, config, bias: bool = False):
|
| 64 |
+
super().__init__()
|
| 65 |
+
self.hidden_size = config.hidden_size
|
| 66 |
+
self.intermediate_size = config.intermediate_size
|
| 67 |
+
self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=bias)
|
| 68 |
+
self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=bias)
|
| 69 |
+
self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=bias)
|
| 70 |
+
self.act_fn = ACT2FN[config.hidden_act]
|
| 71 |
+
|
| 72 |
+
def forward(self, hidden_state):
|
| 73 |
+
return self.down_proj(self.act_fn(self.gate_proj(hidden_state)) * self.up_proj(hidden_state))
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
class Qwen2_5_VisionPatchEmbed(nn.Module):
|
| 77 |
+
def __init__(
|
| 78 |
+
self,
|
| 79 |
+
patch_size: int = 14,
|
| 80 |
+
temporal_patch_size: int = 2,
|
| 81 |
+
in_channels: int = 3,
|
| 82 |
+
embed_dim: int = 1152,
|
| 83 |
+
) -> None:
|
| 84 |
+
super().__init__()
|
| 85 |
+
self.patch_size = patch_size
|
| 86 |
+
self.temporal_patch_size = temporal_patch_size
|
| 87 |
+
self.in_channels = in_channels
|
| 88 |
+
self.embed_dim = embed_dim
|
| 89 |
+
|
| 90 |
+
kernel_size = [temporal_patch_size, patch_size, patch_size]
|
| 91 |
+
self.proj = nn.Conv3d(in_channels, embed_dim, kernel_size=kernel_size, stride=kernel_size, bias=False)
|
| 92 |
+
|
| 93 |
+
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
|
| 94 |
+
target_dtype = self.proj.weight.dtype
|
| 95 |
+
hidden_states = hidden_states.view(
|
| 96 |
+
-1, self.in_channels, self.temporal_patch_size, self.patch_size, self.patch_size
|
| 97 |
+
)
|
| 98 |
+
hidden_states = self.proj(hidden_states.to(dtype=target_dtype)).view(-1, self.embed_dim)
|
| 99 |
+
return hidden_states
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
class Qwen2_5_VisionRotaryEmbedding(nn.Module):
|
| 103 |
+
inv_freq: torch.Tensor # fix linting for `register_buffer`
|
| 104 |
+
|
| 105 |
+
def __init__(self, dim: int, theta: float = 10000.0) -> None:
|
| 106 |
+
super().__init__()
|
| 107 |
+
inv_freq = 1.0 / (theta ** (torch.arange(0, dim, 2, dtype=torch.float) / dim))
|
| 108 |
+
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
| 109 |
+
|
| 110 |
+
def forward(self, seqlen: int) -> torch.Tensor:
|
| 111 |
+
seq = torch.arange(seqlen, device=self.inv_freq.device, dtype=self.inv_freq.dtype)
|
| 112 |
+
freqs = torch.outer(seq, self.inv_freq)
|
| 113 |
+
return freqs
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
class Qwen2_5_VLPatchMerger(nn.Module):
|
| 117 |
+
def __init__(self, dim: int, context_dim: int, spatial_merge_size: int = 2) -> None:
|
| 118 |
+
super().__init__()
|
| 119 |
+
self.hidden_size = context_dim * (spatial_merge_size**2)
|
| 120 |
+
self.ln_q = Qwen2RMSNorm(context_dim, eps=1e-6)
|
| 121 |
+
self.mlp = nn.Sequential(
|
| 122 |
+
nn.Linear(self.hidden_size, self.hidden_size),
|
| 123 |
+
nn.GELU(),
|
| 124 |
+
nn.Linear(self.hidden_size, dim),
|
| 125 |
+
)
|
| 126 |
+
|
| 127 |
+
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
| 128 |
+
x = self.mlp(self.ln_q(x).view(-1, self.hidden_size))
|
| 129 |
+
return x
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
def rotate_half(x):
|
| 133 |
+
"""Rotates half the hidden dims of the input."""
|
| 134 |
+
x1 = x[..., : x.shape[-1] // 2]
|
| 135 |
+
x2 = x[..., x.shape[-1] // 2 :]
|
| 136 |
+
return torch.cat((-x2, x1), dim=-1)
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def apply_rotary_pos_emb_vision(
|
| 140 |
+
q: torch.Tensor, k: torch.Tensor, cos: torch.Tensor, sin: torch.Tensor
|
| 141 |
+
) -> tuple[torch.Tensor, torch.Tensor]:
|
| 142 |
+
orig_q_dtype = q.dtype
|
| 143 |
+
orig_k_dtype = k.dtype
|
| 144 |
+
q, k = q.float(), k.float()
|
| 145 |
+
cos, sin = cos.unsqueeze(-2).float(), sin.unsqueeze(-2).float()
|
| 146 |
+
q_embed = (q * cos) + (rotate_half(q) * sin)
|
| 147 |
+
k_embed = (k * cos) + (rotate_half(k) * sin)
|
| 148 |
+
q_embed = q_embed.to(orig_q_dtype)
|
| 149 |
+
k_embed = k_embed.to(orig_k_dtype)
|
| 150 |
+
return q_embed, k_embed
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
|
| 154 |
+
"""
|
| 155 |
+
This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
|
| 156 |
+
num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
|
| 157 |
+
"""
|
| 158 |
+
batch, num_key_value_heads, slen, head_dim = hidden_states.shape
|
| 159 |
+
if n_rep == 1:
|
| 160 |
+
return hidden_states
|
| 161 |
+
hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
|
| 162 |
+
return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
def eager_attention_forward(
|
| 166 |
+
module: nn.Module,
|
| 167 |
+
query: torch.Tensor,
|
| 168 |
+
key: torch.Tensor,
|
| 169 |
+
value: torch.Tensor,
|
| 170 |
+
attention_mask: torch.Tensor | None,
|
| 171 |
+
scaling: float,
|
| 172 |
+
dropout: float = 0.0,
|
| 173 |
+
**kwargs,
|
| 174 |
+
):
|
| 175 |
+
key_states = repeat_kv(key, module.num_key_value_groups)
|
| 176 |
+
value_states = repeat_kv(value, module.num_key_value_groups)
|
| 177 |
+
|
| 178 |
+
attn_weights = torch.matmul(query, key_states.transpose(2, 3)) * scaling
|
| 179 |
+
if attention_mask is not None:
|
| 180 |
+
causal_mask = attention_mask[:, :, :, : key_states.shape[-2]]
|
| 181 |
+
attn_weights = attn_weights + causal_mask
|
| 182 |
+
|
| 183 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query.dtype)
|
| 184 |
+
attn_weights = nn.functional.dropout(attn_weights, p=dropout, training=module.training)
|
| 185 |
+
attn_output = torch.matmul(attn_weights, value_states)
|
| 186 |
+
attn_output = attn_output.transpose(1, 2).contiguous()
|
| 187 |
+
|
| 188 |
+
return attn_output, attn_weights
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
class Qwen2_5_VLVisionAttention(nn.Module):
|
| 192 |
+
def __init__(self, config: Qwen2_5_VLVisionConfig) -> None:
|
| 193 |
+
super().__init__()
|
| 194 |
+
self.dim = config.hidden_size
|
| 195 |
+
self.num_heads = config.num_heads
|
| 196 |
+
self.head_dim = self.dim // self.num_heads
|
| 197 |
+
self.num_key_value_groups = 1 # needed for eager attention
|
| 198 |
+
self.qkv = nn.Linear(self.dim, self.dim * 3, bias=True)
|
| 199 |
+
self.proj = nn.Linear(self.dim, self.dim)
|
| 200 |
+
self.scaling = self.head_dim**-0.5
|
| 201 |
+
self.config = config
|
| 202 |
+
self.attention_dropout = 0.0
|
| 203 |
+
self.is_causal = False
|
| 204 |
+
|
| 205 |
+
def forward(
|
| 206 |
+
self,
|
| 207 |
+
hidden_states: torch.Tensor,
|
| 208 |
+
cu_seqlens: torch.Tensor,
|
| 209 |
+
rotary_pos_emb: torch.Tensor | None = None,
|
| 210 |
+
position_embeddings: tuple[torch.Tensor, torch.Tensor] | None = None,
|
| 211 |
+
**kwargs,
|
| 212 |
+
) -> torch.Tensor:
|
| 213 |
+
seq_length = hidden_states.shape[0]
|
| 214 |
+
query_states, key_states, value_states = (
|
| 215 |
+
self.qkv(hidden_states).reshape(seq_length, 3, self.num_heads, -1).permute(1, 0, 2, 3).unbind(0)
|
| 216 |
+
)
|
| 217 |
+
if position_embeddings is None:
|
| 218 |
+
logger.warning_once(
|
| 219 |
+
"The attention layers in this model are transitioning from computing the RoPE embeddings internally "
|
| 220 |
+
"through `rotary_pos_emb` (2D tensor of RoPE theta values), to using externally computed "
|
| 221 |
+
"`position_embeddings` (Tuple of tensors, containing cos and sin). In v4.54 `rotary_pos_emb` will be "
|
| 222 |
+
"removed and `position_embeddings` will be mandatory."
|
| 223 |
+
)
|
| 224 |
+
emb = torch.cat((rotary_pos_emb, rotary_pos_emb), dim=-1)
|
| 225 |
+
cos = emb.cos()
|
| 226 |
+
sin = emb.sin()
|
| 227 |
+
else:
|
| 228 |
+
cos, sin = position_embeddings
|
| 229 |
+
query_states, key_states = apply_rotary_pos_emb_vision(query_states, key_states, cos, sin)
|
| 230 |
+
|
| 231 |
+
query_states = query_states.transpose(0, 1).unsqueeze(0)
|
| 232 |
+
key_states = key_states.transpose(0, 1).unsqueeze(0)
|
| 233 |
+
value_states = value_states.transpose(0, 1).unsqueeze(0)
|
| 234 |
+
|
| 235 |
+
attention_interface: Callable = eager_attention_forward
|
| 236 |
+
if self.config._attn_implementation != "eager":
|
| 237 |
+
attention_interface = ALL_ATTENTION_FUNCTIONS[self.config._attn_implementation]
|
| 238 |
+
|
| 239 |
+
if self.config._attn_implementation == "flash_attention_2":
|
| 240 |
+
# Flash Attention 2: Use cu_seqlens for variable length attention
|
| 241 |
+
max_seqlen = (cu_seqlens[1:] - cu_seqlens[:-1]).max()
|
| 242 |
+
attn_output, _ = attention_interface(
|
| 243 |
+
self,
|
| 244 |
+
query_states,
|
| 245 |
+
key_states,
|
| 246 |
+
value_states,
|
| 247 |
+
attention_mask=None,
|
| 248 |
+
scaling=self.scaling,
|
| 249 |
+
dropout=0.0 if not self.training else self.attention_dropout,
|
| 250 |
+
cu_seq_lens_q=cu_seqlens,
|
| 251 |
+
cu_seq_lens_k=cu_seqlens,
|
| 252 |
+
max_length_q=max_seqlen,
|
| 253 |
+
max_length_k=max_seqlen,
|
| 254 |
+
is_causal=False,
|
| 255 |
+
**kwargs,
|
| 256 |
+
)
|
| 257 |
+
else:
|
| 258 |
+
# Other implementations: Process each chunk separately
|
| 259 |
+
lengths = cu_seqlens[1:] - cu_seqlens[:-1]
|
| 260 |
+
splits = [
|
| 261 |
+
torch.split(tensor, lengths.tolist(), dim=2)
|
| 262 |
+
for tensor in (query_states, key_states, value_states)
|
| 263 |
+
]
|
| 264 |
+
|
| 265 |
+
attn_outputs = [
|
| 266 |
+
attention_interface(
|
| 267 |
+
self,
|
| 268 |
+
q,
|
| 269 |
+
k,
|
| 270 |
+
v,
|
| 271 |
+
attention_mask=None,
|
| 272 |
+
scaling=self.scaling,
|
| 273 |
+
dropout=0.0 if not self.training else self.attention_dropout,
|
| 274 |
+
is_causal=False,
|
| 275 |
+
**kwargs,
|
| 276 |
+
)[0]
|
| 277 |
+
for q, k, v in zip(*splits, strict=False)
|
| 278 |
+
]
|
| 279 |
+
attn_output = torch.cat(attn_outputs, dim=1)
|
| 280 |
+
|
| 281 |
+
attn_output = attn_output.reshape(seq_length, -1).contiguous()
|
| 282 |
+
attn_output = self.proj(attn_output)
|
| 283 |
+
return attn_output
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
class Qwen2_5_VLVisionBlock(GradientCheckpointingLayer):
|
| 287 |
+
def __init__(self, config, attn_implementation: str = "sdpa") -> None:
|
| 288 |
+
super().__init__()
|
| 289 |
+
self.norm1 = Qwen2RMSNorm(config.hidden_size, eps=1e-6)
|
| 290 |
+
self.norm2 = Qwen2RMSNorm(config.hidden_size, eps=1e-6)
|
| 291 |
+
self.attn = Qwen2_5_VLVisionAttention(config=config)
|
| 292 |
+
self.mlp = Qwen2_5_VLMLP(config, bias=True)
|
| 293 |
+
|
| 294 |
+
def forward(
|
| 295 |
+
self,
|
| 296 |
+
hidden_states: torch.Tensor,
|
| 297 |
+
cu_seqlens: torch.Tensor,
|
| 298 |
+
rotary_pos_emb: torch.Tensor | None = None,
|
| 299 |
+
position_embeddings: tuple[torch.Tensor, torch.Tensor] | None = None,
|
| 300 |
+
**kwargs,
|
| 301 |
+
) -> torch.Tensor:
|
| 302 |
+
hidden_states = hidden_states + self.attn(
|
| 303 |
+
self.norm1(hidden_states),
|
| 304 |
+
cu_seqlens=cu_seqlens,
|
| 305 |
+
rotary_pos_emb=rotary_pos_emb,
|
| 306 |
+
position_embeddings=position_embeddings,
|
| 307 |
+
**kwargs,
|
| 308 |
+
)
|
| 309 |
+
hidden_states = hidden_states + self.mlp(self.norm2(hidden_states))
|
| 310 |
+
return hidden_states
|
| 311 |
+
|
| 312 |
+
|
| 313 |
+
@auto_docstring
|
| 314 |
+
class Qwen2_5_VLPreTrainedModel(PreTrainedModel):
|
| 315 |
+
config: Qwen2_5_VLConfig
|
| 316 |
+
base_model_prefix = "model"
|
| 317 |
+
supports_gradient_checkpointing = True
|
| 318 |
+
_no_split_modules = ["Qwen2_5_VLDecoderLayer", "Qwen2_5_VLVisionBlock"]
|
| 319 |
+
_skip_keys_device_placement = "past_key_values"
|
| 320 |
+
_supports_flash_attn = True
|
| 321 |
+
_supports_sdpa = True
|
| 322 |
+
|
| 323 |
+
_can_compile_fullgraph = True
|
| 324 |
+
_supports_attention_backend = True
|
| 325 |
+
|
| 326 |
+
|
| 327 |
+
class Qwen2_5_VisionTransformerPretrainedModel(Qwen2_5_VLPreTrainedModel):
|
| 328 |
+
config: Qwen2_5_VLVisionConfig
|
| 329 |
+
_no_split_modules = ["Qwen2_5_VLVisionBlock"]
|
| 330 |
+
|
| 331 |
+
def __init__(self, config, *inputs, **kwargs) -> None:
|
| 332 |
+
super().__init__(config, *inputs, **kwargs)
|
| 333 |
+
self.spatial_merge_size = config.spatial_merge_size
|
| 334 |
+
self.patch_size = config.patch_size
|
| 335 |
+
self.fullatt_block_indexes = config.fullatt_block_indexes
|
| 336 |
+
self.window_size = config.window_size
|
| 337 |
+
self.spatial_merge_unit = self.spatial_merge_size * self.spatial_merge_size
|
| 338 |
+
|
| 339 |
+
self.patch_embed = Qwen2_5_VisionPatchEmbed(
|
| 340 |
+
patch_size=config.patch_size,
|
| 341 |
+
temporal_patch_size=config.temporal_patch_size,
|
| 342 |
+
in_channels=config.in_channels,
|
| 343 |
+
embed_dim=config.hidden_size,
|
| 344 |
+
)
|
| 345 |
+
|
| 346 |
+
head_dim = config.hidden_size // config.num_heads
|
| 347 |
+
self.rotary_pos_emb = Qwen2_5_VisionRotaryEmbedding(head_dim // 2)
|
| 348 |
+
|
| 349 |
+
self.blocks = nn.ModuleList([Qwen2_5_VLVisionBlock(config) for _ in range(config.depth)])
|
| 350 |
+
self.merger = Qwen2_5_VLPatchMerger(
|
| 351 |
+
dim=config.out_hidden_size,
|
| 352 |
+
context_dim=config.hidden_size,
|
| 353 |
+
spatial_merge_size=config.spatial_merge_size,
|
| 354 |
+
)
|
| 355 |
+
self.gradient_checkpointing = False
|
| 356 |
+
|
| 357 |
+
def rot_pos_emb(self, grid_thw):
|
| 358 |
+
pos_ids = []
|
| 359 |
+
for t, h, w in grid_thw:
|
| 360 |
+
hpos_ids = torch.arange(h).unsqueeze(1).expand(-1, w)
|
| 361 |
+
hpos_ids = hpos_ids.reshape(
|
| 362 |
+
h // self.spatial_merge_size,
|
| 363 |
+
self.spatial_merge_size,
|
| 364 |
+
w // self.spatial_merge_size,
|
| 365 |
+
self.spatial_merge_size,
|
| 366 |
+
)
|
| 367 |
+
hpos_ids = hpos_ids.permute(0, 2, 1, 3)
|
| 368 |
+
hpos_ids = hpos_ids.flatten()
|
| 369 |
+
|
| 370 |
+
wpos_ids = torch.arange(w).unsqueeze(0).expand(h, -1)
|
| 371 |
+
wpos_ids = wpos_ids.reshape(
|
| 372 |
+
h // self.spatial_merge_size,
|
| 373 |
+
self.spatial_merge_size,
|
| 374 |
+
w // self.spatial_merge_size,
|
| 375 |
+
self.spatial_merge_size,
|
| 376 |
+
)
|
| 377 |
+
wpos_ids = wpos_ids.permute(0, 2, 1, 3)
|
| 378 |
+
wpos_ids = wpos_ids.flatten()
|
| 379 |
+
pos_ids.append(torch.stack([hpos_ids, wpos_ids], dim=-1).repeat(t, 1))
|
| 380 |
+
pos_ids = torch.cat(pos_ids, dim=0)
|
| 381 |
+
max_grid_size = grid_thw[:, 1:].max()
|
| 382 |
+
rotary_pos_emb_full = self.rotary_pos_emb(max_grid_size)
|
| 383 |
+
rotary_pos_emb = rotary_pos_emb_full[pos_ids].flatten(1)
|
| 384 |
+
return rotary_pos_emb
|
| 385 |
+
|
| 386 |
+
def get_window_index(self, grid_thw):
|
| 387 |
+
window_index: list = []
|
| 388 |
+
cu_window_seqlens: list = [0]
|
| 389 |
+
window_index_id = 0
|
| 390 |
+
vit_merger_window_size = self.window_size // self.spatial_merge_size // self.patch_size
|
| 391 |
+
|
| 392 |
+
for grid_t, grid_h, grid_w in grid_thw:
|
| 393 |
+
llm_grid_h, llm_grid_w = (
|
| 394 |
+
grid_h // self.spatial_merge_size,
|
| 395 |
+
grid_w // self.spatial_merge_size,
|
| 396 |
+
)
|
| 397 |
+
index = torch.arange(grid_t * llm_grid_h * llm_grid_w).reshape(grid_t, llm_grid_h, llm_grid_w)
|
| 398 |
+
pad_h = vit_merger_window_size - llm_grid_h % vit_merger_window_size
|
| 399 |
+
pad_w = vit_merger_window_size - llm_grid_w % vit_merger_window_size
|
| 400 |
+
num_windows_h = (llm_grid_h + pad_h) // vit_merger_window_size
|
| 401 |
+
num_windows_w = (llm_grid_w + pad_w) // vit_merger_window_size
|
| 402 |
+
index_padded = F.pad(index, (0, pad_w, 0, pad_h), "constant", -100)
|
| 403 |
+
index_padded = index_padded.reshape(
|
| 404 |
+
grid_t,
|
| 405 |
+
num_windows_h,
|
| 406 |
+
vit_merger_window_size,
|
| 407 |
+
num_windows_w,
|
| 408 |
+
vit_merger_window_size,
|
| 409 |
+
)
|
| 410 |
+
index_padded = index_padded.permute(0, 1, 3, 2, 4).reshape(
|
| 411 |
+
grid_t,
|
| 412 |
+
num_windows_h * num_windows_w,
|
| 413 |
+
vit_merger_window_size,
|
| 414 |
+
vit_merger_window_size,
|
| 415 |
+
)
|
| 416 |
+
seqlens = (index_padded != -100).sum([2, 3]).reshape(-1)
|
| 417 |
+
index_padded = index_padded.reshape(-1)
|
| 418 |
+
index_new = index_padded[index_padded != -100]
|
| 419 |
+
window_index.append(index_new + window_index_id)
|
| 420 |
+
cu_seqlens_tmp = seqlens.cumsum(0) * self.spatial_merge_unit + cu_window_seqlens[-1]
|
| 421 |
+
cu_window_seqlens.extend(cu_seqlens_tmp.tolist())
|
| 422 |
+
window_index_id += (grid_t * llm_grid_h * llm_grid_w).item()
|
| 423 |
+
window_index = torch.cat(window_index, dim=0)
|
| 424 |
+
|
| 425 |
+
return window_index, cu_window_seqlens
|
| 426 |
+
|
| 427 |
+
def forward(self, hidden_states: torch.Tensor, grid_thw: torch.Tensor, **kwargs) -> torch.Tensor:
|
| 428 |
+
"""
|
| 429 |
+
Args:
|
| 430 |
+
hidden_states (`torch.Tensor` of shape `(seq_len, hidden_size)`):
|
| 431 |
+
The final hidden states of the model.
|
| 432 |
+
grid_thw (`torch.Tensor` of shape `(num_images_or_videos, 3)`):
|
| 433 |
+
The temporal, height and width of feature shape of each image in LLM.
|
| 434 |
+
|
| 435 |
+
Returns:
|
| 436 |
+
`torch.Tensor`: hidden_states.
|
| 437 |
+
"""
|
| 438 |
+
hidden_states = self.patch_embed(hidden_states)
|
| 439 |
+
rotary_pos_emb = self.rot_pos_emb(grid_thw)
|
| 440 |
+
window_index, cu_window_seqlens = self.get_window_index(grid_thw)
|
| 441 |
+
cu_window_seqlens = torch.tensor(
|
| 442 |
+
cu_window_seqlens,
|
| 443 |
+
device=hidden_states.device,
|
| 444 |
+
dtype=grid_thw.dtype if torch.jit.is_tracing() else torch.int32,
|
| 445 |
+
)
|
| 446 |
+
cu_window_seqlens = torch.unique_consecutive(cu_window_seqlens)
|
| 447 |
+
|
| 448 |
+
seq_len, _ = hidden_states.size()
|
| 449 |
+
hidden_states = hidden_states.reshape(seq_len // self.spatial_merge_unit, self.spatial_merge_unit, -1)
|
| 450 |
+
hidden_states = hidden_states[window_index, :, :]
|
| 451 |
+
hidden_states = hidden_states.reshape(seq_len, -1)
|
| 452 |
+
rotary_pos_emb = rotary_pos_emb.reshape(
|
| 453 |
+
seq_len // self.spatial_merge_unit, self.spatial_merge_unit, -1
|
| 454 |
+
)
|
| 455 |
+
rotary_pos_emb = rotary_pos_emb[window_index, :, :]
|
| 456 |
+
rotary_pos_emb = rotary_pos_emb.reshape(seq_len, -1)
|
| 457 |
+
emb = torch.cat((rotary_pos_emb, rotary_pos_emb), dim=-1)
|
| 458 |
+
position_embeddings = (emb.cos(), emb.sin())
|
| 459 |
+
|
| 460 |
+
cu_seqlens = torch.repeat_interleave(grid_thw[:, 1] * grid_thw[:, 2], grid_thw[:, 0]).cumsum(
|
| 461 |
+
dim=0,
|
| 462 |
+
# Select dtype based on the following factors:
|
| 463 |
+
# - FA2 requires that cu_seqlens_q must have dtype int32
|
| 464 |
+
# - torch.onnx.export requires that cu_seqlens_q must have same dtype as grid_thw
|
| 465 |
+
# See https://github.com/huggingface/transformers/pull/34852 for more information
|
| 466 |
+
dtype=grid_thw.dtype if torch.jit.is_tracing() else torch.int32,
|
| 467 |
+
)
|
| 468 |
+
cu_seqlens = F.pad(cu_seqlens, (1, 0), value=0)
|
| 469 |
+
|
| 470 |
+
for layer_num, blk in enumerate(self.blocks):
|
| 471 |
+
if layer_num in self.fullatt_block_indexes:
|
| 472 |
+
cu_seqlens_now = cu_seqlens
|
| 473 |
+
else:
|
| 474 |
+
cu_seqlens_now = cu_window_seqlens
|
| 475 |
+
|
| 476 |
+
hidden_states = blk(
|
| 477 |
+
hidden_states,
|
| 478 |
+
cu_seqlens=cu_seqlens_now,
|
| 479 |
+
position_embeddings=position_embeddings,
|
| 480 |
+
**kwargs,
|
| 481 |
+
)
|
| 482 |
+
|
| 483 |
+
hidden_states = self.merger(hidden_states)
|
| 484 |
+
reverse_indices = torch.argsort(window_index)
|
| 485 |
+
hidden_states = hidden_states[reverse_indices, :]
|
| 486 |
+
|
| 487 |
+
return hidden_states
|
| 488 |
+
|
| 489 |
+
|
| 490 |
+
@dataclass
|
| 491 |
+
@auto_docstring(
|
| 492 |
+
custom_intro="""
|
| 493 |
+
Base class for Llava outputs, with hidden states and attentions.
|
| 494 |
+
"""
|
| 495 |
+
)
|
| 496 |
+
class Qwen2_5_VLModelOutputWithPast(ModelOutput):
|
| 497 |
+
r"""
|
| 498 |
+
past_key_values (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`):
|
| 499 |
+
Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of shape
|
| 500 |
+
`(batch_size, num_heads, sequence_length, embed_size_per_head)`)
|
| 501 |
+
|
| 502 |
+
Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
|
| 503 |
+
`past_key_values` input) to speed up sequential decoding.
|
| 504 |
+
rope_deltas (`torch.LongTensor` of shape `(batch_size, )`, *optional*):
|
| 505 |
+
The rope index difference between sequence length and multimodal rope.
|
| 506 |
+
"""
|
| 507 |
+
|
| 508 |
+
last_hidden_state: torch.FloatTensor = None
|
| 509 |
+
past_key_values: list[torch.FloatTensor] | None = None
|
| 510 |
+
hidden_states: tuple[torch.FloatTensor] | None = None
|
| 511 |
+
attentions: tuple[torch.FloatTensor] | None = None
|
| 512 |
+
rope_deltas: torch.LongTensor | None = None
|
| 513 |
+
|
| 514 |
+
|
| 515 |
+
class Qwen2_5_VLRotaryEmbedding(nn.Module):
|
| 516 |
+
inv_freq: torch.Tensor # fix linting for `register_buffer`
|
| 517 |
+
|
| 518 |
+
def __init__(self, config: Qwen2_5_VLTextConfig, device=None):
|
| 519 |
+
super().__init__()
|
| 520 |
+
# BC: "rope_type" was originally "type"
|
| 521 |
+
if hasattr(config, "rope_scaling") and config.rope_scaling is not None:
|
| 522 |
+
self.rope_type = config.rope_scaling.get("rope_type", config.rope_scaling.get("type"))
|
| 523 |
+
else:
|
| 524 |
+
self.rope_type = "default"
|
| 525 |
+
self.max_seq_len_cached = config.max_position_embeddings
|
| 526 |
+
self.original_max_seq_len = config.max_position_embeddings
|
| 527 |
+
|
| 528 |
+
self.config = config
|
| 529 |
+
self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
|
| 530 |
+
|
| 531 |
+
inv_freq, self.attention_scaling = self.rope_init_fn(self.config, device)
|
| 532 |
+
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
| 533 |
+
self.original_inv_freq = self.inv_freq
|
| 534 |
+
|
| 535 |
+
@torch.no_grad()
|
| 536 |
+
@dynamic_rope_update # power user: used with advanced RoPE types (e.g. dynamic rope)
|
| 537 |
+
def forward(self, x, position_ids):
|
| 538 |
+
# In contrast to other models, Qwen2_5_VL has different position ids for the grids
|
| 539 |
+
# So we expand the inv_freq to shape (3, ...)
|
| 540 |
+
inv_freq_expanded = self.inv_freq[None, None, :, None].float().expand(3, position_ids.shape[1], -1, 1)
|
| 541 |
+
position_ids_expanded = position_ids[:, :, None, :].float() # shape (3, bs, 1, positions)
|
| 542 |
+
|
| 543 |
+
device_type = x.device.type if isinstance(x.device.type, str) and x.device.type != "mps" else "cpu"
|
| 544 |
+
with torch.autocast(device_type=device_type, enabled=False): # Force float32
|
| 545 |
+
freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(2, 3)
|
| 546 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 547 |
+
cos = emb.cos() * self.attention_scaling
|
| 548 |
+
sin = emb.sin() * self.attention_scaling
|
| 549 |
+
|
| 550 |
+
return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
|
| 551 |
+
|
| 552 |
+
|
| 553 |
+
class Qwen2MLP(nn.Module):
|
| 554 |
+
def __init__(self, config):
|
| 555 |
+
super().__init__()
|
| 556 |
+
self.config = config
|
| 557 |
+
self.hidden_size = config.hidden_size
|
| 558 |
+
self.intermediate_size = config.intermediate_size
|
| 559 |
+
self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
|
| 560 |
+
self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
|
| 561 |
+
self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
|
| 562 |
+
self.act_fn = ACT2FN[config.hidden_act]
|
| 563 |
+
|
| 564 |
+
def forward(self, x):
|
| 565 |
+
down_proj = self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
|
| 566 |
+
return down_proj
|
| 567 |
+
|
| 568 |
+
|
| 569 |
+
def apply_multimodal_rotary_pos_emb(q, k, cos, sin, mrope_section, unsqueeze_dim=1):
|
| 570 |
+
"""Applies Rotary Position Embedding with Multimodal Sections to the query and key tensors (https://qwenlm.github.io/blog/qwen2-vl/).
|
| 571 |
+
|
| 572 |
+
Explanation:
|
| 573 |
+
Multimodal 3D rotary position embedding is an extension to 1D rotary position embedding. The input embedding
|
| 574 |
+
sequence contains vision (images / videos) embedding and text embedding or just contains text embedding. For
|
| 575 |
+
vision embedding part, we apply rotary position embedding on temporal, height and width dimension separately.
|
| 576 |
+
Here we split the channel dimension to 3 chunks for the temporal, height and width rotary position embedding.
|
| 577 |
+
For text embedding part, we just apply 1D rotary position embedding. The three rotary position index (temporal,
|
| 578 |
+
height and width) of text embedding is always the same, so the text embedding rotary position embedding has no
|
| 579 |
+
difference with modern LLMs.
|
| 580 |
+
|
| 581 |
+
Args:
|
| 582 |
+
q (`torch.Tensor`): The query tensor.
|
| 583 |
+
k (`torch.Tensor`): The key tensor.
|
| 584 |
+
cos (`torch.Tensor`): The cosine part of the rotary embedding.
|
| 585 |
+
sin (`torch.Tensor`): The sine part of the rotary embedding.
|
| 586 |
+
position_ids (`torch.Tensor`):
|
| 587 |
+
The position indices of the tokens corresponding to the query and key tensors. For example, this can be
|
| 588 |
+
used to pass offsetted position ids when working with a KV-cache.
|
| 589 |
+
mrope_section(`List(int)`):
|
| 590 |
+
Multimodal rope section is for channel dimension of temporal, height and width in rope calculation.
|
| 591 |
+
unsqueeze_dim (`int`, *optional*, defaults to 1):
|
| 592 |
+
The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
|
| 593 |
+
sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
|
| 594 |
+
that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
|
| 595 |
+
k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
|
| 596 |
+
cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
|
| 597 |
+
the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
|
| 598 |
+
Returns:
|
| 599 |
+
`tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
|
| 600 |
+
"""
|
| 601 |
+
mrope_section = mrope_section * 2
|
| 602 |
+
cos = torch.cat([m[i % 3] for i, m in enumerate(cos.split(mrope_section, dim=-1))], dim=-1).unsqueeze(
|
| 603 |
+
unsqueeze_dim
|
| 604 |
+
)
|
| 605 |
+
sin = torch.cat([m[i % 3] for i, m in enumerate(sin.split(mrope_section, dim=-1))], dim=-1).unsqueeze(
|
| 606 |
+
unsqueeze_dim
|
| 607 |
+
)
|
| 608 |
+
|
| 609 |
+
q_embed = (q * cos) + (rotate_half(q) * sin)
|
| 610 |
+
k_embed = (k * cos) + (rotate_half(k) * sin)
|
| 611 |
+
return q_embed, k_embed
|
| 612 |
+
|
| 613 |
+
|
| 614 |
+
class Qwen2_5_VLAttention(nn.Module):
|
| 615 |
+
"""
|
| 616 |
+
Multi-headed attention from 'Attention Is All You Need' paper. Modified to use sliding window attention: Longformer
|
| 617 |
+
and "Generating Long Sequences with Sparse Transformers".
|
| 618 |
+
"""
|
| 619 |
+
|
| 620 |
+
def __init__(self, config: Qwen2_5_VLTextConfig, layer_idx: int | None = None):
|
| 621 |
+
super().__init__()
|
| 622 |
+
self.config = config
|
| 623 |
+
self.layer_idx = layer_idx
|
| 624 |
+
if layer_idx is None:
|
| 625 |
+
logger.warning_once(
|
| 626 |
+
f"Instantiating {self.__class__.__name__} without passing `layer_idx` is not recommended and will "
|
| 627 |
+
"to errors during the forward call, if caching is used. Please make sure to provide a `layer_idx` "
|
| 628 |
+
"when creating this class."
|
| 629 |
+
)
|
| 630 |
+
|
| 631 |
+
self.hidden_size = config.hidden_size
|
| 632 |
+
self.num_heads = config.num_attention_heads
|
| 633 |
+
self.head_dim = self.hidden_size // self.num_heads
|
| 634 |
+
self.num_key_value_heads = config.num_key_value_heads
|
| 635 |
+
self.num_key_value_groups = self.num_heads // self.num_key_value_heads
|
| 636 |
+
self.is_causal = True
|
| 637 |
+
self.attention_dropout = config.attention_dropout
|
| 638 |
+
self.rope_scaling = config.rope_scaling
|
| 639 |
+
self.scaling = self.head_dim**-0.5
|
| 640 |
+
|
| 641 |
+
if (self.head_dim * self.num_heads) != self.hidden_size:
|
| 642 |
+
raise ValueError(
|
| 643 |
+
f"hidden_size must be divisible by num_heads (got `hidden_size`: {self.hidden_size}"
|
| 644 |
+
f" and `num_heads`: {self.num_heads})."
|
| 645 |
+
)
|
| 646 |
+
self.q_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=True)
|
| 647 |
+
self.k_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=True)
|
| 648 |
+
self.v_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=True)
|
| 649 |
+
self.o_proj = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=False)
|
| 650 |
+
self.sliding_window = (
|
| 651 |
+
config.sliding_window if config.layer_types[layer_idx] == "sliding_attention" else None
|
| 652 |
+
)
|
| 653 |
+
|
| 654 |
+
self.rotary_emb = Qwen2_5_VLRotaryEmbedding(config=config)
|
| 655 |
+
|
| 656 |
+
@deprecate_kwarg("past_key_value", new_name="past_key_values", version="4.58")
|
| 657 |
+
def forward(
|
| 658 |
+
self,
|
| 659 |
+
hidden_states: torch.Tensor,
|
| 660 |
+
attention_mask: torch.Tensor | None = None,
|
| 661 |
+
position_ids: torch.LongTensor | None = None,
|
| 662 |
+
past_key_values: Cache | None = None,
|
| 663 |
+
output_attentions: bool = False,
|
| 664 |
+
use_cache: bool = False,
|
| 665 |
+
cache_position: torch.LongTensor | None = None,
|
| 666 |
+
position_embeddings: None
|
| 667 |
+
| (tuple[torch.Tensor, torch.Tensor]) = None, # necessary, but kept here for BC
|
| 668 |
+
**kwargs: Unpack[FlashAttentionKwargs],
|
| 669 |
+
) -> tuple[torch.Tensor, torch.Tensor | None, tuple[torch.Tensor] | None]:
|
| 670 |
+
bsz, q_len, _ = hidden_states.size()
|
| 671 |
+
|
| 672 |
+
query_states = self.q_proj(hidden_states)
|
| 673 |
+
key_states = self.k_proj(hidden_states)
|
| 674 |
+
value_states = self.v_proj(hidden_states)
|
| 675 |
+
|
| 676 |
+
query_states = query_states.view(bsz, q_len, -1, self.head_dim).transpose(1, 2)
|
| 677 |
+
key_states = key_states.view(bsz, q_len, -1, self.head_dim).transpose(1, 2)
|
| 678 |
+
value_states = value_states.view(bsz, q_len, -1, self.head_dim).transpose(1, 2)
|
| 679 |
+
|
| 680 |
+
cos, sin = position_embeddings
|
| 681 |
+
query_states, key_states = apply_multimodal_rotary_pos_emb(
|
| 682 |
+
query_states, key_states, cos, sin, self.rope_scaling["mrope_section"]
|
| 683 |
+
)
|
| 684 |
+
|
| 685 |
+
if past_key_values is not None:
|
| 686 |
+
cache_kwargs = {
|
| 687 |
+
"sin": sin,
|
| 688 |
+
"cos": cos,
|
| 689 |
+
"cache_position": cache_position,
|
| 690 |
+
} # Specific to RoPE models
|
| 691 |
+
key_states, value_states = past_key_values.update(
|
| 692 |
+
key_states, value_states, self.layer_idx, cache_kwargs
|
| 693 |
+
)
|
| 694 |
+
|
| 695 |
+
attention_interface: Callable = eager_attention_forward
|
| 696 |
+
if self.config._attn_implementation != "eager":
|
| 697 |
+
attention_interface = ALL_ATTENTION_FUNCTIONS[self.config._attn_implementation]
|
| 698 |
+
|
| 699 |
+
attn_output, attn_weights = attention_interface(
|
| 700 |
+
self,
|
| 701 |
+
query_states,
|
| 702 |
+
key_states,
|
| 703 |
+
value_states,
|
| 704 |
+
attention_mask,
|
| 705 |
+
dropout=0.0 if not self.training else self.attention_dropout,
|
| 706 |
+
scaling=self.scaling,
|
| 707 |
+
sliding_window=self.sliding_window,
|
| 708 |
+
position_ids=position_ids, # pass positions for FA2
|
| 709 |
+
**kwargs,
|
| 710 |
+
)
|
| 711 |
+
|
| 712 |
+
attn_output = attn_output.reshape(bsz, q_len, -1).contiguous()
|
| 713 |
+
attn_output = self.o_proj(attn_output)
|
| 714 |
+
return attn_output, attn_weights
|
| 715 |
+
|
| 716 |
+
|
| 717 |
+
class Qwen2_5_VLDecoderLayer(GradientCheckpointingLayer):
|
| 718 |
+
def __init__(self, config: Qwen2_5_VLTextConfig, layer_idx: int):
|
| 719 |
+
super().__init__()
|
| 720 |
+
self.hidden_size = config.hidden_size
|
| 721 |
+
|
| 722 |
+
if config.use_sliding_window and config._attn_implementation != "flash_attention_2":
|
| 723 |
+
logger.warning_once(
|
| 724 |
+
f"Sliding Window Attention is enabled but not implemented for `{config._attn_implementation}`; "
|
| 725 |
+
"unexpected results may be encountered."
|
| 726 |
+
)
|
| 727 |
+
self.self_attn = Qwen2_5_VLAttention(config, layer_idx)
|
| 728 |
+
|
| 729 |
+
self.mlp = Qwen2MLP(config)
|
| 730 |
+
self.input_layernorm = Qwen2RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 731 |
+
self.post_attention_layernorm = Qwen2RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 732 |
+
self.attention_type = config.layer_types[layer_idx]
|
| 733 |
+
|
| 734 |
+
@deprecate_kwarg("past_key_value", new_name="past_key_values", version="4.58")
|
| 735 |
+
def forward(
|
| 736 |
+
self,
|
| 737 |
+
hidden_states: torch.Tensor,
|
| 738 |
+
attention_mask: torch.Tensor | None = None,
|
| 739 |
+
position_ids: torch.LongTensor | None = None,
|
| 740 |
+
past_key_values: tuple[torch.Tensor] | None = None,
|
| 741 |
+
output_attentions: bool | None = False,
|
| 742 |
+
use_cache: bool | None = False,
|
| 743 |
+
cache_position: torch.LongTensor | None = None,
|
| 744 |
+
position_embeddings: None
|
| 745 |
+
| (tuple[torch.Tensor, torch.Tensor]) = None, # necessary, but kept here for BC
|
| 746 |
+
**kwargs: Unpack[FlashAttentionKwargs],
|
| 747 |
+
) -> tuple[torch.FloatTensor, tuple[torch.FloatTensor, torch.FloatTensor] | None]:
|
| 748 |
+
"""
|
| 749 |
+
Args:
|
| 750 |
+
hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
|
| 751 |
+
attention_mask (`torch.FloatTensor`, *optional*): attention mask of size
|
| 752 |
+
`(batch, sequence_length)` where padding elements are indicated by 0.
|
| 753 |
+
output_attentions (`bool`, *optional*):
|
| 754 |
+
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
| 755 |
+
returned tensors for more detail.
|
| 756 |
+
use_cache (`bool`, *optional*):
|
| 757 |
+
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
|
| 758 |
+
(see `past_key_values`).
|
| 759 |
+
past_key_values (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
|
| 760 |
+
cache_position (`torch.LongTensor` of shape `(sequence_length)`, *optional*):
|
| 761 |
+
Indices depicting the position of the input sequence tokens in the sequence.
|
| 762 |
+
position_embeddings (`tuple[torch.FloatTensor, torch.FloatTensor]`, *optional*):
|
| 763 |
+
Tuple containing the cosine and sine positional embeddings of shape `(batch_size, seq_len, head_dim)`,
|
| 764 |
+
with `head_dim` being the embedding dimension of each attention head.
|
| 765 |
+
kwargs (`dict`, *optional*):
|
| 766 |
+
Arbitrary kwargs to be ignored, used for FSDP and other methods that injects code
|
| 767 |
+
into the model
|
| 768 |
+
"""
|
| 769 |
+
|
| 770 |
+
residual = hidden_states
|
| 771 |
+
|
| 772 |
+
hidden_states = self.input_layernorm(hidden_states)
|
| 773 |
+
|
| 774 |
+
# Self Attention
|
| 775 |
+
hidden_states, self_attn_weights = self.self_attn(
|
| 776 |
+
hidden_states=hidden_states,
|
| 777 |
+
attention_mask=attention_mask,
|
| 778 |
+
position_ids=position_ids,
|
| 779 |
+
past_key_values=past_key_values,
|
| 780 |
+
output_attentions=output_attentions,
|
| 781 |
+
use_cache=use_cache,
|
| 782 |
+
cache_position=cache_position,
|
| 783 |
+
position_embeddings=position_embeddings,
|
| 784 |
+
**kwargs,
|
| 785 |
+
)
|
| 786 |
+
hidden_states = residual + hidden_states
|
| 787 |
+
|
| 788 |
+
# Fully Connected
|
| 789 |
+
residual = hidden_states
|
| 790 |
+
hidden_states = self.post_attention_layernorm(hidden_states)
|
| 791 |
+
hidden_states = self.mlp(hidden_states)
|
| 792 |
+
hidden_states = residual + hidden_states
|
| 793 |
+
|
| 794 |
+
outputs = (hidden_states,)
|
| 795 |
+
|
| 796 |
+
if output_attentions:
|
| 797 |
+
outputs += (self_attn_weights,)
|
| 798 |
+
|
| 799 |
+
return outputs
|
| 800 |
+
|
| 801 |
+
|
| 802 |
+
@auto_docstring
|
| 803 |
+
class Qwen2_5_VLModel(Qwen2_5_VLPreTrainedModel):
|
| 804 |
+
config: Qwen2_5_VLTextConfig
|
| 805 |
+
|
| 806 |
+
def __init__(self, config: Qwen2_5_VLTextConfig):
|
| 807 |
+
super().__init__(config)
|
| 808 |
+
self.padding_idx = config.pad_token_id
|
| 809 |
+
self.vocab_size = config.vocab_size
|
| 810 |
+
|
| 811 |
+
self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
|
| 812 |
+
self.layers = nn.ModuleList(
|
| 813 |
+
[Qwen2_5_VLDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
|
| 814 |
+
)
|
| 815 |
+
self._attn_implementation = config._attn_implementation
|
| 816 |
+
self.norm = Qwen2RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 817 |
+
self.rotary_emb = Qwen2_5_VLRotaryEmbedding(config=config)
|
| 818 |
+
self.has_sliding_layers = "sliding_attention" in self.config.layer_types
|
| 819 |
+
|
| 820 |
+
self.gradient_checkpointing = False
|
| 821 |
+
# Initialize weights and apply final processing
|
| 822 |
+
self.post_init()
|
| 823 |
+
|
| 824 |
+
def get_input_embeddings(self):
|
| 825 |
+
return self.embed_tokens
|
| 826 |
+
|
| 827 |
+
def set_input_embeddings(self, value):
|
| 828 |
+
self.embed_tokens = value
|
| 829 |
+
|
| 830 |
+
def forward(
|
| 831 |
+
self,
|
| 832 |
+
input_ids: torch.LongTensor | None = None,
|
| 833 |
+
attention_mask: torch.Tensor | None = None,
|
| 834 |
+
position_ids: torch.LongTensor | None = None,
|
| 835 |
+
past_key_values: Cache | None = None,
|
| 836 |
+
inputs_embeds: torch.FloatTensor | None = None,
|
| 837 |
+
use_cache: bool | None = None,
|
| 838 |
+
output_attentions: bool | None = None,
|
| 839 |
+
output_hidden_states: bool | None = None,
|
| 840 |
+
return_dict: bool | None = None,
|
| 841 |
+
cache_position: torch.LongTensor | None = None,
|
| 842 |
+
**kwargs: Unpack[FlashAttentionKwargs],
|
| 843 |
+
) -> tuple | BaseModelOutputWithPast:
|
| 844 |
+
output_attentions = (
|
| 845 |
+
output_attentions if output_attentions is not None else self.config.output_attentions
|
| 846 |
+
)
|
| 847 |
+
output_hidden_states = (
|
| 848 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
| 849 |
+
)
|
| 850 |
+
use_cache = use_cache if use_cache is not None else self.config.use_cache
|
| 851 |
+
|
| 852 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
| 853 |
+
|
| 854 |
+
if (input_ids is None) ^ (inputs_embeds is not None):
|
| 855 |
+
raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
|
| 856 |
+
|
| 857 |
+
if self.gradient_checkpointing and self.training:
|
| 858 |
+
if use_cache:
|
| 859 |
+
logger.warning_once(
|
| 860 |
+
"`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
|
| 861 |
+
)
|
| 862 |
+
use_cache = False
|
| 863 |
+
|
| 864 |
+
# torch.jit.trace() doesn't support cache objects in the output
|
| 865 |
+
if use_cache and past_key_values is None and not torch.jit.is_tracing():
|
| 866 |
+
past_key_values = DynamicCache(config=self.config)
|
| 867 |
+
|
| 868 |
+
if inputs_embeds is None:
|
| 869 |
+
inputs_embeds = self.embed_tokens(input_ids)
|
| 870 |
+
|
| 871 |
+
if cache_position is None:
|
| 872 |
+
past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
|
| 873 |
+
cache_position = torch.arange(
|
| 874 |
+
past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device
|
| 875 |
+
)
|
| 876 |
+
|
| 877 |
+
# the hard coded `3` is for temporal, height and width.
|
| 878 |
+
if position_ids is None:
|
| 879 |
+
position_ids = cache_position.view(1, 1, -1).expand(3, inputs_embeds.shape[0], -1)
|
| 880 |
+
elif position_ids.ndim == 2:
|
| 881 |
+
position_ids = position_ids[None, ...].expand(3, position_ids.shape[0], -1)
|
| 882 |
+
|
| 883 |
+
# NOTE: we need to pass text position ids for packing. Qwen2-VL uses 3D positions
|
| 884 |
+
# where each dim indicates visual spatial positions for temporal/height/width grids.
|
| 885 |
+
# There are two scenarios when FA2-like packed masking might be activated.
|
| 886 |
+
# 1. User specifically passed packed `position_ids` and no attention mask.
|
| 887 |
+
# In this case we expect the useer to create correct position ids for all 3 grids
|
| 888 |
+
# and prepend text-only position ids to it. The final tensor will be [4, bs, seq-len]
|
| 889 |
+
# 2. User runs forward with no attention mask and no position ids. In this case, position ids
|
| 890 |
+
# are prepared by the model (`get_rope_index`) as `[4, bs, seq-len]` tensor. Text-only positions are
|
| 891 |
+
# prepended by us when creating positions so that the mask is constructed correctly. NOTE: failing to pass
|
| 892 |
+
# text-only positions will cause incorrect mask construction, do not change `prepare_input_for_generation`
|
| 893 |
+
if position_ids.ndim == 3 and position_ids.shape[0] == 4:
|
| 894 |
+
text_position_ids = position_ids[0]
|
| 895 |
+
position_ids = position_ids[1:]
|
| 896 |
+
else:
|
| 897 |
+
text_position_ids = position_ids[0]
|
| 898 |
+
|
| 899 |
+
# It may already have been prepared by e.g. `generate`
|
| 900 |
+
if not isinstance(causal_mask_mapping := attention_mask, dict):
|
| 901 |
+
# Prepare mask arguments
|
| 902 |
+
mask_kwargs = {
|
| 903 |
+
"config": self.config,
|
| 904 |
+
"input_embeds": inputs_embeds,
|
| 905 |
+
"attention_mask": attention_mask,
|
| 906 |
+
"cache_position": cache_position,
|
| 907 |
+
"past_key_values": past_key_values,
|
| 908 |
+
"position_ids": text_position_ids,
|
| 909 |
+
}
|
| 910 |
+
# Create the masks
|
| 911 |
+
causal_mask_mapping = {
|
| 912 |
+
"full_attention": create_causal_mask(**mask_kwargs),
|
| 913 |
+
}
|
| 914 |
+
# The sliding window alternating layers are not always activated depending on the config
|
| 915 |
+
if self.has_sliding_layers:
|
| 916 |
+
causal_mask_mapping["sliding_attention"] = create_sliding_window_causal_mask(**mask_kwargs)
|
| 917 |
+
|
| 918 |
+
hidden_states = inputs_embeds
|
| 919 |
+
|
| 920 |
+
# create position embeddings to be shared across the decoder layers
|
| 921 |
+
position_embeddings = self.rotary_emb(hidden_states, position_ids)
|
| 922 |
+
|
| 923 |
+
# decoder layers
|
| 924 |
+
all_hidden_states = () if output_hidden_states else None
|
| 925 |
+
all_self_attns = () if output_attentions else None
|
| 926 |
+
|
| 927 |
+
for decoder_layer in self.layers:
|
| 928 |
+
if output_hidden_states:
|
| 929 |
+
all_hidden_states += (hidden_states,)
|
| 930 |
+
|
| 931 |
+
layer_outputs = decoder_layer(
|
| 932 |
+
hidden_states,
|
| 933 |
+
attention_mask=causal_mask_mapping[decoder_layer.attention_type],
|
| 934 |
+
position_ids=text_position_ids,
|
| 935 |
+
past_key_values=past_key_values,
|
| 936 |
+
output_attentions=output_attentions,
|
| 937 |
+
use_cache=use_cache,
|
| 938 |
+
cache_position=cache_position,
|
| 939 |
+
position_embeddings=position_embeddings,
|
| 940 |
+
**kwargs,
|
| 941 |
+
)
|
| 942 |
+
|
| 943 |
+
hidden_states = layer_outputs[0]
|
| 944 |
+
|
| 945 |
+
if output_attentions:
|
| 946 |
+
all_self_attns += (layer_outputs[1],)
|
| 947 |
+
|
| 948 |
+
hidden_states = self.norm(hidden_states)
|
| 949 |
+
|
| 950 |
+
# add hidden states from the last decoder layer
|
| 951 |
+
if output_hidden_states:
|
| 952 |
+
all_hidden_states += (hidden_states,)
|
| 953 |
+
|
| 954 |
+
if not return_dict:
|
| 955 |
+
return tuple(
|
| 956 |
+
v
|
| 957 |
+
for v in [hidden_states, past_key_values, all_hidden_states, all_self_attns]
|
| 958 |
+
if v is not None
|
| 959 |
+
)
|
| 960 |
+
return BaseModelOutputWithPast(
|
| 961 |
+
last_hidden_state=hidden_states,
|
| 962 |
+
past_key_values=past_key_values,
|
| 963 |
+
hidden_states=all_hidden_states,
|
| 964 |
+
attentions=all_self_attns,
|
| 965 |
+
)
|
| 966 |
+
|
| 967 |
+
|
| 968 |
+
@dataclass
|
| 969 |
+
@auto_docstring(
|
| 970 |
+
custom_intro="""
|
| 971 |
+
Base class for Qwen2_5_VL causal language model (or autoregressive) outputs.
|
| 972 |
+
"""
|
| 973 |
+
)
|
| 974 |
+
class Qwen2_5_VLCausalLMOutputWithPast(ModelOutput):
|
| 975 |
+
r"""
|
| 976 |
+
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
|
| 977 |
+
Language modeling loss (for next-token prediction).
|
| 978 |
+
logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`):
|
| 979 |
+
Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
|
| 980 |
+
past_key_values (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`):
|
| 981 |
+
Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of shape
|
| 982 |
+
`(batch_size, num_heads, sequence_length, embed_size_per_head)`)
|
| 983 |
+
|
| 984 |
+
Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
|
| 985 |
+
`past_key_values` input) to speed up sequential decoding.
|
| 986 |
+
rope_deltas (`torch.LongTensor` of shape `(batch_size, )`, *optional*):
|
| 987 |
+
The rope index difference between sequence length and multimodal rope.
|
| 988 |
+
"""
|
| 989 |
+
|
| 990 |
+
loss: torch.FloatTensor | None = None
|
| 991 |
+
logits: torch.FloatTensor | None = None
|
| 992 |
+
past_key_values: list[torch.FloatTensor] | None = None
|
| 993 |
+
hidden_states: tuple[torch.FloatTensor] | None = None
|
| 994 |
+
attentions: tuple[torch.FloatTensor] | None = None
|
| 995 |
+
rope_deltas: torch.LongTensor | None = None
|
| 996 |
+
|
| 997 |
+
|
| 998 |
+
class Qwen2_5_VLForConditionalGeneration(Qwen2_5_VLPreTrainedModel, GenerationMixin):
|
| 999 |
+
_tied_weights_keys = ["lm_head.weight"]
|
| 1000 |
+
_no_split_modules = ["Qwen2_5_VLDecoderLayer", "Qwen2_5_VLVisionBlock"]
|
| 1001 |
+
|
| 1002 |
+
config = Qwen2_5_VLConfig
|
| 1003 |
+
accepts_loss_kwargs = False
|
| 1004 |
+
|
| 1005 |
+
def __init__(self, config):
|
| 1006 |
+
super().__init__(config)
|
| 1007 |
+
self.visual = Qwen2_5_VisionTransformerPretrainedModel._from_config(config.vision_config)
|
| 1008 |
+
|
| 1009 |
+
text_config = config.get_text_config()
|
| 1010 |
+
self.model = Qwen2_5_VLModel._from_config(text_config)
|
| 1011 |
+
self.vocab_size = text_config.vocab_size
|
| 1012 |
+
self.lm_head = nn.Linear(text_config.hidden_size, text_config.vocab_size, bias=False)
|
| 1013 |
+
self.rope_deltas = None # cache rope_deltas here
|
| 1014 |
+
|
| 1015 |
+
self.post_init()
|
| 1016 |
+
|
| 1017 |
+
def get_input_embeddings(self):
|
| 1018 |
+
return self.model.embed_tokens
|
| 1019 |
+
|
| 1020 |
+
def set_input_embeddings(self, value):
|
| 1021 |
+
self.model.embed_tokens = value
|
| 1022 |
+
|
| 1023 |
+
def get_output_embeddings(self):
|
| 1024 |
+
return self.lm_head
|
| 1025 |
+
|
| 1026 |
+
def set_output_embeddings(self, new_embeddings):
|
| 1027 |
+
self.lm_head = new_embeddings
|
| 1028 |
+
|
| 1029 |
+
def set_decoder(self, decoder):
|
| 1030 |
+
self.model = decoder
|
| 1031 |
+
|
| 1032 |
+
def get_decoder(self):
|
| 1033 |
+
return self.model
|
| 1034 |
+
|
| 1035 |
+
def get_video_features(
|
| 1036 |
+
self, pixel_values_videos: torch.FloatTensor, video_grid_thw: torch.LongTensor | None = None
|
| 1037 |
+
):
|
| 1038 |
+
"""
|
| 1039 |
+
Encodes videos into continuous embeddings that can be forwarded to the language model.
|
| 1040 |
+
|
| 1041 |
+
Args:
|
| 1042 |
+
pixel_values_videos (`torch.FloatTensor` of shape `(batch_size, num_channels, image_size, image_size)`):
|
| 1043 |
+
The tensors corresponding to the input videos.
|
| 1044 |
+
video_grid_thw (`torch.LongTensor` of shape `(num_videos, 3)`, *optional*):
|
| 1045 |
+
The temporal, height and width of feature shape of each video in LLM.
|
| 1046 |
+
"""
|
| 1047 |
+
pixel_values_videos = pixel_values_videos.type(self.visual.dtype)
|
| 1048 |
+
video_embeds = self.visual(pixel_values_videos, grid_thw=video_grid_thw)
|
| 1049 |
+
split_sizes = (video_grid_thw.prod(-1) // self.visual.spatial_merge_size**2).tolist()
|
| 1050 |
+
video_embeds = torch.split(video_embeds, split_sizes)
|
| 1051 |
+
return video_embeds
|
| 1052 |
+
|
| 1053 |
+
def get_image_features(
|
| 1054 |
+
self, pixel_values: torch.FloatTensor, image_grid_thw: torch.LongTensor | None = None
|
| 1055 |
+
):
|
| 1056 |
+
"""
|
| 1057 |
+
Encodes images into continuous embeddings that can be forwarded to the language model.
|
| 1058 |
+
|
| 1059 |
+
Args:
|
| 1060 |
+
pixel_values (`torch.FloatTensor` of shape `(batch_size, num_channels, image_size, image_size)`):
|
| 1061 |
+
The tensors corresponding to the input images.
|
| 1062 |
+
image_grid_thw (`torch.LongTensor` of shape `(num_images, 3)`, *optional*):
|
| 1063 |
+
The temporal, height and width of feature shape of each image in LLM.
|
| 1064 |
+
"""
|
| 1065 |
+
pixel_values = pixel_values.type(self.visual.dtype)
|
| 1066 |
+
image_embeds = self.visual(pixel_values, grid_thw=image_grid_thw)
|
| 1067 |
+
split_sizes = (image_grid_thw.prod(-1) // self.visual.spatial_merge_size**2).tolist()
|
| 1068 |
+
image_embeds = torch.split(image_embeds, split_sizes)
|
| 1069 |
+
return image_embeds
|
| 1070 |
+
|
| 1071 |
+
def get_placeholder_mask(
|
| 1072 |
+
self,
|
| 1073 |
+
input_ids: torch.LongTensor,
|
| 1074 |
+
inputs_embeds: torch.FloatTensor,
|
| 1075 |
+
image_features: torch.FloatTensor = None,
|
| 1076 |
+
video_features: torch.FloatTensor = None,
|
| 1077 |
+
):
|
| 1078 |
+
"""
|
| 1079 |
+
Obtains multimodal placeholder mask from `input_ids` or `inputs_embeds`, and checks that the placeholder token count is
|
| 1080 |
+
equal to the length of multimodal features. If the lengths are different, an error is raised.
|
| 1081 |
+
"""
|
| 1082 |
+
if input_ids is None:
|
| 1083 |
+
special_image_mask = inputs_embeds == self.get_input_embeddings()(
|
| 1084 |
+
torch.tensor(self.config.image_token_id, dtype=torch.long, device=inputs_embeds.device)
|
| 1085 |
+
)
|
| 1086 |
+
special_image_mask = special_image_mask.all(-1)
|
| 1087 |
+
special_video_mask = inputs_embeds == self.get_input_embeddings()(
|
| 1088 |
+
torch.tensor(self.config.video_token_id, dtype=torch.long, device=inputs_embeds.device)
|
| 1089 |
+
)
|
| 1090 |
+
special_video_mask = special_video_mask.all(-1)
|
| 1091 |
+
else:
|
| 1092 |
+
special_image_mask = input_ids == self.config.image_token_id
|
| 1093 |
+
special_video_mask = input_ids == self.config.video_token_id
|
| 1094 |
+
|
| 1095 |
+
n_image_tokens = special_image_mask.sum()
|
| 1096 |
+
special_image_mask = (
|
| 1097 |
+
special_image_mask.unsqueeze(-1).expand_as(inputs_embeds).to(inputs_embeds.device)
|
| 1098 |
+
)
|
| 1099 |
+
if image_features is not None and inputs_embeds[special_image_mask].numel() != image_features.numel():
|
| 1100 |
+
raise ValueError(
|
| 1101 |
+
f"Image features and image tokens do not match: tokens: {n_image_tokens}, features {image_features.shape[0]}"
|
| 1102 |
+
)
|
| 1103 |
+
|
| 1104 |
+
n_video_tokens = special_video_mask.sum()
|
| 1105 |
+
special_video_mask = (
|
| 1106 |
+
special_video_mask.unsqueeze(-1).expand_as(inputs_embeds).to(inputs_embeds.device)
|
| 1107 |
+
)
|
| 1108 |
+
if video_features is not None and inputs_embeds[special_video_mask].numel() != video_features.numel():
|
| 1109 |
+
raise ValueError(
|
| 1110 |
+
f"Videos features and video tokens do not match: tokens: {n_video_tokens}, features {video_features.shape[0]}"
|
| 1111 |
+
)
|
| 1112 |
+
|
| 1113 |
+
return special_image_mask, special_video_mask
|
| 1114 |
+
|
| 1115 |
+
def get_rope_index(
|
| 1116 |
+
self,
|
| 1117 |
+
input_ids: torch.LongTensor | None = None,
|
| 1118 |
+
image_grid_thw: torch.LongTensor | None = None,
|
| 1119 |
+
video_grid_thw: torch.LongTensor | None = None,
|
| 1120 |
+
second_per_grid_ts: torch.Tensor | None = None,
|
| 1121 |
+
attention_mask: torch.Tensor | None = None,
|
| 1122 |
+
) -> tuple[torch.Tensor, torch.Tensor]:
|
| 1123 |
+
"""
|
| 1124 |
+
Calculate the 3D rope index based on image and video's temporal, height and width in LLM.
|
| 1125 |
+
|
| 1126 |
+
Explanation:
|
| 1127 |
+
Each embedding sequence contains vision embedding and text embedding or just contains text embedding.
|
| 1128 |
+
|
| 1129 |
+
For pure text embedding sequence, the rotary position embedding has no difference with modern LLMs.
|
| 1130 |
+
Examples:
|
| 1131 |
+
input_ids: [T T T T T], here T is for text.
|
| 1132 |
+
temporal position_ids: [0, 1, 2, 3, 4]
|
| 1133 |
+
height position_ids: [0, 1, 2, 3, 4]
|
| 1134 |
+
width position_ids: [0, 1, 2, 3, 4]
|
| 1135 |
+
|
| 1136 |
+
For vision and text embedding sequence, we calculate 3D rotary position embedding for vision part
|
| 1137 |
+
and 1D rotary position embedding for text part.
|
| 1138 |
+
Examples:
|
| 1139 |
+
Temporal (Time): 3 patches, representing different segments of the video in time.
|
| 1140 |
+
Height: 2 patches, dividing each frame vertically.
|
| 1141 |
+
Width: 2 patches, dividing each frame horizontally.
|
| 1142 |
+
We also have some important parameters:
|
| 1143 |
+
fps (Frames Per Second): The video's frame rate, set to 1. This means one frame is processed each second.
|
| 1144 |
+
tokens_per_second: This is a crucial parameter. It dictates how many "time-steps" or "temporal tokens" are conceptually packed into a one-second interval of the video. In this case, we have 25 tokens per second. So each second of the video will be represented with 25 separate time points. It essentially defines the temporal granularity.
|
| 1145 |
+
temporal_patch_size: The number of frames that compose one temporal patch. Here, it's 2 frames.
|
| 1146 |
+
interval: The step size for the temporal position IDs, calculated as tokens_per_second * temporal_patch_size / fps. In this case, 25 * 2 / 1 = 50. This means that each temporal patch will be have a difference of 50 in the temporal position IDs.
|
| 1147 |
+
input_ids: [V V V V V V V V V V V V T T T T T], here V is for vision.
|
| 1148 |
+
vision temporal position_ids: [0, 0, 0, 0, 50, 50, 50, 50, 100, 100, 100, 100]
|
| 1149 |
+
vision height position_ids: [0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1]
|
| 1150 |
+
vision width position_ids: [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]
|
| 1151 |
+
text temporal position_ids: [101, 102, 103, 104, 105]
|
| 1152 |
+
text height position_ids: [101, 102, 103, 104, 105]
|
| 1153 |
+
text width position_ids: [101, 102, 103, 104, 105]
|
| 1154 |
+
Here we calculate the text start position_ids as the max vision position_ids plus 1.
|
| 1155 |
+
|
| 1156 |
+
Args:
|
| 1157 |
+
input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
|
| 1158 |
+
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
|
| 1159 |
+
it.
|
| 1160 |
+
image_grid_thw (`torch.LongTensor` of shape `(num_images, 3)`, *optional*):
|
| 1161 |
+
The temporal, height and width of feature shape of each image in LLM.
|
| 1162 |
+
video_grid_thw (`torch.LongTensor` of shape `(num_videos, 3)`, *optional*):
|
| 1163 |
+
The temporal, height and width of feature shape of each video in LLM.
|
| 1164 |
+
second_per_grid_ts (`torch.Tensor` of shape `(num_videos)`, *optional*):
|
| 1165 |
+
The time interval (in seconds) for each grid along the temporal dimension in the 3D position IDs.
|
| 1166 |
+
attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 1167 |
+
Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
|
| 1168 |
+
|
| 1169 |
+
- 1 for tokens that are **not masked**,
|
| 1170 |
+
- 0 for tokens that are **masked**.
|
| 1171 |
+
|
| 1172 |
+
Returns:
|
| 1173 |
+
position_ids (`torch.LongTensor` of shape `(3, batch_size, sequence_length)`)
|
| 1174 |
+
mrope_position_deltas (`torch.Tensor` of shape `(batch_size)`)
|
| 1175 |
+
"""
|
| 1176 |
+
spatial_merge_size = self.config.vision_config.spatial_merge_size
|
| 1177 |
+
image_token_id = self.config.image_token_id
|
| 1178 |
+
video_token_id = self.config.video_token_id
|
| 1179 |
+
vision_start_token_id = self.config.vision_start_token_id
|
| 1180 |
+
mrope_position_deltas = []
|
| 1181 |
+
if input_ids is not None and (image_grid_thw is not None or video_grid_thw is not None):
|
| 1182 |
+
total_input_ids = input_ids
|
| 1183 |
+
if attention_mask is None:
|
| 1184 |
+
attention_mask = torch.ones_like(total_input_ids)
|
| 1185 |
+
position_ids = torch.ones(
|
| 1186 |
+
3,
|
| 1187 |
+
input_ids.shape[0],
|
| 1188 |
+
input_ids.shape[1],
|
| 1189 |
+
dtype=input_ids.dtype,
|
| 1190 |
+
device=input_ids.device,
|
| 1191 |
+
)
|
| 1192 |
+
image_index, video_index = 0, 0
|
| 1193 |
+
attention_mask = attention_mask.to(total_input_ids.device)
|
| 1194 |
+
for i, input_ids in enumerate(total_input_ids):
|
| 1195 |
+
input_ids = input_ids[attention_mask[i] == 1]
|
| 1196 |
+
image_nums, video_nums = 0, 0
|
| 1197 |
+
vision_start_indices = torch.argwhere(input_ids == vision_start_token_id).squeeze(1)
|
| 1198 |
+
vision_tokens = input_ids[vision_start_indices + 1]
|
| 1199 |
+
image_nums = (vision_tokens == image_token_id).sum()
|
| 1200 |
+
video_nums = (vision_tokens == video_token_id).sum()
|
| 1201 |
+
input_tokens = input_ids.tolist()
|
| 1202 |
+
llm_pos_ids_list: list = []
|
| 1203 |
+
st = 0
|
| 1204 |
+
remain_images, remain_videos = image_nums, video_nums
|
| 1205 |
+
for _ in range(image_nums + video_nums):
|
| 1206 |
+
if image_token_id in input_tokens and remain_images > 0:
|
| 1207 |
+
ed_image = input_tokens.index(image_token_id, st)
|
| 1208 |
+
else:
|
| 1209 |
+
ed_image = len(input_tokens) + 1
|
| 1210 |
+
if video_token_id in input_tokens and remain_videos > 0:
|
| 1211 |
+
ed_video = input_tokens.index(video_token_id, st)
|
| 1212 |
+
else:
|
| 1213 |
+
ed_video = len(input_tokens) + 1
|
| 1214 |
+
if ed_image < ed_video:
|
| 1215 |
+
t, h, w = (
|
| 1216 |
+
image_grid_thw[image_index][0],
|
| 1217 |
+
image_grid_thw[image_index][1],
|
| 1218 |
+
image_grid_thw[image_index][2],
|
| 1219 |
+
)
|
| 1220 |
+
second_per_grid_t = 0
|
| 1221 |
+
image_index += 1
|
| 1222 |
+
remain_images -= 1
|
| 1223 |
+
ed = ed_image
|
| 1224 |
+
|
| 1225 |
+
else:
|
| 1226 |
+
t, h, w = (
|
| 1227 |
+
video_grid_thw[video_index][0],
|
| 1228 |
+
video_grid_thw[video_index][1],
|
| 1229 |
+
video_grid_thw[video_index][2],
|
| 1230 |
+
)
|
| 1231 |
+
if second_per_grid_ts is not None:
|
| 1232 |
+
second_per_grid_t = second_per_grid_ts[video_index]
|
| 1233 |
+
else:
|
| 1234 |
+
second_per_grid_t = 1.0
|
| 1235 |
+
video_index += 1
|
| 1236 |
+
remain_videos -= 1
|
| 1237 |
+
ed = ed_video
|
| 1238 |
+
llm_grid_t, llm_grid_h, llm_grid_w = (
|
| 1239 |
+
t.item(),
|
| 1240 |
+
h.item() // spatial_merge_size,
|
| 1241 |
+
w.item() // spatial_merge_size,
|
| 1242 |
+
)
|
| 1243 |
+
text_len = ed - st
|
| 1244 |
+
|
| 1245 |
+
st_idx = llm_pos_ids_list[-1].max() + 1 if len(llm_pos_ids_list) > 0 else 0
|
| 1246 |
+
llm_pos_ids_list.append(torch.arange(text_len).view(1, -1).expand(3, -1) + st_idx)
|
| 1247 |
+
|
| 1248 |
+
range_tensor = torch.arange(llm_grid_t).view(-1, 1)
|
| 1249 |
+
expanded_range = range_tensor.expand(-1, llm_grid_h * llm_grid_w)
|
| 1250 |
+
|
| 1251 |
+
## normalize type, send to device.
|
| 1252 |
+
second_per_grid_t = torch.as_tensor(
|
| 1253 |
+
second_per_grid_t, dtype=range_tensor.dtype, device=range_tensor.device
|
| 1254 |
+
)
|
| 1255 |
+
|
| 1256 |
+
time_tensor = (
|
| 1257 |
+
expanded_range * second_per_grid_t * self.config.vision_config.tokens_per_second
|
| 1258 |
+
)
|
| 1259 |
+
|
| 1260 |
+
time_tensor_long = time_tensor.long()
|
| 1261 |
+
t_index = time_tensor_long.flatten()
|
| 1262 |
+
|
| 1263 |
+
h_index = (
|
| 1264 |
+
torch.arange(llm_grid_h).view(1, -1, 1).expand(llm_grid_t, -1, llm_grid_w).flatten()
|
| 1265 |
+
)
|
| 1266 |
+
w_index = (
|
| 1267 |
+
torch.arange(llm_grid_w).view(1, 1, -1).expand(llm_grid_t, llm_grid_h, -1).flatten()
|
| 1268 |
+
)
|
| 1269 |
+
llm_pos_ids_list.append(torch.stack([t_index, h_index, w_index]) + text_len + st_idx)
|
| 1270 |
+
st = ed + llm_grid_t * llm_grid_h * llm_grid_w
|
| 1271 |
+
|
| 1272 |
+
if st < len(input_tokens):
|
| 1273 |
+
st_idx = llm_pos_ids_list[-1].max() + 1 if len(llm_pos_ids_list) > 0 else 0
|
| 1274 |
+
text_len = len(input_tokens) - st
|
| 1275 |
+
llm_pos_ids_list.append(torch.arange(text_len).view(1, -1).expand(3, -1) + st_idx)
|
| 1276 |
+
|
| 1277 |
+
llm_positions = torch.cat(llm_pos_ids_list, dim=1).reshape(3, -1)
|
| 1278 |
+
position_ids[..., i, attention_mask[i] == 1] = llm_positions.to(position_ids.device)
|
| 1279 |
+
mrope_position_deltas.append(llm_positions.max() + 1 - len(total_input_ids[i]))
|
| 1280 |
+
mrope_position_deltas = torch.tensor(mrope_position_deltas, device=input_ids.device).unsqueeze(1)
|
| 1281 |
+
return position_ids, mrope_position_deltas
|
| 1282 |
+
else:
|
| 1283 |
+
if attention_mask is not None:
|
| 1284 |
+
position_ids = attention_mask.long().cumsum(-1) - 1
|
| 1285 |
+
position_ids.masked_fill_(attention_mask == 0, 1)
|
| 1286 |
+
position_ids = position_ids.unsqueeze(0).expand(3, -1, -1).to(attention_mask.device)
|
| 1287 |
+
max_position_ids = position_ids.max(0, keepdim=False)[0].max(-1, keepdim=True)[0]
|
| 1288 |
+
mrope_position_deltas = max_position_ids + 1 - attention_mask.shape[-1]
|
| 1289 |
+
else:
|
| 1290 |
+
position_ids = (
|
| 1291 |
+
torch.arange(input_ids.shape[1], device=input_ids.device)
|
| 1292 |
+
.view(1, 1, -1)
|
| 1293 |
+
.expand(3, input_ids.shape[0], -1)
|
| 1294 |
+
)
|
| 1295 |
+
mrope_position_deltas = torch.zeros(
|
| 1296 |
+
[input_ids.shape[0], 1],
|
| 1297 |
+
device=input_ids.device,
|
| 1298 |
+
dtype=input_ids.dtype,
|
| 1299 |
+
)
|
| 1300 |
+
|
| 1301 |
+
return position_ids, mrope_position_deltas
|
| 1302 |
+
|
| 1303 |
+
@can_return_tuple
|
| 1304 |
+
def forward(
|
| 1305 |
+
self,
|
| 1306 |
+
input_ids: torch.LongTensor = None,
|
| 1307 |
+
attention_mask: torch.Tensor | None = None,
|
| 1308 |
+
position_ids: torch.LongTensor | None = None,
|
| 1309 |
+
past_key_values: Cache | None = None,
|
| 1310 |
+
inputs_embeds: torch.FloatTensor | None = None,
|
| 1311 |
+
labels: torch.LongTensor | None = None,
|
| 1312 |
+
use_cache: bool | None = None,
|
| 1313 |
+
output_attentions: bool | None = None,
|
| 1314 |
+
output_hidden_states: bool | None = None,
|
| 1315 |
+
pixel_values: torch.Tensor | None = None,
|
| 1316 |
+
pixel_values_videos: torch.FloatTensor | None = None,
|
| 1317 |
+
image_grid_thw: torch.LongTensor | None = None,
|
| 1318 |
+
video_grid_thw: torch.LongTensor | None = None,
|
| 1319 |
+
rope_deltas: torch.LongTensor | None = None,
|
| 1320 |
+
cache_position: torch.LongTensor | None = None,
|
| 1321 |
+
second_per_grid_ts: torch.Tensor | None = None,
|
| 1322 |
+
logits_to_keep: int | torch.Tensor = 0,
|
| 1323 |
+
**kwargs: Unpack[TransformersKwargs],
|
| 1324 |
+
) -> tuple | Qwen2_5_VLCausalLMOutputWithPast:
|
| 1325 |
+
r"""
|
| 1326 |
+
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 1327 |
+
Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
|
| 1328 |
+
config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
|
| 1329 |
+
(masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
|
| 1330 |
+
image_grid_thw (`torch.LongTensor` of shape `(num_images, 3)`, *optional*):
|
| 1331 |
+
The temporal, height and width of feature shape of each image in LLM.
|
| 1332 |
+
video_grid_thw (`torch.LongTensor` of shape `(num_videos, 3)`, *optional*):
|
| 1333 |
+
The temporal, height and width of feature shape of each video in LLM.
|
| 1334 |
+
rope_deltas (`torch.LongTensor` of shape `(batch_size, )`, *optional*):
|
| 1335 |
+
The rope index difference between sequence length and multimodal rope.
|
| 1336 |
+
second_per_grid_ts (`torch.Tensor` of shape `(num_videos)`, *optional*):
|
| 1337 |
+
The time interval (in seconds) for each grid along the temporal dimension in the 3D position IDs.
|
| 1338 |
+
```"""
|
| 1339 |
+
output_attentions = (
|
| 1340 |
+
output_attentions if output_attentions is not None else self.config.output_attentions
|
| 1341 |
+
)
|
| 1342 |
+
output_hidden_states = (
|
| 1343 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
| 1344 |
+
)
|
| 1345 |
+
|
| 1346 |
+
if inputs_embeds is None:
|
| 1347 |
+
inputs_embeds = self.get_input_embeddings()(input_ids)
|
| 1348 |
+
|
| 1349 |
+
if pixel_values is not None:
|
| 1350 |
+
image_embeds = self.get_image_features(pixel_values, image_grid_thw)
|
| 1351 |
+
image_embeds = torch.cat(image_embeds, dim=0).to(inputs_embeds.device, inputs_embeds.dtype)
|
| 1352 |
+
image_mask, _ = self.get_placeholder_mask(
|
| 1353 |
+
input_ids, inputs_embeds=inputs_embeds, image_features=image_embeds
|
| 1354 |
+
)
|
| 1355 |
+
inputs_embeds = inputs_embeds.masked_scatter(image_mask, image_embeds)
|
| 1356 |
+
|
| 1357 |
+
if pixel_values_videos is not None:
|
| 1358 |
+
video_embeds = self.get_video_features(pixel_values_videos, video_grid_thw)
|
| 1359 |
+
video_embeds = torch.cat(video_embeds, dim=0).to(inputs_embeds.device, inputs_embeds.dtype)
|
| 1360 |
+
_, video_mask = self.get_placeholder_mask(
|
| 1361 |
+
input_ids, inputs_embeds=inputs_embeds, video_features=video_embeds
|
| 1362 |
+
)
|
| 1363 |
+
inputs_embeds = inputs_embeds.masked_scatter(video_mask, video_embeds)
|
| 1364 |
+
|
| 1365 |
+
if position_ids is None:
|
| 1366 |
+
# Calculate RoPE index once per generation in the pre-fill stage only.
|
| 1367 |
+
# When compiling, we can't check tensor values thus we check only input length
|
| 1368 |
+
# It is safe to assume that `length!=1` means we're in pre-fill because compiled
|
| 1369 |
+
# models currently cannot do asssisted decoding
|
| 1370 |
+
prefill_compiled_stage = is_torchdynamo_compiling() and (
|
| 1371 |
+
(input_ids is not None and input_ids.shape[1] != 1)
|
| 1372 |
+
or (inputs_embeds is not None and inputs_embeds.shape[1] != 1)
|
| 1373 |
+
)
|
| 1374 |
+
prefill_noncompiled_stage = not is_torchdynamo_compiling() and (
|
| 1375 |
+
(cache_position is not None and cache_position[0] == 0)
|
| 1376 |
+
or (past_key_values is None or past_key_values.get_seq_length() == 0)
|
| 1377 |
+
)
|
| 1378 |
+
if (prefill_compiled_stage or prefill_noncompiled_stage) or self.rope_deltas is None:
|
| 1379 |
+
position_ids, rope_deltas = self.get_rope_index(
|
| 1380 |
+
input_ids,
|
| 1381 |
+
image_grid_thw,
|
| 1382 |
+
video_grid_thw,
|
| 1383 |
+
second_per_grid_ts=second_per_grid_ts,
|
| 1384 |
+
attention_mask=attention_mask,
|
| 1385 |
+
)
|
| 1386 |
+
self.rope_deltas = rope_deltas
|
| 1387 |
+
else:
|
| 1388 |
+
batch_size, seq_length, _ = inputs_embeds.shape
|
| 1389 |
+
position_ids = torch.arange(seq_length, device=inputs_embeds.device)
|
| 1390 |
+
position_ids = position_ids.view(1, 1, -1).expand(3, batch_size, -1)
|
| 1391 |
+
if cache_position is not None:
|
| 1392 |
+
delta = (cache_position[0] + self.rope_deltas).to(inputs_embeds.device)
|
| 1393 |
+
else:
|
| 1394 |
+
delta = torch.zeros((batch_size, seq_length), device=inputs_embeds.device)
|
| 1395 |
+
delta = delta.repeat_interleave(batch_size // delta.shape[0], dim=1)
|
| 1396 |
+
position_ids += delta.to(position_ids.device)
|
| 1397 |
+
|
| 1398 |
+
outputs = self.model(
|
| 1399 |
+
input_ids=None,
|
| 1400 |
+
position_ids=position_ids,
|
| 1401 |
+
attention_mask=attention_mask,
|
| 1402 |
+
past_key_values=past_key_values,
|
| 1403 |
+
inputs_embeds=inputs_embeds,
|
| 1404 |
+
use_cache=use_cache,
|
| 1405 |
+
output_attentions=output_attentions,
|
| 1406 |
+
output_hidden_states=output_hidden_states,
|
| 1407 |
+
return_dict=True,
|
| 1408 |
+
cache_position=cache_position,
|
| 1409 |
+
**kwargs,
|
| 1410 |
+
)
|
| 1411 |
+
|
| 1412 |
+
hidden_states = outputs[0]
|
| 1413 |
+
|
| 1414 |
+
# Only compute necessary logits, and do not upcast them to float if we are not computing the loss
|
| 1415 |
+
slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
|
| 1416 |
+
logits = self.lm_head(hidden_states[:, slice_indices, :])
|
| 1417 |
+
|
| 1418 |
+
loss = None
|
| 1419 |
+
if labels is not None:
|
| 1420 |
+
loss = self.loss_function(
|
| 1421 |
+
logits=logits, labels=labels, vocab_size=self.config.text_config.vocab_size, **kwargs
|
| 1422 |
+
)
|
| 1423 |
+
|
| 1424 |
+
return Qwen2_5_VLCausalLMOutputWithPast(
|
| 1425 |
+
loss=loss,
|
| 1426 |
+
logits=logits,
|
| 1427 |
+
past_key_values=outputs.past_key_values,
|
| 1428 |
+
hidden_states=outputs.hidden_states,
|
| 1429 |
+
attentions=outputs.attentions,
|
| 1430 |
+
rope_deltas=self.rope_deltas,
|
| 1431 |
+
)
|
| 1432 |
+
|
| 1433 |
+
def prepare_inputs_for_generation(
|
| 1434 |
+
self,
|
| 1435 |
+
input_ids,
|
| 1436 |
+
past_key_values=None,
|
| 1437 |
+
attention_mask=None,
|
| 1438 |
+
inputs_embeds=None,
|
| 1439 |
+
cache_position=None,
|
| 1440 |
+
position_ids=None,
|
| 1441 |
+
use_cache=True,
|
| 1442 |
+
pixel_values=None,
|
| 1443 |
+
pixel_values_videos=None,
|
| 1444 |
+
image_grid_thw=None,
|
| 1445 |
+
video_grid_thw=None,
|
| 1446 |
+
second_per_grid_ts=None,
|
| 1447 |
+
**kwargs,
|
| 1448 |
+
):
|
| 1449 |
+
# Overwritten -- in specific circumstances we don't want to forward image inputs to the model
|
| 1450 |
+
model_inputs = super().prepare_inputs_for_generation(
|
| 1451 |
+
input_ids,
|
| 1452 |
+
past_key_values=past_key_values,
|
| 1453 |
+
attention_mask=attention_mask,
|
| 1454 |
+
inputs_embeds=inputs_embeds,
|
| 1455 |
+
cache_position=cache_position,
|
| 1456 |
+
position_ids=position_ids,
|
| 1457 |
+
pixel_values=pixel_values,
|
| 1458 |
+
pixel_values_videos=pixel_values_videos,
|
| 1459 |
+
image_grid_thw=image_grid_thw,
|
| 1460 |
+
video_grid_thw=video_grid_thw,
|
| 1461 |
+
second_per_grid_ts=second_per_grid_ts,
|
| 1462 |
+
use_cache=use_cache,
|
| 1463 |
+
**kwargs,
|
| 1464 |
+
)
|
| 1465 |
+
|
| 1466 |
+
# Qwen2-5-VL position_ids are prepared with rope_deltas
|
| 1467 |
+
if position_ids is None:
|
| 1468 |
+
# Calculate RoPE index once per generation in the pre-fill stage only.
|
| 1469 |
+
# When compiling, we can't check tensor values thus we check only input length
|
| 1470 |
+
# It is safe to assume that `length!=1` means we're in pre-fill because compiled
|
| 1471 |
+
# models currently cannot do asssisted decoding
|
| 1472 |
+
if cache_position[0] == 0 or self.rope_deltas is None:
|
| 1473 |
+
vision_positions, rope_deltas = self.get_rope_index(
|
| 1474 |
+
model_inputs.get("input_ids", None),
|
| 1475 |
+
image_grid_thw=image_grid_thw,
|
| 1476 |
+
video_grid_thw=video_grid_thw,
|
| 1477 |
+
second_per_grid_ts=second_per_grid_ts,
|
| 1478 |
+
attention_mask=attention_mask,
|
| 1479 |
+
)
|
| 1480 |
+
self.rope_deltas = rope_deltas
|
| 1481 |
+
# then use the prev pre-calculated rope-deltas to get the correct position ids
|
| 1482 |
+
elif "position_ids" in model_inputs:
|
| 1483 |
+
position_ids = model_inputs["position_ids"][None, ...]
|
| 1484 |
+
delta = self.rope_deltas
|
| 1485 |
+
delta = delta.repeat_interleave(position_ids.shape[1] // delta.shape[0], dim=0)
|
| 1486 |
+
vision_positions = position_ids + delta.expand_as(position_ids)
|
| 1487 |
+
vision_positions = vision_positions.expand(3, vision_positions.shape[1], -1)
|
| 1488 |
+
|
| 1489 |
+
# Concatenate "text + vision" positions into [4, bs, seq-len]
|
| 1490 |
+
if "position_ids" not in model_inputs:
|
| 1491 |
+
text_positions = torch.arange(input_ids, device=input_ids.device)[None, None, :]
|
| 1492 |
+
else:
|
| 1493 |
+
text_positions = model_inputs["position_ids"][None, ...]
|
| 1494 |
+
model_inputs["position_ids"] = torch.cat([text_positions, vision_positions], dim=0)
|
| 1495 |
+
|
| 1496 |
+
if cache_position[0] != 0 and cache_position.shape[-1] == 1:
|
| 1497 |
+
model_inputs["pixel_values"] = None
|
| 1498 |
+
model_inputs["pixel_values_videos"] = None
|
| 1499 |
+
model_inputs["states"] = None
|
| 1500 |
+
|
| 1501 |
+
return model_inputs
|
| 1502 |
+
|
| 1503 |
+
def _get_image_nums_and_video_nums(
|
| 1504 |
+
self,
|
| 1505 |
+
input_ids: torch.LongTensor | None,
|
| 1506 |
+
inputs_embeds: torch.Tensor | None = None,
|
| 1507 |
+
) -> tuple[torch.Tensor, torch.Tensor]:
|
| 1508 |
+
"""
|
| 1509 |
+
Get the number of images and videos for each sample to calculate the separation length of the sample tensor.
|
| 1510 |
+
These parameters are not passed through the processor to avoid unpredictable impacts from interface modifications.
|
| 1511 |
+
|
| 1512 |
+
Args:
|
| 1513 |
+
input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
|
| 1514 |
+
Indices of input sequence tokens in the vocabulary.
|
| 1515 |
+
|
| 1516 |
+
Returns:
|
| 1517 |
+
image_nums (`torch.LongTensor` of shape `(batch_size, num_images_sample)`)
|
| 1518 |
+
video_nums (`torch.LongTensor` of shape `(batch_size, num_videos_sample)`)
|
| 1519 |
+
"""
|
| 1520 |
+
image_token_id = self.config.image_token_id
|
| 1521 |
+
video_token_id = self.config.video_token_id
|
| 1522 |
+
vision_start_token_id = self.config.vision_start_token_id
|
| 1523 |
+
|
| 1524 |
+
if inputs_embeds is not None:
|
| 1525 |
+
vision_start_mask = (
|
| 1526 |
+
inputs_embeds
|
| 1527 |
+
== self.get_input_embeddings()(
|
| 1528 |
+
torch.tensor(vision_start_token_id, dtype=torch.long, device=inputs_embeds.device)
|
| 1529 |
+
)
|
| 1530 |
+
)[..., 0]
|
| 1531 |
+
image_mask = (
|
| 1532 |
+
inputs_embeds
|
| 1533 |
+
== self.get_input_embeddings()(
|
| 1534 |
+
torch.tensor(image_token_id, dtype=torch.long, device=inputs_embeds.device)
|
| 1535 |
+
)
|
| 1536 |
+
)[..., 0]
|
| 1537 |
+
video_mask = (
|
| 1538 |
+
inputs_embeds
|
| 1539 |
+
== self.get_input_embeddings()(
|
| 1540 |
+
torch.tensor(video_token_id, dtype=torch.long, device=inputs_embeds.device)
|
| 1541 |
+
)
|
| 1542 |
+
)[..., 0]
|
| 1543 |
+
else:
|
| 1544 |
+
vision_start_mask = input_ids == vision_start_token_id
|
| 1545 |
+
image_mask = input_ids == image_token_id
|
| 1546 |
+
video_mask = input_ids == video_token_id
|
| 1547 |
+
|
| 1548 |
+
vision_first_mask = torch.roll(vision_start_mask, shifts=1, dims=1)
|
| 1549 |
+
image_nums = torch.sum(vision_first_mask & image_mask, dim=1)
|
| 1550 |
+
video_nums = torch.sum(vision_first_mask & video_mask, dim=1)
|
| 1551 |
+
|
| 1552 |
+
return image_nums, video_nums
|
| 1553 |
+
|
| 1554 |
+
def _expand_inputs_for_generation(
|
| 1555 |
+
self,
|
| 1556 |
+
expand_size: int = 1,
|
| 1557 |
+
is_encoder_decoder: bool = False,
|
| 1558 |
+
input_ids: torch.LongTensor | None = None,
|
| 1559 |
+
**model_kwargs,
|
| 1560 |
+
) -> tuple[torch.LongTensor, dict[str, Any]]:
|
| 1561 |
+
# Overwritten -- Support for expanding tensors without a batch size dimension
|
| 1562 |
+
# e.g., pixel_values, image_grid_thw, pixel_values_videos, video_grid_thw, second_per_grid_t
|
| 1563 |
+
# pixel_values.shape[0] is sum(seqlen_images for samples)
|
| 1564 |
+
# image_grid_thw.shape[0] is sum(num_images for samples)
|
| 1565 |
+
|
| 1566 |
+
if expand_size == 1:
|
| 1567 |
+
return input_ids, model_kwargs
|
| 1568 |
+
|
| 1569 |
+
visual_keys = [
|
| 1570 |
+
"pixel_values",
|
| 1571 |
+
"image_grid_thw",
|
| 1572 |
+
"pixel_values_videos",
|
| 1573 |
+
"video_grid_thw",
|
| 1574 |
+
"second_per_grid_ts",
|
| 1575 |
+
]
|
| 1576 |
+
|
| 1577 |
+
def _expand_dict_for_generation_visual(dict_to_expand):
|
| 1578 |
+
image_grid_thw = model_kwargs.get("image_grid_thw", None)
|
| 1579 |
+
video_grid_thw = model_kwargs.get("video_grid_thw", None)
|
| 1580 |
+
image_nums, video_nums = self._get_image_nums_and_video_nums(
|
| 1581 |
+
input_ids, inputs_embeds=model_kwargs.get("inputs_embeds", None)
|
| 1582 |
+
)
|
| 1583 |
+
|
| 1584 |
+
def _repeat_interleave_samples(x, lengths, repeat_times):
|
| 1585 |
+
samples = torch.split(x, lengths)
|
| 1586 |
+
repeat_args = [repeat_times] + [1] * (x.dim() - 1)
|
| 1587 |
+
result = torch.cat([sample.repeat(*repeat_args) for sample in samples], dim=0)
|
| 1588 |
+
return result
|
| 1589 |
+
|
| 1590 |
+
for key in dict_to_expand:
|
| 1591 |
+
if key == "pixel_values":
|
| 1592 |
+
# split images into samples
|
| 1593 |
+
samples = torch.split(image_grid_thw, list(image_nums))
|
| 1594 |
+
# compute the sequence length of images for each sample
|
| 1595 |
+
lengths = [torch.prod(sample, dim=1).sum() for sample in samples]
|
| 1596 |
+
dict_to_expand[key] = _repeat_interleave_samples(
|
| 1597 |
+
dict_to_expand[key], lengths=lengths, repeat_times=expand_size
|
| 1598 |
+
)
|
| 1599 |
+
elif key == "image_grid_thw":
|
| 1600 |
+
# get the num of images for each sample
|
| 1601 |
+
lengths = list(image_nums)
|
| 1602 |
+
dict_to_expand[key] = _repeat_interleave_samples(
|
| 1603 |
+
dict_to_expand[key], lengths=lengths, repeat_times=expand_size
|
| 1604 |
+
)
|
| 1605 |
+
elif key == "pixel_values_videos":
|
| 1606 |
+
samples = torch.split(video_grid_thw, list(video_nums))
|
| 1607 |
+
lengths = [torch.prod(sample, dim=1).sum() for sample in samples]
|
| 1608 |
+
dict_to_expand[key] = _repeat_interleave_samples(
|
| 1609 |
+
dict_to_expand[key], lengths=lengths, repeat_times=expand_size
|
| 1610 |
+
)
|
| 1611 |
+
elif key == "video_grid_thw":
|
| 1612 |
+
lengths = list(video_nums)
|
| 1613 |
+
dict_to_expand[key] = _repeat_interleave_samples(
|
| 1614 |
+
dict_to_expand[key], lengths=lengths, repeat_times=expand_size
|
| 1615 |
+
)
|
| 1616 |
+
elif key == "second_per_grid_ts":
|
| 1617 |
+
dict_to_expand[key] = _repeat_interleave_samples(
|
| 1618 |
+
dict_to_expand[key], lengths=list(video_nums), repeat_times=expand_size
|
| 1619 |
+
)
|
| 1620 |
+
return dict_to_expand
|
| 1621 |
+
|
| 1622 |
+
def _expand_dict_for_generation(dict_to_expand):
|
| 1623 |
+
for key in dict_to_expand:
|
| 1624 |
+
if (
|
| 1625 |
+
key != "cache_position"
|
| 1626 |
+
and dict_to_expand[key] is not None
|
| 1627 |
+
and isinstance(dict_to_expand[key], torch.Tensor)
|
| 1628 |
+
and key not in visual_keys
|
| 1629 |
+
):
|
| 1630 |
+
dict_to_expand[key] = dict_to_expand[key].repeat_interleave(expand_size, dim=0)
|
| 1631 |
+
return dict_to_expand
|
| 1632 |
+
|
| 1633 |
+
model_kwargs = _expand_dict_for_generation_visual(model_kwargs)
|
| 1634 |
+
|
| 1635 |
+
if input_ids is not None:
|
| 1636 |
+
input_ids = input_ids.repeat_interleave(expand_size, dim=0)
|
| 1637 |
+
|
| 1638 |
+
model_kwargs = _expand_dict_for_generation(model_kwargs)
|
| 1639 |
+
|
| 1640 |
+
if is_encoder_decoder:
|
| 1641 |
+
if model_kwargs.get("encoder_outputs") is None:
|
| 1642 |
+
raise ValueError(
|
| 1643 |
+
"If `is_encoder_decoder` is True, make sure that `encoder_outputs` is defined."
|
| 1644 |
+
)
|
| 1645 |
+
model_kwargs["encoder_outputs"] = _expand_dict_for_generation(model_kwargs["encoder_outputs"])
|
| 1646 |
+
|
| 1647 |
+
return input_ids, model_kwargs
|
| 1648 |
+
|
| 1649 |
+
|
| 1650 |
+
__all__ = [
|
| 1651 |
+
"Qwen2_5_VLForConditionalGeneration",
|
| 1652 |
+
"Qwen2_5_VLModel",
|
| 1653 |
+
"Qwen2_5_VLPreTrainedModel",
|
| 1654 |
+
"Qwen2_5_VLTextModel",
|
| 1655 |
+
]
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"auto_map": {
|
| 3 |
+
"AutoProcessor": "processing_eo1.EO1VisionProcessor"
|
| 4 |
+
},
|
| 5 |
+
"crop_size": null,
|
| 6 |
+
"data_format": "channels_first",
|
| 7 |
+
"default_to_square": true,
|
| 8 |
+
"device": null,
|
| 9 |
+
"disable_grouping": null,
|
| 10 |
+
"do_center_crop": null,
|
| 11 |
+
"do_convert_rgb": true,
|
| 12 |
+
"do_normalize": true,
|
| 13 |
+
"do_rescale": true,
|
| 14 |
+
"do_resize": true,
|
| 15 |
+
"image_mean": [
|
| 16 |
+
0.48145466,
|
| 17 |
+
0.4578275,
|
| 18 |
+
0.40821073
|
| 19 |
+
],
|
| 20 |
+
"image_processor_type": "Qwen2VLImageProcessorFast",
|
| 21 |
+
"image_std": [
|
| 22 |
+
0.26862954,
|
| 23 |
+
0.26130258,
|
| 24 |
+
0.27577711
|
| 25 |
+
],
|
| 26 |
+
"input_data_format": null,
|
| 27 |
+
"max_pixels": 100352,
|
| 28 |
+
"merge_size": 2,
|
| 29 |
+
"min_pixels": 50176,
|
| 30 |
+
"patch_size": 14,
|
| 31 |
+
"processor_class": "EO1VisionProcessor",
|
| 32 |
+
"resample": 3,
|
| 33 |
+
"rescale_factor": 0.00392156862745098,
|
| 34 |
+
"return_tensors": null,
|
| 35 |
+
"size": {
|
| 36 |
+
"longest_edge": 12845056,
|
| 37 |
+
"shortest_edge": 3136
|
| 38 |
+
},
|
| 39 |
+
"temporal_patch_size": 2
|
| 40 |
+
}
|
processing_eo1.py
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2025 EO-Robotics Team. All rights reserved.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
import os
|
| 16 |
+
from typing import Union
|
| 17 |
+
|
| 18 |
+
import numpy as np
|
| 19 |
+
import torch
|
| 20 |
+
from lerobot.configs.types import FeatureType, NormalizationMode, PolicyFeature
|
| 21 |
+
from lerobot.constants import OBS_STATE
|
| 22 |
+
from lerobot.datasets.utils import cast_stats_to_numpy
|
| 23 |
+
from lerobot.policies.normalize import Normalize, Unnormalize
|
| 24 |
+
from transformers.feature_extraction_utils import BatchFeature
|
| 25 |
+
from transformers.image_utils import ImageInput
|
| 26 |
+
from transformers.processing_utils import (
|
| 27 |
+
ImagesKwargs,
|
| 28 |
+
ProcessingKwargs,
|
| 29 |
+
ProcessorMixin,
|
| 30 |
+
TextKwargs,
|
| 31 |
+
Unpack,
|
| 32 |
+
VideosKwargs,
|
| 33 |
+
)
|
| 34 |
+
from transformers.tokenization_utils_base import PreTokenizedInput, TextInput
|
| 35 |
+
from transformers.video_utils import VideoInput
|
| 36 |
+
|
| 37 |
+
os.environ["TOKENIZERS_PARALLELISM"] = "0"
|
| 38 |
+
|
| 39 |
+
"""constants"""
|
| 40 |
+
DEFAULT_IMAGE_TOKEN = "<|image_pad|>"
|
| 41 |
+
DEFAULT_VIDEO_TOKEN = "<|video_pad|>"
|
| 42 |
+
VISION_START_TOKEN = "<|vision_start|>"
|
| 43 |
+
VISION_END_TOKEN = "<|vision_end|>"
|
| 44 |
+
|
| 45 |
+
ACTION_START_TOKEN = "<|action_start|>"
|
| 46 |
+
DEFAULT_ACTION_TOKEN = "<|action_pad|>"
|
| 47 |
+
PASS_ACTION_TOKEN = "<|action_pass|>"
|
| 48 |
+
ACTION_END_TOKEN = "<|action_end|>"
|
| 49 |
+
|
| 50 |
+
STATE_START_TOKEN = "<|state_start|>"
|
| 51 |
+
DEFAULT_STATE_TOKEN = "<|state_pad|>"
|
| 52 |
+
STATE_END_TOKEN = "<|state_end|>"
|
| 53 |
+
TASK_VLA_TOKEN = "<|vla|>"
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
RobotInput = Union[np.ndarray, "torch.Tensor", list[np.ndarray], list["torch.Tensor"]]
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
class EO1VisionVideosProcessorKwargs(VideosKwargs, total=False):
|
| 60 |
+
fps: list[float] | float
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
class EO1VisionImagesKwargs(ImagesKwargs):
|
| 64 |
+
min_pixels: int | None
|
| 65 |
+
max_pixels: int | None
|
| 66 |
+
patch_size: int | None
|
| 67 |
+
temporal_patch_size: int | None
|
| 68 |
+
merge_size: int | None
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
class EO1VisionTextKwargs(TextKwargs):
|
| 72 |
+
noise_token_num: int | None
|
| 73 |
+
noise_prompt: str | None
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
class EO1VisionProcessorKwargs(ProcessingKwargs, total=False):
|
| 77 |
+
text_kwargs: EO1VisionTextKwargs
|
| 78 |
+
images_kwargs: EO1VisionImagesKwargs
|
| 79 |
+
videos_kwargs: EO1VisionVideosProcessorKwargs
|
| 80 |
+
_defaults = {
|
| 81 |
+
"text_kwargs": {
|
| 82 |
+
"padding": False,
|
| 83 |
+
"return_mm_token_type_ids": False,
|
| 84 |
+
},
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
class EO1VisionProcessor(ProcessorMixin):
|
| 89 |
+
"""EO1Vision Processor for Image, Text, Video, and Robotic Action Processing"""
|
| 90 |
+
|
| 91 |
+
attributes = ["image_processor", "tokenizer", "video_processor"]
|
| 92 |
+
valid_kwargs = ["chat_template"]
|
| 93 |
+
image_processor_class = "AutoImageProcessor"
|
| 94 |
+
video_processor_class = "AutoVideoProcessor"
|
| 95 |
+
tokenizer_class = ("Qwen2Tokenizer", "Qwen2TokenizerFast")
|
| 96 |
+
|
| 97 |
+
def __init__(
|
| 98 |
+
self,
|
| 99 |
+
image_processor=None,
|
| 100 |
+
tokenizer=None,
|
| 101 |
+
video_processor=None,
|
| 102 |
+
chat_template=None,
|
| 103 |
+
robot_config=None,
|
| 104 |
+
**kwargs,
|
| 105 |
+
):
|
| 106 |
+
self.image_token = getattr(tokenizer, "image_token", DEFAULT_IMAGE_TOKEN)
|
| 107 |
+
self.video_token = getattr(tokenizer, "video_token", DEFAULT_VIDEO_TOKEN)
|
| 108 |
+
self.action_token = getattr(tokenizer, "action_token", DEFAULT_ACTION_TOKEN)
|
| 109 |
+
self.state_token = getattr(tokenizer, "state_token", DEFAULT_STATE_TOKEN)
|
| 110 |
+
|
| 111 |
+
# robot policy
|
| 112 |
+
self.action_token_id = tokenizer.convert_tokens_to_ids(DEFAULT_ACTION_TOKEN) or 151666
|
| 113 |
+
self.action_pass_id = tokenizer.convert_tokens_to_ids(PASS_ACTION_TOKEN) or 151672
|
| 114 |
+
self.robot_config = robot_config or {}
|
| 115 |
+
self.set_normalization(self.robot_config)
|
| 116 |
+
|
| 117 |
+
super().__init__(image_processor, tokenizer, video_processor, chat_template=chat_template)
|
| 118 |
+
|
| 119 |
+
def set_normalization(self, robot_config: dict):
|
| 120 |
+
features, stats, state_mode = (
|
| 121 |
+
robot_config.get("features"),
|
| 122 |
+
robot_config.get("stats"),
|
| 123 |
+
robot_config.get("state_mode"),
|
| 124 |
+
)
|
| 125 |
+
if None in [features, stats, state_mode]:
|
| 126 |
+
return
|
| 127 |
+
else:
|
| 128 |
+
normalization_mapping = {
|
| 129 |
+
"STATE": NormalizationMode(state_mode),
|
| 130 |
+
"ACTION": NormalizationMode(state_mode),
|
| 131 |
+
}
|
| 132 |
+
normalize_inputs, unnormalize_outputs = {}, {}
|
| 133 |
+
for repo_id, fea in features.items():
|
| 134 |
+
stat = cast_stats_to_numpy(stats[repo_id])
|
| 135 |
+
fea = dataset_to_policy_features(fea)
|
| 136 |
+
|
| 137 |
+
input_features = {k: v for k, v in fea.items() if v.type == FeatureType.STATE}
|
| 138 |
+
output_features = {k: v for k, v in fea.items() if v.type == FeatureType.ACTION}
|
| 139 |
+
|
| 140 |
+
normalize_inputs[repo_id] = Normalize(input_features, normalization_mapping, stat)
|
| 141 |
+
unnormalize_outputs[repo_id] = Unnormalize(output_features, normalization_mapping, stat)
|
| 142 |
+
|
| 143 |
+
self.robot_config = dict(robot_config)
|
| 144 |
+
self.normalize_inputs, self.unnormalize_outputs = normalize_inputs, unnormalize_outputs
|
| 145 |
+
|
| 146 |
+
def __call__(
|
| 147 |
+
self,
|
| 148 |
+
images: ImageInput = None,
|
| 149 |
+
text: TextInput | PreTokenizedInput | list[TextInput] | list[PreTokenizedInput] = None,
|
| 150 |
+
videos: VideoInput = None,
|
| 151 |
+
states: RobotInput = None,
|
| 152 |
+
actions: RobotInput = None,
|
| 153 |
+
**kwargs: Unpack[EO1VisionProcessorKwargs],
|
| 154 |
+
) -> BatchFeature:
|
| 155 |
+
output_kwargs = self._merge_kwargs(
|
| 156 |
+
EO1VisionProcessorKwargs,
|
| 157 |
+
tokenizer_init_kwargs=self.tokenizer.init_kwargs,
|
| 158 |
+
**kwargs,
|
| 159 |
+
)
|
| 160 |
+
|
| 161 |
+
noise_token_num = output_kwargs["text_kwargs"].pop("noise_token_num", None)
|
| 162 |
+
output_kwargs["text_kwargs"].pop("noise_prompt", None)
|
| 163 |
+
|
| 164 |
+
image_inputs = videos_inputs = {}
|
| 165 |
+
if images is not None:
|
| 166 |
+
image_inputs = self.image_processor(images=images, **output_kwargs["images_kwargs"])
|
| 167 |
+
image_grid_thw = image_inputs["image_grid_thw"]
|
| 168 |
+
else:
|
| 169 |
+
image_inputs = {}
|
| 170 |
+
image_grid_thw = None
|
| 171 |
+
|
| 172 |
+
if videos is not None:
|
| 173 |
+
fps = output_kwargs["videos_kwargs"].get("fps", 2.0)
|
| 174 |
+
videos_inputs = self.video_processor(videos=videos, **output_kwargs["videos_kwargs"])
|
| 175 |
+
video_grid_thw = videos_inputs["video_grid_thw"]
|
| 176 |
+
if isinstance(fps, (int, float)):
|
| 177 |
+
second_per_grid_ts = [self.video_processor.temporal_patch_size / fps] * len(video_grid_thw)
|
| 178 |
+
elif hasattr(fps, "__len__") and len(fps) == len(video_grid_thw):
|
| 179 |
+
second_per_grid_ts = [self.video_processor.temporal_patch_size / tmp for tmp in fps]
|
| 180 |
+
else:
|
| 181 |
+
raise ValueError(
|
| 182 |
+
f"The length of fps ({len(fps) if hasattr(fps, '__len__') else fps}) must be equal to \
|
| 183 |
+
the length of video_grid_thw ({len(video_grid_thw)}) or fps should be a single number."
|
| 184 |
+
)
|
| 185 |
+
videos_inputs.update({"second_per_grid_ts": second_per_grid_ts})
|
| 186 |
+
else:
|
| 187 |
+
videos_inputs = {}
|
| 188 |
+
video_grid_thw = None
|
| 189 |
+
|
| 190 |
+
if not isinstance(text, list):
|
| 191 |
+
text = [text]
|
| 192 |
+
|
| 193 |
+
if images is not None:
|
| 194 |
+
merge_length = self.image_processor.merge_size**2
|
| 195 |
+
index = 0
|
| 196 |
+
for i in range(len(text)):
|
| 197 |
+
while self.image_token in text[i]:
|
| 198 |
+
text[i] = text[i].replace(
|
| 199 |
+
self.image_token,
|
| 200 |
+
"<|placeholder|>" * (image_grid_thw[index].prod() // merge_length),
|
| 201 |
+
1,
|
| 202 |
+
)
|
| 203 |
+
index += 1
|
| 204 |
+
text[i] = text[i].replace("<|placeholder|>", self.image_token)
|
| 205 |
+
|
| 206 |
+
if videos is not None:
|
| 207 |
+
merge_length = self.video_processor.merge_size**2
|
| 208 |
+
index = 0
|
| 209 |
+
for i in range(len(text)):
|
| 210 |
+
while self.video_token in text[i]:
|
| 211 |
+
text[i] = text[i].replace(
|
| 212 |
+
self.video_token,
|
| 213 |
+
"<|placeholder|>" * (video_grid_thw[index].prod() // merge_length),
|
| 214 |
+
1,
|
| 215 |
+
)
|
| 216 |
+
index += 1
|
| 217 |
+
text[i] = text[i].replace("<|placeholder|>", self.video_token)
|
| 218 |
+
|
| 219 |
+
# noise tokens
|
| 220 |
+
noise_token_num = noise_token_num or self.robot_config.get("action_chunk_size")
|
| 221 |
+
for i in range(len(text)):
|
| 222 |
+
while self.action_token in text[i]:
|
| 223 |
+
text[i] = text[i].replace(
|
| 224 |
+
self.action_token,
|
| 225 |
+
"<|placeholder|>" * noise_token_num,
|
| 226 |
+
1,
|
| 227 |
+
)
|
| 228 |
+
text[i] = text[i].replace("<|placeholder|>", self.action_token)
|
| 229 |
+
|
| 230 |
+
return_mm_token_type_ids = output_kwargs["text_kwargs"].pop("return_mm_token_type_ids", None)
|
| 231 |
+
text_inputs = self.tokenizer(text, **output_kwargs["text_kwargs"])
|
| 232 |
+
if return_mm_token_type_ids:
|
| 233 |
+
array_ids = np.array(text_inputs["input_ids"])
|
| 234 |
+
mm_token_type_ids = np.zeros_like(text_inputs["input_ids"])
|
| 235 |
+
mm_token_type_ids[array_ids == self.image_token_id] = 1
|
| 236 |
+
text_inputs["mm_token_type_ids"] = mm_token_type_ids.tolist()
|
| 237 |
+
|
| 238 |
+
# robot inputs
|
| 239 |
+
robot_inputs = {}
|
| 240 |
+
|
| 241 |
+
if states is not None:
|
| 242 |
+
if isinstance(states, list):
|
| 243 |
+
states = torch.stack(states, dim=0)
|
| 244 |
+
if states.ndim == 1:
|
| 245 |
+
states = states.unsqueeze(0)
|
| 246 |
+
robot_inputs.update({"states": states})
|
| 247 |
+
|
| 248 |
+
if actions is not None:
|
| 249 |
+
if isinstance(actions, list):
|
| 250 |
+
actions = torch.stack(actions, dim=0)
|
| 251 |
+
if actions.ndim == 2:
|
| 252 |
+
actions = actions.unsqueeze(0)
|
| 253 |
+
robot_inputs.update({"actions": actions})
|
| 254 |
+
|
| 255 |
+
return BatchFeature(
|
| 256 |
+
data={**text_inputs, **image_inputs, **videos_inputs, **robot_inputs},
|
| 257 |
+
)
|
| 258 |
+
|
| 259 |
+
@property
|
| 260 |
+
def model_input_names(self):
|
| 261 |
+
tokenizer_input_names = self.tokenizer.model_input_names
|
| 262 |
+
image_processor_input_names = self.image_processor.model_input_names
|
| 263 |
+
names_from_processor = list(dict.fromkeys(tokenizer_input_names + image_processor_input_names))
|
| 264 |
+
return names_from_processor + ["second_per_grid_ts"] + ["states", "actions"]
|
| 265 |
+
|
| 266 |
+
@torch.no_grad
|
| 267 |
+
def _prepare_robot_inputs(self, batch: dict):
|
| 268 |
+
"""Prepare model inputs from raw robot batch"""
|
| 269 |
+
batch_messages = []
|
| 270 |
+
batch_states = []
|
| 271 |
+
max_state_dim = self.robot_config.get("max_state_dim", 32)
|
| 272 |
+
|
| 273 |
+
state_keys = [x for x in batch.keys() if x.startswith(OBS_STATE)]
|
| 274 |
+
batch_size = len(batch[state_keys[0]])
|
| 275 |
+
|
| 276 |
+
if "repo_id" in batch:
|
| 277 |
+
repo_ids = batch.pop("repo_id")
|
| 278 |
+
else:
|
| 279 |
+
print("no repo_id found, use the first one in normalize_inputs")
|
| 280 |
+
repo_ids = list(self.normalize_inputs.keys())[0]
|
| 281 |
+
repo_ids = [repo_ids] * batch_size if isinstance(repo_ids, str) else repo_ids
|
| 282 |
+
|
| 283 |
+
for i, repo_id in enumerate(repo_ids):
|
| 284 |
+
mini_batch = {k: v[i] for k, v in batch.items()}
|
| 285 |
+
|
| 286 |
+
normalize_inputs = self.normalize_inputs[repo_id]
|
| 287 |
+
select_video_keys = self.robot_config["select_video_keys"][repo_id]
|
| 288 |
+
select_state_keys = self.robot_config["select_state_keys"][repo_id]
|
| 289 |
+
|
| 290 |
+
for k in normalize_inputs.features:
|
| 291 |
+
if not isinstance(mini_batch[k], torch.Tensor):
|
| 292 |
+
mini_batch[k] = torch.tensor(mini_batch[k], dtype=torch.float32)
|
| 293 |
+
|
| 294 |
+
mini_batch = normalize_inputs(mini_batch)
|
| 295 |
+
states = torch.concat([mini_batch[k] for k in select_state_keys])
|
| 296 |
+
batch_states.append(pad_vector(states, max_state_dim))
|
| 297 |
+
messages = [
|
| 298 |
+
{
|
| 299 |
+
"role": "user",
|
| 300 |
+
"content": [
|
| 301 |
+
*({"type": "image", "image": mini_batch[k]} for k in select_video_keys),
|
| 302 |
+
{"type": "state", "state": []}, # chat template state token
|
| 303 |
+
{"type": "text", "text": f"{mini_batch['task']}{TASK_VLA_TOKEN}"},
|
| 304 |
+
],
|
| 305 |
+
}
|
| 306 |
+
]
|
| 307 |
+
batch_messages += [messages]
|
| 308 |
+
return batch_messages, batch_states, repo_ids
|
| 309 |
+
|
| 310 |
+
def _process_robot_outputs(self, repo_ids: list[str], actions: torch.Tensor):
|
| 311 |
+
"""Process model outputs back to robot format"""
|
| 312 |
+
output_actions = []
|
| 313 |
+
for i, repo_id in enumerate(repo_ids):
|
| 314 |
+
unnormalize_outputs = self.unnormalize_outputs[repo_id]
|
| 315 |
+
select_action_keys = self.robot_config["select_action_keys"][repo_id]
|
| 316 |
+
features = unnormalize_outputs.features
|
| 317 |
+
cum_dims = [0] + np.cumsum([features[k].shape[0] for k in select_action_keys]).tolist()
|
| 318 |
+
origin_action = actions[i].to(torch.float32)[..., : cum_dims[-1]]
|
| 319 |
+
batch = {
|
| 320 |
+
k: origin_action[..., cum_dims[m] : cum_dims[m + 1]] for m, k in enumerate(select_action_keys)
|
| 321 |
+
}
|
| 322 |
+
unnorm_actions = unnormalize_outputs(batch)
|
| 323 |
+
unnorm_actions = torch.concat([unnorm_actions[k] for k in select_action_keys], -1)
|
| 324 |
+
output_actions.append(unnorm_actions)
|
| 325 |
+
output_actions = torch.stack(output_actions, dim=0)
|
| 326 |
+
return output_actions
|
| 327 |
+
|
| 328 |
+
@torch.no_grad
|
| 329 |
+
def select_action(self, model, batch: dict, **kwargs):
|
| 330 |
+
batch_messages, batch_states, repo_ids = self._prepare_robot_inputs(batch)
|
| 331 |
+
|
| 332 |
+
noise_prompt = f"{ACTION_START_TOKEN}{DEFAULT_ACTION_TOKEN}{ACTION_END_TOKEN}"
|
| 333 |
+
inputs = self.apply_chat_template(
|
| 334 |
+
batch_messages,
|
| 335 |
+
states=batch_states,
|
| 336 |
+
add_generation_prompt=True,
|
| 337 |
+
noise_prompt=noise_prompt,
|
| 338 |
+
tokenize=True,
|
| 339 |
+
return_dict=True,
|
| 340 |
+
return_tensors="pt",
|
| 341 |
+
).to(model.device)
|
| 342 |
+
|
| 343 |
+
actions = model.sample_actions(**inputs).cpu()
|
| 344 |
+
output_actions = self._process_robot_outputs(repo_ids, actions)
|
| 345 |
+
return BatchFeature({"action": output_actions})
|
| 346 |
+
|
| 347 |
+
|
| 348 |
+
def dataset_to_policy_features(features: dict[str, dict]) -> dict[str, PolicyFeature]:
|
| 349 |
+
"""Lerobot robot policy features"""
|
| 350 |
+
policy_features = {}
|
| 351 |
+
for key, ft in features.items():
|
| 352 |
+
shape = ft["shape"]
|
| 353 |
+
if ft["dtype"] in ["image", "video"]:
|
| 354 |
+
type = FeatureType.VISUAL
|
| 355 |
+
if len(shape) != 3:
|
| 356 |
+
raise ValueError(f"Number of dimensions of {key} != 3 (shape={shape})")
|
| 357 |
+
names = ft["names"]
|
| 358 |
+
if names[2] in ["channel", "channels"]: # (h, w, c) -> (c, h, w)
|
| 359 |
+
shape = (shape[2], shape[0], shape[1])
|
| 360 |
+
elif key == "observation.environment_state":
|
| 361 |
+
type = FeatureType.ENV
|
| 362 |
+
elif key.startswith("observation"):
|
| 363 |
+
type = FeatureType.STATE
|
| 364 |
+
elif key.startswith("action"):
|
| 365 |
+
type = FeatureType.ACTION
|
| 366 |
+
else:
|
| 367 |
+
continue
|
| 368 |
+
policy_features[key] = PolicyFeature(
|
| 369 |
+
type=type,
|
| 370 |
+
shape=shape,
|
| 371 |
+
)
|
| 372 |
+
return policy_features
|
| 373 |
+
|
| 374 |
+
|
| 375 |
+
def pad_vector(vector, new_dim=32):
|
| 376 |
+
"""Can be (batch_size x sequence_length x features_dimension)
|
| 377 |
+
or (batch_size x features_dimension)
|
| 378 |
+
"""
|
| 379 |
+
if vector.shape[-1] == new_dim:
|
| 380 |
+
return vector
|
| 381 |
+
shape = list(vector.shape)
|
| 382 |
+
current_dim = shape[-1]
|
| 383 |
+
shape[-1] = new_dim
|
| 384 |
+
new_vector = torch.zeros(*shape, dtype=vector.dtype, device=vector.device)
|
| 385 |
+
new_vector[..., :current_dim] = vector
|
| 386 |
+
return new_vector
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
EO1VisionProcessor.register_for_auto_class()
|
processor_config.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"auto_map": {
|
| 3 |
+
"AutoProcessor": "processing_eo1.EO1VisionProcessor"
|
| 4 |
+
},
|
| 5 |
+
"processor_class": "EO1VisionProcessor",
|
| 6 |
+
"robot_config": {
|
| 7 |
+
"action_chunk_size": 16,
|
| 8 |
+
"features": {},
|
| 9 |
+
"max_action_dim": 32,
|
| 10 |
+
"select_action_keys": {},
|
| 11 |
+
"select_state_keys": {},
|
| 12 |
+
"select_video_keys": {},
|
| 13 |
+
"state_mode": "MEAN_STD",
|
| 14 |
+
"stats": {}
|
| 15 |
+
}
|
| 16 |
+
}
|
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:0d75140c13f06848d19839de24c66ac06c06d3431887b0aa737948337d4031b4
|
| 3 |
+
size 11423419
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": false,
|
| 3 |
+
"add_prefix_space": false,
|
| 4 |
+
"added_tokens_decoder": {
|
| 5 |
+
"151643": {
|
| 6 |
+
"content": "<|endoftext|>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": false,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false,
|
| 11 |
+
"special": true
|
| 12 |
+
},
|
| 13 |
+
"151644": {
|
| 14 |
+
"content": "<|im_start|>",
|
| 15 |
+
"lstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"rstrip": false,
|
| 18 |
+
"single_word": false,
|
| 19 |
+
"special": true
|
| 20 |
+
},
|
| 21 |
+
"151645": {
|
| 22 |
+
"content": "<|im_end|>",
|
| 23 |
+
"lstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"rstrip": false,
|
| 26 |
+
"single_word": false,
|
| 27 |
+
"special": true
|
| 28 |
+
},
|
| 29 |
+
"151646": {
|
| 30 |
+
"content": "<|object_ref_start|>",
|
| 31 |
+
"lstrip": false,
|
| 32 |
+
"normalized": false,
|
| 33 |
+
"rstrip": false,
|
| 34 |
+
"single_word": false,
|
| 35 |
+
"special": true
|
| 36 |
+
},
|
| 37 |
+
"151647": {
|
| 38 |
+
"content": "<|object_ref_end|>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false,
|
| 43 |
+
"special": true
|
| 44 |
+
},
|
| 45 |
+
"151648": {
|
| 46 |
+
"content": "<|box_start|>",
|
| 47 |
+
"lstrip": false,
|
| 48 |
+
"normalized": false,
|
| 49 |
+
"rstrip": false,
|
| 50 |
+
"single_word": false,
|
| 51 |
+
"special": true
|
| 52 |
+
},
|
| 53 |
+
"151649": {
|
| 54 |
+
"content": "<|box_end|>",
|
| 55 |
+
"lstrip": false,
|
| 56 |
+
"normalized": false,
|
| 57 |
+
"rstrip": false,
|
| 58 |
+
"single_word": false,
|
| 59 |
+
"special": true
|
| 60 |
+
},
|
| 61 |
+
"151650": {
|
| 62 |
+
"content": "<|quad_start|>",
|
| 63 |
+
"lstrip": false,
|
| 64 |
+
"normalized": false,
|
| 65 |
+
"rstrip": false,
|
| 66 |
+
"single_word": false,
|
| 67 |
+
"special": true
|
| 68 |
+
},
|
| 69 |
+
"151651": {
|
| 70 |
+
"content": "<|quad_end|>",
|
| 71 |
+
"lstrip": false,
|
| 72 |
+
"normalized": false,
|
| 73 |
+
"rstrip": false,
|
| 74 |
+
"single_word": false,
|
| 75 |
+
"special": true
|
| 76 |
+
},
|
| 77 |
+
"151652": {
|
| 78 |
+
"content": "<|vision_start|>",
|
| 79 |
+
"lstrip": false,
|
| 80 |
+
"normalized": false,
|
| 81 |
+
"rstrip": false,
|
| 82 |
+
"single_word": false,
|
| 83 |
+
"special": true
|
| 84 |
+
},
|
| 85 |
+
"151653": {
|
| 86 |
+
"content": "<|vision_end|>",
|
| 87 |
+
"lstrip": false,
|
| 88 |
+
"normalized": false,
|
| 89 |
+
"rstrip": false,
|
| 90 |
+
"single_word": false,
|
| 91 |
+
"special": true
|
| 92 |
+
},
|
| 93 |
+
"151654": {
|
| 94 |
+
"content": "<|vision_pad|>",
|
| 95 |
+
"lstrip": false,
|
| 96 |
+
"normalized": false,
|
| 97 |
+
"rstrip": false,
|
| 98 |
+
"single_word": false,
|
| 99 |
+
"special": true
|
| 100 |
+
},
|
| 101 |
+
"151655": {
|
| 102 |
+
"content": "<|image_pad|>",
|
| 103 |
+
"lstrip": false,
|
| 104 |
+
"normalized": false,
|
| 105 |
+
"rstrip": false,
|
| 106 |
+
"single_word": false,
|
| 107 |
+
"special": true
|
| 108 |
+
},
|
| 109 |
+
"151656": {
|
| 110 |
+
"content": "<|video_pad|>",
|
| 111 |
+
"lstrip": false,
|
| 112 |
+
"normalized": false,
|
| 113 |
+
"rstrip": false,
|
| 114 |
+
"single_word": false,
|
| 115 |
+
"special": true
|
| 116 |
+
},
|
| 117 |
+
"151657": {
|
| 118 |
+
"content": "<tool_call>",
|
| 119 |
+
"lstrip": false,
|
| 120 |
+
"normalized": false,
|
| 121 |
+
"rstrip": false,
|
| 122 |
+
"single_word": false,
|
| 123 |
+
"special": false
|
| 124 |
+
},
|
| 125 |
+
"151658": {
|
| 126 |
+
"content": "</tool_call>",
|
| 127 |
+
"lstrip": false,
|
| 128 |
+
"normalized": false,
|
| 129 |
+
"rstrip": false,
|
| 130 |
+
"single_word": false,
|
| 131 |
+
"special": false
|
| 132 |
+
},
|
| 133 |
+
"151659": {
|
| 134 |
+
"content": "<|fim_prefix|>",
|
| 135 |
+
"lstrip": false,
|
| 136 |
+
"normalized": false,
|
| 137 |
+
"rstrip": false,
|
| 138 |
+
"single_word": false,
|
| 139 |
+
"special": false
|
| 140 |
+
},
|
| 141 |
+
"151660": {
|
| 142 |
+
"content": "<|fim_middle|>",
|
| 143 |
+
"lstrip": false,
|
| 144 |
+
"normalized": false,
|
| 145 |
+
"rstrip": false,
|
| 146 |
+
"single_word": false,
|
| 147 |
+
"special": false
|
| 148 |
+
},
|
| 149 |
+
"151661": {
|
| 150 |
+
"content": "<|fim_suffix|>",
|
| 151 |
+
"lstrip": false,
|
| 152 |
+
"normalized": false,
|
| 153 |
+
"rstrip": false,
|
| 154 |
+
"single_word": false,
|
| 155 |
+
"special": false
|
| 156 |
+
},
|
| 157 |
+
"151662": {
|
| 158 |
+
"content": "<|fim_pad|>",
|
| 159 |
+
"lstrip": false,
|
| 160 |
+
"normalized": false,
|
| 161 |
+
"rstrip": false,
|
| 162 |
+
"single_word": false,
|
| 163 |
+
"special": false
|
| 164 |
+
},
|
| 165 |
+
"151663": {
|
| 166 |
+
"content": "<|repo_name|>",
|
| 167 |
+
"lstrip": false,
|
| 168 |
+
"normalized": false,
|
| 169 |
+
"rstrip": false,
|
| 170 |
+
"single_word": false,
|
| 171 |
+
"special": false
|
| 172 |
+
},
|
| 173 |
+
"151664": {
|
| 174 |
+
"content": "<|file_sep|>",
|
| 175 |
+
"lstrip": false,
|
| 176 |
+
"normalized": false,
|
| 177 |
+
"rstrip": false,
|
| 178 |
+
"single_word": false,
|
| 179 |
+
"special": false
|
| 180 |
+
},
|
| 181 |
+
"151665": {
|
| 182 |
+
"content": "<|action_start|>",
|
| 183 |
+
"lstrip": false,
|
| 184 |
+
"normalized": false,
|
| 185 |
+
"rstrip": false,
|
| 186 |
+
"single_word": false,
|
| 187 |
+
"special": true
|
| 188 |
+
},
|
| 189 |
+
"151666": {
|
| 190 |
+
"content": "<|action_pad|>",
|
| 191 |
+
"lstrip": false,
|
| 192 |
+
"normalized": false,
|
| 193 |
+
"rstrip": false,
|
| 194 |
+
"single_word": false,
|
| 195 |
+
"special": true
|
| 196 |
+
},
|
| 197 |
+
"151667": {
|
| 198 |
+
"content": "<|action_end|>",
|
| 199 |
+
"lstrip": false,
|
| 200 |
+
"normalized": false,
|
| 201 |
+
"rstrip": false,
|
| 202 |
+
"single_word": false,
|
| 203 |
+
"special": true
|
| 204 |
+
},
|
| 205 |
+
"151668": {
|
| 206 |
+
"content": "<|state_start|>",
|
| 207 |
+
"lstrip": false,
|
| 208 |
+
"normalized": false,
|
| 209 |
+
"rstrip": false,
|
| 210 |
+
"single_word": false,
|
| 211 |
+
"special": true
|
| 212 |
+
},
|
| 213 |
+
"151669": {
|
| 214 |
+
"content": "<|state_pad|>",
|
| 215 |
+
"lstrip": false,
|
| 216 |
+
"normalized": false,
|
| 217 |
+
"rstrip": false,
|
| 218 |
+
"single_word": false,
|
| 219 |
+
"special": true
|
| 220 |
+
},
|
| 221 |
+
"151670": {
|
| 222 |
+
"content": "<|state_end|>",
|
| 223 |
+
"lstrip": false,
|
| 224 |
+
"normalized": false,
|
| 225 |
+
"rstrip": false,
|
| 226 |
+
"single_word": false,
|
| 227 |
+
"special": true
|
| 228 |
+
},
|
| 229 |
+
"151671": {
|
| 230 |
+
"content": "<|vla|>",
|
| 231 |
+
"lstrip": false,
|
| 232 |
+
"normalized": false,
|
| 233 |
+
"rstrip": false,
|
| 234 |
+
"single_word": false,
|
| 235 |
+
"special": true
|
| 236 |
+
},
|
| 237 |
+
"151672": {
|
| 238 |
+
"content": "<|action_pass|>",
|
| 239 |
+
"lstrip": false,
|
| 240 |
+
"normalized": false,
|
| 241 |
+
"rstrip": false,
|
| 242 |
+
"single_word": false,
|
| 243 |
+
"special": true
|
| 244 |
+
}
|
| 245 |
+
},
|
| 246 |
+
"additional_special_tokens": [
|
| 247 |
+
"<|im_start|>",
|
| 248 |
+
"<|im_end|>",
|
| 249 |
+
"<|object_ref_start|>",
|
| 250 |
+
"<|object_ref_end|>",
|
| 251 |
+
"<|box_start|>",
|
| 252 |
+
"<|box_end|>",
|
| 253 |
+
"<|quad_start|>",
|
| 254 |
+
"<|quad_end|>",
|
| 255 |
+
"<|vision_start|>",
|
| 256 |
+
"<|vision_end|>",
|
| 257 |
+
"<|vision_pad|>",
|
| 258 |
+
"<|image_pad|>",
|
| 259 |
+
"<|video_pad|>"
|
| 260 |
+
],
|
| 261 |
+
"auto_map": {
|
| 262 |
+
"AutoProcessor": "processing_eo1.EO1VisionProcessor"
|
| 263 |
+
},
|
| 264 |
+
"bos_token": null,
|
| 265 |
+
"clean_up_tokenization_spaces": false,
|
| 266 |
+
"eos_token": "<|im_end|>",
|
| 267 |
+
"errors": "replace",
|
| 268 |
+
"extra_special_tokens": {},
|
| 269 |
+
"model_max_length": 131072,
|
| 270 |
+
"pad_token": "<|endoftext|>",
|
| 271 |
+
"padding_side": "right",
|
| 272 |
+
"processor_class": "EO1VisionProcessor",
|
| 273 |
+
"split_special_tokens": false,
|
| 274 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 275 |
+
"unk_token": null,
|
| 276 |
+
"use_fast": true
|
| 277 |
+
}
|
trainer_state.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
video_preprocessor_config.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"auto_map": {
|
| 3 |
+
"AutoProcessor": "processing_eo1.EO1VisionProcessor"
|
| 4 |
+
},
|
| 5 |
+
"crop_size": null,
|
| 6 |
+
"data_format": "channels_first",
|
| 7 |
+
"default_to_square": true,
|
| 8 |
+
"device": null,
|
| 9 |
+
"do_center_crop": null,
|
| 10 |
+
"do_convert_rgb": true,
|
| 11 |
+
"do_normalize": true,
|
| 12 |
+
"do_pad": null,
|
| 13 |
+
"do_rescale": true,
|
| 14 |
+
"do_resize": true,
|
| 15 |
+
"do_sample_frames": false,
|
| 16 |
+
"fps": null,
|
| 17 |
+
"image_mean": [
|
| 18 |
+
0.48145466,
|
| 19 |
+
0.4578275,
|
| 20 |
+
0.40821073
|
| 21 |
+
],
|
| 22 |
+
"image_std": [
|
| 23 |
+
0.26862954,
|
| 24 |
+
0.26130258,
|
| 25 |
+
0.27577711
|
| 26 |
+
],
|
| 27 |
+
"input_data_format": null,
|
| 28 |
+
"max_frames": 768,
|
| 29 |
+
"max_pixels": 12845056,
|
| 30 |
+
"merge_size": 2,
|
| 31 |
+
"min_frames": 4,
|
| 32 |
+
"min_pixels": 3136,
|
| 33 |
+
"num_frames": null,
|
| 34 |
+
"patch_size": 14,
|
| 35 |
+
"processor_class": "EO1VisionProcessor",
|
| 36 |
+
"resample": 3,
|
| 37 |
+
"rescale_factor": 0.00392156862745098,
|
| 38 |
+
"return_metadata": false,
|
| 39 |
+
"size": {
|
| 40 |
+
"longest_edge": 12845056,
|
| 41 |
+
"shortest_edge": 3136
|
| 42 |
+
},
|
| 43 |
+
"size_divisor": null,
|
| 44 |
+
"temporal_patch_size": 2,
|
| 45 |
+
"video_metadata": null,
|
| 46 |
+
"video_processor_type": "Qwen2VLVideoProcessor"
|
| 47 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|