brandonywl commited on
Commit
d23799d
·
verified ·
1 Parent(s): b2170fc

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ images/gme_logo.png filter=lfs diff=lfs merge=lfs -text
1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 1536,
3
+ "pooling_mode_cls_token": false,
4
+ "pooling_mode_mean_tokens": false,
5
+ "pooling_mode_max_tokens": false,
6
+ "pooling_mode_mean_sqrt_len_tokens": false,
7
+ "pooling_mode_weightedmean_tokens": false,
8
+ "pooling_mode_lasttoken": true,
9
+ "include_prompt": true
10
+ }
README.md ADDED
The diff for this file is too large to render. See raw diff
 
added_tokens.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "<|box_end|>": 151649,
3
+ "<|box_start|>": 151648,
4
+ "<|endoftext|>": 151643,
5
+ "<|im_end|>": 151645,
6
+ "<|im_start|>": 151644,
7
+ "<|image_pad|>": 151655,
8
+ "<|object_ref_end|>": 151647,
9
+ "<|object_ref_start|>": 151646,
10
+ "<|quad_end|>": 151651,
11
+ "<|quad_start|>": 151650,
12
+ "<|video_pad|>": 151656,
13
+ "<|vision_end|>": 151653,
14
+ "<|vision_pad|>": 151654,
15
+ "<|vision_start|>": 151652
16
+ }
chat_template.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "chat_template": "{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n{% endif %}<|im_start|>{{ message['role'] }}\n{% if message['content'] is string %}{{ message['content'] }}<|im_end|>\n{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_start|><|image_pad|><|vision_end|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_start|><|video_pad|><|vision_end|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>\n{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant\n{% endif %}"
3
+ }
config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "Alibaba-NLP/gme-Qwen2-VL-2B-Instruct",
3
+ "architectures": [
4
+ "Qwen2VLForConditionalGeneration",
5
+ "GmeQwen2VL"
6
+ ],
7
+ "auto_map": {
8
+ "AutoConfig": "modeling_gme_qwen2vl.GmeQwen2VLConfig",
9
+ "AutoModel": "modeling_gme_qwen2vl.GmeQwen2VL"
10
+ },
11
+ "attention_dropout": 0.0,
12
+ "bos_token_id": 151643,
13
+ "eos_token_id": 151645,
14
+ "hidden_act": "silu",
15
+ "hidden_size": 1536,
16
+ "image_token_id": 151655,
17
+ "initializer_range": 0.02,
18
+ "intermediate_size": 8960,
19
+ "max_position_embeddings": 32768,
20
+ "max_window_layers": 28,
21
+ "model_type": "qwen2_vl",
22
+ "num_attention_heads": 12,
23
+ "num_hidden_layers": 28,
24
+ "num_key_value_heads": 2,
25
+ "rms_norm_eps": 1e-6,
26
+ "rope_scaling": {
27
+ "mrope_section": [16, 24, 24],
28
+ "type": "mrope"
29
+ },
30
+ "rope_theta": 1000000.0,
31
+ "sliding_window": 32768,
32
+ "tie_word_embeddings": true,
33
+ "torch_dtype": "float32",
34
+ "transformers_version": "4.45.0.dev0",
35
+ "use_cache": true,
36
+ "use_sliding_window": false,
37
+ "video_token_id": 151656,
38
+ "vision_config": {
39
+ "hidden_size": 1536,
40
+ "in_chans": 3,
41
+ "model_type": "qwen2_vl",
42
+ "spatial_patch_size": 14
43
+ },
44
+ "vision_end_token_id": 151653,
45
+ "vision_start_token_id": 151652,
46
+ "vision_token_id": 151654,
47
+ "vocab_size": 151936
48
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "prompts": {
3
+ "query": "<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n"
4
+ },
5
+ "default_prompt_name": null,
6
+ "similarity_fn_name": null
7
+ }
custom_st.py ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ import logging
3
+ from io import BytesIO
4
+ from typing import Any, Dict, Optional, List
5
+ import torch
6
+ from PIL import Image
7
+ from sentence_transformers.models import Transformer as BaseTransformer
8
+ from transformers import AutoModelForVision2Seq, AutoProcessor
9
+
10
+
11
+ class MultiModalTransformer(BaseTransformer):
12
+ def __init__(
13
+ self,
14
+ model_name_or_path: str,
15
+ cache_dir: Optional[str] = None,
16
+ tokenizer_args: Optional[Dict[str, Any]] = None,
17
+ min_image_tokens: int = 256,
18
+ max_image_tokens: int = 1280,
19
+ max_length: int = 1800,
20
+ **kwargs,
21
+ ):
22
+ super().__init__(model_name_or_path, **kwargs)
23
+ if tokenizer_args is None:
24
+ tokenizer_args = {}
25
+ tokenizer_args.pop("trust_remote_code", None)
26
+
27
+ # Initialize processor
28
+ min_pixels = min_image_tokens * 28 * 28
29
+ max_pixels = max_image_tokens * 28 * 28
30
+ self.processor = AutoProcessor.from_pretrained(
31
+ model_name_or_path, min_pixels=min_pixels, max_pixels=max_pixels, **kwargs
32
+ )
33
+ self.processor.tokenizer.padding_side = 'right'
34
+ self.sep = ' '
35
+ self.max_length = max_length
36
+ self.normalize = True
37
+
38
+ def _load_model(
39
+ self,
40
+ model_name_or_path: str,
41
+ config,
42
+ cache_dir: str,
43
+ backend: str,
44
+ is_peft_model: bool,
45
+ **model_args,
46
+ ) -> None:
47
+ model_args.pop("trust_remote_code", None)
48
+ self.auto_model = AutoModelForVision2Seq.from_pretrained(
49
+ model_name_or_path, torch_dtype=torch.float16, **model_args
50
+ )
51
+
52
+ def forward(
53
+ self, features: Dict[str, torch.Tensor], **kwargs
54
+ ) -> Dict[str, torch.Tensor]:
55
+ if features.get("inputs_embeds", None) is None:
56
+ features["inputs_embeds"] = self.auto_model.base_model.get_input_embeddings()(features["input_ids"])
57
+ if features.get("pixel_values", None) is not None:
58
+ features["pixel_values"] = features["pixel_values"].type(self.auto_model.visual.get_dtype())
59
+ image_embeds = self.auto_model.visual(
60
+ features["pixel_values"], grid_thw=features["image_grid_thw"]
61
+ )
62
+ image_mask = features["input_ids"] == self.auto_model.config.image_token_id
63
+ features["inputs_embeds"][image_mask] = image_embeds
64
+ # features.pop("pixel_values")
65
+ # features.pop("image_grid_thw")
66
+ # features.pop("input_ids")
67
+ inputs = {k: v for k, v in features.items() if k in 'position_ids,attention_mask,inputs_embeds'}
68
+ outputs = self.auto_model.model(
69
+ **inputs,
70
+ return_dict=True,
71
+ output_hidden_states=True,
72
+ # **kwargs
73
+ )
74
+ # pooling_mask = features["attention_mask"] if features.get("pooling_mask", None) is None else features["pooling_mask"]
75
+ # left_padding = (pooling_mask[:, -1].sum() == pooling_mask.shape[0]) # TODO
76
+ # if left_padding:
77
+ # embeddings = outputs.last_hidden_state
78
+ # else:
79
+ # sequence_lengths = pooling_mask.sum(dim=1) - 1
80
+ # embeddings = outputs.last_hidden_state[torch.arange(
81
+ # outputs.last_hidden_state.shape[0], device=outputs.last_hidden_state.device
82
+ # ), sequence_lengths]
83
+ features.update({"token_embeddings": outputs.last_hidden_state})
84
+ return features
85
+
86
+ def tokenize(self, texts: List[List[Dict[str, Any]]] | List[str]) -> Dict[str, torch.Tensor]:
87
+ default_instruction = 'You are a helpful assistant.'
88
+
89
+ all_texts, all_images = list(), list()
90
+ for item in texts:
91
+ if isinstance(item, str):
92
+ txt, img, inst = item, None, default_instruction
93
+ elif isinstance(item, dict):
94
+ txt = item.get('text', None)
95
+ img = item.get('image', None)
96
+ inst = item.get('prompt', default_instruction)
97
+ else:
98
+ raise RuntimeError(f'Input format not supported! {item=}')
99
+
100
+ input_str = ''
101
+ if img is None:
102
+ all_images = None # All examples in the same batch are consistent
103
+ # or will have ValueError: Could not make a flat list of images from xxxx
104
+ else:
105
+ input_str += '<|vision_start|><|image_pad|><|vision_end|>'
106
+ img = fetch_image(img)
107
+ all_images.append(img)
108
+ if txt is not None:
109
+ input_str += txt
110
+ msg = f'<|im_start|>system\n{inst}<|im_end|>\n<|im_start|>user\n{input_str}<|im_end|>\n<|im_start|>assistant\n<|endoftext|>'
111
+ all_texts.append(msg)
112
+
113
+ inputs = self.processor(
114
+ text=all_texts,
115
+ images=all_images,
116
+ padding="longest",
117
+ truncation=True,
118
+ max_length=self.max_seq_length,
119
+ return_tensors='pt'
120
+ )
121
+ return inputs
122
+
123
+
124
+ ### Copied from qwen_vl_utils.vision_process.py
125
+ import base64
126
+ from io import BytesIO
127
+ import requests
128
+
129
+ IMAGE_FACTOR = 28
130
+ MIN_PIXELS = 4 * 28 * 28
131
+ MAX_PIXELS = 16384 * 28 * 28
132
+ MAX_RATIO = 200
133
+
134
+
135
+ def round_by_factor(number: int, factor: int) -> int:
136
+ """Returns the closest integer to 'number' that is divisible by 'factor'."""
137
+ return round(number / factor) * factor
138
+
139
+
140
+ def ceil_by_factor(number: int, factor: int) -> int:
141
+ """Returns the smallest integer greater than or equal to 'number' that is divisible by 'factor'."""
142
+ return math.ceil(number / factor) * factor
143
+
144
+
145
+ def floor_by_factor(number: int, factor: int) -> int:
146
+ """Returns the largest integer less than or equal to 'number' that is divisible by 'factor'."""
147
+ return math.floor(number / factor) * factor
148
+
149
+
150
+ def smart_resize(
151
+ height: int, width: int, factor: int = IMAGE_FACTOR, min_pixels: int = MIN_PIXELS, max_pixels: int = MAX_PIXELS
152
+ ) -> tuple[int, int]:
153
+ """
154
+ Rescales the image so that the following conditions are met:
155
+
156
+ 1. Both dimensions (height and width) are divisible by 'factor'.
157
+
158
+ 2. The total number of pixels is within the range ['min_pixels', 'max_pixels'].
159
+
160
+ 3. The aspect ratio of the image is maintained as closely as possible.
161
+ """
162
+ h_bar = max(factor, round_by_factor(height, factor))
163
+ w_bar = max(factor, round_by_factor(width, factor))
164
+ if h_bar * w_bar > max_pixels:
165
+ beta = math.sqrt((height * width) / max_pixels)
166
+ h_bar = floor_by_factor(height / beta, factor)
167
+ w_bar = floor_by_factor(width / beta, factor)
168
+ elif h_bar * w_bar < min_pixels:
169
+ beta = math.sqrt(min_pixels / (height * width))
170
+ h_bar = ceil_by_factor(height * beta, factor)
171
+ w_bar = ceil_by_factor(width * beta, factor)
172
+
173
+ if max(h_bar, w_bar) / min(h_bar, w_bar) > MAX_RATIO:
174
+ logging.warning(
175
+ f"Absolute aspect ratio must be smaller than {MAX_RATIO}, got {max(h_bar, w_bar) / min(h_bar, w_bar)}"
176
+ )
177
+ if h_bar > w_bar:
178
+ h_bar = w_bar * MAX_RATIO
179
+ else:
180
+ w_bar = h_bar * MAX_RATIO
181
+ return h_bar, w_bar
182
+
183
+
184
+ def fetch_image(image: str | Image.Image, size_factor: int = IMAGE_FACTOR) -> Image.Image:
185
+ image_obj = None
186
+ if isinstance(image, Image.Image):
187
+ image_obj = image
188
+ elif image.startswith("http://") or image.startswith("https://"):
189
+ image_obj = Image.open(requests.get(image, stream=True).raw)
190
+ elif image.startswith("file://"):
191
+ image_obj = Image.open(image[7:])
192
+ elif image.startswith("data:image"):
193
+ if "base64," in image:
194
+ _, base64_data = image.split("base64,", 1)
195
+ data = base64.b64decode(base64_data)
196
+ image_obj = Image.open(BytesIO(data))
197
+ else:
198
+ image_obj = Image.open(image)
199
+ if image_obj is None:
200
+ raise ValueError(f"Unrecognized image input, support local path, http url, base64 and PIL.Image, got {image}")
201
+ image = image_obj.convert("RGB")
202
+ ## resize
203
+ # if "resized_height" in ele and "resized_width" in ele:
204
+ # resized_height, resized_width = smart_resize(
205
+ # ele["resized_height"],
206
+ # ele["resized_width"],
207
+ # factor=size_factor,
208
+ # )
209
+ # else:
210
+ width, height = image.size
211
+ # min_pixels = ele.get("min_pixels", MIN_PIXELS)
212
+ # max_pixels = ele.get("max_pixels", MAX_PIXELS)
213
+ resized_height, resized_width = smart_resize(
214
+ height,
215
+ width,
216
+ factor=size_factor,
217
+ min_pixels=MIN_PIXELS,
218
+ max_pixels=MAX_PIXELS,
219
+ )
220
+ image = image.resize((resized_width, resized_height))
221
+
222
+ return image
223
+ ###
generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "repetition_penalty": 1.05,
10
+ "temperature": 0.1,
11
+ "top_k": 1,
12
+ "top_p": 0.001,
13
+ "transformers_version": "4.45.0.dev0"
14
+ }
gme_inference.py ADDED
@@ -0,0 +1,329 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import logging
4
+ import math
5
+ import os
6
+ from typing import Dict, List, Optional
7
+
8
+ import torch
9
+ from PIL import Image
10
+ from torch.utils.data import DataLoader
11
+ from tqdm.autonotebook import tqdm
12
+ from transformers import AutoModelForVision2Seq, AutoProcessor
13
+
14
+
15
+ class GmeQwen2VL:
16
+ def __init__(
17
+ self,
18
+ model_name: str = "Alibaba-NLP/gme-Qwen2-VL-2B-Instruct",
19
+ model_path: Optional[str] = None,
20
+ device: str = "cuda" if torch.cuda.is_available() else "cpu",
21
+ min_image_tokens=256,
22
+ max_image_tokens=1280,
23
+ max_length=1800,
24
+ **kwargs,
25
+ ) -> None:
26
+ model_name = model_path or model_name
27
+ self.base = AutoModelForVision2Seq.from_pretrained(
28
+ model_name, torch_dtype=torch.float16, **kwargs
29
+ )
30
+ self.base.eval()
31
+ self.normalize = True
32
+ self.device = device
33
+ min_pixels = min_image_tokens * 28 * 28
34
+ max_pixels = max_image_tokens * 28 * 28
35
+ self.max_length = max_length
36
+ self.processor = AutoProcessor.from_pretrained(
37
+ model_name, min_pixels=min_pixels, max_pixels=max_pixels, **kwargs
38
+ )
39
+ self.processor.tokenizer.padding_side = 'right'
40
+ self.default_instruction = 'You are a helpful assistant.'
41
+ self.sep = ' '
42
+
43
+ def forward(
44
+ self,
45
+ input_ids: Optional[torch.LongTensor] = None,
46
+ attention_mask: Optional[torch.Tensor] = None,
47
+ position_ids: Optional[torch.LongTensor] = None,
48
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
49
+ inputs_embeds: Optional[torch.FloatTensor] = None,
50
+ pixel_values: Optional[torch.Tensor] = None,
51
+ # pixel_values_videos: Optional[torch.FloatTensor] = None,
52
+ image_grid_thw: Optional[torch.LongTensor] = None,
53
+ # video_grid_thw: Optional[torch.LongTensor] = None,
54
+ pooling_mask: Optional[torch.LongTensor] = None,
55
+ **kwargs
56
+ ) -> torch.Tensor:
57
+ if inputs_embeds is None:
58
+ inputs_embeds = self.base.model.embed_tokens(input_ids)
59
+ if pixel_values is not None:
60
+ pixel_values = pixel_values.type(self.base.visual.get_dtype())
61
+ image_embeds = self.base.visual(pixel_values, grid_thw=image_grid_thw).to(inputs_embeds.device)
62
+ image_mask = input_ids == self.base.config.image_token_id
63
+ inputs_embeds[image_mask] = image_embeds
64
+ # if pixel_values_videos is not None:
65
+ # pixel_values_videos = pixel_values_videos.type(self.base.visual.get_dtype())
66
+ # video_embeds = self.base.visual(pixel_values_videos, grid_thw=video_grid_thw).to(inputs_embeds.device)
67
+ # video_mask = input_ids == self.base.config.video_token_id
68
+ # inputs_embeds[video_mask] = video_embeds
69
+ if attention_mask is not None:
70
+ attention_mask = attention_mask.to(inputs_embeds.device)
71
+
72
+ outputs = self.base.model(
73
+ input_ids=None,
74
+ position_ids=position_ids,
75
+ attention_mask=attention_mask,
76
+ past_key_values=past_key_values,
77
+ inputs_embeds=inputs_embeds,
78
+ )
79
+
80
+ pooling_mask = attention_mask if pooling_mask is None else pooling_mask
81
+ left_padding = (pooling_mask[:, -1].sum() == pooling_mask.shape[0]) # TODO
82
+ if left_padding:
83
+ embeddings = outputs.last_hidden_state[:, -1]
84
+ else:
85
+ sequence_lengths = pooling_mask.sum(dim=1) - 1
86
+ batch_size = outputs.last_hidden_state.shape[0]
87
+ embeddings = outputs.last_hidden_state[torch.arange(
88
+ batch_size, device=outputs.last_hidden_state.device
89
+ ), sequence_lengths]
90
+ if self.normalize:
91
+ embeddings = torch.nn.functional.normalize(embeddings, p=2, dim=1)
92
+ return embeddings.contiguous()
93
+
94
+ def embed(self, texts: list[str], images: list[Image.Image], is_query=True, instruction=None, **kwargs):
95
+ self.base.to(self.device)
96
+ # Inputs must be batched
97
+ input_texts, input_images = list(), list()
98
+ for t, i in zip(texts, images):
99
+ if not is_query or instruction is None:
100
+ instruction = self.default_instruction
101
+ input_str = ''
102
+ if i is None:
103
+ input_images = None # All examples in the same batch are consistent
104
+ else:
105
+ input_str += '<|vision_start|><|image_pad|><|vision_end|>'
106
+ i = fetch_image(i)
107
+ input_images.append(i)
108
+ if t is not None:
109
+ input_str += t
110
+ msg = f'<|im_start|>system\n{instruction}<|im_end|>\n<|im_start|>user\n{input_str}<|im_end|>\n<|im_start|>assistant\n<|endoftext|>'
111
+ input_texts.append(msg)
112
+
113
+ inputs = self.processor(
114
+ text=input_texts,
115
+ images=input_images,
116
+ padding=True,
117
+ truncation=True,
118
+ max_length=self.max_length,
119
+ return_tensors='pt'
120
+ )
121
+ inputs = {k: v.to(self.device) for k, v in inputs.items()} # TODO
122
+ with torch.no_grad():
123
+ embeddings = self.forward(**inputs)
124
+ return embeddings
125
+
126
+ def encode(self, sentences: list[str], *, prompt_name=None, **kwargs):
127
+ return self.get_fused_embeddings(texts=sentences, prompt_name=prompt_name, **kwargs)
128
+
129
+ def encode_queries(self, queries: List[str], **kwargs):
130
+ embeddings = self.encode(queries, **kwargs)
131
+ return embeddings
132
+
133
+ def encode_corpus(self, corpus: List[Dict[str, str]], **kwargs):
134
+ if type(corpus) is dict:
135
+ sentences = [
136
+ (corpus["title"][i] + self.sep + corpus["text"][i]).strip()
137
+ if "title" in corpus
138
+ else corpus["text"][i].strip()
139
+ for i in range(len(corpus["text"]))
140
+ ]
141
+ else:
142
+ sentences = [
143
+ (doc["title"] + self.sep + doc["text"]).strip() if "title" in doc else doc["text"].strip()
144
+ for doc in corpus
145
+ ]
146
+ embeddings = self.encode(sentences, is_query=False, **kwargs)
147
+ return embeddings
148
+
149
+ def get_image_embeddings(self, images: list[Image.Image] | DataLoader, **kwargs):
150
+ return self.get_fused_embeddings(images=images, **kwargs)
151
+
152
+ def get_text_embeddings(self, texts: list[str], **kwargs):
153
+ return self.get_fused_embeddings(texts=texts, **kwargs)
154
+
155
+ def get_fused_embeddings(self, texts: list[str] = None, images: list[Image.Image] | DataLoader = None, **kwargs):
156
+ if isinstance(images, DataLoader):
157
+ image_loader = images
158
+ batch_size = image_loader.batch_size
159
+ image_loader.dataset.transform = None
160
+ else:
161
+ batch_size = kwargs.pop('batch_size', 32)
162
+ if images is None:
163
+ image_loader = None
164
+ else:
165
+ image_loader = DataLoader(
166
+ images,
167
+ batch_size=batch_size,
168
+ shuffle=False,
169
+ collate_fn=custom_collate_fn,
170
+ num_workers=min(math.floor(os.cpu_count() / 2), 8),
171
+ )
172
+
173
+ if texts is None:
174
+ assert image_loader is not None
175
+ n_batch = len(image_loader)
176
+ else:
177
+ n_batch = len(texts) // batch_size + int(len(texts) % batch_size > 0)
178
+ image_loader = image_loader or [None] * n_batch
179
+
180
+ all_embeddings = list()
181
+ none_batch = [None] * batch_size
182
+ show_progress_bar = kwargs.pop('show_progress_bar', True)
183
+ pbar = tqdm(total=n_batch, disable=not show_progress_bar, mininterval=1, miniters=10, desc='encode')
184
+ for n, img_batch in zip(range(0, n_batch * batch_size, batch_size), image_loader):
185
+ text_batch = none_batch if texts is None else texts[n: n+batch_size]
186
+ img_batch = none_batch if img_batch is None else img_batch
187
+ embeddings = self.embed(texts=text_batch, images=img_batch, **kwargs)
188
+ pbar.update(1)
189
+ all_embeddings.append(embeddings.cpu())
190
+ pbar.close()
191
+ all_embeddings = torch.cat(all_embeddings, dim=0)
192
+ return all_embeddings
193
+
194
+
195
+ def custom_collate_fn(batch):
196
+ return batch
197
+
198
+
199
+ ### Copied from qwen_vl_utils.vision_process.py
200
+ import base64
201
+ from io import BytesIO
202
+ import requests
203
+
204
+ IMAGE_FACTOR = 28
205
+ MIN_PIXELS = 4 * 28 * 28
206
+ MAX_PIXELS = 16384 * 28 * 28
207
+ MAX_RATIO = 200
208
+
209
+
210
+ def round_by_factor(number: int, factor: int) -> int:
211
+ """Returns the closest integer to 'number' that is divisible by 'factor'."""
212
+ return round(number / factor) * factor
213
+
214
+
215
+ def ceil_by_factor(number: int, factor: int) -> int:
216
+ """Returns the smallest integer greater than or equal to 'number' that is divisible by 'factor'."""
217
+ return math.ceil(number / factor) * factor
218
+
219
+
220
+ def floor_by_factor(number: int, factor: int) -> int:
221
+ """Returns the largest integer less than or equal to 'number' that is divisible by 'factor'."""
222
+ return math.floor(number / factor) * factor
223
+
224
+
225
+ def smart_resize(
226
+ height: int, width: int, factor: int = IMAGE_FACTOR, min_pixels: int = MIN_PIXELS, max_pixels: int = MAX_PIXELS
227
+ ) -> tuple[int, int]:
228
+ """
229
+ Rescales the image so that the following conditions are met:
230
+
231
+ 1. Both dimensions (height and width) are divisible by 'factor'.
232
+
233
+ 2. The total number of pixels is within the range ['min_pixels', 'max_pixels'].
234
+
235
+ 3. The aspect ratio of the image is maintained as closely as possible.
236
+ """
237
+ h_bar = max(factor, round_by_factor(height, factor))
238
+ w_bar = max(factor, round_by_factor(width, factor))
239
+ if h_bar * w_bar > max_pixels:
240
+ beta = math.sqrt((height * width) / max_pixels)
241
+ h_bar = floor_by_factor(height / beta, factor)
242
+ w_bar = floor_by_factor(width / beta, factor)
243
+ elif h_bar * w_bar < min_pixels:
244
+ beta = math.sqrt(min_pixels / (height * width))
245
+ h_bar = ceil_by_factor(height * beta, factor)
246
+ w_bar = ceil_by_factor(width * beta, factor)
247
+
248
+ if max(h_bar, w_bar) / min(h_bar, w_bar) > MAX_RATIO:
249
+ logging.warning(
250
+ f"Absolute aspect ratio must be smaller than {MAX_RATIO}, got {max(h_bar, w_bar) / min(h_bar, w_bar)}"
251
+ )
252
+ if h_bar > w_bar:
253
+ h_bar = w_bar * MAX_RATIO
254
+ else:
255
+ w_bar = h_bar * MAX_RATIO
256
+ return h_bar, w_bar
257
+
258
+
259
+ def fetch_image(image: str | Image.Image, size_factor: int = IMAGE_FACTOR) -> Image.Image:
260
+ image_obj = None
261
+ if isinstance(image, Image.Image):
262
+ image_obj = image
263
+ elif image.startswith("http://") or image.startswith("https://"):
264
+ image_obj = Image.open(requests.get(image, stream=True).raw)
265
+ elif image.startswith("file://"):
266
+ image_obj = Image.open(image[7:])
267
+ elif image.startswith("data:image"):
268
+ if "base64," in image:
269
+ _, base64_data = image.split("base64,", 1)
270
+ data = base64.b64decode(base64_data)
271
+ image_obj = Image.open(BytesIO(data))
272
+ else:
273
+ image_obj = Image.open(image)
274
+ if image_obj is None:
275
+ raise ValueError(f"Unrecognized image input, support local path, http url, base64 and PIL.Image, got {image}")
276
+ image = image_obj.convert("RGB")
277
+ ## resize
278
+ # if "resized_height" in ele and "resized_width" in ele:
279
+ # resized_height, resized_width = smart_resize(
280
+ # ele["resized_height"],
281
+ # ele["resized_width"],
282
+ # factor=size_factor,
283
+ # )
284
+ # else:
285
+ width, height = image.size
286
+ # min_pixels = ele.get("min_pixels", MIN_PIXELS)
287
+ # max_pixels = ele.get("max_pixels", MAX_PIXELS)
288
+ resized_height, resized_width = smart_resize(
289
+ height,
290
+ width,
291
+ factor=size_factor,
292
+ min_pixels=MIN_PIXELS,
293
+ max_pixels=MAX_PIXELS,
294
+ )
295
+ image = image.resize((resized_width, resized_height))
296
+
297
+ return image
298
+ ###
299
+
300
+
301
+ if __name__ == '__main__':
302
+ texts = [
303
+ "What kind of car is this?",
304
+ "The Tesla Cybertruck is a battery electric pickup truck built by Tesla, Inc. since 2023."
305
+ ]
306
+ images = [
307
+ 'https://upload.wikimedia.org/wikipedia/commons/e/e9/Tesla_Cybertruck_damaged_window.jpg',
308
+ 'https://upload.wikimedia.org/wikipedia/commons/9/95/2024_Tesla_Cybertruck_Foundation_Series%2C_front_left_%28Greenwich%29.jpg',
309
+ ]
310
+
311
+ gme = GmeQwen2VL("Alibaba-NLP/gme-Qwen2-VL-2B-Instruct")
312
+
313
+ # Single-modal embedding
314
+ e_text = gme.get_text_embeddings(texts=texts)
315
+ e_image = gme.get_image_embeddings(images=images)
316
+ print((e_text * e_image).sum(-1))
317
+ ## tensor([0.2281, 0.6001], dtype=torch.float16)
318
+
319
+ # How to set embedding instruction
320
+ e_query = gme.get_text_embeddings(texts=texts, instruction='Find an image that matches the given text.')
321
+ # If is_query=False, we always use the default instruction.
322
+ e_corpus = gme.get_image_embeddings(images=images, is_query=False)
323
+ print((e_query * e_corpus).sum(-1))
324
+ ## tensor([0.2433, 0.7051], dtype=torch.float16)
325
+
326
+ # Fused-modal embedding
327
+ e_fused = gme.get_fused_embeddings(texts=texts, images=images)
328
+ print((e_fused[0] * e_fused[1]).sum())
329
+ ## tensor(0.6108, dtype=torch.float16)
images/gme_logo.png ADDED

Git LFS Details

  • SHA256: 852d3f21c088f7a29e0982e2f404ffed1d7344d9088668ff7015f324d40f1439
  • Pointer size: 131 Bytes
  • Size of remote file: 526 kB
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model-00001-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ce525de1d47307ebf63285ce4f2f80ca8ffffd94235b2151585e5714307e4e99
3
+ size 4046085544
model-00002-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b42b76064f5d14ee9d0390f9a1f3571fc66eae4f40764f818cb5e9aafc5d6f5
3
+ size 4063188000
model-00003-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e3f1342fe1dd7df1582be00ebd45557316015050ae2edb841e61150825f16adc
3
+ size 726747736
model.safetensors.index.json ADDED
@@ -0,0 +1,736 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 8835942400
4
+ },
5
+ "weight_map": {
6
+ "model.embed_tokens.weight": "model-00001-of-00003.safetensors",
7
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00003.safetensors",
8
+ "model.layers.0.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
9
+ "model.layers.0.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
10
+ "model.layers.0.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
11
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
12
+ "model.layers.0.self_attn.k_proj.bias": "model-00001-of-00003.safetensors",
13
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
14
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
15
+ "model.layers.0.self_attn.q_proj.bias": "model-00001-of-00003.safetensors",
16
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
17
+ "model.layers.0.self_attn.v_proj.bias": "model-00001-of-00003.safetensors",
18
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
19
+ "model.layers.1.input_layernorm.weight": "model-00001-of-00003.safetensors",
20
+ "model.layers.1.mlp.down_proj.weight": "model-00001-of-00003.safetensors",
21
+ "model.layers.1.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
22
+ "model.layers.1.mlp.up_proj.weight": "model-00001-of-00003.safetensors",
23
+ "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00003.safetensors",
24
+ "model.layers.1.self_attn.k_proj.bias": "model-00001-of-00003.safetensors",
25
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
26
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
27
+ "model.layers.1.self_attn.q_proj.bias": "model-00001-of-00003.safetensors",
28
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
29
+ "model.layers.1.self_attn.v_proj.bias": "model-00001-of-00003.safetensors",
30
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
31
+ "model.layers.10.input_layernorm.weight": "model-00002-of-00003.safetensors",
32
+ "model.layers.10.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
33
+ "model.layers.10.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
34
+ "model.layers.10.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
35
+ "model.layers.10.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
36
+ "model.layers.10.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
37
+ "model.layers.10.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
38
+ "model.layers.10.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
39
+ "model.layers.10.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
40
+ "model.layers.10.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
41
+ "model.layers.10.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
42
+ "model.layers.10.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
43
+ "model.layers.11.input_layernorm.weight": "model-00002-of-00003.safetensors",
44
+ "model.layers.11.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
45
+ "model.layers.11.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
46
+ "model.layers.11.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
47
+ "model.layers.11.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
48
+ "model.layers.11.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
49
+ "model.layers.11.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
50
+ "model.layers.11.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
51
+ "model.layers.11.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
52
+ "model.layers.11.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
53
+ "model.layers.11.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
54
+ "model.layers.11.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
55
+ "model.layers.12.input_layernorm.weight": "model-00002-of-00003.safetensors",
56
+ "model.layers.12.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
57
+ "model.layers.12.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
58
+ "model.layers.12.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
59
+ "model.layers.12.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
60
+ "model.layers.12.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
61
+ "model.layers.12.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
62
+ "model.layers.12.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
63
+ "model.layers.12.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
64
+ "model.layers.12.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
65
+ "model.layers.12.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
66
+ "model.layers.12.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
67
+ "model.layers.13.input_layernorm.weight": "model-00002-of-00003.safetensors",
68
+ "model.layers.13.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
69
+ "model.layers.13.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
70
+ "model.layers.13.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
71
+ "model.layers.13.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
72
+ "model.layers.13.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
73
+ "model.layers.13.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
74
+ "model.layers.13.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
75
+ "model.layers.13.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
76
+ "model.layers.13.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
77
+ "model.layers.13.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
78
+ "model.layers.13.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
79
+ "model.layers.14.input_layernorm.weight": "model-00002-of-00003.safetensors",
80
+ "model.layers.14.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
81
+ "model.layers.14.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
82
+ "model.layers.14.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
83
+ "model.layers.14.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
84
+ "model.layers.14.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
85
+ "model.layers.14.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
86
+ "model.layers.14.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
87
+ "model.layers.14.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
88
+ "model.layers.14.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
89
+ "model.layers.14.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
90
+ "model.layers.14.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
91
+ "model.layers.15.input_layernorm.weight": "model-00002-of-00003.safetensors",
92
+ "model.layers.15.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
93
+ "model.layers.15.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
94
+ "model.layers.15.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
95
+ "model.layers.15.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
96
+ "model.layers.15.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
97
+ "model.layers.15.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
98
+ "model.layers.15.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
99
+ "model.layers.15.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
100
+ "model.layers.15.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
101
+ "model.layers.15.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
102
+ "model.layers.15.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
103
+ "model.layers.16.input_layernorm.weight": "model-00002-of-00003.safetensors",
104
+ "model.layers.16.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
105
+ "model.layers.16.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
106
+ "model.layers.16.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
107
+ "model.layers.16.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
108
+ "model.layers.16.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
109
+ "model.layers.16.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
110
+ "model.layers.16.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
111
+ "model.layers.16.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
112
+ "model.layers.16.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
113
+ "model.layers.16.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
114
+ "model.layers.16.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
115
+ "model.layers.17.input_layernorm.weight": "model-00002-of-00003.safetensors",
116
+ "model.layers.17.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
117
+ "model.layers.17.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
118
+ "model.layers.17.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
119
+ "model.layers.17.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
120
+ "model.layers.17.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
121
+ "model.layers.17.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
122
+ "model.layers.17.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
123
+ "model.layers.17.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
124
+ "model.layers.17.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
125
+ "model.layers.17.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
126
+ "model.layers.17.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
127
+ "model.layers.18.input_layernorm.weight": "model-00002-of-00003.safetensors",
128
+ "model.layers.18.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
129
+ "model.layers.18.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
130
+ "model.layers.18.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
131
+ "model.layers.18.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
132
+ "model.layers.18.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
133
+ "model.layers.18.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
134
+ "model.layers.18.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
135
+ "model.layers.18.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
136
+ "model.layers.18.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
137
+ "model.layers.18.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
138
+ "model.layers.18.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
139
+ "model.layers.19.input_layernorm.weight": "model-00002-of-00003.safetensors",
140
+ "model.layers.19.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
141
+ "model.layers.19.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
142
+ "model.layers.19.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
143
+ "model.layers.19.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
144
+ "model.layers.19.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
145
+ "model.layers.19.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
146
+ "model.layers.19.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
147
+ "model.layers.19.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
148
+ "model.layers.19.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
149
+ "model.layers.19.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
150
+ "model.layers.19.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
151
+ "model.layers.2.input_layernorm.weight": "model-00002-of-00003.safetensors",
152
+ "model.layers.2.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
153
+ "model.layers.2.mlp.gate_proj.weight": "model-00001-of-00003.safetensors",
154
+ "model.layers.2.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
155
+ "model.layers.2.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
156
+ "model.layers.2.self_attn.k_proj.bias": "model-00001-of-00003.safetensors",
157
+ "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00003.safetensors",
158
+ "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00003.safetensors",
159
+ "model.layers.2.self_attn.q_proj.bias": "model-00001-of-00003.safetensors",
160
+ "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00003.safetensors",
161
+ "model.layers.2.self_attn.v_proj.bias": "model-00001-of-00003.safetensors",
162
+ "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00003.safetensors",
163
+ "model.layers.20.input_layernorm.weight": "model-00002-of-00003.safetensors",
164
+ "model.layers.20.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
165
+ "model.layers.20.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
166
+ "model.layers.20.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
167
+ "model.layers.20.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
168
+ "model.layers.20.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
169
+ "model.layers.20.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
170
+ "model.layers.20.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
171
+ "model.layers.20.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
172
+ "model.layers.20.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
173
+ "model.layers.20.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
174
+ "model.layers.20.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
175
+ "model.layers.21.input_layernorm.weight": "model-00002-of-00003.safetensors",
176
+ "model.layers.21.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
177
+ "model.layers.21.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
178
+ "model.layers.21.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
179
+ "model.layers.21.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
180
+ "model.layers.21.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
181
+ "model.layers.21.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
182
+ "model.layers.21.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
183
+ "model.layers.21.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
184
+ "model.layers.21.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
185
+ "model.layers.21.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
186
+ "model.layers.21.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
187
+ "model.layers.22.input_layernorm.weight": "model-00002-of-00003.safetensors",
188
+ "model.layers.22.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
189
+ "model.layers.22.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
190
+ "model.layers.22.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
191
+ "model.layers.22.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
192
+ "model.layers.22.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
193
+ "model.layers.22.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
194
+ "model.layers.22.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
195
+ "model.layers.22.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
196
+ "model.layers.22.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
197
+ "model.layers.22.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
198
+ "model.layers.22.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
199
+ "model.layers.23.input_layernorm.weight": "model-00002-of-00003.safetensors",
200
+ "model.layers.23.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
201
+ "model.layers.23.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
202
+ "model.layers.23.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
203
+ "model.layers.23.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
204
+ "model.layers.23.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
205
+ "model.layers.23.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
206
+ "model.layers.23.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
207
+ "model.layers.23.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
208
+ "model.layers.23.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
209
+ "model.layers.23.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
210
+ "model.layers.23.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
211
+ "model.layers.24.input_layernorm.weight": "model-00003-of-00003.safetensors",
212
+ "model.layers.24.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
213
+ "model.layers.24.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
214
+ "model.layers.24.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
215
+ "model.layers.24.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
216
+ "model.layers.24.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
217
+ "model.layers.24.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
218
+ "model.layers.24.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
219
+ "model.layers.24.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
220
+ "model.layers.24.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
221
+ "model.layers.24.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
222
+ "model.layers.24.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
223
+ "model.layers.25.input_layernorm.weight": "model-00003-of-00003.safetensors",
224
+ "model.layers.25.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
225
+ "model.layers.25.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
226
+ "model.layers.25.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
227
+ "model.layers.25.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
228
+ "model.layers.25.self_attn.k_proj.bias": "model-00003-of-00003.safetensors",
229
+ "model.layers.25.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
230
+ "model.layers.25.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
231
+ "model.layers.25.self_attn.q_proj.bias": "model-00003-of-00003.safetensors",
232
+ "model.layers.25.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
233
+ "model.layers.25.self_attn.v_proj.bias": "model-00003-of-00003.safetensors",
234
+ "model.layers.25.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
235
+ "model.layers.26.input_layernorm.weight": "model-00003-of-00003.safetensors",
236
+ "model.layers.26.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
237
+ "model.layers.26.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
238
+ "model.layers.26.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
239
+ "model.layers.26.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
240
+ "model.layers.26.self_attn.k_proj.bias": "model-00003-of-00003.safetensors",
241
+ "model.layers.26.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
242
+ "model.layers.26.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
243
+ "model.layers.26.self_attn.q_proj.bias": "model-00003-of-00003.safetensors",
244
+ "model.layers.26.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
245
+ "model.layers.26.self_attn.v_proj.bias": "model-00003-of-00003.safetensors",
246
+ "model.layers.26.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
247
+ "model.layers.27.input_layernorm.weight": "model-00003-of-00003.safetensors",
248
+ "model.layers.27.mlp.down_proj.weight": "model-00003-of-00003.safetensors",
249
+ "model.layers.27.mlp.gate_proj.weight": "model-00003-of-00003.safetensors",
250
+ "model.layers.27.mlp.up_proj.weight": "model-00003-of-00003.safetensors",
251
+ "model.layers.27.post_attention_layernorm.weight": "model-00003-of-00003.safetensors",
252
+ "model.layers.27.self_attn.k_proj.bias": "model-00003-of-00003.safetensors",
253
+ "model.layers.27.self_attn.k_proj.weight": "model-00003-of-00003.safetensors",
254
+ "model.layers.27.self_attn.o_proj.weight": "model-00003-of-00003.safetensors",
255
+ "model.layers.27.self_attn.q_proj.bias": "model-00003-of-00003.safetensors",
256
+ "model.layers.27.self_attn.q_proj.weight": "model-00003-of-00003.safetensors",
257
+ "model.layers.27.self_attn.v_proj.bias": "model-00003-of-00003.safetensors",
258
+ "model.layers.27.self_attn.v_proj.weight": "model-00003-of-00003.safetensors",
259
+ "model.layers.3.input_layernorm.weight": "model-00002-of-00003.safetensors",
260
+ "model.layers.3.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
261
+ "model.layers.3.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
262
+ "model.layers.3.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
263
+ "model.layers.3.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
264
+ "model.layers.3.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
265
+ "model.layers.3.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
266
+ "model.layers.3.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
267
+ "model.layers.3.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
268
+ "model.layers.3.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
269
+ "model.layers.3.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
270
+ "model.layers.3.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
271
+ "model.layers.4.input_layernorm.weight": "model-00002-of-00003.safetensors",
272
+ "model.layers.4.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
273
+ "model.layers.4.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
274
+ "model.layers.4.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
275
+ "model.layers.4.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
276
+ "model.layers.4.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
277
+ "model.layers.4.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
278
+ "model.layers.4.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
279
+ "model.layers.4.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
280
+ "model.layers.4.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
281
+ "model.layers.4.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
282
+ "model.layers.4.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
283
+ "model.layers.5.input_layernorm.weight": "model-00002-of-00003.safetensors",
284
+ "model.layers.5.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
285
+ "model.layers.5.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
286
+ "model.layers.5.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
287
+ "model.layers.5.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
288
+ "model.layers.5.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
289
+ "model.layers.5.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
290
+ "model.layers.5.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
291
+ "model.layers.5.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
292
+ "model.layers.5.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
293
+ "model.layers.5.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
294
+ "model.layers.5.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
295
+ "model.layers.6.input_layernorm.weight": "model-00002-of-00003.safetensors",
296
+ "model.layers.6.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
297
+ "model.layers.6.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
298
+ "model.layers.6.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
299
+ "model.layers.6.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
300
+ "model.layers.6.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
301
+ "model.layers.6.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
302
+ "model.layers.6.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
303
+ "model.layers.6.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
304
+ "model.layers.6.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
305
+ "model.layers.6.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
306
+ "model.layers.6.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
307
+ "model.layers.7.input_layernorm.weight": "model-00002-of-00003.safetensors",
308
+ "model.layers.7.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
309
+ "model.layers.7.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
310
+ "model.layers.7.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
311
+ "model.layers.7.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
312
+ "model.layers.7.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
313
+ "model.layers.7.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
314
+ "model.layers.7.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
315
+ "model.layers.7.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
316
+ "model.layers.7.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
317
+ "model.layers.7.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
318
+ "model.layers.7.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
319
+ "model.layers.8.input_layernorm.weight": "model-00002-of-00003.safetensors",
320
+ "model.layers.8.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
321
+ "model.layers.8.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
322
+ "model.layers.8.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
323
+ "model.layers.8.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
324
+ "model.layers.8.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
325
+ "model.layers.8.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
326
+ "model.layers.8.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
327
+ "model.layers.8.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
328
+ "model.layers.8.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
329
+ "model.layers.8.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
330
+ "model.layers.8.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
331
+ "model.layers.9.input_layernorm.weight": "model-00002-of-00003.safetensors",
332
+ "model.layers.9.mlp.down_proj.weight": "model-00002-of-00003.safetensors",
333
+ "model.layers.9.mlp.gate_proj.weight": "model-00002-of-00003.safetensors",
334
+ "model.layers.9.mlp.up_proj.weight": "model-00002-of-00003.safetensors",
335
+ "model.layers.9.post_attention_layernorm.weight": "model-00002-of-00003.safetensors",
336
+ "model.layers.9.self_attn.k_proj.bias": "model-00002-of-00003.safetensors",
337
+ "model.layers.9.self_attn.k_proj.weight": "model-00002-of-00003.safetensors",
338
+ "model.layers.9.self_attn.o_proj.weight": "model-00002-of-00003.safetensors",
339
+ "model.layers.9.self_attn.q_proj.bias": "model-00002-of-00003.safetensors",
340
+ "model.layers.9.self_attn.q_proj.weight": "model-00002-of-00003.safetensors",
341
+ "model.layers.9.self_attn.v_proj.bias": "model-00002-of-00003.safetensors",
342
+ "model.layers.9.self_attn.v_proj.weight": "model-00002-of-00003.safetensors",
343
+ "model.norm.weight": "model-00003-of-00003.safetensors",
344
+ "visual.blocks.0.attn.proj.bias": "model-00001-of-00003.safetensors",
345
+ "visual.blocks.0.attn.proj.weight": "model-00001-of-00003.safetensors",
346
+ "visual.blocks.0.attn.qkv.bias": "model-00001-of-00003.safetensors",
347
+ "visual.blocks.0.attn.qkv.weight": "model-00001-of-00003.safetensors",
348
+ "visual.blocks.0.mlp.fc1.bias": "model-00001-of-00003.safetensors",
349
+ "visual.blocks.0.mlp.fc1.weight": "model-00001-of-00003.safetensors",
350
+ "visual.blocks.0.mlp.fc2.bias": "model-00001-of-00003.safetensors",
351
+ "visual.blocks.0.mlp.fc2.weight": "model-00001-of-00003.safetensors",
352
+ "visual.blocks.0.norm1.bias": "model-00001-of-00003.safetensors",
353
+ "visual.blocks.0.norm1.weight": "model-00001-of-00003.safetensors",
354
+ "visual.blocks.0.norm2.bias": "model-00001-of-00003.safetensors",
355
+ "visual.blocks.0.norm2.weight": "model-00001-of-00003.safetensors",
356
+ "visual.blocks.1.attn.proj.bias": "model-00001-of-00003.safetensors",
357
+ "visual.blocks.1.attn.proj.weight": "model-00001-of-00003.safetensors",
358
+ "visual.blocks.1.attn.qkv.bias": "model-00001-of-00003.safetensors",
359
+ "visual.blocks.1.attn.qkv.weight": "model-00001-of-00003.safetensors",
360
+ "visual.blocks.1.mlp.fc1.bias": "model-00001-of-00003.safetensors",
361
+ "visual.blocks.1.mlp.fc1.weight": "model-00001-of-00003.safetensors",
362
+ "visual.blocks.1.mlp.fc2.bias": "model-00001-of-00003.safetensors",
363
+ "visual.blocks.1.mlp.fc2.weight": "model-00001-of-00003.safetensors",
364
+ "visual.blocks.1.norm1.bias": "model-00001-of-00003.safetensors",
365
+ "visual.blocks.1.norm1.weight": "model-00001-of-00003.safetensors",
366
+ "visual.blocks.1.norm2.bias": "model-00001-of-00003.safetensors",
367
+ "visual.blocks.1.norm2.weight": "model-00001-of-00003.safetensors",
368
+ "visual.blocks.10.attn.proj.bias": "model-00001-of-00003.safetensors",
369
+ "visual.blocks.10.attn.proj.weight": "model-00001-of-00003.safetensors",
370
+ "visual.blocks.10.attn.qkv.bias": "model-00001-of-00003.safetensors",
371
+ "visual.blocks.10.attn.qkv.weight": "model-00001-of-00003.safetensors",
372
+ "visual.blocks.10.mlp.fc1.bias": "model-00001-of-00003.safetensors",
373
+ "visual.blocks.10.mlp.fc1.weight": "model-00001-of-00003.safetensors",
374
+ "visual.blocks.10.mlp.fc2.bias": "model-00001-of-00003.safetensors",
375
+ "visual.blocks.10.mlp.fc2.weight": "model-00001-of-00003.safetensors",
376
+ "visual.blocks.10.norm1.bias": "model-00001-of-00003.safetensors",
377
+ "visual.blocks.10.norm1.weight": "model-00001-of-00003.safetensors",
378
+ "visual.blocks.10.norm2.bias": "model-00001-of-00003.safetensors",
379
+ "visual.blocks.10.norm2.weight": "model-00001-of-00003.safetensors",
380
+ "visual.blocks.11.attn.proj.bias": "model-00001-of-00003.safetensors",
381
+ "visual.blocks.11.attn.proj.weight": "model-00001-of-00003.safetensors",
382
+ "visual.blocks.11.attn.qkv.bias": "model-00001-of-00003.safetensors",
383
+ "visual.blocks.11.attn.qkv.weight": "model-00001-of-00003.safetensors",
384
+ "visual.blocks.11.mlp.fc1.bias": "model-00001-of-00003.safetensors",
385
+ "visual.blocks.11.mlp.fc1.weight": "model-00001-of-00003.safetensors",
386
+ "visual.blocks.11.mlp.fc2.bias": "model-00001-of-00003.safetensors",
387
+ "visual.blocks.11.mlp.fc2.weight": "model-00001-of-00003.safetensors",
388
+ "visual.blocks.11.norm1.bias": "model-00001-of-00003.safetensors",
389
+ "visual.blocks.11.norm1.weight": "model-00001-of-00003.safetensors",
390
+ "visual.blocks.11.norm2.bias": "model-00001-of-00003.safetensors",
391
+ "visual.blocks.11.norm2.weight": "model-00001-of-00003.safetensors",
392
+ "visual.blocks.12.attn.proj.bias": "model-00001-of-00003.safetensors",
393
+ "visual.blocks.12.attn.proj.weight": "model-00001-of-00003.safetensors",
394
+ "visual.blocks.12.attn.qkv.bias": "model-00001-of-00003.safetensors",
395
+ "visual.blocks.12.attn.qkv.weight": "model-00001-of-00003.safetensors",
396
+ "visual.blocks.12.mlp.fc1.bias": "model-00001-of-00003.safetensors",
397
+ "visual.blocks.12.mlp.fc1.weight": "model-00001-of-00003.safetensors",
398
+ "visual.blocks.12.mlp.fc2.bias": "model-00001-of-00003.safetensors",
399
+ "visual.blocks.12.mlp.fc2.weight": "model-00001-of-00003.safetensors",
400
+ "visual.blocks.12.norm1.bias": "model-00001-of-00003.safetensors",
401
+ "visual.blocks.12.norm1.weight": "model-00001-of-00003.safetensors",
402
+ "visual.blocks.12.norm2.bias": "model-00001-of-00003.safetensors",
403
+ "visual.blocks.12.norm2.weight": "model-00001-of-00003.safetensors",
404
+ "visual.blocks.13.attn.proj.bias": "model-00001-of-00003.safetensors",
405
+ "visual.blocks.13.attn.proj.weight": "model-00001-of-00003.safetensors",
406
+ "visual.blocks.13.attn.qkv.bias": "model-00001-of-00003.safetensors",
407
+ "visual.blocks.13.attn.qkv.weight": "model-00001-of-00003.safetensors",
408
+ "visual.blocks.13.mlp.fc1.bias": "model-00001-of-00003.safetensors",
409
+ "visual.blocks.13.mlp.fc1.weight": "model-00001-of-00003.safetensors",
410
+ "visual.blocks.13.mlp.fc2.bias": "model-00001-of-00003.safetensors",
411
+ "visual.blocks.13.mlp.fc2.weight": "model-00001-of-00003.safetensors",
412
+ "visual.blocks.13.norm1.bias": "model-00001-of-00003.safetensors",
413
+ "visual.blocks.13.norm1.weight": "model-00001-of-00003.safetensors",
414
+ "visual.blocks.13.norm2.bias": "model-00001-of-00003.safetensors",
415
+ "visual.blocks.13.norm2.weight": "model-00001-of-00003.safetensors",
416
+ "visual.blocks.14.attn.proj.bias": "model-00001-of-00003.safetensors",
417
+ "visual.blocks.14.attn.proj.weight": "model-00001-of-00003.safetensors",
418
+ "visual.blocks.14.attn.qkv.bias": "model-00001-of-00003.safetensors",
419
+ "visual.blocks.14.attn.qkv.weight": "model-00001-of-00003.safetensors",
420
+ "visual.blocks.14.mlp.fc1.bias": "model-00001-of-00003.safetensors",
421
+ "visual.blocks.14.mlp.fc1.weight": "model-00001-of-00003.safetensors",
422
+ "visual.blocks.14.mlp.fc2.bias": "model-00001-of-00003.safetensors",
423
+ "visual.blocks.14.mlp.fc2.weight": "model-00001-of-00003.safetensors",
424
+ "visual.blocks.14.norm1.bias": "model-00001-of-00003.safetensors",
425
+ "visual.blocks.14.norm1.weight": "model-00001-of-00003.safetensors",
426
+ "visual.blocks.14.norm2.bias": "model-00001-of-00003.safetensors",
427
+ "visual.blocks.14.norm2.weight": "model-00001-of-00003.safetensors",
428
+ "visual.blocks.15.attn.proj.bias": "model-00001-of-00003.safetensors",
429
+ "visual.blocks.15.attn.proj.weight": "model-00001-of-00003.safetensors",
430
+ "visual.blocks.15.attn.qkv.bias": "model-00001-of-00003.safetensors",
431
+ "visual.blocks.15.attn.qkv.weight": "model-00001-of-00003.safetensors",
432
+ "visual.blocks.15.mlp.fc1.bias": "model-00001-of-00003.safetensors",
433
+ "visual.blocks.15.mlp.fc1.weight": "model-00001-of-00003.safetensors",
434
+ "visual.blocks.15.mlp.fc2.bias": "model-00001-of-00003.safetensors",
435
+ "visual.blocks.15.mlp.fc2.weight": "model-00001-of-00003.safetensors",
436
+ "visual.blocks.15.norm1.bias": "model-00001-of-00003.safetensors",
437
+ "visual.blocks.15.norm1.weight": "model-00001-of-00003.safetensors",
438
+ "visual.blocks.15.norm2.bias": "model-00001-of-00003.safetensors",
439
+ "visual.blocks.15.norm2.weight": "model-00001-of-00003.safetensors",
440
+ "visual.blocks.16.attn.proj.bias": "model-00001-of-00003.safetensors",
441
+ "visual.blocks.16.attn.proj.weight": "model-00001-of-00003.safetensors",
442
+ "visual.blocks.16.attn.qkv.bias": "model-00001-of-00003.safetensors",
443
+ "visual.blocks.16.attn.qkv.weight": "model-00001-of-00003.safetensors",
444
+ "visual.blocks.16.mlp.fc1.bias": "model-00001-of-00003.safetensors",
445
+ "visual.blocks.16.mlp.fc1.weight": "model-00001-of-00003.safetensors",
446
+ "visual.blocks.16.mlp.fc2.bias": "model-00001-of-00003.safetensors",
447
+ "visual.blocks.16.mlp.fc2.weight": "model-00001-of-00003.safetensors",
448
+ "visual.blocks.16.norm1.bias": "model-00001-of-00003.safetensors",
449
+ "visual.blocks.16.norm1.weight": "model-00001-of-00003.safetensors",
450
+ "visual.blocks.16.norm2.bias": "model-00001-of-00003.safetensors",
451
+ "visual.blocks.16.norm2.weight": "model-00001-of-00003.safetensors",
452
+ "visual.blocks.17.attn.proj.bias": "model-00001-of-00003.safetensors",
453
+ "visual.blocks.17.attn.proj.weight": "model-00001-of-00003.safetensors",
454
+ "visual.blocks.17.attn.qkv.bias": "model-00001-of-00003.safetensors",
455
+ "visual.blocks.17.attn.qkv.weight": "model-00001-of-00003.safetensors",
456
+ "visual.blocks.17.mlp.fc1.bias": "model-00001-of-00003.safetensors",
457
+ "visual.blocks.17.mlp.fc1.weight": "model-00001-of-00003.safetensors",
458
+ "visual.blocks.17.mlp.fc2.bias": "model-00001-of-00003.safetensors",
459
+ "visual.blocks.17.mlp.fc2.weight": "model-00001-of-00003.safetensors",
460
+ "visual.blocks.17.norm1.bias": "model-00001-of-00003.safetensors",
461
+ "visual.blocks.17.norm1.weight": "model-00001-of-00003.safetensors",
462
+ "visual.blocks.17.norm2.bias": "model-00001-of-00003.safetensors",
463
+ "visual.blocks.17.norm2.weight": "model-00001-of-00003.safetensors",
464
+ "visual.blocks.18.attn.proj.bias": "model-00001-of-00003.safetensors",
465
+ "visual.blocks.18.attn.proj.weight": "model-00001-of-00003.safetensors",
466
+ "visual.blocks.18.attn.qkv.bias": "model-00001-of-00003.safetensors",
467
+ "visual.blocks.18.attn.qkv.weight": "model-00001-of-00003.safetensors",
468
+ "visual.blocks.18.mlp.fc1.bias": "model-00001-of-00003.safetensors",
469
+ "visual.blocks.18.mlp.fc1.weight": "model-00001-of-00003.safetensors",
470
+ "visual.blocks.18.mlp.fc2.bias": "model-00001-of-00003.safetensors",
471
+ "visual.blocks.18.mlp.fc2.weight": "model-00001-of-00003.safetensors",
472
+ "visual.blocks.18.norm1.bias": "model-00001-of-00003.safetensors",
473
+ "visual.blocks.18.norm1.weight": "model-00001-of-00003.safetensors",
474
+ "visual.blocks.18.norm2.bias": "model-00001-of-00003.safetensors",
475
+ "visual.blocks.18.norm2.weight": "model-00001-of-00003.safetensors",
476
+ "visual.blocks.19.attn.proj.bias": "model-00001-of-00003.safetensors",
477
+ "visual.blocks.19.attn.proj.weight": "model-00001-of-00003.safetensors",
478
+ "visual.blocks.19.attn.qkv.bias": "model-00001-of-00003.safetensors",
479
+ "visual.blocks.19.attn.qkv.weight": "model-00001-of-00003.safetensors",
480
+ "visual.blocks.19.mlp.fc1.bias": "model-00001-of-00003.safetensors",
481
+ "visual.blocks.19.mlp.fc1.weight": "model-00001-of-00003.safetensors",
482
+ "visual.blocks.19.mlp.fc2.bias": "model-00001-of-00003.safetensors",
483
+ "visual.blocks.19.mlp.fc2.weight": "model-00001-of-00003.safetensors",
484
+ "visual.blocks.19.norm1.bias": "model-00001-of-00003.safetensors",
485
+ "visual.blocks.19.norm1.weight": "model-00001-of-00003.safetensors",
486
+ "visual.blocks.19.norm2.bias": "model-00001-of-00003.safetensors",
487
+ "visual.blocks.19.norm2.weight": "model-00001-of-00003.safetensors",
488
+ "visual.blocks.2.attn.proj.bias": "model-00001-of-00003.safetensors",
489
+ "visual.blocks.2.attn.proj.weight": "model-00001-of-00003.safetensors",
490
+ "visual.blocks.2.attn.qkv.bias": "model-00001-of-00003.safetensors",
491
+ "visual.blocks.2.attn.qkv.weight": "model-00001-of-00003.safetensors",
492
+ "visual.blocks.2.mlp.fc1.bias": "model-00001-of-00003.safetensors",
493
+ "visual.blocks.2.mlp.fc1.weight": "model-00001-of-00003.safetensors",
494
+ "visual.blocks.2.mlp.fc2.bias": "model-00001-of-00003.safetensors",
495
+ "visual.blocks.2.mlp.fc2.weight": "model-00001-of-00003.safetensors",
496
+ "visual.blocks.2.norm1.bias": "model-00001-of-00003.safetensors",
497
+ "visual.blocks.2.norm1.weight": "model-00001-of-00003.safetensors",
498
+ "visual.blocks.2.norm2.bias": "model-00001-of-00003.safetensors",
499
+ "visual.blocks.2.norm2.weight": "model-00001-of-00003.safetensors",
500
+ "visual.blocks.20.attn.proj.bias": "model-00001-of-00003.safetensors",
501
+ "visual.blocks.20.attn.proj.weight": "model-00001-of-00003.safetensors",
502
+ "visual.blocks.20.attn.qkv.bias": "model-00001-of-00003.safetensors",
503
+ "visual.blocks.20.attn.qkv.weight": "model-00001-of-00003.safetensors",
504
+ "visual.blocks.20.mlp.fc1.bias": "model-00001-of-00003.safetensors",
505
+ "visual.blocks.20.mlp.fc1.weight": "model-00001-of-00003.safetensors",
506
+ "visual.blocks.20.mlp.fc2.bias": "model-00001-of-00003.safetensors",
507
+ "visual.blocks.20.mlp.fc2.weight": "model-00001-of-00003.safetensors",
508
+ "visual.blocks.20.norm1.bias": "model-00001-of-00003.safetensors",
509
+ "visual.blocks.20.norm1.weight": "model-00001-of-00003.safetensors",
510
+ "visual.blocks.20.norm2.bias": "model-00001-of-00003.safetensors",
511
+ "visual.blocks.20.norm2.weight": "model-00001-of-00003.safetensors",
512
+ "visual.blocks.21.attn.proj.bias": "model-00001-of-00003.safetensors",
513
+ "visual.blocks.21.attn.proj.weight": "model-00001-of-00003.safetensors",
514
+ "visual.blocks.21.attn.qkv.bias": "model-00001-of-00003.safetensors",
515
+ "visual.blocks.21.attn.qkv.weight": "model-00001-of-00003.safetensors",
516
+ "visual.blocks.21.mlp.fc1.bias": "model-00001-of-00003.safetensors",
517
+ "visual.blocks.21.mlp.fc1.weight": "model-00001-of-00003.safetensors",
518
+ "visual.blocks.21.mlp.fc2.bias": "model-00001-of-00003.safetensors",
519
+ "visual.blocks.21.mlp.fc2.weight": "model-00001-of-00003.safetensors",
520
+ "visual.blocks.21.norm1.bias": "model-00001-of-00003.safetensors",
521
+ "visual.blocks.21.norm1.weight": "model-00001-of-00003.safetensors",
522
+ "visual.blocks.21.norm2.bias": "model-00001-of-00003.safetensors",
523
+ "visual.blocks.21.norm2.weight": "model-00001-of-00003.safetensors",
524
+ "visual.blocks.22.attn.proj.bias": "model-00001-of-00003.safetensors",
525
+ "visual.blocks.22.attn.proj.weight": "model-00001-of-00003.safetensors",
526
+ "visual.blocks.22.attn.qkv.bias": "model-00001-of-00003.safetensors",
527
+ "visual.blocks.22.attn.qkv.weight": "model-00001-of-00003.safetensors",
528
+ "visual.blocks.22.mlp.fc1.bias": "model-00001-of-00003.safetensors",
529
+ "visual.blocks.22.mlp.fc1.weight": "model-00001-of-00003.safetensors",
530
+ "visual.blocks.22.mlp.fc2.bias": "model-00001-of-00003.safetensors",
531
+ "visual.blocks.22.mlp.fc2.weight": "model-00001-of-00003.safetensors",
532
+ "visual.blocks.22.norm1.bias": "model-00001-of-00003.safetensors",
533
+ "visual.blocks.22.norm1.weight": "model-00001-of-00003.safetensors",
534
+ "visual.blocks.22.norm2.bias": "model-00001-of-00003.safetensors",
535
+ "visual.blocks.22.norm2.weight": "model-00001-of-00003.safetensors",
536
+ "visual.blocks.23.attn.proj.bias": "model-00001-of-00003.safetensors",
537
+ "visual.blocks.23.attn.proj.weight": "model-00001-of-00003.safetensors",
538
+ "visual.blocks.23.attn.qkv.bias": "model-00001-of-00003.safetensors",
539
+ "visual.blocks.23.attn.qkv.weight": "model-00001-of-00003.safetensors",
540
+ "visual.blocks.23.mlp.fc1.bias": "model-00001-of-00003.safetensors",
541
+ "visual.blocks.23.mlp.fc1.weight": "model-00001-of-00003.safetensors",
542
+ "visual.blocks.23.mlp.fc2.bias": "model-00001-of-00003.safetensors",
543
+ "visual.blocks.23.mlp.fc2.weight": "model-00001-of-00003.safetensors",
544
+ "visual.blocks.23.norm1.bias": "model-00001-of-00003.safetensors",
545
+ "visual.blocks.23.norm1.weight": "model-00001-of-00003.safetensors",
546
+ "visual.blocks.23.norm2.bias": "model-00001-of-00003.safetensors",
547
+ "visual.blocks.23.norm2.weight": "model-00001-of-00003.safetensors",
548
+ "visual.blocks.24.attn.proj.bias": "model-00001-of-00003.safetensors",
549
+ "visual.blocks.24.attn.proj.weight": "model-00001-of-00003.safetensors",
550
+ "visual.blocks.24.attn.qkv.bias": "model-00001-of-00003.safetensors",
551
+ "visual.blocks.24.attn.qkv.weight": "model-00001-of-00003.safetensors",
552
+ "visual.blocks.24.mlp.fc1.bias": "model-00001-of-00003.safetensors",
553
+ "visual.blocks.24.mlp.fc1.weight": "model-00001-of-00003.safetensors",
554
+ "visual.blocks.24.mlp.fc2.bias": "model-00001-of-00003.safetensors",
555
+ "visual.blocks.24.mlp.fc2.weight": "model-00001-of-00003.safetensors",
556
+ "visual.blocks.24.norm1.bias": "model-00001-of-00003.safetensors",
557
+ "visual.blocks.24.norm1.weight": "model-00001-of-00003.safetensors",
558
+ "visual.blocks.24.norm2.bias": "model-00001-of-00003.safetensors",
559
+ "visual.blocks.24.norm2.weight": "model-00001-of-00003.safetensors",
560
+ "visual.blocks.25.attn.proj.bias": "model-00001-of-00003.safetensors",
561
+ "visual.blocks.25.attn.proj.weight": "model-00001-of-00003.safetensors",
562
+ "visual.blocks.25.attn.qkv.bias": "model-00001-of-00003.safetensors",
563
+ "visual.blocks.25.attn.qkv.weight": "model-00001-of-00003.safetensors",
564
+ "visual.blocks.25.mlp.fc1.bias": "model-00001-of-00003.safetensors",
565
+ "visual.blocks.25.mlp.fc1.weight": "model-00001-of-00003.safetensors",
566
+ "visual.blocks.25.mlp.fc2.bias": "model-00001-of-00003.safetensors",
567
+ "visual.blocks.25.mlp.fc2.weight": "model-00001-of-00003.safetensors",
568
+ "visual.blocks.25.norm1.bias": "model-00001-of-00003.safetensors",
569
+ "visual.blocks.25.norm1.weight": "model-00001-of-00003.safetensors",
570
+ "visual.blocks.25.norm2.bias": "model-00001-of-00003.safetensors",
571
+ "visual.blocks.25.norm2.weight": "model-00001-of-00003.safetensors",
572
+ "visual.blocks.26.attn.proj.bias": "model-00001-of-00003.safetensors",
573
+ "visual.blocks.26.attn.proj.weight": "model-00001-of-00003.safetensors",
574
+ "visual.blocks.26.attn.qkv.bias": "model-00001-of-00003.safetensors",
575
+ "visual.blocks.26.attn.qkv.weight": "model-00001-of-00003.safetensors",
576
+ "visual.blocks.26.mlp.fc1.bias": "model-00001-of-00003.safetensors",
577
+ "visual.blocks.26.mlp.fc1.weight": "model-00001-of-00003.safetensors",
578
+ "visual.blocks.26.mlp.fc2.bias": "model-00001-of-00003.safetensors",
579
+ "visual.blocks.26.mlp.fc2.weight": "model-00001-of-00003.safetensors",
580
+ "visual.blocks.26.norm1.bias": "model-00001-of-00003.safetensors",
581
+ "visual.blocks.26.norm1.weight": "model-00001-of-00003.safetensors",
582
+ "visual.blocks.26.norm2.bias": "model-00001-of-00003.safetensors",
583
+ "visual.blocks.26.norm2.weight": "model-00001-of-00003.safetensors",
584
+ "visual.blocks.27.attn.proj.bias": "model-00001-of-00003.safetensors",
585
+ "visual.blocks.27.attn.proj.weight": "model-00001-of-00003.safetensors",
586
+ "visual.blocks.27.attn.qkv.bias": "model-00001-of-00003.safetensors",
587
+ "visual.blocks.27.attn.qkv.weight": "model-00001-of-00003.safetensors",
588
+ "visual.blocks.27.mlp.fc1.bias": "model-00001-of-00003.safetensors",
589
+ "visual.blocks.27.mlp.fc1.weight": "model-00001-of-00003.safetensors",
590
+ "visual.blocks.27.mlp.fc2.bias": "model-00001-of-00003.safetensors",
591
+ "visual.blocks.27.mlp.fc2.weight": "model-00001-of-00003.safetensors",
592
+ "visual.blocks.27.norm1.bias": "model-00001-of-00003.safetensors",
593
+ "visual.blocks.27.norm1.weight": "model-00001-of-00003.safetensors",
594
+ "visual.blocks.27.norm2.bias": "model-00001-of-00003.safetensors",
595
+ "visual.blocks.27.norm2.weight": "model-00001-of-00003.safetensors",
596
+ "visual.blocks.28.attn.proj.bias": "model-00001-of-00003.safetensors",
597
+ "visual.blocks.28.attn.proj.weight": "model-00001-of-00003.safetensors",
598
+ "visual.blocks.28.attn.qkv.bias": "model-00001-of-00003.safetensors",
599
+ "visual.blocks.28.attn.qkv.weight": "model-00001-of-00003.safetensors",
600
+ "visual.blocks.28.mlp.fc1.bias": "model-00001-of-00003.safetensors",
601
+ "visual.blocks.28.mlp.fc1.weight": "model-00001-of-00003.safetensors",
602
+ "visual.blocks.28.mlp.fc2.bias": "model-00001-of-00003.safetensors",
603
+ "visual.blocks.28.mlp.fc2.weight": "model-00001-of-00003.safetensors",
604
+ "visual.blocks.28.norm1.bias": "model-00001-of-00003.safetensors",
605
+ "visual.blocks.28.norm1.weight": "model-00001-of-00003.safetensors",
606
+ "visual.blocks.28.norm2.bias": "model-00001-of-00003.safetensors",
607
+ "visual.blocks.28.norm2.weight": "model-00001-of-00003.safetensors",
608
+ "visual.blocks.29.attn.proj.bias": "model-00001-of-00003.safetensors",
609
+ "visual.blocks.29.attn.proj.weight": "model-00001-of-00003.safetensors",
610
+ "visual.blocks.29.attn.qkv.bias": "model-00001-of-00003.safetensors",
611
+ "visual.blocks.29.attn.qkv.weight": "model-00001-of-00003.safetensors",
612
+ "visual.blocks.29.mlp.fc1.bias": "model-00001-of-00003.safetensors",
613
+ "visual.blocks.29.mlp.fc1.weight": "model-00001-of-00003.safetensors",
614
+ "visual.blocks.29.mlp.fc2.bias": "model-00001-of-00003.safetensors",
615
+ "visual.blocks.29.mlp.fc2.weight": "model-00001-of-00003.safetensors",
616
+ "visual.blocks.29.norm1.bias": "model-00001-of-00003.safetensors",
617
+ "visual.blocks.29.norm1.weight": "model-00001-of-00003.safetensors",
618
+ "visual.blocks.29.norm2.bias": "model-00001-of-00003.safetensors",
619
+ "visual.blocks.29.norm2.weight": "model-00001-of-00003.safetensors",
620
+ "visual.blocks.3.attn.proj.bias": "model-00001-of-00003.safetensors",
621
+ "visual.blocks.3.attn.proj.weight": "model-00001-of-00003.safetensors",
622
+ "visual.blocks.3.attn.qkv.bias": "model-00001-of-00003.safetensors",
623
+ "visual.blocks.3.attn.qkv.weight": "model-00001-of-00003.safetensors",
624
+ "visual.blocks.3.mlp.fc1.bias": "model-00001-of-00003.safetensors",
625
+ "visual.blocks.3.mlp.fc1.weight": "model-00001-of-00003.safetensors",
626
+ "visual.blocks.3.mlp.fc2.bias": "model-00001-of-00003.safetensors",
627
+ "visual.blocks.3.mlp.fc2.weight": "model-00001-of-00003.safetensors",
628
+ "visual.blocks.3.norm1.bias": "model-00001-of-00003.safetensors",
629
+ "visual.blocks.3.norm1.weight": "model-00001-of-00003.safetensors",
630
+ "visual.blocks.3.norm2.bias": "model-00001-of-00003.safetensors",
631
+ "visual.blocks.3.norm2.weight": "model-00001-of-00003.safetensors",
632
+ "visual.blocks.30.attn.proj.bias": "model-00001-of-00003.safetensors",
633
+ "visual.blocks.30.attn.proj.weight": "model-00001-of-00003.safetensors",
634
+ "visual.blocks.30.attn.qkv.bias": "model-00001-of-00003.safetensors",
635
+ "visual.blocks.30.attn.qkv.weight": "model-00001-of-00003.safetensors",
636
+ "visual.blocks.30.mlp.fc1.bias": "model-00001-of-00003.safetensors",
637
+ "visual.blocks.30.mlp.fc1.weight": "model-00001-of-00003.safetensors",
638
+ "visual.blocks.30.mlp.fc2.bias": "model-00001-of-00003.safetensors",
639
+ "visual.blocks.30.mlp.fc2.weight": "model-00001-of-00003.safetensors",
640
+ "visual.blocks.30.norm1.bias": "model-00001-of-00003.safetensors",
641
+ "visual.blocks.30.norm1.weight": "model-00001-of-00003.safetensors",
642
+ "visual.blocks.30.norm2.bias": "model-00001-of-00003.safetensors",
643
+ "visual.blocks.30.norm2.weight": "model-00001-of-00003.safetensors",
644
+ "visual.blocks.31.attn.proj.bias": "model-00001-of-00003.safetensors",
645
+ "visual.blocks.31.attn.proj.weight": "model-00001-of-00003.safetensors",
646
+ "visual.blocks.31.attn.qkv.bias": "model-00001-of-00003.safetensors",
647
+ "visual.blocks.31.attn.qkv.weight": "model-00001-of-00003.safetensors",
648
+ "visual.blocks.31.mlp.fc1.bias": "model-00001-of-00003.safetensors",
649
+ "visual.blocks.31.mlp.fc1.weight": "model-00001-of-00003.safetensors",
650
+ "visual.blocks.31.mlp.fc2.bias": "model-00001-of-00003.safetensors",
651
+ "visual.blocks.31.mlp.fc2.weight": "model-00001-of-00003.safetensors",
652
+ "visual.blocks.31.norm1.bias": "model-00001-of-00003.safetensors",
653
+ "visual.blocks.31.norm1.weight": "model-00001-of-00003.safetensors",
654
+ "visual.blocks.31.norm2.bias": "model-00001-of-00003.safetensors",
655
+ "visual.blocks.31.norm2.weight": "model-00001-of-00003.safetensors",
656
+ "visual.blocks.4.attn.proj.bias": "model-00001-of-00003.safetensors",
657
+ "visual.blocks.4.attn.proj.weight": "model-00001-of-00003.safetensors",
658
+ "visual.blocks.4.attn.qkv.bias": "model-00001-of-00003.safetensors",
659
+ "visual.blocks.4.attn.qkv.weight": "model-00001-of-00003.safetensors",
660
+ "visual.blocks.4.mlp.fc1.bias": "model-00001-of-00003.safetensors",
661
+ "visual.blocks.4.mlp.fc1.weight": "model-00001-of-00003.safetensors",
662
+ "visual.blocks.4.mlp.fc2.bias": "model-00001-of-00003.safetensors",
663
+ "visual.blocks.4.mlp.fc2.weight": "model-00001-of-00003.safetensors",
664
+ "visual.blocks.4.norm1.bias": "model-00001-of-00003.safetensors",
665
+ "visual.blocks.4.norm1.weight": "model-00001-of-00003.safetensors",
666
+ "visual.blocks.4.norm2.bias": "model-00001-of-00003.safetensors",
667
+ "visual.blocks.4.norm2.weight": "model-00001-of-00003.safetensors",
668
+ "visual.blocks.5.attn.proj.bias": "model-00001-of-00003.safetensors",
669
+ "visual.blocks.5.attn.proj.weight": "model-00001-of-00003.safetensors",
670
+ "visual.blocks.5.attn.qkv.bias": "model-00001-of-00003.safetensors",
671
+ "visual.blocks.5.attn.qkv.weight": "model-00001-of-00003.safetensors",
672
+ "visual.blocks.5.mlp.fc1.bias": "model-00001-of-00003.safetensors",
673
+ "visual.blocks.5.mlp.fc1.weight": "model-00001-of-00003.safetensors",
674
+ "visual.blocks.5.mlp.fc2.bias": "model-00001-of-00003.safetensors",
675
+ "visual.blocks.5.mlp.fc2.weight": "model-00001-of-00003.safetensors",
676
+ "visual.blocks.5.norm1.bias": "model-00001-of-00003.safetensors",
677
+ "visual.blocks.5.norm1.weight": "model-00001-of-00003.safetensors",
678
+ "visual.blocks.5.norm2.bias": "model-00001-of-00003.safetensors",
679
+ "visual.blocks.5.norm2.weight": "model-00001-of-00003.safetensors",
680
+ "visual.blocks.6.attn.proj.bias": "model-00001-of-00003.safetensors",
681
+ "visual.blocks.6.attn.proj.weight": "model-00001-of-00003.safetensors",
682
+ "visual.blocks.6.attn.qkv.bias": "model-00001-of-00003.safetensors",
683
+ "visual.blocks.6.attn.qkv.weight": "model-00001-of-00003.safetensors",
684
+ "visual.blocks.6.mlp.fc1.bias": "model-00001-of-00003.safetensors",
685
+ "visual.blocks.6.mlp.fc1.weight": "model-00001-of-00003.safetensors",
686
+ "visual.blocks.6.mlp.fc2.bias": "model-00001-of-00003.safetensors",
687
+ "visual.blocks.6.mlp.fc2.weight": "model-00001-of-00003.safetensors",
688
+ "visual.blocks.6.norm1.bias": "model-00001-of-00003.safetensors",
689
+ "visual.blocks.6.norm1.weight": "model-00001-of-00003.safetensors",
690
+ "visual.blocks.6.norm2.bias": "model-00001-of-00003.safetensors",
691
+ "visual.blocks.6.norm2.weight": "model-00001-of-00003.safetensors",
692
+ "visual.blocks.7.attn.proj.bias": "model-00001-of-00003.safetensors",
693
+ "visual.blocks.7.attn.proj.weight": "model-00001-of-00003.safetensors",
694
+ "visual.blocks.7.attn.qkv.bias": "model-00001-of-00003.safetensors",
695
+ "visual.blocks.7.attn.qkv.weight": "model-00001-of-00003.safetensors",
696
+ "visual.blocks.7.mlp.fc1.bias": "model-00001-of-00003.safetensors",
697
+ "visual.blocks.7.mlp.fc1.weight": "model-00001-of-00003.safetensors",
698
+ "visual.blocks.7.mlp.fc2.bias": "model-00001-of-00003.safetensors",
699
+ "visual.blocks.7.mlp.fc2.weight": "model-00001-of-00003.safetensors",
700
+ "visual.blocks.7.norm1.bias": "model-00001-of-00003.safetensors",
701
+ "visual.blocks.7.norm1.weight": "model-00001-of-00003.safetensors",
702
+ "visual.blocks.7.norm2.bias": "model-00001-of-00003.safetensors",
703
+ "visual.blocks.7.norm2.weight": "model-00001-of-00003.safetensors",
704
+ "visual.blocks.8.attn.proj.bias": "model-00001-of-00003.safetensors",
705
+ "visual.blocks.8.attn.proj.weight": "model-00001-of-00003.safetensors",
706
+ "visual.blocks.8.attn.qkv.bias": "model-00001-of-00003.safetensors",
707
+ "visual.blocks.8.attn.qkv.weight": "model-00001-of-00003.safetensors",
708
+ "visual.blocks.8.mlp.fc1.bias": "model-00001-of-00003.safetensors",
709
+ "visual.blocks.8.mlp.fc1.weight": "model-00001-of-00003.safetensors",
710
+ "visual.blocks.8.mlp.fc2.bias": "model-00001-of-00003.safetensors",
711
+ "visual.blocks.8.mlp.fc2.weight": "model-00001-of-00003.safetensors",
712
+ "visual.blocks.8.norm1.bias": "model-00001-of-00003.safetensors",
713
+ "visual.blocks.8.norm1.weight": "model-00001-of-00003.safetensors",
714
+ "visual.blocks.8.norm2.bias": "model-00001-of-00003.safetensors",
715
+ "visual.blocks.8.norm2.weight": "model-00001-of-00003.safetensors",
716
+ "visual.blocks.9.attn.proj.bias": "model-00001-of-00003.safetensors",
717
+ "visual.blocks.9.attn.proj.weight": "model-00001-of-00003.safetensors",
718
+ "visual.blocks.9.attn.qkv.bias": "model-00001-of-00003.safetensors",
719
+ "visual.blocks.9.attn.qkv.weight": "model-00001-of-00003.safetensors",
720
+ "visual.blocks.9.mlp.fc1.bias": "model-00001-of-00003.safetensors",
721
+ "visual.blocks.9.mlp.fc1.weight": "model-00001-of-00003.safetensors",
722
+ "visual.blocks.9.mlp.fc2.bias": "model-00001-of-00003.safetensors",
723
+ "visual.blocks.9.mlp.fc2.weight": "model-00001-of-00003.safetensors",
724
+ "visual.blocks.9.norm1.bias": "model-00001-of-00003.safetensors",
725
+ "visual.blocks.9.norm1.weight": "model-00001-of-00003.safetensors",
726
+ "visual.blocks.9.norm2.bias": "model-00001-of-00003.safetensors",
727
+ "visual.blocks.9.norm2.weight": "model-00001-of-00003.safetensors",
728
+ "visual.merger.ln_q.bias": "model-00001-of-00003.safetensors",
729
+ "visual.merger.ln_q.weight": "model-00001-of-00003.safetensors",
730
+ "visual.merger.mlp.0.bias": "model-00001-of-00003.safetensors",
731
+ "visual.merger.mlp.0.weight": "model-00001-of-00003.safetensors",
732
+ "visual.merger.mlp.2.bias": "model-00001-of-00003.safetensors",
733
+ "visual.merger.mlp.2.weight": "model-00001-of-00003.safetensors",
734
+ "visual.patch_embed.proj.weight": "model-00001-of-00003.safetensors"
735
+ }
736
+ }
modeling_gme_qwen2vl.py ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import base64
4
+ import logging
5
+ import math
6
+ import os
7
+ from io import BytesIO
8
+ from typing import Any, Dict, List, Optional, Union
9
+
10
+ import requests
11
+ import torch
12
+ from PIL import Image
13
+ from torch.utils.data import DataLoader
14
+ from tqdm.autonotebook import tqdm
15
+ from transformers import AutoProcessor, PreTrainedModel
16
+ from transformers.models.qwen2_vl.modeling_qwen2_vl import (
17
+ Qwen2VisionTransformerPretrainedModel,
18
+ Qwen2VLConfig,
19
+ Qwen2VLForConditionalGeneration,
20
+ Qwen2VLModel,
21
+ )
22
+ from transformers.utils.versions import require_version
23
+
24
+
25
+ # require_version(
26
+ # "transformers<4.52.0",
27
+ # "This code has some issues with transformers>=4.52.0, please downgrade: pip install transformers==4.51.3"
28
+ # )
29
+
30
+
31
+ class GmeQwen2VLConfig(Qwen2VLConfig):
32
+ # model_type = ''
33
+
34
+ def __init__(
35
+ self,
36
+ min_image_tokens: int = 256,
37
+ max_image_tokens: int = 1280,
38
+ max_length: int = 1800,
39
+ **kwargs: Any,
40
+ ) -> None:
41
+ super().__init__(**kwargs)
42
+ self.min_image_tokens = min_image_tokens
43
+ self.max_image_tokens = max_image_tokens
44
+ self.max_length = max_length
45
+
46
+
47
+ class GmeQwen2VL(PreTrainedModel):
48
+ config_class = GmeQwen2VLConfig
49
+ base_model_prefix = "model"
50
+ supports_gradient_checkpointing = True
51
+ _no_split_modules = ["Qwen2VLDecoderLayer", "Qwen2VLVisionBlock"]
52
+ # _skip_keys_device_placement = "past_key_values"
53
+ _supports_flash_attn_2 = True
54
+ _supports_sdpa = True
55
+ # _supports_cache_class = True
56
+ _supports_static_cache = False # TODO (joao): fix. torch.compile failing probably due to `cache_positions`
57
+ # _tied_weights_keys = ["lm_head.weight"]
58
+
59
+ def __init__(self, config: GmeQwen2VLConfig, **kwargs: Any) -> None:
60
+ super().__init__(config)
61
+ self.visual = Qwen2VisionTransformerPretrainedModel._from_config(config.vision_config)
62
+ self.model = Qwen2VLModel(config)
63
+ self.vocab_size = config.vocab_size
64
+ # self.lm_head = torch.nn.Linear(config.hidden_size, config.vocab_size, bias=False)
65
+ self.rope_deltas = None # cache rope_deltas here
66
+
67
+ min_pixels: int = config.min_image_tokens * 28 * 28
68
+ max_pixels: int = config.max_image_tokens * 28 * 28
69
+ self.processor = AutoProcessor.from_pretrained(
70
+ config._name_or_path, min_pixels=min_pixels, max_pixels=max_pixels, **kwargs
71
+ )
72
+ self.max_length: int = config.max_length
73
+ self.normalize: bool = True
74
+ self.processor.tokenizer.padding_side = "right"
75
+ self.default_instruction: str = "You are a helpful assistant."
76
+ self.sep: str = " "
77
+
78
+ # Initialize weights and apply final processing
79
+ self.post_init()
80
+
81
+ def forward(
82
+ self,
83
+ input_ids: Optional[torch.LongTensor] = None,
84
+ attention_mask: Optional[torch.Tensor] = None,
85
+ position_ids: Optional[torch.LongTensor] = None,
86
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
87
+ inputs_embeds: Optional[torch.FloatTensor] = None,
88
+ pixel_values: Optional[torch.Tensor] = None,
89
+ # pixel_values_videos: Optional[torch.FloatTensor] = None,
90
+ image_grid_thw: Optional[torch.LongTensor] = None,
91
+ # video_grid_thw: Optional[torch.LongTensor] = None,
92
+ pooling_mask: Optional[torch.LongTensor] = None,
93
+ **kwargs
94
+ ) -> torch.Tensor:
95
+ if inputs_embeds is None:
96
+ inputs_embeds = self.model.get_input_embeddings()(input_ids)
97
+ if pixel_values is not None:
98
+ pixel_values = pixel_values.type(self.visual.get_dtype())
99
+ image_embeds = self.visual(pixel_values, grid_thw=image_grid_thw).to(inputs_embeds.device)
100
+ image_mask = input_ids == self.config.image_token_id
101
+ inputs_embeds[image_mask] = image_embeds
102
+ # if pixel_values_videos is not None:
103
+ # pixel_values_videos = pixel_values_videos.type(self.visual.get_dtype())
104
+ # video_embeds = self.visual(pixel_values_videos, grid_thw=video_grid_thw).to(inputs_embeds.device)
105
+ # video_mask = input_ids == self.config.video_token_id
106
+ # inputs_embeds[video_mask] = video_embeds
107
+ if attention_mask is not None:
108
+ attention_mask = attention_mask.to(inputs_embeds.device)
109
+
110
+ outputs = self.model(
111
+ input_ids=None,
112
+ position_ids=position_ids,
113
+ attention_mask=attention_mask,
114
+ past_key_values=past_key_values,
115
+ inputs_embeds=inputs_embeds,
116
+ )
117
+
118
+ pooling_mask = attention_mask if pooling_mask is None else pooling_mask
119
+ left_padding = (pooling_mask[:, -1].sum() == pooling_mask.shape[0]) # TODO
120
+ if left_padding:
121
+ embeddings = outputs.last_hidden_state[:, -1]
122
+ else:
123
+ sequence_lengths = pooling_mask.sum(dim=1) - 1
124
+ batch_size = outputs.last_hidden_state.shape[0]
125
+ embeddings = outputs.last_hidden_state[torch.arange(
126
+ batch_size, device=outputs.last_hidden_state.device
127
+ ), sequence_lengths]
128
+ if self.normalize:
129
+ embeddings = torch.nn.functional.normalize(embeddings, p=2, dim=1)
130
+ return embeddings.contiguous()
131
+
132
+ def embed(self, texts: list[str], images: list[Image.Image], is_query=True, instruction=None, **kwargs):
133
+ self.eval()
134
+ # Inputs must be batched
135
+ input_texts, input_images = list(), list()
136
+ for t, i in zip(texts, images):
137
+ if not is_query or instruction is None:
138
+ instruction = self.default_instruction
139
+ input_str = ''
140
+ if i is None:
141
+ input_images = None # All examples in the same batch are consistent
142
+ else:
143
+ input_str += '<|vision_start|><|image_pad|><|vision_end|>'
144
+ i = fetch_image(i)
145
+ input_images.append(i)
146
+ if t is not None:
147
+ input_str += t
148
+ msg = f'<|im_start|>system\n{instruction}<|im_end|>\n<|im_start|>user\n{input_str}<|im_end|>\n<|im_start|>assistant\n<|endoftext|>'
149
+ input_texts.append(msg)
150
+
151
+ inputs = self.processor(
152
+ text=input_texts,
153
+ images=input_images,
154
+ padding=True,
155
+ truncation=True,
156
+ max_length=self.max_length,
157
+ return_tensors='pt'
158
+ )
159
+ inputs = {k: v.to(self.device) for k, v in inputs.items()} # TODO
160
+ with torch.inference_mode():
161
+ embeddings = self.forward(**inputs)
162
+ return embeddings
163
+
164
+ def encode(self, sentences: list[str], *, prompt_name=None, **kwargs):
165
+ return self.get_fused_embeddings(texts=sentences, prompt_name=prompt_name, **kwargs)
166
+
167
+ def encode_queries(self, queries: List[str], **kwargs):
168
+ embeddings = self.encode(queries, **kwargs)
169
+ return embeddings
170
+
171
+ def encode_corpus(self, corpus: List[Dict[str, str]], **kwargs):
172
+ if type(corpus) is dict:
173
+ sentences = [
174
+ (corpus["title"][i] + self.sep + corpus["text"][i]).strip()
175
+ if "title" in corpus
176
+ else corpus["text"][i].strip()
177
+ for i in range(len(corpus["text"]))
178
+ ]
179
+ else:
180
+ sentences = [
181
+ (doc["title"] + self.sep + doc["text"]).strip() if "title" in doc else doc["text"].strip()
182
+ for doc in corpus
183
+ ]
184
+ embeddings = self.encode(sentences, is_query=False, **kwargs)
185
+ return embeddings
186
+
187
+ def get_image_embeddings(self, images: list[Image.Image] | DataLoader, **kwargs):
188
+ return self.get_fused_embeddings(images=images, **kwargs)
189
+
190
+ def get_text_embeddings(self, texts: list[str], **kwargs):
191
+ return self.get_fused_embeddings(texts=texts, **kwargs)
192
+
193
+ def get_fused_embeddings(self, texts: list[str] = None, images: list[Image.Image] | DataLoader = None, **kwargs):
194
+ if isinstance(images, DataLoader):
195
+ image_loader = images
196
+ batch_size = image_loader.batch_size
197
+ image_loader.dataset.transform = None
198
+ else:
199
+ batch_size = kwargs.pop('batch_size', 32)
200
+ if images is None:
201
+ image_loader = None
202
+ else:
203
+ image_loader = DataLoader(
204
+ images,
205
+ batch_size=batch_size,
206
+ shuffle=False,
207
+ collate_fn=custom_collate_fn,
208
+ num_workers=min(math.floor(os.cpu_count() / 2), 8),
209
+ )
210
+
211
+ if texts is None:
212
+ assert image_loader is not None
213
+ n_batch = len(image_loader)
214
+ else:
215
+ n_batch = len(texts) // batch_size + int(len(texts) % batch_size > 0)
216
+ image_loader = image_loader or [None] * n_batch
217
+
218
+ all_embeddings = list()
219
+ none_batch = [None] * batch_size
220
+ show_progress_bar = kwargs.pop('show_progress_bar', False)
221
+ pbar = tqdm(total=n_batch, disable=not show_progress_bar, mininterval=1, miniters=10, desc='encode')
222
+ for n, img_batch in zip(range(0, n_batch * batch_size, batch_size), image_loader):
223
+ text_batch = none_batch if texts is None else texts[n: n+batch_size]
224
+ img_batch = none_batch if img_batch is None else img_batch
225
+ embeddings = self.embed(texts=text_batch, images=img_batch, **kwargs)
226
+ pbar.update(1)
227
+ all_embeddings.append(embeddings.cpu())
228
+ pbar.close()
229
+ all_embeddings = torch.cat(all_embeddings, dim=0)
230
+ return all_embeddings
231
+
232
+
233
+ def custom_collate_fn(batch):
234
+ return batch
235
+
236
+
237
+ ### Copied from qwen_vl_utils.vision_process.py
238
+ import base64
239
+ from io import BytesIO
240
+ import requests
241
+
242
+ IMAGE_FACTOR = 28
243
+ MIN_PIXELS = 4 * 28 * 28
244
+ MAX_PIXELS = 16384 * 28 * 28
245
+ MAX_RATIO = 200
246
+
247
+
248
+ def round_by_factor(number: int, factor: int) -> int:
249
+ """Returns the closest integer to 'number' that is divisible by 'factor'."""
250
+ return round(number / factor) * factor
251
+
252
+
253
+ def ceil_by_factor(number: int, factor: int) -> int:
254
+ """Returns the smallest integer greater than or equal to 'number' that is divisible by 'factor'."""
255
+ return math.ceil(number / factor) * factor
256
+
257
+
258
+ def floor_by_factor(number: int, factor: int) -> int:
259
+ """Returns the largest integer less than or equal to 'number' that is divisible by 'factor'."""
260
+ return math.floor(number / factor) * factor
261
+
262
+
263
+ def smart_resize(
264
+ height: int, width: int, factor: int = IMAGE_FACTOR, min_pixels: int = MIN_PIXELS, max_pixels: int = MAX_PIXELS
265
+ ) -> tuple[int, int]:
266
+ """
267
+ Rescales the image so that the following conditions are met:
268
+
269
+ 1. Both dimensions (height and width) are divisible by 'factor'.
270
+
271
+ 2. The total number of pixels is within the range ['min_pixels', 'max_pixels'].
272
+
273
+ 3. The aspect ratio of the image is maintained as closely as possible.
274
+ """
275
+ h_bar = max(factor, round_by_factor(height, factor))
276
+ w_bar = max(factor, round_by_factor(width, factor))
277
+ if h_bar * w_bar > max_pixels:
278
+ beta = math.sqrt((height * width) / max_pixels)
279
+ h_bar = floor_by_factor(height / beta, factor)
280
+ w_bar = floor_by_factor(width / beta, factor)
281
+ elif h_bar * w_bar < min_pixels:
282
+ beta = math.sqrt(min_pixels / (height * width))
283
+ h_bar = ceil_by_factor(height * beta, factor)
284
+ w_bar = ceil_by_factor(width * beta, factor)
285
+
286
+ if max(h_bar, w_bar) / min(h_bar, w_bar) > MAX_RATIO:
287
+ logging.warning(
288
+ f"Absolute aspect ratio must be smaller than {MAX_RATIO}, got {max(h_bar, w_bar) / min(h_bar, w_bar)}"
289
+ )
290
+ if h_bar > w_bar:
291
+ h_bar = w_bar * MAX_RATIO
292
+ else:
293
+ w_bar = h_bar * MAX_RATIO
294
+ return h_bar, w_bar
295
+
296
+
297
+ def fetch_image(image: str | Image.Image, size_factor: int = IMAGE_FACTOR) -> Image.Image:
298
+ image_obj = None
299
+ if isinstance(image, Image.Image):
300
+ image_obj = image
301
+ elif image.startswith("http://") or image.startswith("https://"):
302
+ image_obj = Image.open(requests.get(image, stream=True).raw)
303
+ elif image.startswith("file://"):
304
+ image_obj = Image.open(image[7:])
305
+ elif image.startswith("data:image"):
306
+ if "base64," in image:
307
+ _, base64_data = image.split("base64,", 1)
308
+ data = base64.b64decode(base64_data)
309
+ image_obj = Image.open(BytesIO(data))
310
+ else:
311
+ image_obj = Image.open(image)
312
+ if image_obj is None:
313
+ raise ValueError(f"Unrecognized image input, support local path, http url, base64 and PIL.Image, got {image}")
314
+ image = image_obj.convert("RGB")
315
+ ## resize
316
+ # if "resized_height" in ele and "resized_width" in ele:
317
+ # resized_height, resized_width = smart_resize(
318
+ # ele["resized_height"],
319
+ # ele["resized_width"],
320
+ # factor=size_factor,
321
+ # )
322
+ # else:
323
+ width, height = image.size
324
+ # min_pixels = ele.get("min_pixels", MIN_PIXELS)
325
+ # max_pixels = ele.get("max_pixels", MAX_PIXELS)
326
+ resized_height, resized_width = smart_resize(
327
+ height,
328
+ width,
329
+ factor=size_factor,
330
+ min_pixels=MIN_PIXELS,
331
+ max_pixels=MAX_PIXELS,
332
+ )
333
+ image = image.resize((resized_width, resized_height))
334
+
335
+ return image
336
+ ###
337
+
modules.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "custom_st.MultiModalTransformer"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Pooling",
12
+ "type": "sentence_transformers.models.Pooling"
13
+ },
14
+ {
15
+ "idx": 2,
16
+ "name": "2",
17
+ "path": "2_Normalize",
18
+ "type": "sentence_transformers.models.Normalize"
19
+ }
20
+ ]
preprocessor_config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "min_pixels": 3136,
3
+ "max_pixels": 12845056,
4
+ "patch_size": 14,
5
+ "temporal_patch_size": 2,
6
+ "merge_size": 2,
7
+ "image_mean": [
8
+ 0.48145466,
9
+ 0.4578275,
10
+ 0.40821073
11
+ ],
12
+ "image_std": [
13
+ 0.26862954,
14
+ 0.26130258,
15
+ 0.27577711
16
+ ],
17
+ "image_processor_type": "Qwen2VLImageProcessor",
18
+ "processor_class": "Qwen2VLProcessor"
19
+ }
results.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"arxivqa_test_subsampled": {"ndcg_at_1": 0.786, "ndcg_at_3": 0.82859, "ndcg_at_5": 0.83909, "ndcg_at_10": 0.85118, "ndcg_at_20": 0.85912, "ndcg_at_50": 0.86489, "ndcg_at_100": 0.8669, "map_at_1": 0.786, "map_at_3": 0.819, "map_at_5": 0.8247, "map_at_10": 0.82957, "map_at_20": 0.83167, "map_at_50": 0.83269, "map_at_100": 0.83289, "recall_at_1": 0.786, "recall_at_3": 0.856, "recall_at_5": 0.882, "recall_at_10": 0.92, "recall_at_20": 0.952, "recall_at_50": 0.98, "recall_at_100": 0.992, "precision_at_1": 0.786, "precision_at_3": 0.28533, "precision_at_5": 0.1764, "precision_at_10": 0.092, "precision_at_20": 0.0476, "precision_at_50": 0.0196, "precision_at_100": 0.00992, "mrr_at_1": 0.786, "mrr_at_3": 0.8189999999999998, "mrr_at_5": 0.8246999999999999, "mrr_at_10": 0.8295706349206347, "mrr_at_20": 0.8316712173447467, "mrr_at_50": 0.8326901700317237, "mrr_at_100": 0.832885280842064, "naucs_at_1_max": 0.8892284946618716, "naucs_at_1_std": -0.3267276061583954, "naucs_at_1_diff1": 0.9336110202863116, "naucs_at_3_max": 0.8940728333693538, "naucs_at_3_std": -0.2892397881996969, "naucs_at_3_diff1": 0.9035214501837059, "naucs_at_5_max": 0.8728866928256561, "naucs_at_5_std": -0.2504965363561503, "naucs_at_5_diff1": 0.8887031923654505, "naucs_at_10_max": 0.8634570494864612, "naucs_at_10_std": -0.32796451914099106, "naucs_at_10_diff1": 0.8821195144724552, "naucs_at_20_max": 0.8949579831932764, "naucs_at_20_std": -0.29034391534391896, "naucs_at_20_diff1": 0.878618113912229, "naucs_at_50_max": 0.9096638655462147, "naucs_at_50_std": 0.12301587301586674, "naucs_at_50_diff1": 0.9014939309056892, "naucs_at_100_max": 1.0, "naucs_at_100_std": 0.8558590102707644, "naucs_at_100_diff1": 0.9673202614378978}, "docvqa_test_subsampled": {"ndcg_at_1": 0.4612, "ndcg_at_3": 0.52679, "ndcg_at_5": 0.54568, "ndcg_at_10": 0.56932, "ndcg_at_20": 0.58751, "ndcg_at_50": 0.59746, "ndcg_at_100": 0.60597, "map_at_1": 0.4612, "map_at_3": 0.51109, "map_at_5": 0.5214, "map_at_10": 0.53156, "map_at_20": 0.53639, "map_at_50": 0.5381, "map_at_100": 0.53881, "recall_at_1": 0.4612, "recall_at_3": 0.57206, "recall_at_5": 0.61863, "recall_at_10": 0.68958, "recall_at_20": 0.76275, "recall_at_50": 0.81153, "recall_at_100": 0.86475, "precision_at_1": 0.4612, "precision_at_3": 0.19069, "precision_at_5": 0.12373, "precision_at_10": 0.06896, "precision_at_20": 0.03814, "precision_at_50": 0.01623, "precision_at_100": 0.00865, "mrr_at_1": 0.4611973392461197, "mrr_at_3": 0.5110864745011088, "mrr_at_5": 0.5213968957871397, "mrr_at_10": 0.531558617534227, "mrr_at_20": 0.5363705459439568, "mrr_at_50": 0.5380818653716594, "mrr_at_100": 0.5387956639409233, "naucs_at_1_max": 0.6018461520563698, "naucs_at_1_std": -0.29453860375419927, "naucs_at_1_diff1": 0.7645813967276972, "naucs_at_3_max": 0.58164206836642, "naucs_at_3_std": -0.25403366910903274, "naucs_at_3_diff1": 0.6515883726118482, "naucs_at_5_max": 0.5721975818175079, "naucs_at_5_std": -0.2744904256592273, "naucs_at_5_diff1": 0.61928231963369, "naucs_at_10_max": 0.5671552158378993, "naucs_at_10_std": -0.28750264247429225, "naucs_at_10_diff1": 0.5626707252181952, "naucs_at_20_max": 0.6156578041155646, "naucs_at_20_std": -0.2749165128258015, "naucs_at_20_diff1": 0.6002227825216901, "naucs_at_50_max": 0.6012704408386546, "naucs_at_50_std": -0.33739300418375234, "naucs_at_50_diff1": 0.6419776051914634, "naucs_at_100_max": 0.6412951544246476, "naucs_at_100_std": -0.2690460787063671, "naucs_at_100_diff1": 0.6375549090035819}, "infovqa_test_subsampled": {"ndcg_at_1": 0.8664, "ndcg_at_3": 0.89876, "ndcg_at_5": 0.91113, "ndcg_at_10": 0.91568, "ndcg_at_20": 0.91815, "ndcg_at_50": 0.92068, "ndcg_at_100": 0.92099, "map_at_1": 0.8664, "map_at_3": 0.89103, "map_at_5": 0.89781, "map_at_10": 0.89966, "map_at_20": 0.9003, "map_at_50": 0.90076, "map_at_100": 0.90078, "recall_at_1": 0.8664, "recall_at_3": 0.92105, "recall_at_5": 0.95142, "recall_at_10": 0.96559, "recall_at_20": 0.97571, "recall_at_50": 0.98785, "recall_at_100": 0.98988, "precision_at_1": 0.8664, "precision_at_3": 0.30702, "precision_at_5": 0.19028, "precision_at_10": 0.09656, "precision_at_20": 0.04879, "precision_at_50": 0.01976, "precision_at_100": 0.0099, "mrr_at_1": 0.8663967611336032, "mrr_at_3": 0.891025641025641, "mrr_at_5": 0.8978070175438595, "mrr_at_10": 0.8996626180836705, "mrr_at_20": 0.9003085288927154, "mrr_at_50": 0.9007665297125582, "mrr_at_100": 0.9007882962878053, "naucs_at_1_max": 0.6852647369506982, "naucs_at_1_std": -0.11019839462727245, "naucs_at_1_diff1": 0.9097315890589761, "naucs_at_3_max": 0.6980505621537562, "naucs_at_3_std": -0.1587891880170896, "naucs_at_3_diff1": 0.8829217951800641, "naucs_at_5_max": 0.857855262670585, "naucs_at_5_std": 0.07362769173568413, "naucs_at_5_diff1": 0.9054241580005612, "naucs_at_10_max": 0.8918421488449596, "naucs_at_10_std": 0.19317064064529682, "naucs_at_10_diff1": 0.9222031546896321, "naucs_at_20_max": 0.8948019000326467, "naucs_at_20_std": 0.19941878566952734, "naucs_at_20_diff1": 0.9238158184622186, "naucs_at_50_max": 0.9564661819783937, "naucs_at_50_std": 0.6394965227510232, "naucs_at_50_diff1": 0.9129323639568211, "naucs_at_100_max": 0.9477594183740937, "naucs_at_100_std": 0.5935161181141998, "naucs_at_100_diff1": 0.9216391275611305}, "shiftproject_test": {"ndcg_at_1": 0.88, "ndcg_at_3": 0.94286, "ndcg_at_5": 0.94286, "ndcg_at_10": 0.94601, "ndcg_at_20": 0.94601, "ndcg_at_50": 0.94601, "ndcg_at_100": 0.94601, "map_at_1": 0.88, "map_at_3": 0.92667, "map_at_5": 0.92667, "map_at_10": 0.92792, "map_at_20": 0.92792, "map_at_50": 0.92792, "map_at_100": 0.92792, "recall_at_1": 0.88, "recall_at_3": 0.99, "recall_at_5": 0.99, "recall_at_10": 1.0, "recall_at_20": 1.0, "recall_at_50": 1.0, "recall_at_100": 1.0, "precision_at_1": 0.88, "precision_at_3": 0.33, "precision_at_5": 0.198, "precision_at_10": 0.1, "precision_at_20": 0.05, "precision_at_50": 0.02, "precision_at_100": 0.01, "mrr_at_1": 0.89, "mrr_at_3": 0.9316666666666668, "mrr_at_5": 0.9316666666666668, "mrr_at_10": 0.9329166666666667, "mrr_at_20": 0.9329166666666667, "mrr_at_50": 0.9329166666666667, "mrr_at_100": 0.9329166666666667, "naucs_at_1_max": 0.477529430480433, "naucs_at_1_std": -0.17256601972637695, "naucs_at_1_diff1": 0.8993795736557426, "naucs_at_3_max": 1.0, "naucs_at_3_std": 0.35807656395889226, "naucs_at_3_diff1": 1.0, "naucs_at_5_max": 1.0, "naucs_at_5_std": 0.35807656395891135, "naucs_at_5_diff1": 1.0, "naucs_at_10_max": 1.0, "naucs_at_10_std": 1.0, "naucs_at_10_diff1": 1.0, "naucs_at_20_max": 1.0, "naucs_at_20_std": 1.0, "naucs_at_20_diff1": 1.0, "naucs_at_50_max": null, "naucs_at_50_std": null, "naucs_at_50_diff1": null, "naucs_at_100_max": null, "naucs_at_100_std": null, "naucs_at_100_diff1": null}, "syntheticDocQA_artificial_intelligence_test": {"ndcg_at_1": 0.98, "ndcg_at_3": 0.98631, "ndcg_at_5": 0.99018, "ndcg_at_10": 0.99018, "ndcg_at_20": 0.99018, "ndcg_at_50": 0.99018, "ndcg_at_100": 0.99018, "map_at_1": 0.98, "map_at_3": 0.985, "map_at_5": 0.987, "map_at_10": 0.987, "map_at_20": 0.987, "map_at_50": 0.987, "map_at_100": 0.987, "recall_at_1": 0.98, "recall_at_3": 0.99, "recall_at_5": 1.0, "recall_at_10": 1.0, "recall_at_20": 1.0, "recall_at_50": 1.0, "recall_at_100": 1.0, "precision_at_1": 0.98, "precision_at_3": 0.33, "precision_at_5": 0.2, "precision_at_10": 0.1, "precision_at_20": 0.05, "precision_at_50": 0.02, "precision_at_100": 0.01, "mrr_at_1": 0.98, "mrr_at_3": 0.985, "mrr_at_5": 0.987, "mrr_at_10": 0.987, "mrr_at_20": 0.987, "mrr_at_50": 0.987, "mrr_at_100": 0.987, "naucs_at_1_max": 1.0, "naucs_at_1_std": 0.8692810457516332, "naucs_at_1_diff1": 1.0, "naucs_at_3_max": 1.0, "naucs_at_3_std": 0.8692810457516356, "naucs_at_3_diff1": 1.0, "naucs_at_5_max": 1.0, "naucs_at_5_std": 1.0, "naucs_at_5_diff1": 1.0, "naucs_at_10_max": 1.0, "naucs_at_10_std": 1.0, "naucs_at_10_diff1": 1.0, "naucs_at_20_max": 1.0, "naucs_at_20_std": 1.0, "naucs_at_20_diff1": 1.0, "naucs_at_50_max": null, "naucs_at_50_std": null, "naucs_at_50_diff1": null, "naucs_at_100_max": null, "naucs_at_100_std": null, "naucs_at_100_diff1": null}, "syntheticDocQA_energy_test": {"ndcg_at_1": 0.9, "ndcg_at_3": 0.92762, "ndcg_at_5": 0.93149, "ndcg_at_10": 0.93149, "ndcg_at_20": 0.93698, "ndcg_at_50": 0.9409, "ndcg_at_100": 0.9409, "map_at_1": 0.9, "map_at_3": 0.92, "map_at_5": 0.922, "map_at_10": 0.922, "map_at_20": 0.92374, "map_at_50": 0.92435, "map_at_100": 0.92435, "recall_at_1": 0.9, "recall_at_3": 0.95, "recall_at_5": 0.96, "recall_at_10": 0.96, "recall_at_20": 0.98, "recall_at_50": 1.0, "recall_at_100": 1.0, "precision_at_1": 0.9, "precision_at_3": 0.31667, "precision_at_5": 0.192, "precision_at_10": 0.096, "precision_at_20": 0.049, "precision_at_50": 0.02, "precision_at_100": 0.01, "mrr_at_1": 0.9, "mrr_at_3": 0.92, "mrr_at_5": 0.9220000000000002, "mrr_at_10": 0.9220000000000002, "mrr_at_20": 0.9237424242424244, "mrr_at_50": 0.924346027846028, "mrr_at_100": 0.924346027846028, "naucs_at_1_max": 0.7248832866479916, "naucs_at_1_std": -0.5339402427637734, "naucs_at_1_diff1": 0.9477124183006546, "naucs_at_3_max": 0.5314659197012136, "naucs_at_3_std": -0.9360410830999026, "naucs_at_3_diff1": 0.9477124183006521, "naucs_at_5_max": 0.7071661998132599, "naucs_at_5_std": -0.7350606909430335, "naucs_at_5_diff1": 0.9346405228758139, "naucs_at_10_max": 0.7071661998132599, "naucs_at_10_std": -0.7350606909430335, "naucs_at_10_diff1": 0.9346405228758139, "naucs_at_20_max": 1.0, "naucs_at_20_std": -0.024276377217554025, "naucs_at_20_diff1": 0.9346405228758136, "naucs_at_50_max": null, "naucs_at_50_std": null, "naucs_at_50_diff1": null, "naucs_at_100_max": null, "naucs_at_100_std": null, "naucs_at_100_diff1": null}, "syntheticDocQA_government_reports_test": {"ndcg_at_1": 0.96, "ndcg_at_3": 0.97893, "ndcg_at_5": 0.97893, "ndcg_at_10": 0.98194, "ndcg_at_20": 0.98194, "ndcg_at_50": 0.98194, "ndcg_at_100": 0.98194, "map_at_1": 0.96, "map_at_3": 0.975, "map_at_5": 0.975, "map_at_10": 0.97611, "map_at_20": 0.97611, "map_at_50": 0.97611, "map_at_100": 0.97611, "recall_at_1": 0.96, "recall_at_3": 0.99, "recall_at_5": 0.99, "recall_at_10": 1.0, "recall_at_20": 1.0, "recall_at_50": 1.0, "recall_at_100": 1.0, "precision_at_1": 0.96, "precision_at_3": 0.33, "precision_at_5": 0.198, "precision_at_10": 0.1, "precision_at_20": 0.05, "precision_at_50": 0.02, "precision_at_100": 0.01, "mrr_at_1": 0.96, "mrr_at_3": 0.975, "mrr_at_5": 0.975, "mrr_at_10": 0.9761111111111112, "mrr_at_20": 0.9761111111111112, "mrr_at_50": 0.9761111111111112, "mrr_at_100": 0.9761111111111112, "naucs_at_1_max": 0.5997899159663848, "naucs_at_1_std": -1.2007469654528418, "naucs_at_1_diff1": 0.96732026143791, "naucs_at_3_max": 0.7222222222222157, "naucs_at_3_std": -1.7399626517274398, "naucs_at_3_diff1": 1.0, "naucs_at_5_max": 0.7222222222222276, "naucs_at_5_std": -1.7399626517273863, "naucs_at_5_diff1": 1.0, "naucs_at_10_max": 1.0, "naucs_at_10_std": 1.0, "naucs_at_10_diff1": 1.0, "naucs_at_20_max": 1.0, "naucs_at_20_std": 1.0, "naucs_at_20_diff1": 1.0, "naucs_at_50_max": null, "naucs_at_50_std": null, "naucs_at_50_diff1": null, "naucs_at_100_max": null, "naucs_at_100_std": null, "naucs_at_100_diff1": null}, "syntheticDocQA_healthcare_industry_test": {"ndcg_at_1": 0.97, "ndcg_at_3": 0.98893, "ndcg_at_5": 0.98893, "ndcg_at_10": 0.98893, "ndcg_at_20": 0.98893, "ndcg_at_50": 0.98893, "ndcg_at_100": 0.98893, "map_at_1": 0.97, "map_at_3": 0.985, "map_at_5": 0.985, "map_at_10": 0.985, "map_at_20": 0.985, "map_at_50": 0.985, "map_at_100": 0.985, "recall_at_1": 0.97, "recall_at_3": 1.0, "recall_at_5": 1.0, "recall_at_10": 1.0, "recall_at_20": 1.0, "recall_at_50": 1.0, "recall_at_100": 1.0, "precision_at_1": 0.97, "precision_at_3": 0.33333, "precision_at_5": 0.2, "precision_at_10": 0.1, "precision_at_20": 0.05, "precision_at_50": 0.02, "precision_at_100": 0.01, "mrr_at_1": 0.97, "mrr_at_3": 0.985, "mrr_at_5": 0.985, "mrr_at_10": 0.985, "mrr_at_20": 0.985, "mrr_at_50": 0.985, "mrr_at_100": 0.985, "naucs_at_1_max": 0.8078120136943662, "naucs_at_1_std": 0.4733893557422995, "naucs_at_1_diff1": 1.0, "naucs_at_3_max": 1.0, "naucs_at_3_std": 1.0, "naucs_at_3_diff1": 1.0, "naucs_at_5_max": 1.0, "naucs_at_5_std": 1.0, "naucs_at_5_diff1": 1.0, "naucs_at_10_max": 1.0, "naucs_at_10_std": 1.0, "naucs_at_10_diff1": 1.0, "naucs_at_20_max": 1.0, "naucs_at_20_std": 1.0, "naucs_at_20_diff1": 1.0, "naucs_at_50_max": null, "naucs_at_50_std": null, "naucs_at_50_diff1": null, "naucs_at_100_max": null, "naucs_at_100_std": null, "naucs_at_100_diff1": null}, "tabfquad_test_subsampled": {"ndcg_at_1": 0.91429, "ndcg_at_3": 0.9372, "ndcg_at_5": 0.94612, "ndcg_at_10": 0.94612, "ndcg_at_20": 0.94992, "ndcg_at_50": 0.9522, "ndcg_at_100": 0.9522, "map_at_1": 0.91429, "map_at_3": 0.93155, "map_at_5": 0.93655, "map_at_10": 0.93655, "map_at_20": 0.93769, "map_at_50": 0.93813, "map_at_100": 0.93813, "recall_at_1": 0.91429, "recall_at_3": 0.95357, "recall_at_5": 0.975, "recall_at_10": 0.975, "recall_at_20": 0.98929, "recall_at_50": 1.0, "recall_at_100": 1.0, "precision_at_1": 0.91429, "precision_at_3": 0.31786, "precision_at_5": 0.195, "precision_at_10": 0.0975, "precision_at_20": 0.04946, "precision_at_50": 0.02, "precision_at_100": 0.01, "mrr_at_1": 0.9142857142857143, "mrr_at_3": 0.9315476190476192, "mrr_at_5": 0.9365476190476191, "mrr_at_10": 0.9365476190476191, "mrr_at_20": 0.9376930014430014, "mrr_at_50": 0.9381267131585722, "mrr_at_100": 0.9381267131585722, "naucs_at_1_max": 0.8191332088390891, "naucs_at_1_std": 0.4374610955493308, "naucs_at_1_diff1": 0.8954442888266413, "naucs_at_3_max": 0.9484665661136237, "naucs_at_3_std": 0.7109818286288868, "naucs_at_3_diff1": 0.9484665661136237, "naucs_at_5_max": 0.9416433239962654, "naucs_at_5_std": 0.8163265306122475, "naucs_at_5_diff1": 0.9439775910364095, "naucs_at_10_max": 0.9416433239962654, "naucs_at_10_std": 0.8163265306122475, "naucs_at_10_diff1": 0.9439775910364095, "naucs_at_20_max": 0.9564270152505505, "naucs_at_20_std": 0.8638344226579515, "naucs_at_20_diff1": 0.9564270152505505, "naucs_at_50_max": 1.0, "naucs_at_50_std": 1.0, "naucs_at_50_diff1": 1.0, "naucs_at_100_max": 1.0, "naucs_at_100_std": 1.0, "naucs_at_100_diff1": 1.0}, "tatdqa_test": {"ndcg_at_1": 0.57594, "ndcg_at_3": 0.68196, "ndcg_at_5": 0.71051, "ndcg_at_10": 0.73262, "ndcg_at_20": 0.74285, "ndcg_at_50": 0.75016, "ndcg_at_100": 0.75232, "map_at_1": 0.57594, "map_at_3": 0.65583, "map_at_5": 0.67169, "map_at_10": 0.68088, "map_at_20": 0.68373, "map_at_50": 0.68489, "map_at_100": 0.68507, "recall_at_1": 0.57594, "recall_at_3": 0.75759, "recall_at_5": 0.82685, "recall_at_10": 0.8949, "recall_at_20": 0.93499, "recall_at_50": 0.97205, "recall_at_100": 0.98542, "precision_at_1": 0.57594, "precision_at_3": 0.25253, "precision_at_5": 0.16537, "precision_at_10": 0.08949, "precision_at_20": 0.04675, "precision_at_50": 0.01944, "precision_at_100": 0.00985, "mrr_at_1": 0.5765492102065614, "mrr_at_3": 0.6560348319157563, "mrr_at_5": 0.6721952207371417, "mrr_at_10": 0.6813224459488133, "mrr_at_20": 0.6841812145327757, "mrr_at_50": 0.6853427671085895, "mrr_at_100": 0.6855309554803338, "naucs_at_1_max": 0.5301694754533977, "naucs_at_1_std": -0.1619263455379304, "naucs_at_1_diff1": 0.7278065996239447, "naucs_at_3_max": 0.5908076044993518, "naucs_at_3_std": -0.1323722551834884, "naucs_at_3_diff1": 0.6135897839866084, "naucs_at_5_max": 0.5964907222680631, "naucs_at_5_std": -0.12904588858296043, "naucs_at_5_diff1": 0.5731447174171511, "naucs_at_10_max": 0.6224287679728321, "naucs_at_10_std": 0.0010190169826118439, "naucs_at_10_diff1": 0.5292659611089736, "naucs_at_20_max": 0.7484085475471819, "naucs_at_20_std": 0.2475268741958173, "naucs_at_20_diff1": 0.5572740928407118, "naucs_at_50_max": 0.7916713620973378, "naucs_at_50_std": 0.35271506013966625, "naucs_at_50_diff1": 0.6134648860897702, "naucs_at_100_max": 0.83478407909221, "naucs_at_100_std": 0.6562392206248636, "naucs_at_100_diff1": 0.594171346126163}}
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
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "151643": {
5
+ "content": "<|endoftext|>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "151644": {
13
+ "content": "<|im_start|>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "151645": {
21
+ "content": "<|im_end|>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "151646": {
29
+ "content": "<|object_ref_start|>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "151647": {
37
+ "content": "<|object_ref_end|>",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "151648": {
45
+ "content": "<|box_start|>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "151649": {
53
+ "content": "<|box_end|>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ },
60
+ "151650": {
61
+ "content": "<|quad_start|>",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": true
67
+ },
68
+ "151651": {
69
+ "content": "<|quad_end|>",
70
+ "lstrip": false,
71
+ "normalized": false,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": true
75
+ },
76
+ "151652": {
77
+ "content": "<|vision_start|>",
78
+ "lstrip": false,
79
+ "normalized": false,
80
+ "rstrip": false,
81
+ "single_word": false,
82
+ "special": true
83
+ },
84
+ "151653": {
85
+ "content": "<|vision_end|>",
86
+ "lstrip": false,
87
+ "normalized": false,
88
+ "rstrip": false,
89
+ "single_word": false,
90
+ "special": true
91
+ },
92
+ "151654": {
93
+ "content": "<|vision_pad|>",
94
+ "lstrip": false,
95
+ "normalized": false,
96
+ "rstrip": false,
97
+ "single_word": false,
98
+ "special": true
99
+ },
100
+ "151655": {
101
+ "content": "<|image_pad|>",
102
+ "lstrip": false,
103
+ "normalized": false,
104
+ "rstrip": false,
105
+ "single_word": false,
106
+ "special": true
107
+ },
108
+ "151656": {
109
+ "content": "<|video_pad|>",
110
+ "lstrip": false,
111
+ "normalized": false,
112
+ "rstrip": false,
113
+ "single_word": false,
114
+ "special": true
115
+ }
116
+ },
117
+ "additional_special_tokens": [
118
+ "<|im_start|>",
119
+ "<|im_end|>",
120
+ "<|object_ref_start|>",
121
+ "<|object_ref_end|>",
122
+ "<|box_start|>",
123
+ "<|box_end|>",
124
+ "<|quad_start|>",
125
+ "<|quad_end|>",
126
+ "<|vision_start|>",
127
+ "<|vision_end|>",
128
+ "<|vision_pad|>",
129
+ "<|image_pad|>",
130
+ "<|video_pad|>"
131
+ ],
132
+ "bos_token": null,
133
+ "chat_template": "{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n{% endif %}<|im_start|>{{ message['role'] }}\n{% if message['content'] is string %}{{ message['content'] }}<|im_end|>\n{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_start|><|image_pad|><|vision_end|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_start|><|video_pad|><|vision_end|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>\n{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant\n{% endif %}",
134
+ "clean_up_tokenization_spaces": false,
135
+ "eos_token": "<|im_end|>",
136
+ "errors": "replace",
137
+ "model_max_length": 32768,
138
+ "pad_token": "<|endoftext|>",
139
+ "padding_side": "left",
140
+ "split_special_tokens": false,
141
+ "tokenizer_class": "Qwen2Tokenizer",
142
+ "unk_token": null
143
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff