zhiyuanyou commited on
Commit
d4dad89
·
1 Parent(s): f5f800d

add script files

Browse files
.gitattributes CHANGED
File without changes
README.md CHANGED
File without changes
__init__.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # Import all *.py files here, they will be copied to .cache
2
+ from .configuration_mplug_owl2 import MPLUGOwl2Config
3
+ from .modeling_attn_mask_utils import *
4
+ from .modeling_llama2 import *
5
+ from .modeling_mplug_owl2_huggingface import MPLUGOwl2LlamaForCausalLM
6
+ from .visual_encoder import *
config.json ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "zhiyuanyou/DeQA-Score-Mix3",
3
+ "model_type": "mplug_owl2",
4
+ "architectures": [
5
+ "MPLUGOwl2LlamaForCausalLM"
6
+ ],
7
+ "auto_map": {
8
+ "AutoConfig": "__init__.MPLUGOwl2Config",
9
+ "AutoModel": "__init__.MPLUGOwl2LlamaForCausalLM",
10
+ "AutoModelForCausalLM": "__init__.MPLUGOwl2LlamaForCausalLM"
11
+ },
12
+ "attention_bias": false,
13
+ "attention_dropout": 0.0,
14
+ "binary_rating_loss": "fidelity",
15
+ "bos_token_id": 1,
16
+ "closeset_rating_loss": true,
17
+ "continuous_rating_loss": true,
18
+ "eos_token_id": 2,
19
+ "freeze_vision_model": false,
20
+ "hidden_act": "silu",
21
+ "hidden_size": 4096,
22
+ "image_aspect_ratio": "pad",
23
+ "image_grid_pinpoints": null,
24
+ "initializer_range": 0.02,
25
+ "intermediate_size": 11008,
26
+ "learned_scale": true,
27
+ "level_ids": [
28
+ 15129,
29
+ 1781,
30
+ 6534,
31
+ 6460,
32
+ 4319
33
+ ],
34
+ "level_prefix": [
35
+ 450,
36
+ 11029,
37
+ 310,
38
+ 278,
39
+ 1967,
40
+ 338
41
+ ],
42
+ "max_position_embeddings": 2048,
43
+ "num_attention_heads": 32,
44
+ "num_hidden_layers": 32,
45
+ "num_key_value_heads": 32,
46
+ "pretraining_tp": 1,
47
+ "rms_norm_eps": 1e-06,
48
+ "rope_scaling": null,
49
+ "rope_theta": 10000.0,
50
+ "softkl_loss": true,
51
+ "tie_word_embeddings": false,
52
+ "torch_dtype": "bfloat16",
53
+ "transformers_version": "4.36.1",
54
+ "tune_visual_abstractor": true,
55
+ "use_cache": true,
56
+ "visual_abstractor_lr": null,
57
+ "visual_config": {
58
+ "visual_abstractor": {
59
+ "_name_or_path": "",
60
+ "add_cross_attention": false,
61
+ "architectures": null,
62
+ "attention_probs_dropout_prob": 0.0,
63
+ "bad_words_ids": null,
64
+ "begin_suppress_tokens": null,
65
+ "bos_token_id": null,
66
+ "chunk_size_feed_forward": 0,
67
+ "cross_attention_hidden_size": null,
68
+ "decoder_start_token_id": null,
69
+ "diversity_penalty": 0.0,
70
+ "do_sample": false,
71
+ "early_stopping": false,
72
+ "encoder_hidden_size": 1024,
73
+ "encoder_no_repeat_ngram_size": 0,
74
+ "eos_token_id": null,
75
+ "exponential_decay_length_penalty": null,
76
+ "finetuning_task": null,
77
+ "forced_bos_token_id": null,
78
+ "forced_eos_token_id": null,
79
+ "grid_size": 32,
80
+ "hidden_size": 1024,
81
+ "id2label": {
82
+ "0": "LABEL_0",
83
+ "1": "LABEL_1"
84
+ },
85
+ "initializer_range": 0.02,
86
+ "intermediate_size": 2816,
87
+ "is_decoder": false,
88
+ "is_encoder_decoder": false,
89
+ "label2id": {
90
+ "LABEL_0": 0,
91
+ "LABEL_1": 1
92
+ },
93
+ "layer_norm_eps": 1e-06,
94
+ "length_penalty": 1.0,
95
+ "max_length": 20,
96
+ "min_length": 0,
97
+ "model_type": "mplug_owl_visual_abstract",
98
+ "no_repeat_ngram_size": 0,
99
+ "num_attention_heads": 16,
100
+ "num_beam_groups": 1,
101
+ "num_beams": 1,
102
+ "num_hidden_layers": 6,
103
+ "num_learnable_queries": 64,
104
+ "num_return_sequences": 1,
105
+ "output_attentions": false,
106
+ "output_hidden_states": false,
107
+ "output_scores": false,
108
+ "pad_token_id": null,
109
+ "prefix": null,
110
+ "problem_type": null,
111
+ "pruned_heads": {},
112
+ "remove_invalid_values": false,
113
+ "repetition_penalty": 1.0,
114
+ "return_dict": true,
115
+ "return_dict_in_generate": false,
116
+ "sep_token_id": null,
117
+ "suppress_tokens": null,
118
+ "task_specific_params": null,
119
+ "temperature": 1.0,
120
+ "tf_legacy_loss": false,
121
+ "tie_encoder_decoder": false,
122
+ "tie_word_embeddings": true,
123
+ "tokenizer_class": null,
124
+ "top_k": 50,
125
+ "top_p": 1.0,
126
+ "torch_dtype": null,
127
+ "torchscript": false,
128
+ "transformers_version": "4.28.1",
129
+ "typical_p": 1.0,
130
+ "use_bfloat16": false
131
+ },
132
+ "visual_model": {
133
+ "_name_or_path": "",
134
+ "add_cross_attention": false,
135
+ "architectures": null,
136
+ "attention_dropout": 0.0,
137
+ "bad_words_ids": null,
138
+ "begin_suppress_tokens": null,
139
+ "bos_token_id": null,
140
+ "chunk_size_feed_forward": 0,
141
+ "cross_attention_hidden_size": null,
142
+ "decoder_start_token_id": null,
143
+ "diversity_penalty": 0.0,
144
+ "do_sample": false,
145
+ "early_stopping": false,
146
+ "encoder_no_repeat_ngram_size": 0,
147
+ "eos_token_id": null,
148
+ "exponential_decay_length_penalty": null,
149
+ "finetuning_task": null,
150
+ "forced_bos_token_id": null,
151
+ "forced_eos_token_id": null,
152
+ "hidden_act": "quick_gelu",
153
+ "hidden_size": 1024,
154
+ "id2label": {
155
+ "0": "LABEL_0",
156
+ "1": "LABEL_1"
157
+ },
158
+ "image_size": 448,
159
+ "initializer_factor": 1.0,
160
+ "initializer_range": 0.02,
161
+ "intermediate_size": 4096,
162
+ "is_decoder": false,
163
+ "is_encoder_decoder": false,
164
+ "label2id": {
165
+ "LABEL_0": 0,
166
+ "LABEL_1": 1
167
+ },
168
+ "layer_norm_eps": 1e-06,
169
+ "length_penalty": 1.0,
170
+ "max_length": 20,
171
+ "min_length": 0,
172
+ "model_type": "mplug_owl_vision_model",
173
+ "no_repeat_ngram_size": 0,
174
+ "num_attention_heads": 16,
175
+ "num_beam_groups": 1,
176
+ "num_beams": 1,
177
+ "num_channels": 3,
178
+ "num_hidden_layers": 24,
179
+ "num_return_sequences": 1,
180
+ "output_attentions": false,
181
+ "output_hidden_states": false,
182
+ "output_scores": false,
183
+ "pad_token_id": null,
184
+ "patch_size": 14,
185
+ "prefix": null,
186
+ "problem_type": null,
187
+ "projection_dim": 768,
188
+ "pruned_heads": {},
189
+ "remove_invalid_values": false,
190
+ "repetition_penalty": 1.0,
191
+ "return_dict": true,
192
+ "return_dict_in_generate": false,
193
+ "sep_token_id": null,
194
+ "suppress_tokens": null,
195
+ "task_specific_params": null,
196
+ "temperature": 1.0,
197
+ "tf_legacy_loss": false,
198
+ "tie_encoder_decoder": false,
199
+ "tie_word_embeddings": true,
200
+ "tokenizer_class": null,
201
+ "top_k": 50,
202
+ "top_p": 1.0,
203
+ "torch_dtype": null,
204
+ "torchscript": false,
205
+ "transformers_version": "4.28.1",
206
+ "typical_p": 1.0,
207
+ "use_bfloat16": false,
208
+ "use_flash_attn": false
209
+ }
210
+ },
211
+ "vocab_size": 32000,
212
+ "weight_desp": 1.0,
213
+ "weight_in_level": null,
214
+ "weight_next_token": 0.05,
215
+ "weight_rank": 1.0,
216
+ "weight_softkl": 1.0
217
+ }
configuration_mplug_owl2.py ADDED
@@ -0,0 +1,334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) Alibaba.
2
+ #
3
+ # This source code is licensed under the license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+ import copy
6
+ import os
7
+ from typing import Union
8
+
9
+ from transformers.configuration_utils import PretrainedConfig
10
+ from transformers.models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES
11
+ from transformers.utils import logging
12
+ from transformers.models.auto import CONFIG_MAPPING
13
+
14
+
15
+ class LlamaConfig(PretrainedConfig):
16
+ r"""
17
+ This is the configuration class to store the configuration of a [`LlamaModel`]. It is used to instantiate an LLaMA
18
+ model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
19
+ defaults will yield a similar configuration to that of the LLaMA-7B.
20
+
21
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
22
+ documentation from [`PretrainedConfig`] for more information.
23
+
24
+
25
+ Args:
26
+ vocab_size (`int`, *optional*, defaults to 32000):
27
+ Vocabulary size of the LLaMA model. Defines the number of different tokens that can be represented by the
28
+ `inputs_ids` passed when calling [`LlamaModel`]
29
+ hidden_size (`int`, *optional*, defaults to 4096):
30
+ Dimension of the hidden representations.
31
+ intermediate_size (`int`, *optional*, defaults to 11008):
32
+ Dimension of the MLP representations.
33
+ num_hidden_layers (`int`, *optional*, defaults to 32):
34
+ Number of hidden layers in the Transformer decoder.
35
+ num_attention_heads (`int`, *optional*, defaults to 32):
36
+ Number of attention heads for each attention layer in the Transformer decoder.
37
+ num_key_value_heads (`int`, *optional*):
38
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
39
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
40
+ `num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
41
+ converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
42
+ by meanpooling all the original heads within that group. For more details checkout [this
43
+ paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
44
+ `num_attention_heads`.
45
+ hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
46
+ The non-linear activation function (function or string) in the decoder.
47
+ max_position_embeddings (`int`, *optional*, defaults to 2048):
48
+ The maximum sequence length that this model might ever be used with. Llama 1 supports up to 2048 tokens,
49
+ Llama 2 up to 4096, CodeLlama up to 16384.
50
+ initializer_range (`float`, *optional*, defaults to 0.02):
51
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
52
+ rms_norm_eps (`float`, *optional*, defaults to 1e-06):
53
+ The epsilon used by the rms normalization layers.
54
+ use_cache (`bool`, *optional*, defaults to `True`):
55
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
56
+ relevant if `config.is_decoder=True`.
57
+ pad_token_id (`int`, *optional*):
58
+ Padding token id.
59
+ bos_token_id (`int`, *optional*, defaults to 1):
60
+ Beginning of stream token id.
61
+ eos_token_id (`int`, *optional*, defaults to 2):
62
+ End of stream token id.
63
+ pretraining_tp (`int`, *optional*, defaults to 1):
64
+ Experimental feature. Tensor parallelism rank used during pretraining. Please refer to [this
65
+ document](https://huggingface.co/docs/transformers/parallelism) to understand more about it. This value is
66
+ necessary to ensure exact reproducibility of the pretraining results. Please refer to [this
67
+ issue](https://github.com/pytorch/pytorch/issues/76232).
68
+ tie_word_embeddings (`bool`, *optional*, defaults to `False`):
69
+ Whether to tie weight embeddings
70
+ rope_theta (`float`, *optional*, defaults to 10000.0):
71
+ The base period of the RoPE embeddings.
72
+ rope_scaling (`Dict`, *optional*):
73
+ Dictionary containing the scaling configuration for the RoPE embeddings. Currently supports two scaling
74
+ strategies: linear and dynamic. Their scaling factor must be a float greater than 1. The expected format is
75
+ `{"type": strategy name, "factor": scaling factor}`. When using this flag, don't update
76
+ `max_position_embeddings` to the expected new maximum. See the following thread for more information on how
77
+ these scaling strategies behave:
78
+ https://www.reddit.com/r/LocalLLaMA/comments/14mrgpr/dynamically_scaled_rope_further_increases/. This is an
79
+ experimental feature, subject to breaking API changes in future versions.
80
+ attention_bias (`bool`, defaults to `False`, *optional*, defaults to `False`):
81
+ Whether to use a bias in the query, key, value and output projection layers during self-attention.
82
+
83
+
84
+ ```python
85
+ >>> from transformers import LlamaModel, LlamaConfig
86
+
87
+ >>> # Initializing a LLaMA llama-7b style configuration
88
+ >>> configuration = LlamaConfig()
89
+
90
+ >>> # Initializing a model from the llama-7b style configuration
91
+ >>> model = LlamaModel(configuration)
92
+
93
+ >>> # Accessing the model configuration
94
+ >>> configuration = model.config
95
+ ```"""
96
+ model_type = "llama"
97
+ keys_to_ignore_at_inference = ["past_key_values"]
98
+
99
+ def __init__(
100
+ self,
101
+ vocab_size=32000,
102
+ hidden_size=4096,
103
+ intermediate_size=11008,
104
+ num_hidden_layers=32,
105
+ num_attention_heads=32,
106
+ num_key_value_heads=None,
107
+ hidden_act="silu",
108
+ max_position_embeddings=2048,
109
+ initializer_range=0.02,
110
+ rms_norm_eps=1e-6,
111
+ use_cache=True,
112
+ pad_token_id=None,
113
+ bos_token_id=1,
114
+ eos_token_id=2,
115
+ pretraining_tp=1,
116
+ tie_word_embeddings=False,
117
+ rope_theta=10000.0,
118
+ rope_scaling=None,
119
+ attention_bias=False,
120
+ attention_dropout=0.0,
121
+ **kwargs,
122
+ ):
123
+ self.vocab_size = vocab_size
124
+ self.max_position_embeddings = max_position_embeddings
125
+ self.hidden_size = hidden_size
126
+ self.intermediate_size = intermediate_size
127
+ self.num_hidden_layers = num_hidden_layers
128
+ self.num_attention_heads = num_attention_heads
129
+
130
+ # for backward compatibility
131
+ if num_key_value_heads is None:
132
+ num_key_value_heads = num_attention_heads
133
+
134
+ self.num_key_value_heads = num_key_value_heads
135
+ self.hidden_act = hidden_act
136
+ self.initializer_range = initializer_range
137
+ self.rms_norm_eps = rms_norm_eps
138
+ self.pretraining_tp = pretraining_tp
139
+ self.use_cache = use_cache
140
+ self.rope_theta = rope_theta
141
+ self.rope_scaling = rope_scaling
142
+ self._rope_scaling_validation()
143
+ self.attention_bias = attention_bias
144
+ self.attention_dropout = attention_dropout
145
+
146
+ super().__init__(
147
+ pad_token_id=pad_token_id,
148
+ bos_token_id=bos_token_id,
149
+ eos_token_id=eos_token_id,
150
+ tie_word_embeddings=tie_word_embeddings,
151
+ **kwargs,
152
+ )
153
+
154
+ def _rope_scaling_validation(self):
155
+ """
156
+ Validate the `rope_scaling` configuration.
157
+ """
158
+ if self.rope_scaling is None:
159
+ return
160
+
161
+ if not isinstance(self.rope_scaling, dict) or len(self.rope_scaling) != 2:
162
+ raise ValueError(
163
+ "`rope_scaling` must be a dictionary with with two fields, `type` and `factor`, "
164
+ f"got {self.rope_scaling}"
165
+ )
166
+ rope_scaling_type = self.rope_scaling.get("type", None)
167
+ rope_scaling_factor = self.rope_scaling.get("factor", None)
168
+ if rope_scaling_type is None or rope_scaling_type not in ["linear", "dynamic"]:
169
+ raise ValueError(
170
+ f"`rope_scaling`'s type field must be one of ['linear', 'dynamic'], got {rope_scaling_type}"
171
+ )
172
+ if rope_scaling_factor is None or not isinstance(rope_scaling_factor, float) or rope_scaling_factor <= 1.0:
173
+ raise ValueError(f"`rope_scaling`'s factor field must be a float > 1, got {rope_scaling_factor}")
174
+
175
+
176
+ class MplugOwlVisionConfig(PretrainedConfig):
177
+ r"""
178
+ This is the configuration class to store the configuration of a [`MplugOwlVisionModel`]. It is used to instantiate
179
+ a
180
+ mPLUG-Owl vision encoder according to the specified arguments, defining the model architecture. Instantiating a
181
+ configuration defaults will yield a similar configuration to that of the mPLUG-Owl
182
+ [x-plug/x_plug-llama-7b](https://huggingface.co/x-plug/x_plug-llama-7b) architecture.
183
+
184
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
185
+ documentation from [`PretrainedConfig`] for more information.
186
+
187
+ Args:
188
+ hidden_size (`int`, *optional*, defaults to 768):
189
+ Dimensionality of the encoder layers and the pooler layer.
190
+ intermediate_size (`int`, *optional*, defaults to 3072):
191
+ Dimensionality of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder.
192
+ num_hidden_layers (`int`, *optional*, defaults to 12):
193
+ Number of hidden layers in the Transformer encoder.
194
+ num_attention_heads (`int`, *optional*, defaults to 12):
195
+ Number of attention heads for each attention layer in the Transformer encoder.
196
+ image_size (`int`, *optional*, defaults to 224):
197
+ The size (resolution) of each image.
198
+ patch_size (`int`, *optional*, defaults to 32):
199
+ The size (resolution) of each patch.
200
+ hidden_act (`str` or `function`, *optional*, defaults to `"quick_gelu"`):
201
+ The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
202
+ `"relu"`, `"selu"` and `"gelu_new"` ``"quick_gelu"` are supported.
203
+ layer_norm_eps (`float`, *optional*, defaults to 1e-5):
204
+ The epsilon used by the layer normalization layers.
205
+ attention_dropout (`float`, *optional*, defaults to 0.0):
206
+ The dropout ratio for the attention probabilities.
207
+ initializer_range (`float`, *optional*, defaults to 0.02):
208
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
209
+ initializer_factor (`float`, *optional*, defaults to 1):
210
+ A factor for initializing all weight matrices (should be kept to 1, used internally for initialization
211
+ testing).
212
+
213
+
214
+ ```"""
215
+
216
+ model_type = "mplug_owl_vision_model"
217
+
218
+ def __init__(
219
+ self,
220
+ hidden_size=1024,
221
+ intermediate_size=4096,
222
+ projection_dim=768,
223
+ num_hidden_layers=24,
224
+ num_attention_heads=16,
225
+ num_channels=3,
226
+ image_size=448,
227
+ patch_size=14,
228
+ hidden_act="quick_gelu",
229
+ layer_norm_eps=1e-6,
230
+ attention_dropout=0.0,
231
+ initializer_range=0.02,
232
+ initializer_factor=1.0,
233
+ use_flash_attn=False,
234
+ **kwargs,
235
+ ):
236
+ super().__init__(**kwargs)
237
+ self.hidden_size = hidden_size
238
+ self.intermediate_size = intermediate_size
239
+ self.projection_dim = projection_dim
240
+ self.num_hidden_layers = num_hidden_layers
241
+ self.num_attention_heads = num_attention_heads
242
+ self.num_channels = num_channels
243
+ self.patch_size = patch_size
244
+ self.image_size = image_size
245
+ self.initializer_range = initializer_range
246
+ self.initializer_factor = initializer_factor
247
+ self.attention_dropout = attention_dropout
248
+ self.layer_norm_eps = layer_norm_eps
249
+ self.hidden_act = hidden_act
250
+ self.use_flash_attn = use_flash_attn
251
+
252
+ @classmethod
253
+ def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.PathLike], **kwargs) -> "PretrainedConfig":
254
+ config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
255
+
256
+ # get the vision config dict if we are loading from MplugOwlConfig
257
+ if config_dict.get("model_type") == "mplug-owl":
258
+ config_dict = config_dict["vision_config"]
259
+
260
+ if "model_type" in config_dict and hasattr(cls, "model_type") and config_dict["model_type"] != cls.model_type:
261
+ logger.warning(
262
+ f"You are using a model of type {config_dict['model_type']} to instantiate a model of type "
263
+ f"{cls.model_type}. This is not supported for all configurations of models and can yield errors."
264
+ )
265
+
266
+ return cls.from_dict(config_dict, **kwargs)
267
+
268
+
269
+ class MplugOwlVisualAbstractorConfig(PretrainedConfig):
270
+ model_type = "mplug_owl_visual_abstract"
271
+
272
+ def __init__(
273
+ self,
274
+ num_learnable_queries=64,
275
+ hidden_size=1024,
276
+ num_hidden_layers=6,
277
+ num_attention_heads=16,
278
+ intermediate_size=2816,
279
+ attention_probs_dropout_prob=0.,
280
+ initializer_range=0.02,
281
+ layer_norm_eps=1e-6,
282
+ encoder_hidden_size=1024,
283
+ grid_size=None,
284
+ **kwargs,
285
+ ):
286
+ super().__init__(**kwargs)
287
+ self.hidden_size = hidden_size
288
+ self.num_learnable_queries = num_learnable_queries
289
+ self.num_hidden_layers = num_hidden_layers
290
+ self.num_attention_heads = num_attention_heads
291
+ self.intermediate_size = intermediate_size
292
+ self.attention_probs_dropout_prob = attention_probs_dropout_prob
293
+ self.initializer_range = initializer_range
294
+ self.layer_norm_eps = layer_norm_eps
295
+ self.encoder_hidden_size = encoder_hidden_size
296
+ self.grid_size = grid_size if grid_size else 32
297
+
298
+ @classmethod
299
+ def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.PathLike], **kwargs) -> "PretrainedConfig":
300
+ config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
301
+
302
+ # get the visual_abstractor config dict if we are loading from MplugOwlConfig
303
+ if config_dict.get("model_type") == "mplug-owl":
304
+ config_dict = config_dict["abstractor_config"]
305
+
306
+ if "model_type" in config_dict and hasattr(cls, "model_type") and config_dict["model_type"] != cls.model_type:
307
+ logger.warning(
308
+ f"You are using a model of type {config_dict['model_type']} to instantiate a model of type "
309
+ f"{cls.model_type}. This is not supported for all configurations of models and can yield errors."
310
+ )
311
+
312
+ return cls.from_dict(config_dict, **kwargs)
313
+
314
+
315
+
316
+ DEFAULT_VISUAL_CONFIG = {
317
+ "visual_model": MplugOwlVisionConfig().to_dict(),
318
+ "visual_abstractor": MplugOwlVisualAbstractorConfig().to_dict()
319
+ }
320
+
321
+ class MPLUGOwl2Config(LlamaConfig):
322
+ model_type = "mplug_owl2"
323
+ def __init__(self, visual_config=None, **kwargs):
324
+ if visual_config is None:
325
+ self.visual_config = DEFAULT_VISUAL_CONFIG
326
+ else:
327
+ self.visual_config = visual_config
328
+
329
+ super().__init__(
330
+ **kwargs,
331
+ )
332
+
333
+ if __name__ == "__main__":
334
+ print(MplugOwlVisionConfig().to_dict())
generation_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 1,
3
+ "eos_token_id": 2,
4
+ "max_length": 4096,
5
+ "pad_token_id": 0,
6
+ "temperature": 0.9,
7
+ "top_p": 0.6,
8
+ "transformers_version": "4.31.0"
9
+ }
modeling_attn_mask_utils.py ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2023 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ from typing import List, Optional, Tuple, Union
15
+
16
+ import torch
17
+
18
+
19
+ class AttentionMaskConverter:
20
+ """
21
+ A utility attention mask class that allows one to:
22
+ - Create a causal 4d mask
23
+ - Create a causal 4d mask with slided window
24
+ - Convert a 2d attention mask (batch_size, query_length) to a 4d attention mask (batch_size, 1, query_length,
25
+ key_value_length) that can be multiplied with attention scores
26
+
27
+ Parameters:
28
+ is_causal (`bool`):
29
+ Whether the attention mask should be a uni-directional (causal) or bi-directional mask.
30
+
31
+ sliding_window (`int`, *optional*):
32
+ Optionally, the sliding window masks can be created if `sliding_window` is defined to a positive integer.
33
+ """
34
+
35
+ def __init__(self, is_causal: bool, sliding_window: Optional[int] = None):
36
+ self.is_causal = is_causal
37
+ self.sliding_window = sliding_window
38
+
39
+ if self.sliding_window is not None and self.sliding_window <= 0:
40
+ raise ValueError(
41
+ f"Make sure that when passing `sliding_window` that its value is a strictly positive integer, not `{self.sliding_window}`"
42
+ )
43
+
44
+ def to_causal_4d(
45
+ self,
46
+ batch_size: int,
47
+ query_length: int,
48
+ key_value_length: int,
49
+ dtype: torch.dtype = torch.float32,
50
+ device: Union[torch.device, "str"] = "cpu",
51
+ ) -> torch.Tensor:
52
+ """
53
+ Creates a causal 4D mask of (bsz, head_dim=1, query_length, key_value_length) shape and adds large negative
54
+ bias to upper right hand triangular matrix (causal mask).
55
+ """
56
+ if not self.is_causal:
57
+ raise ValueError(f"Please use `to_causal_4d` only if {self.__class__} has `is_causal` set to True.")
58
+
59
+ # If shape is not cached, create a new causal mask and cache it
60
+ input_shape = (batch_size, query_length)
61
+ past_key_values_length = key_value_length - query_length
62
+
63
+ # create causal mask
64
+ # [bsz, seq_len] -> [bsz, 1, tgt_seq_len, src_seq_len]
65
+ causal_4d_mask = None
66
+ if input_shape[-1] > 1 or self.sliding_window is not None:
67
+ causal_4d_mask = self._make_causal_mask(
68
+ input_shape,
69
+ dtype,
70
+ device=device,
71
+ past_key_values_length=past_key_values_length,
72
+ sliding_window=self.sliding_window,
73
+ )
74
+
75
+ return causal_4d_mask
76
+
77
+ def to_4d(
78
+ self,
79
+ attention_mask_2d: torch.Tensor,
80
+ query_length: int,
81
+ key_value_length: Optional[int] = None,
82
+ dtype: torch.dtype = torch.float32,
83
+ ) -> torch.Tensor:
84
+ """
85
+ Converts 2D attention mask to 4D attention mask by expanding mask to (bsz, head_dim=1, query_length,
86
+ key_value_length) shape and by adding a large negative bias to not-attended positions. If attention_mask is
87
+ causal, a causal mask will be added.
88
+ """
89
+ input_shape = (attention_mask_2d.shape[0], query_length)
90
+
91
+ # create causal mask
92
+ # [bsz, seq_len] -> [bsz, 1, tgt_seq_len, src_seq_len]
93
+ causal_4d_mask = None
94
+ if (input_shape[-1] > 1 or self.sliding_window is not None) and self.is_causal:
95
+ if key_value_length is None:
96
+ raise ValueError(
97
+ "This attention mask converter is causal. Make sure to pass `key_value_length` to correctly create a causal mask."
98
+ )
99
+
100
+ past_key_values_length = key_value_length - query_length
101
+ causal_4d_mask = self._make_causal_mask(
102
+ input_shape,
103
+ dtype,
104
+ device=attention_mask_2d.device,
105
+ past_key_values_length=past_key_values_length,
106
+ sliding_window=self.sliding_window,
107
+ )
108
+ elif self.sliding_window is not None:
109
+ raise NotImplementedError("Sliding window is currently only implemented for causal masking")
110
+
111
+ # [bsz, seq_len] -> [bsz, 1, tgt_seq_len, src_seq_len]
112
+ expanded_attn_mask = self._expand_mask(attention_mask_2d, dtype, tgt_len=input_shape[-1]).to(
113
+ attention_mask_2d.device
114
+ )
115
+ expanded_4d_mask = expanded_attn_mask if causal_4d_mask is None else expanded_attn_mask + causal_4d_mask
116
+
117
+ return expanded_4d_mask
118
+
119
+ @staticmethod
120
+ def _make_causal_mask(
121
+ input_ids_shape: torch.Size,
122
+ dtype: torch.dtype,
123
+ device: torch.device,
124
+ past_key_values_length: int = 0,
125
+ sliding_window: Optional[int] = None,
126
+ ):
127
+ """
128
+ Make causal mask used for bi-directional self-attention.
129
+ """
130
+ bsz, tgt_len = input_ids_shape
131
+ mask = torch.full((tgt_len, tgt_len), torch.finfo(dtype).min, device=device)
132
+ mask_cond = torch.arange(mask.size(-1), device=device)
133
+ mask.masked_fill_(mask_cond < (mask_cond + 1).view(mask.size(-1), 1), 0)
134
+
135
+ mask = mask.to(dtype)
136
+
137
+ if past_key_values_length > 0:
138
+ mask = torch.cat([torch.zeros(tgt_len, past_key_values_length, dtype=dtype, device=device), mask], dim=-1)
139
+
140
+ # add lower triangular sliding window mask if necessary
141
+ if sliding_window is not None:
142
+ diagonal = past_key_values_length - sliding_window + 1
143
+
144
+ context_mask = 1 - torch.triu(torch.ones_like(mask, dtype=torch.int), diagonal=diagonal)
145
+ mask.masked_fill_(context_mask.bool(), torch.finfo(dtype).min)
146
+
147
+ return mask[None, None, :, :].expand(bsz, 1, tgt_len, tgt_len + past_key_values_length)
148
+
149
+ @staticmethod
150
+ def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Optional[int] = None):
151
+ """
152
+ Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`.
153
+ """
154
+ bsz, src_len = mask.size()
155
+ tgt_len = tgt_len if tgt_len is not None else src_len
156
+
157
+ expanded_mask = mask[:, None, None, :].expand(bsz, 1, tgt_len, src_len).to(dtype)
158
+
159
+ inverted_mask = 1.0 - expanded_mask
160
+
161
+ return inverted_mask.masked_fill(inverted_mask.to(torch.bool), torch.finfo(dtype).min)
162
+
163
+
164
+ def _prepare_4d_causal_attention_mask(
165
+ attention_mask: Optional[torch.Tensor],
166
+ input_shape: Union[torch.Size, Tuple, List],
167
+ inputs_embeds: torch.Tensor,
168
+ past_key_values_length: int,
169
+ sliding_window: Optional[int] = None,
170
+ ):
171
+ """
172
+ Creates a causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)` from a 2D mask of shape
173
+ `(batch_size, key_value_length)`
174
+
175
+ Args:
176
+ attention_mask (`torch.Tensor` or `None`):
177
+ A 2D attention mask of shape `(batch_size, key_value_length)`
178
+ input_shape (`tuple(int)` or `list(int)` or `torch.Size`):
179
+ The input shape should be a tuple that defines `(batch_size, query_length)`.
180
+ inputs_embeds (`torch.Tensor`):
181
+ The embedded inputs as a torch Tensor.
182
+ past_key_values_length (`int`):
183
+ The length of the key value cache.
184
+ sliding_window (`int`, *optional*):
185
+ If the model uses windowed attention, a sliding window should be passed.
186
+ """
187
+ attn_mask_converter = AttentionMaskConverter(is_causal=True, sliding_window=sliding_window)
188
+
189
+ key_value_length = input_shape[-1] + past_key_values_length
190
+
191
+ # 4d mask is passed through the layers
192
+ if attention_mask is not None:
193
+ attention_mask = attn_mask_converter.to_4d(
194
+ attention_mask, input_shape[-1], key_value_length, dtype=inputs_embeds.dtype
195
+ )
196
+ else:
197
+ attention_mask = attn_mask_converter.to_causal_4d(
198
+ input_shape[0], input_shape[-1], key_value_length, dtype=inputs_embeds.dtype, device=inputs_embeds.device
199
+ )
200
+
201
+ return attention_mask
202
+
203
+
204
+ def _prepare_4d_attention_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Optional[int] = None):
205
+ """
206
+ Creates a non-causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)` from a 2D mask of shape
207
+ `(batch_size, key_value_length)`
208
+
209
+ Args:
210
+ mask (`torch.Tensor` or `None`):
211
+ A 2D attention mask of shape `(batch_size, key_value_length)`
212
+ dtype (`torch.dtype`):
213
+ The torch dtype the created mask shall have.
214
+ tgt_len (`int`):
215
+ The target length or query length the created mask shall have.
216
+ """
217
+ return AttentionMaskConverter._expand_mask(mask=mask, dtype=dtype, tgt_len=tgt_len)
218
+
219
+
220
+ def _create_4d_causal_attention_mask(
221
+ input_shape: Union[torch.Size, Tuple, List],
222
+ dtype: torch.dtype,
223
+ device: torch.device,
224
+ past_key_values_length: int = 0,
225
+ sliding_window: Optional[int] = None,
226
+ ):
227
+ """
228
+ Creates a causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)`
229
+
230
+ Args:
231
+ input_shape (`tuple(int)` or `list(int)` or `torch.Size`):
232
+ The input shape should be a tuple that defines `(batch_size, query_length)`.
233
+ dtype (`torch.dtype`):
234
+ The torch dtype the created mask shall have.
235
+ device (`int`):
236
+ The torch device the created mask shall have.
237
+ sliding_window (`int`, *optional*):
238
+ If the model uses windowed attention, a sliding window should be passed.
239
+ """
240
+ attn_mask_converter = AttentionMaskConverter(is_causal=True, sliding_window=sliding_window)
241
+
242
+ key_value_length = past_key_values_length + input_shape[-1]
243
+ attention_mask = attn_mask_converter.to_causal_4d(
244
+ input_shape[0], input_shape[-1], key_value_length, dtype=dtype, device=device
245
+ )
246
+
247
+ return attention_mask
modeling_llama2.py ADDED
@@ -0,0 +1,834 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ import warnings
3
+ from functools import partial
4
+ from typing import List, Optional, Tuple, Union
5
+
6
+ import torch
7
+ import torch.nn.functional as F
8
+ import torch.utils.checkpoint
9
+ from torch import nn
10
+
11
+
12
+ import copy
13
+ import os
14
+ import sys
15
+
16
+ dir_path = os.path.dirname(os.path.realpath(__file__))
17
+ sys.path.insert(0, dir_path)
18
+
19
+ import transformers
20
+ from transformers.models.llama.modeling_llama import *
21
+
22
+ def _get_unpad_data(attention_mask):
23
+ seqlens_in_batch = attention_mask.sum(dim=-1, dtype=torch.int32)
24
+ indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()
25
+ max_seqlen_in_batch = seqlens_in_batch.max().item()
26
+ cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.torch.int32), (1, 0))
27
+ return (
28
+ indices,
29
+ cu_seqlens,
30
+ max_seqlen_in_batch,
31
+ )
32
+
33
+
34
+ from transformers.configuration_utils import PretrainedConfig
35
+ from transformers.utils import logging
36
+
37
+ from .modeling_attn_mask_utils import _prepare_4d_causal_attention_mask
38
+ from .configuration_mplug_owl2 import LlamaConfig
39
+
40
+ class MultiwayNetwork(nn.Module):
41
+
42
+ def __init__(self, module_provider, num_multiway=2):
43
+ super(MultiwayNetwork, self).__init__()
44
+
45
+ self.multiway = torch.nn.ModuleList([module_provider() for _ in range(num_multiway)])
46
+
47
+ def forward(self, hidden_states, multiway_indices):
48
+
49
+ if len(self.multiway) == 1:
50
+ return self.multiway[0](hidden_states)
51
+
52
+ output_hidden_states = torch.empty_like(hidden_states)
53
+
54
+ for idx, subway in enumerate(self.multiway):
55
+ local_indices = multiway_indices.eq(idx).nonzero(as_tuple=True)
56
+ hidden = hidden_states[local_indices].unsqueeze(1).contiguous()
57
+ if hidden.numel():
58
+ output = subway(hidden)
59
+ if isinstance(output, tuple):
60
+ output = output[0]
61
+ output = output.squeeze(1)
62
+ output_hidden_states[local_indices] = output
63
+
64
+ return output_hidden_states.contiguous()
65
+
66
+
67
+ class LlamaAttention(nn.Module):
68
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
69
+
70
+ def __init__(self, config: LlamaConfig, layer_idx: Optional[int] = None):
71
+ super().__init__()
72
+ self.config = config
73
+ self.layer_idx = layer_idx
74
+ if layer_idx is None:
75
+ logger.warning_once(
76
+ f"Instantiating {self.__class__.__name__} without passing `layer_idx` is not recommended and will "
77
+ "to errors during the forward call, if caching is used. Please make sure to provide a `layer_idx` "
78
+ "when creating this class."
79
+ )
80
+
81
+ self.attention_dropout = config.attention_dropout
82
+ self.hidden_size = config.hidden_size
83
+ self.num_heads = config.num_attention_heads
84
+ self.head_dim = self.hidden_size // self.num_heads
85
+ self.num_key_value_heads = config.num_key_value_heads
86
+ self.num_key_value_groups = self.num_heads // self.num_key_value_heads
87
+ self.max_position_embeddings = config.max_position_embeddings
88
+ self.rope_theta = config.rope_theta
89
+ self.is_causal = True
90
+
91
+ if (self.head_dim * self.num_heads) != self.hidden_size:
92
+ raise ValueError(
93
+ f"hidden_size must be divisible by num_heads (got `hidden_size`: {self.hidden_size}"
94
+ f" and `num_heads`: {self.num_heads})."
95
+ )
96
+ self.q_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=config.attention_bias)
97
+ self.k_proj = MultiwayNetwork(module_provider=partial(
98
+ nn.Linear, in_features=self.hidden_size, out_features=self.num_key_value_heads * self.head_dim, bias=config.attention_bias)
99
+ )
100
+ self.v_proj = MultiwayNetwork(module_provider=partial(
101
+ nn.Linear, in_features=self.hidden_size, out_features=self.num_key_value_heads * self.head_dim, bias=config.attention_bias)
102
+ )
103
+ self.o_proj = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=config.attention_bias)
104
+ self._init_rope()
105
+
106
+ def _init_rope(self):
107
+ if self.config.rope_scaling is None:
108
+ self.rotary_emb = LlamaRotaryEmbedding(
109
+ self.head_dim,
110
+ max_position_embeddings=self.max_position_embeddings,
111
+ base=self.rope_theta,
112
+ )
113
+ else:
114
+ scaling_type = self.config.rope_scaling["type"]
115
+ scaling_factor = self.config.rope_scaling["factor"]
116
+ if scaling_type == "linear":
117
+ self.rotary_emb = LlamaLinearScalingRotaryEmbedding(
118
+ self.head_dim,
119
+ max_position_embeddings=self.max_position_embeddings,
120
+ scaling_factor=scaling_factor,
121
+ base=self.rope_theta,
122
+ )
123
+ elif scaling_type == "dynamic":
124
+ self.rotary_emb = LlamaDynamicNTKScalingRotaryEmbedding(
125
+ self.head_dim,
126
+ max_position_embeddings=self.max_position_embeddings,
127
+ scaling_factor=scaling_factor,
128
+ base=self.rope_theta,
129
+ )
130
+ else:
131
+ raise ValueError(f"Unknown RoPE scaling type {scaling_type}")
132
+
133
+ def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
134
+ return tensor.view(bsz, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
135
+
136
+ def forward(
137
+ self,
138
+ hidden_states: torch.Tensor,
139
+ modality_indicators: torch.Tensor,
140
+ attention_mask: Optional[torch.Tensor] = None,
141
+ position_ids: Optional[torch.LongTensor] = None,
142
+ past_key_value: Optional[Tuple[torch.Tensor]] = None,
143
+ output_attentions: bool = False,
144
+ use_cache: bool = False,
145
+ padding_mask: Optional[torch.LongTensor] = None,
146
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
147
+ bsz, q_len, _ = hidden_states.size()
148
+
149
+ query_states = self.q_proj(hidden_states, )
150
+ key_states = self.k_proj(hidden_states, modality_indicators)
151
+ value_states = self.v_proj(hidden_states, modality_indicators)
152
+
153
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
154
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
155
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
156
+
157
+ kv_seq_len = key_states.shape[-2]
158
+ if past_key_value is not None:
159
+ kv_seq_len += past_key_value[0].shape[-2]
160
+ cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
161
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
162
+
163
+ if past_key_value is not None:
164
+ # reuse k, v, self_attention
165
+ key_states = torch.cat([past_key_value[0], key_states], dim=2)
166
+ value_states = torch.cat([past_key_value[1], value_states], dim=2)
167
+
168
+ past_key_value = (key_states, value_states) if use_cache else None
169
+
170
+ key_states = repeat_kv(key_states, self.num_key_value_groups)
171
+ value_states = repeat_kv(value_states, self.num_key_value_groups)
172
+
173
+ attn_weights = torch.matmul(query_states, key_states.transpose(2, 3)) / math.sqrt(self.head_dim)
174
+
175
+ if attn_weights.size() != (bsz, self.num_heads, q_len, kv_seq_len):
176
+ raise ValueError(
177
+ f"Attention weights should be of size {(bsz, self.num_heads, q_len, kv_seq_len)}, but is"
178
+ f" {attn_weights.size()}"
179
+ )
180
+
181
+ if attention_mask is not None:
182
+ if attention_mask.size() != (bsz, 1, q_len, kv_seq_len):
183
+ raise ValueError(
184
+ f"Attention mask should be of size {(bsz, 1, q_len, kv_seq_len)}, but is {attention_mask.size()}"
185
+ )
186
+ attn_weights = attn_weights + attention_mask
187
+
188
+ # upcast attention to fp32
189
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query_states.dtype)
190
+ attn_output = torch.matmul(attn_weights, value_states)
191
+
192
+ if attn_output.size() != (bsz, self.num_heads, q_len, self.head_dim):
193
+ raise ValueError(
194
+ f"`attn_output` should be of size {(bsz, self.num_heads, q_len, self.head_dim)}, but is"
195
+ f" {attn_output.size()}"
196
+ )
197
+
198
+ attn_output = attn_output.transpose(1, 2).contiguous()
199
+
200
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
201
+
202
+ attn_output = self.o_proj(attn_output)
203
+
204
+ if not output_attentions:
205
+ attn_weights = None
206
+
207
+ return attn_output, attn_weights, past_key_value
208
+
209
+
210
+ class LlamaFlashAttention2(LlamaAttention):
211
+ """
212
+ Llama flash attention module. This module inherits from `LlamaAttention` as the weights of the module stays
213
+ untouched. The only required change would be on the forward pass where it needs to correctly call the public API of
214
+ flash attention and deal with padding tokens in case the input contains any of them.
215
+ """
216
+
217
+ def __init__(self, *args, **kwargs):
218
+ super().__init__(*args, **kwargs)
219
+
220
+ # TODO: Should be removed once Flash Attention for RoCm is bumped to 2.1.
221
+ # flash_attn<2.1 generates top-left aligned causal mask, while what is needed here is bottom-right alignement, that was made default for flash_attn>=2.1. This attribute is used to handle this difference. Reference: https://github.com/Dao-AILab/flash-attention/releases/tag/v2.1.0.
222
+ # Beware that with flash_attn<2.1, using q_seqlen != k_seqlen (except for the case q_seqlen == 1) produces a wrong mask (top-left).
223
+ self._flash_attn_uses_top_left_mask = not is_flash_attn_greater_or_equal_2_10()
224
+
225
+ def forward(
226
+ self,
227
+ hidden_states: torch.Tensor,
228
+ modality_indicators: torch.Tensor,
229
+ attention_mask: Optional[torch.LongTensor] = None,
230
+ position_ids: Optional[torch.LongTensor] = None,
231
+ past_key_value: Optional[Cache] = None,
232
+ output_attentions: bool = False,
233
+ use_cache: bool = False,
234
+ **kwargs,
235
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
236
+ # LlamaFlashAttention2 attention does not support output_attentions
237
+ if "padding_mask" in kwargs:
238
+ warnings.warn(
239
+ "Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
240
+ )
241
+
242
+ # overwrite attention_mask with padding_mask
243
+ attention_mask = kwargs.pop("padding_mask")
244
+
245
+ output_attentions = False
246
+
247
+ bsz, q_len, _ = hidden_states.size()
248
+
249
+ query_states = self.q_proj(hidden_states)
250
+ key_states = self.k_proj(hidden_states, modality_indicators)
251
+ value_states = self.v_proj(hidden_states, modality_indicators)
252
+
253
+ # Flash attention requires the input to have the shape
254
+ # batch_size x seq_length x head_dim x hidden_dim
255
+ # therefore we just need to keep the original shape
256
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
257
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
258
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
259
+
260
+ kv_seq_len = key_states.shape[-2]
261
+ if past_key_value is not None:
262
+ kv_seq_len += past_key_value.get_usable_length(kv_seq_len, self.layer_idx)
263
+ cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
264
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
265
+
266
+ if past_key_value is not None:
267
+ cache_kwargs = {"sin": sin, "cos": cos} # Specific to RoPE models
268
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
269
+
270
+ # TODO: These transpose are quite inefficient but Flash Attention requires the layout [batch_size, sequence_length, num_heads, head_dim]. We would need to refactor the KV cache
271
+ # to be able to avoid many of these transpose/reshape/view.
272
+ query_states = query_states.transpose(1, 2)
273
+ key_states = key_states.transpose(1, 2)
274
+ value_states = value_states.transpose(1, 2)
275
+
276
+ dropout_rate = self.attention_dropout if self.training else 0.0
277
+
278
+ # In PEFT, usually we cast the layer norms in float32 for training stability reasons
279
+ # therefore the input hidden states gets silently casted in float32. Hence, we need
280
+ # cast them back in the correct dtype just to be sure everything works as expected.
281
+ # This might slowdown training & inference so it is recommended to not cast the LayerNorms
282
+ # in fp32. (LlamaRMSNorm handles it correctly)
283
+
284
+ input_dtype = query_states.dtype
285
+ if input_dtype == torch.float32:
286
+ if torch.is_autocast_enabled():
287
+ target_dtype = torch.get_autocast_gpu_dtype()
288
+ # Handle the case where the model is quantized
289
+ elif hasattr(self.config, "_pre_quantization_dtype"):
290
+ target_dtype = self.config._pre_quantization_dtype
291
+ else:
292
+ target_dtype = self.q_proj.weight.dtype
293
+
294
+ logger.warning_once(
295
+ f"The input hidden states seems to be silently casted in float32, this might be related to"
296
+ f" the fact you have upcasted embedding or layer norm layers in float32. We will cast back the input in"
297
+ f" {target_dtype}."
298
+ )
299
+
300
+ query_states = query_states.to(target_dtype)
301
+ key_states = key_states.to(target_dtype)
302
+ value_states = value_states.to(target_dtype)
303
+
304
+ attn_output = self._flash_attention_forward(
305
+ query_states, key_states, value_states, attention_mask, q_len, dropout=dropout_rate
306
+ )
307
+
308
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size).contiguous()
309
+ attn_output = self.o_proj(attn_output)
310
+
311
+ if not output_attentions:
312
+ attn_weights = None
313
+
314
+ return attn_output, attn_weights, past_key_value
315
+
316
+ def _flash_attention_forward(
317
+ self, query_states, key_states, value_states, attention_mask, query_length, dropout=0.0, softmax_scale=None
318
+ ):
319
+ """
320
+ Calls the forward method of Flash Attention - if the input hidden states contain at least one padding token
321
+ first unpad the input, then computes the attention scores and pad the final attention scores.
322
+
323
+ Args:
324
+ query_states (`torch.Tensor`):
325
+ Input query states to be passed to Flash Attention API
326
+ key_states (`torch.Tensor`):
327
+ Input key states to be passed to Flash Attention API
328
+ value_states (`torch.Tensor`):
329
+ Input value states to be passed to Flash Attention API
330
+ attention_mask (`torch.Tensor`):
331
+ The padding mask - corresponds to a tensor of size `(batch_size, seq_len)` where 0 stands for the
332
+ position of padding tokens and 1 for the position of non-padding tokens.
333
+ dropout (`int`, *optional*):
334
+ Attention dropout
335
+ softmax_scale (`float`, *optional*):
336
+ The scaling of QK^T before applying softmax. Default to 1 / sqrt(head_dim)
337
+ """
338
+ if not self._flash_attn_uses_top_left_mask:
339
+ causal = self.is_causal
340
+ else:
341
+ # TODO: Remove the `query_length != 1` check once Flash Attention for RoCm is bumped to 2.1. For details, please see the comment in LlamaFlashAttention2 __init__.
342
+ causal = self.is_causal and query_length != 1
343
+
344
+ # Contains at least one padding token in the sequence
345
+ if attention_mask is not None:
346
+ batch_size = query_states.shape[0]
347
+ query_states, key_states, value_states, indices_q, cu_seq_lens, max_seq_lens = self._upad_input(
348
+ query_states, key_states, value_states, attention_mask, query_length
349
+ )
350
+
351
+ cu_seqlens_q, cu_seqlens_k = cu_seq_lens
352
+ max_seqlen_in_batch_q, max_seqlen_in_batch_k = max_seq_lens
353
+
354
+ attn_output_unpad = flash_attn_varlen_func(
355
+ query_states,
356
+ key_states,
357
+ value_states,
358
+ cu_seqlens_q=cu_seqlens_q,
359
+ cu_seqlens_k=cu_seqlens_k,
360
+ max_seqlen_q=max_seqlen_in_batch_q,
361
+ max_seqlen_k=max_seqlen_in_batch_k,
362
+ dropout_p=dropout,
363
+ softmax_scale=softmax_scale,
364
+ causal=causal,
365
+ )
366
+
367
+ attn_output = pad_input(attn_output_unpad, indices_q, batch_size, query_length)
368
+ else:
369
+ attn_output = flash_attn_func(
370
+ query_states, key_states, value_states, dropout, softmax_scale=softmax_scale, causal=causal
371
+ )
372
+
373
+ return attn_output
374
+
375
+ def _upad_input(self, query_layer, key_layer, value_layer, attention_mask, query_length):
376
+ indices_k, cu_seqlens_k, max_seqlen_in_batch_k = _get_unpad_data(attention_mask)
377
+ batch_size, kv_seq_len, num_key_value_heads, head_dim = key_layer.shape
378
+
379
+ key_layer = index_first_axis(
380
+ key_layer.reshape(batch_size * kv_seq_len, num_key_value_heads, head_dim), indices_k
381
+ )
382
+ value_layer = index_first_axis(
383
+ value_layer.reshape(batch_size * kv_seq_len, num_key_value_heads, head_dim), indices_k
384
+ )
385
+ if query_length == kv_seq_len:
386
+ query_layer = index_first_axis(
387
+ query_layer.reshape(batch_size * kv_seq_len, self.num_heads, head_dim), indices_k
388
+ )
389
+ cu_seqlens_q = cu_seqlens_k
390
+ max_seqlen_in_batch_q = max_seqlen_in_batch_k
391
+ indices_q = indices_k
392
+ elif query_length == 1:
393
+ max_seqlen_in_batch_q = 1
394
+ cu_seqlens_q = torch.arange(
395
+ batch_size + 1, dtype=torch.int32, device=query_layer.device
396
+ ) # There is a memcpy here, that is very bad.
397
+ indices_q = cu_seqlens_q[:-1]
398
+ query_layer = query_layer.squeeze(1)
399
+ else:
400
+ # The -q_len: slice assumes left padding.
401
+ attention_mask = attention_mask[:, -query_length:]
402
+ query_layer, indices_q, cu_seqlens_q, max_seqlen_in_batch_q = unpad_input(query_layer, attention_mask)
403
+
404
+ return (
405
+ query_layer,
406
+ key_layer,
407
+ value_layer,
408
+ indices_q,
409
+ (cu_seqlens_q, cu_seqlens_k),
410
+ (max_seqlen_in_batch_q, max_seqlen_in_batch_k),
411
+ )
412
+
413
+
414
+ class LlamaSdpaAttention(LlamaAttention):
415
+ """
416
+ Llama attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
417
+ `LlamaAttention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to
418
+ SDPA API.
419
+ """
420
+
421
+ # Adapted from LlamaAttention.forward
422
+ def forward(
423
+ self,
424
+ hidden_states: torch.Tensor,
425
+ modality_indicators: torch.Tensor,
426
+ attention_mask: Optional[torch.Tensor] = None,
427
+ position_ids: Optional[torch.LongTensor] = None,
428
+ past_key_value: Optional[Cache] = None,
429
+ output_attentions: bool = False,
430
+ use_cache: bool = False,
431
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
432
+ if output_attentions:
433
+ # TODO: Improve this warning with e.g. `model.config.attn_implementation = "manual"` once this is implemented.
434
+ logger.warning_once(
435
+ "LlamaModel is using LlamaSdpaAttention, but `torch.nn.functional.scaled_dot_product_attention` does not support `output_attentions=True`. Falling back to the manual attention implementation, "
436
+ 'but specifying the manual implementation will be required from Transformers version v5.0.0 onwards. This warning can be removed using the argument `attn_implementation="eager"` when loading the model.'
437
+ )
438
+ return super().forward(
439
+ hidden_states=hidden_states,
440
+ modality_indicators=modality_indicators,
441
+ attention_mask=attention_mask,
442
+ position_ids=position_ids,
443
+ past_key_value=past_key_value,
444
+ output_attentions=output_attentions,
445
+ use_cache=use_cache,
446
+ )
447
+
448
+ bsz, q_len, _ = hidden_states.size()
449
+
450
+ query_states = self.q_proj(hidden_states)
451
+ key_states = self.k_proj(hidden_states, modality_indicators)
452
+ value_states = self.v_proj(hidden_states, modality_indicators)
453
+
454
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
455
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
456
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
457
+
458
+ kv_seq_len = key_states.shape[-2]
459
+ if past_key_value is not None:
460
+ kv_seq_len += past_key_value.get_usable_length(kv_seq_len, self.layer_idx)
461
+ cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
462
+
463
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
464
+
465
+ if past_key_value is not None:
466
+ cache_kwargs = {"sin": sin, "cos": cos} # Specific to RoPE models
467
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
468
+
469
+ key_states = repeat_kv(key_states, self.num_key_value_groups)
470
+ value_states = repeat_kv(value_states, self.num_key_value_groups)
471
+
472
+ if attention_mask is not None:
473
+ if attention_mask.size() != (bsz, 1, q_len, kv_seq_len):
474
+ raise ValueError(
475
+ f"Attention mask should be of size {(bsz, 1, q_len, kv_seq_len)}, but is {attention_mask.size()}"
476
+ )
477
+
478
+ # SDPA with memory-efficient backend is currently (torch==2.1.2) bugged with non-contiguous inputs with custom attn_mask,
479
+ # Reference: https://github.com/pytorch/pytorch/issues/112577.
480
+ if query_states.device.type == "cuda" and attention_mask is not None:
481
+ query_states = query_states.contiguous()
482
+ key_states = key_states.contiguous()
483
+ value_states = value_states.contiguous()
484
+
485
+ attn_output = torch.nn.functional.scaled_dot_product_attention(
486
+ query_states,
487
+ key_states,
488
+ value_states,
489
+ attn_mask=attention_mask,
490
+ dropout_p=self.attention_dropout if self.training else 0.0,
491
+ # The q_len > 1 is necessary to match with AttentionMaskConverter.to_causal_4d that does not create a causal mask in case q_len == 1.
492
+ is_causal=self.is_causal and attention_mask is None and q_len > 1,
493
+ )
494
+
495
+ attn_output = attn_output.transpose(1, 2).contiguous()
496
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
497
+
498
+ attn_output = self.o_proj(attn_output)
499
+
500
+ return attn_output, None, past_key_value
501
+
502
+
503
+
504
+ LLAMA_ATTENTION_CLASSES = {
505
+ "eager": LlamaAttention,
506
+ "flash_attention_2": LlamaFlashAttention2,
507
+ "sdpa": LlamaSdpaAttention,
508
+ }
509
+
510
+ class LlamaDecoderLayer(nn.Module):
511
+ def __init__(self, config: LlamaConfig, layer_idx):
512
+ super().__init__()
513
+ self.hidden_size = config.hidden_size
514
+ self.self_attn = LlamaAttention(config=config)
515
+ self.self_attn = LLAMA_ATTENTION_CLASSES[config._attn_implementation](config=config, layer_idx=layer_idx)
516
+ self.mlp = LlamaMLP(config)
517
+ self.input_layernorm = MultiwayNetwork(module_provider=partial(
518
+ LlamaRMSNorm, hidden_size=config.hidden_size, eps=config.rms_norm_eps
519
+ ))
520
+ self.post_attention_layernorm = MultiwayNetwork(module_provider=partial(
521
+ LlamaRMSNorm, hidden_size=config.hidden_size, eps=config.rms_norm_eps
522
+ ))
523
+
524
+ def forward(
525
+ self,
526
+ hidden_states: torch.Tensor,
527
+ modality_indicators: torch.Tensor = None,
528
+ attention_mask: Optional[torch.Tensor] = None,
529
+ position_ids: Optional[torch.LongTensor] = None,
530
+ past_key_value: Optional[Tuple[torch.Tensor]] = None,
531
+ output_attentions: Optional[bool] = False,
532
+ use_cache: Optional[bool] = False,
533
+ ) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
534
+ """
535
+ Args:
536
+ hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
537
+ attention_mask (`torch.FloatTensor`, *optional*): attention mask of size
538
+ `(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values.
539
+ output_attentions (`bool`, *optional*):
540
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under
541
+ returned tensors for more detail.
542
+ use_cache (`bool`, *optional*):
543
+ If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
544
+ (see `past_key_values`).
545
+ past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
546
+ """
547
+
548
+ residual = hidden_states
549
+
550
+ hidden_states = self.input_layernorm(hidden_states, modality_indicators)
551
+
552
+ # Self Attention
553
+ hidden_states, self_attn_weights, present_key_value = self.self_attn(
554
+ hidden_states=hidden_states,
555
+ modality_indicators=modality_indicators,
556
+ attention_mask=attention_mask,
557
+ position_ids=position_ids,
558
+ past_key_value=past_key_value,
559
+ output_attentions=output_attentions,
560
+ use_cache=use_cache,
561
+ )
562
+ hidden_states = residual + hidden_states
563
+
564
+ # Fully Connected
565
+ residual = hidden_states
566
+ hidden_states = self.post_attention_layernorm(hidden_states, modality_indicators)
567
+ hidden_states = self.mlp(hidden_states)
568
+ hidden_states = residual + hidden_states
569
+
570
+ outputs = (hidden_states,)
571
+
572
+ if output_attentions:
573
+ outputs += (self_attn_weights,)
574
+
575
+ if use_cache:
576
+ outputs += (present_key_value,)
577
+
578
+ return outputs
579
+
580
+
581
+ def model_forward(
582
+ self,
583
+ input_ids: torch.LongTensor = None,
584
+ modality_indicators: torch.Tensor = None,
585
+ attention_mask: Optional[torch.Tensor] = None,
586
+ position_ids: Optional[torch.LongTensor] = None,
587
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
588
+ inputs_embeds: Optional[torch.FloatTensor] = None,
589
+ use_cache: Optional[bool] = None,
590
+ output_attentions: Optional[bool] = None,
591
+ output_hidden_states: Optional[bool] = None,
592
+ return_dict: Optional[bool] = None,
593
+ ) -> Union[Tuple, BaseModelOutputWithPast]:
594
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
595
+ output_hidden_states = (
596
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
597
+ )
598
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
599
+
600
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
601
+
602
+ # retrieve input_ids and inputs_embeds
603
+ if input_ids is not None and inputs_embeds is not None:
604
+ raise ValueError("You cannot specify both decoder_input_ids and decoder_inputs_embeds at the same time")
605
+ elif input_ids is not None:
606
+ batch_size, seq_length = input_ids.shape
607
+ elif inputs_embeds is not None:
608
+ batch_size, seq_length, _ = inputs_embeds.shape
609
+ else:
610
+ raise ValueError("You have to specify either decoder_input_ids or decoder_inputs_embeds")
611
+
612
+ seq_length_with_past = seq_length
613
+ past_key_values_length = 0
614
+
615
+ if past_key_values is not None:
616
+ past_key_values_length = past_key_values[0][0].shape[2]
617
+ seq_length_with_past = seq_length_with_past + past_key_values_length
618
+
619
+ if position_ids is None:
620
+ device = input_ids.device if input_ids is not None else inputs_embeds.device
621
+ position_ids = torch.arange(
622
+ past_key_values_length, seq_length + past_key_values_length, dtype=torch.long, device=device
623
+ )
624
+ position_ids = position_ids.unsqueeze(0).view(-1, seq_length)
625
+ else:
626
+ position_ids = position_ids.view(-1, seq_length).long()
627
+
628
+ if inputs_embeds is None:
629
+ inputs_embeds = self.embed_tokens(input_ids)
630
+ # embed positions
631
+ if attention_mask is None:
632
+ attention_mask = torch.ones(
633
+ (batch_size, seq_length_with_past), dtype=torch.bool, device=inputs_embeds.device
634
+ )
635
+
636
+ if self._use_flash_attention_2:
637
+ # 2d mask is passed through the layers
638
+ attention_mask = attention_mask if (attention_mask is not None and 0 in attention_mask) else None
639
+ elif self._use_sdpa and not output_attentions:
640
+ # output_attentions=True can not be supported when using SDPA, and we fall back on
641
+ # the manual implementation that requires a 4D causal mask in all cases.
642
+ attention_mask = _prepare_4d_causal_attention_mask_for_sdpa(
643
+ attention_mask,
644
+ (batch_size, seq_length),
645
+ inputs_embeds,
646
+ past_key_values_length,
647
+ )
648
+ else:
649
+ # 4d mask is passed through the layers
650
+ attention_mask = _prepare_4d_causal_attention_mask(
651
+ attention_mask, (batch_size, seq_length), inputs_embeds, past_key_values_length
652
+ )
653
+
654
+ hidden_states = inputs_embeds
655
+
656
+ if self.gradient_checkpointing and self.training:
657
+ if use_cache:
658
+ logger.warning_once(
659
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
660
+ )
661
+ use_cache = False
662
+
663
+ # decoder layers
664
+ all_hidden_states = () if output_hidden_states else None
665
+ all_self_attns = () if output_attentions else None
666
+ next_decoder_cache = () if use_cache else None
667
+
668
+ for idx, decoder_layer in enumerate(self.layers):
669
+ if output_hidden_states:
670
+ all_hidden_states += (hidden_states,)
671
+
672
+ past_key_value = past_key_values[idx] if past_key_values is not None else None
673
+
674
+ if self.gradient_checkpointing and self.training:
675
+
676
+ def create_custom_forward(module):
677
+ def custom_forward(*inputs):
678
+ # None for past_key_value
679
+ return module(*inputs, past_key_value, output_attentions)
680
+
681
+ return custom_forward
682
+
683
+ layer_outputs = torch.utils.checkpoint.checkpoint(
684
+ create_custom_forward(decoder_layer),
685
+ hidden_states,
686
+ modality_indicators,
687
+ attention_mask,
688
+ position_ids,
689
+ )
690
+ else:
691
+ layer_outputs = decoder_layer(
692
+ hidden_states,
693
+ modality_indicators=modality_indicators,
694
+ attention_mask=attention_mask,
695
+ position_ids=position_ids,
696
+ past_key_value=past_key_value,
697
+ output_attentions=output_attentions,
698
+ use_cache=use_cache,
699
+ )
700
+
701
+ hidden_states = layer_outputs[0]
702
+
703
+ if use_cache:
704
+ next_decoder_cache += (layer_outputs[2 if output_attentions else 1],)
705
+
706
+ if output_attentions:
707
+ all_self_attns += (layer_outputs[1],)
708
+
709
+ hidden_states = self.norm(hidden_states)
710
+
711
+ # add hidden states from the last decoder layer
712
+ if output_hidden_states:
713
+ all_hidden_states += (hidden_states,)
714
+
715
+ next_cache = next_decoder_cache if use_cache else None
716
+ if not return_dict:
717
+ return tuple(v for v in [hidden_states, next_cache, all_hidden_states, all_self_attns] if v is not None)
718
+ return BaseModelOutputWithPast(
719
+ last_hidden_state=hidden_states,
720
+ past_key_values=next_cache,
721
+ hidden_states=all_hidden_states,
722
+ attentions=all_self_attns,
723
+ )
724
+
725
+
726
+ def causal_model_forward(
727
+ self,
728
+ input_ids: torch.LongTensor = None,
729
+ modality_indicators: torch.Tensor = None,
730
+ attention_mask: Optional[torch.Tensor] = None,
731
+ position_ids: Optional[torch.LongTensor] = None,
732
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
733
+ inputs_embeds: Optional[torch.FloatTensor] = None,
734
+ labels: Optional[torch.LongTensor] = None,
735
+ use_cache: Optional[bool] = None,
736
+ output_attentions: Optional[bool] = None,
737
+ output_hidden_states: Optional[bool] = None,
738
+ return_dict: Optional[bool] = None,
739
+ ) -> Union[Tuple, CausalLMOutputWithPast]:
740
+ r"""
741
+ Args:
742
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
743
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
744
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
745
+ (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
746
+
747
+ Returns:
748
+
749
+ Example:
750
+
751
+ ```python
752
+ >>> from transformers import AutoTokenizer, LlamaForCausalLM
753
+
754
+ >>> model = LlamaForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS)
755
+ >>> tokenizer = AutoTokenizer.from_pretrained(PATH_TO_CONVERTED_TOKENIZER)
756
+
757
+ >>> prompt = "Hey, are you conscious? Can you talk to me?"
758
+ >>> inputs = tokenizer(prompt, return_tensors="pt")
759
+
760
+ >>> # Generate
761
+ >>> generate_ids = model.generate(inputs.input_ids, max_length=30)
762
+ >>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
763
+ "Hey, are you conscious? Can you talk to me?\nI'm not conscious, but I can talk to you."
764
+ ```"""
765
+
766
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
767
+ output_hidden_states = (
768
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
769
+ )
770
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
771
+
772
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
773
+ outputs = self.model(
774
+ input_ids=input_ids,
775
+ modality_indicators=modality_indicators,
776
+ attention_mask=attention_mask,
777
+ position_ids=position_ids,
778
+ past_key_values=past_key_values,
779
+ inputs_embeds=inputs_embeds,
780
+ use_cache=use_cache,
781
+ output_attentions=output_attentions,
782
+ output_hidden_states=output_hidden_states,
783
+ return_dict=return_dict,
784
+ )
785
+
786
+ hidden_states = outputs[0]
787
+ if self.config.pretraining_tp > 1:
788
+ lm_head_slices = self.lm_head.weight.split(self.vocab_size // self.config.pretraining_tp, dim=0)
789
+ logits = [F.linear(hidden_states, lm_head_slices[i]) for i in range(self.config.pretraining_tp)]
790
+ logits = torch.cat(logits, dim=-1)
791
+ else:
792
+ logits = self.lm_head(hidden_states)
793
+ logits = logits.float()
794
+
795
+ loss = None
796
+ if labels is not None:
797
+ # Shift so that tokens < n predict n
798
+ shift_logits = logits[..., :-1, :].contiguous()
799
+ shift_labels = labels[..., 1:].contiguous()
800
+ # Flatten the tokens
801
+ loss_fct = CrossEntropyLoss()
802
+ shift_logits = shift_logits.view(-1, self.config.vocab_size)
803
+ shift_labels = shift_labels.view(-1)
804
+ # Enable model parallelism
805
+ shift_labels = shift_labels.to(shift_logits.device)
806
+ loss = loss_fct(shift_logits, shift_labels)
807
+
808
+ if not return_dict:
809
+ output = (logits,) + outputs[1:]
810
+ return (loss,) + output if loss is not None else output
811
+
812
+ return CausalLMOutputWithPast(
813
+ loss=loss,
814
+ logits=logits,
815
+ past_key_values=outputs.past_key_values,
816
+ hidden_states=outputs.hidden_states,
817
+ attentions=outputs.attentions,
818
+ )
819
+
820
+ def replace_llama_modality_adaptive():
821
+ transformers.models.llama.configuration_llama.LlamaConfig = LlamaConfig
822
+ transformers.models.llama.modeling_llama.LlamaAttention = LlamaAttention
823
+ transformers.models.llama.modeling_llama.LlamaFlashAttention2 = LlamaFlashAttention2
824
+ transformers.models.llama.modeling_llama.LlamaSdpaAttention = LlamaSdpaAttention
825
+ transformers.models.llama.modeling_llama.LlamaDecoderLayer = LlamaDecoderLayer
826
+ transformers.models.llama.modeling_llama.LlamaModel.forward = model_forward
827
+ transformers.models.llama.modeling_llama.LlamaForCausalLM.forward = causal_model_forward
828
+
829
+
830
+ if __name__ == "__main__":
831
+ replace_llama_modality_adaptive()
832
+ config = transformers.LlamaConfig.from_pretrained('/cpfs01/shared/public/test/vicuna-7b-v1.5/')
833
+ model = transformers.LlamaForCausalLM(config)
834
+ print(model)
modeling_mplug_owl2_huggingface.py ADDED
@@ -0,0 +1,400 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2023 Haotian Liu & Qinghao Ye (Modified from LLaVA)
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from abc import ABC, abstractmethod
16
+ from typing import List, Optional, Tuple, Union
17
+
18
+ import torch
19
+ import torch.nn as nn
20
+ from torch.nn import CrossEntropyLoss
21
+
22
+ import copy
23
+ import os
24
+ import sys
25
+
26
+ dir_path = os.path.dirname(os.path.realpath(__file__))
27
+ sys.path.insert(0, dir_path)
28
+
29
+ from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, CLIPImageProcessor, LlamaConfig, LlamaModel, LlamaForCausalLM
30
+ from transformers.modeling_outputs import CausalLMOutputWithPast
31
+
32
+ from .configuration_mplug_owl2 import MPLUGOwl2Config, MplugOwlVisionConfig, MplugOwlVisualAbstractorConfig
33
+ from .visual_encoder import MplugOwlVisionModel, MplugOwlVisualAbstractorModel
34
+ from .modeling_llama2 import replace_llama_modality_adaptive
35
+ IGNORE_INDEX = -100
36
+ IMAGE_TOKEN_INDEX = -200
37
+ DEFAULT_IMAGE_TOKEN = "<|image|>"
38
+ from icecream import ic
39
+
40
+ def tokenizer_image_token(prompt, tokenizer, image_token_index=IMAGE_TOKEN_INDEX, return_tensors=None):
41
+ prompt_chunks = [tokenizer(chunk).input_ids if len(chunk) > 0 else [] for chunk in prompt.split(DEFAULT_IMAGE_TOKEN)]
42
+
43
+ def insert_separator(X, sep):
44
+ return [ele for sublist in zip(X, [sep]*len(X)) for ele in sublist][:-1]
45
+
46
+ input_ids = []
47
+ offset = 0
48
+ if len(prompt_chunks) > 0 and len(prompt_chunks[0]) > 0 and prompt_chunks[0][0] == tokenizer.bos_token_id:
49
+ offset = 1
50
+ input_ids.append(prompt_chunks[0][0])
51
+
52
+ for x in insert_separator(prompt_chunks, [image_token_index] * (offset + 1)):
53
+ input_ids.extend(x[offset:])
54
+
55
+ if return_tensors is not None:
56
+ if return_tensors == 'pt':
57
+ return torch.tensor(input_ids, dtype=torch.long)
58
+ raise ValueError(f'Unsupported tensor type: {return_tensors}')
59
+ return input_ids
60
+
61
+ def expand2square(pil_img, background_color):
62
+ from PIL import Image
63
+ width, height = pil_img.size
64
+ if width == height:
65
+ return pil_img
66
+ elif width > height:
67
+ result = Image.new(pil_img.mode, (width, width), background_color)
68
+ result.paste(pil_img, (0, (width - height) // 2))
69
+ return result
70
+ else:
71
+ result = Image.new(pil_img.mode, (height, height), background_color)
72
+ result.paste(pil_img, ((height - width) // 2, 0))
73
+ return result
74
+
75
+ class MPLUGOwl2MetaModel:
76
+ def __init__(self, config):
77
+ super(MPLUGOwl2MetaModel, self).__init__(config)
78
+ self.vision_model = MplugOwlVisionModel(
79
+ MplugOwlVisionConfig(**config.visual_config["visual_model"])
80
+ )
81
+ self.visual_abstractor = MplugOwlVisualAbstractorModel(
82
+ MplugOwlVisualAbstractorConfig(**config.visual_config["visual_abstractor"]), config.hidden_size
83
+ )
84
+
85
+ def get_vision_tower(self):
86
+ vision_model = getattr(self, 'vision_model', None)
87
+ if type(vision_model) is list:
88
+ vision_model = vision_model[0]
89
+ return vision_model
90
+
91
+ def get_visual_abstractor(self):
92
+ visual_abstractor = getattr(self, 'visual_abstractor', None)
93
+ if type(visual_abstractor) is list:
94
+ visual_abstractor = visual_abstractor[0]
95
+ return visual_abstractor
96
+
97
+
98
+ class MPLUGOwl2MetaForCausalLM(ABC):
99
+ @abstractmethod
100
+ def get_model(self):
101
+ pass
102
+
103
+ def encode_images(self, images):
104
+ image_features = self.get_model().vision_model(images).last_hidden_state
105
+ image_features = self.get_model().visual_abstractor(encoder_hidden_states=image_features).last_hidden_state
106
+ return image_features
107
+
108
+ def prepare_inputs_labels_for_multimodal(
109
+ self, input_ids, attention_mask, past_key_values, labels, images
110
+ ):
111
+ if images is None or input_ids.shape[1] == 1:
112
+ if past_key_values is not None and images is not None and input_ids.shape[1] == 1:
113
+ attention_mask = torch.ones((attention_mask.shape[0], past_key_values[-1][-1].shape[-2] + 1), dtype=attention_mask.dtype, device=attention_mask.device)
114
+ multiway_indices = torch.zeros_like(input_ids).long().to(self.device)
115
+ return input_ids, multiway_indices, attention_mask, past_key_values, None, labels
116
+
117
+ if type(images) is list or images.ndim == 5:
118
+ concat_images = torch.cat([image for image in images], dim=0)
119
+ image_features = self.encode_images(concat_images)
120
+ split_sizes = [image.shape[0] for image in images]
121
+ image_features = torch.split(image_features, split_sizes, dim=0)
122
+ image_features = [x.flatten(0, 1) for x in image_features]
123
+ else:
124
+ image_features = self.encode_images(images)
125
+
126
+ new_input_embeds = []
127
+ new_modality_indicators = []
128
+ new_labels = [] if labels is not None else None
129
+ cur_image_idx = 0
130
+ for batch_idx, cur_input_ids in enumerate(input_ids):
131
+ if (cur_input_ids == IMAGE_TOKEN_INDEX).sum() == 0:
132
+ # multimodal LLM, but the current sample is not multimodal
133
+ # FIXME: this is a hacky fix, for deepspeed zero3 to work
134
+ half_len = cur_input_ids.shape[0] // 2
135
+ cur_image_features = image_features[cur_image_idx]
136
+ cur_input_embeds_1 = self.get_model().embed_tokens(cur_input_ids[:half_len])
137
+ cur_input_embeds_2 = self.get_model().embed_tokens(cur_input_ids[half_len:])
138
+ cur_input_embeds = torch.cat([cur_input_embeds_1, cur_image_features[0:0], cur_input_embeds_2], dim=0)
139
+ new_input_embeds.append(cur_input_embeds)
140
+
141
+ cur_modality_indicators = torch.zeros(len(cur_input_embeds)).long().to(self.device)
142
+ new_modality_indicators.append(cur_modality_indicators)
143
+ if labels is not None:
144
+ new_labels.append(labels[batch_idx])
145
+ cur_image_idx += 1
146
+ continue
147
+ image_token_indices = torch.where(cur_input_ids == IMAGE_TOKEN_INDEX)[0]
148
+ cur_new_input_embeds = []
149
+ cur_modality_indicators = []
150
+ if labels is not None:
151
+ cur_labels = labels[batch_idx]
152
+ cur_new_labels = []
153
+ assert cur_labels.shape == cur_input_ids.shape
154
+ while image_token_indices.numel() > 0:
155
+ cur_image_features = image_features[cur_image_idx]
156
+ image_token_start = image_token_indices[0]
157
+ cur_new_input_embeds.append(self.get_model().embed_tokens(cur_input_ids[:image_token_start]))
158
+ cur_new_input_embeds.append(cur_image_features)
159
+
160
+ # Add modality indicator
161
+ assert image_token_start == len(cur_input_ids[:image_token_start])
162
+ cur_modality_indicators.append(torch.zeros(len(cur_input_ids[:image_token_start])).long())
163
+ cur_modality_indicators.append(torch.ones(len(cur_image_features)).long())
164
+
165
+ if labels is not None:
166
+ cur_new_labels.append(cur_labels[:image_token_start])
167
+ cur_new_labels.append(torch.full((cur_image_features.shape[0],), IGNORE_INDEX, device=labels.device, dtype=labels.dtype))
168
+ cur_labels = cur_labels[image_token_start+1:]
169
+ cur_image_idx += 1
170
+ cur_input_ids = cur_input_ids[image_token_start+1:]
171
+ image_token_indices = torch.where(cur_input_ids == IMAGE_TOKEN_INDEX)[0]
172
+ if cur_input_ids.numel() > 0:
173
+ cur_new_input_embeds.append(self.get_model().embed_tokens(cur_input_ids))
174
+ cur_modality_indicators.append(torch.zeros(len(cur_input_ids)).long())
175
+ if labels is not None:
176
+ cur_new_labels.append(cur_labels)
177
+ cur_new_input_embeds = [x.to(device=self.device) for x in cur_new_input_embeds]
178
+ cur_new_input_embeds = torch.cat(cur_new_input_embeds, dim=0)
179
+ new_input_embeds.append(cur_new_input_embeds)
180
+
181
+ # Modality
182
+ cur_modality_indicators = [x.to(device=self.device) for x in cur_modality_indicators]
183
+ cur_modality_indicators = torch.cat(cur_modality_indicators, dim=0)
184
+ new_modality_indicators.append(cur_modality_indicators)
185
+
186
+
187
+ if labels is not None:
188
+ cur_new_labels = torch.cat(cur_new_labels, dim=0)
189
+ new_labels.append(cur_new_labels)
190
+
191
+ if any(x.shape != new_input_embeds[0].shape for x in new_input_embeds):
192
+ max_len = max(x.shape[0] for x in new_input_embeds)
193
+
194
+ # Embedding
195
+ new_input_embeds_align = []
196
+ for cur_new_embed in new_input_embeds:
197
+ cur_new_embed = torch.cat((cur_new_embed, torch.zeros((max_len - cur_new_embed.shape[0], cur_new_embed.shape[1]), dtype=cur_new_embed.dtype, device=cur_new_embed.device)), dim=0)
198
+ new_input_embeds_align.append(cur_new_embed)
199
+ new_input_embeds = torch.stack(new_input_embeds_align, dim=0)
200
+
201
+ # Modality
202
+ new_modality_indicators_align = []
203
+ for cur_modality_indicator in new_modality_indicators:
204
+ cur_new_embed = torch.cat((cur_modality_indicator, torch.zeros(max_len - cur_modality_indicator.shape[0], dtype=cur_modality_indicator.dtype, device=cur_modality_indicator.device)), dim=0)
205
+ new_modality_indicators_align.append(cur_new_embed)
206
+ new_modality_indicators = torch.stack(new_modality_indicators_align, dim=0)
207
+
208
+ # Label
209
+ if labels is not None:
210
+ new_labels_align = []
211
+ _new_labels = new_labels
212
+ for cur_new_label in new_labels:
213
+ cur_new_label = torch.cat((cur_new_label, torch.full((max_len - cur_new_label.shape[0],), IGNORE_INDEX, dtype=cur_new_label.dtype, device=cur_new_label.device)), dim=0)
214
+ new_labels_align.append(cur_new_label)
215
+ new_labels = torch.stack(new_labels_align, dim=0)
216
+
217
+ # Attention Mask
218
+ if attention_mask is not None:
219
+ new_attention_mask = []
220
+ for cur_attention_mask, cur_new_labels, cur_new_labels_align in zip(attention_mask, _new_labels, new_labels):
221
+ new_attn_mask_pad_left = torch.full((cur_new_labels.shape[0] - labels.shape[1],), True, dtype=attention_mask.dtype, device=attention_mask.device)
222
+ new_attn_mask_pad_right = torch.full((cur_new_labels_align.shape[0] - cur_new_labels.shape[0],), False, dtype=attention_mask.dtype, device=attention_mask.device)
223
+ cur_new_attention_mask = torch.cat((new_attn_mask_pad_left, cur_attention_mask, new_attn_mask_pad_right), dim=0)
224
+ new_attention_mask.append(cur_new_attention_mask)
225
+ attention_mask = torch.stack(new_attention_mask, dim=0)
226
+ assert attention_mask.shape == new_labels.shape
227
+ else:
228
+ new_input_embeds = torch.stack(new_input_embeds, dim=0)
229
+ new_modality_indicators = torch.stack(new_modality_indicators, dim=0)
230
+ if labels is not None:
231
+ new_labels = torch.stack(new_labels, dim=0)
232
+
233
+ if attention_mask is not None:
234
+ new_attn_mask_pad_left = torch.full((attention_mask.shape[0], new_input_embeds.shape[1] - input_ids.shape[1]), True, dtype=attention_mask.dtype, device=attention_mask.device)
235
+ attention_mask = torch.cat((new_attn_mask_pad_left, attention_mask), dim=1)
236
+ assert attention_mask.shape == new_input_embeds.shape[:2]
237
+ return None, new_modality_indicators, attention_mask, past_key_values, new_input_embeds, new_labels
238
+
239
+
240
+
241
+ class MPLUGOwl2LlamaModel(MPLUGOwl2MetaModel, LlamaModel):
242
+ config_class = MPLUGOwl2Config
243
+
244
+ def __init__(self, config: MPLUGOwl2Config):
245
+ super(MPLUGOwl2LlamaModel, self).__init__(config)
246
+
247
+
248
+ class MPLUGOwl2LlamaForCausalLM(LlamaForCausalLM, MPLUGOwl2MetaForCausalLM):
249
+ config_class = MPLUGOwl2Config
250
+
251
+ def __init__(self, config):
252
+ super(LlamaForCausalLM, self).__init__(config)
253
+ self.model = MPLUGOwl2LlamaModel(config)
254
+
255
+ self.tokenizer = AutoTokenizer.from_pretrained(config._name_or_path)
256
+ self.image_processor = CLIPImageProcessor.from_pretrained(config._name_or_path)
257
+
258
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
259
+ self.preferential_ids_ = [id_[1] for id_ in self.tokenizer(["excellent","good","fair","poor","bad"])["input_ids"]]
260
+
261
+ # Initialize weights and apply final processing
262
+ self.post_init()
263
+
264
+
265
+ def get_model(self):
266
+ return self.model
267
+
268
+ def score(self, images,
269
+ task_: str = "quality",
270
+ input_: str = "image",
271
+ ):
272
+ if not hasattr(self, "weight_tensor"):
273
+ self.weight_tensor = torch.Tensor([5.,4.,3.,2.,1.]).half().to(self.device)
274
+ prompt = "USER: How would you rate the {} of this {}?\n<|image|>\nASSISTANT: The {} of the {} is".format(task_, input_, input_, task_)
275
+ if input_ == "image":
276
+ images = [expand2square(img, tuple(int(x*255) for x in self.image_processor.image_mean)) for img in images]
277
+ input_ids = tokenizer_image_token(prompt, self.tokenizer, IMAGE_TOKEN_INDEX, return_tensors='pt').unsqueeze(0).to(self.device)
278
+ with torch.inference_mode():
279
+ image_tensor = self.image_processor.preprocess(images, return_tensors="pt")["pixel_values"].half().to(self.device)
280
+ output_logits = self(input_ids.repeat(image_tensor.shape[0], 1),
281
+ images=image_tensor)["logits"][:,-1, self.preferential_ids_]
282
+ return torch.softmax(output_logits, -1) @ self.weight_tensor
283
+ else:
284
+ video = [[expand2square(frame, tuple(int(x*255) for x in self.image_processor.image_mean)) for frame in vid] for vid in images]
285
+ input_ids = tokenizer_image_token(prompt, self.tokenizer, IMAGE_TOKEN_INDEX, return_tensors='pt').unsqueeze(0).to(self.device)
286
+ with torch.inference_mode():
287
+ video_tensors = [self.image_processor.preprocess(vid, return_tensors="pt")["pixel_values"].half().to(self.model.device) for vid in video]
288
+ output_logits = self(input_ids.repeat(len(video_tensors), 1),
289
+ images=video_tensors)["logits"][:,-1, self.preferential_ids_]
290
+ return torch.softmax(output_logits, -1) @ self.weight_tensor
291
+
292
+ def forward(
293
+ self,
294
+ input_ids: torch.LongTensor = None,
295
+ # modality_indicators: torch.LongTensor = None,
296
+ attention_mask: Optional[torch.Tensor] = None,
297
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
298
+ inputs_embeds: Optional[torch.FloatTensor] = None,
299
+ labels: Optional[torch.LongTensor] = None,
300
+ use_cache: Optional[bool] = None,
301
+ output_attentions: Optional[bool] = None,
302
+ output_hidden_states: Optional[bool] = None,
303
+ images: Optional[torch.FloatTensor] = None,
304
+ return_dict: Optional[bool] = None,
305
+ ) -> Union[Tuple, CausalLMOutputWithPast]:
306
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
307
+ output_hidden_states = (
308
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
309
+ )
310
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
311
+ input_ids, modality_indicators, attention_mask, past_key_values, inputs_embeds, labels = \
312
+ self.prepare_inputs_labels_for_multimodal(input_ids, attention_mask, past_key_values, labels, images)
313
+
314
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
315
+ outputs = self.model(
316
+ input_ids=input_ids,
317
+ modality_indicators=modality_indicators,
318
+ attention_mask=attention_mask,
319
+ past_key_values=past_key_values,
320
+ inputs_embeds=inputs_embeds,
321
+ use_cache=use_cache,
322
+ output_attentions=output_attentions,
323
+ output_hidden_states=output_hidden_states,
324
+ return_dict=return_dict
325
+ )
326
+
327
+ hidden_states = outputs[0]
328
+ logits = self.lm_head(hidden_states)
329
+
330
+ loss = None
331
+ if labels is not None:
332
+ # Shift so that tokens < n predict n
333
+ shift_logits = logits[..., :-1, :].contiguous()
334
+ shift_labels = labels[..., 1:].contiguous()
335
+ # Flatten the tokens
336
+ loss_fct = CrossEntropyLoss()
337
+ shift_logits = shift_logits.view(-1, self.config.vocab_size)
338
+ shift_labels = shift_labels.view(-1)
339
+ # Enable model/pipeline parallelism
340
+ shift_labels = shift_labels.to(shift_logits.device)
341
+ loss = loss_fct(shift_logits, shift_labels)
342
+
343
+ if not return_dict:
344
+ output = (logits,) + outputs[1:]
345
+ return (loss,) + output if loss is not None else output
346
+
347
+ return CausalLMOutputWithPast(
348
+ loss=loss,
349
+ logits=logits,
350
+ past_key_values=outputs.past_key_values,
351
+ hidden_states=outputs.hidden_states,
352
+ attentions=outputs.attentions,
353
+ )
354
+
355
+ def prepare_inputs_for_generation(
356
+ self, input_ids, past_key_values=None, attention_mask=None, inputs_embeds=None, **kwargs
357
+ ):
358
+ if past_key_values:
359
+ input_ids = input_ids[:, -1:]
360
+
361
+ # if `inputs_embeds` are passed, we only want to use them in the 1st generation step
362
+ if inputs_embeds is not None and past_key_values is None:
363
+ model_inputs = {"inputs_embeds": inputs_embeds}
364
+ else:
365
+ model_inputs = {"input_ids": input_ids}
366
+
367
+ model_inputs.update(
368
+ {
369
+ "past_key_values": past_key_values,
370
+ "use_cache": kwargs.get("use_cache"),
371
+ "attention_mask": attention_mask,
372
+ "images": kwargs.get("images", None),
373
+ }
374
+ )
375
+ return model_inputs
376
+
377
+ AutoConfig.register("mplug_owl2", MPLUGOwl2Config)
378
+ AutoModelForCausalLM.register(MPLUGOwl2Config, MPLUGOwl2LlamaForCausalLM)
379
+
380
+ replace_llama_modality_adaptive()
381
+
382
+ if __name__ == "__main__":
383
+ config = MPLUGOwl2Config.from_pretrained('zhiyuanyou/DeQA-Score-Mix3')
384
+ from icecream import ic
385
+ # config = MPLUGOwl2Config()
386
+ model = AutoModelForCausalLM(config)
387
+
388
+ images = torch.randn(2, 3, 448, 448)
389
+ input_ids = torch.cat([
390
+ torch.ones(8).long(), torch.tensor([-1]*1).long(), torch.ones(8).long(), torch.tensor([-1]*1).long(), torch.ones(8).long()
391
+ ], dim=0).unsqueeze(0)
392
+ labels = input_ids.clone()
393
+ labels[labels < 0] = -100
394
+
395
+ # image_feature = model.encode_images(images)
396
+ # ic(image_feature.shape)
397
+
398
+ output = model(images=images, input_ids=input_ids, labels=labels)
399
+ ic(output.loss)
400
+ ic(output.logits.shape)
preprocessor_config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "crop_size": 448,
3
+ "do_center_crop": true,
4
+ "do_normalize": true,
5
+ "do_resize": true,
6
+ "feature_extractor_type": "CLIPFeatureExtractor",
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
+ "resample": 3,
18
+ "size": 448
19
+ }
pytorch_model.bin.index.json ADDED
@@ -0,0 +1,869 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 16409100288
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "pytorch_model-00004-of-00004.bin",
7
+ "model.embed_tokens.weight": "pytorch_model-00001-of-00004.bin",
8
+ "model.layers.0.input_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
9
+ "model.layers.0.input_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
10
+ "model.layers.0.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
11
+ "model.layers.0.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
12
+ "model.layers.0.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
13
+ "model.layers.0.post_attention_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
14
+ "model.layers.0.post_attention_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
15
+ "model.layers.0.self_attn.k_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
16
+ "model.layers.0.self_attn.k_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
17
+ "model.layers.0.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
18
+ "model.layers.0.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
19
+ "model.layers.0.self_attn.v_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
20
+ "model.layers.0.self_attn.v_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
21
+ "model.layers.1.input_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
22
+ "model.layers.1.input_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
23
+ "model.layers.1.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
24
+ "model.layers.1.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
25
+ "model.layers.1.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
26
+ "model.layers.1.post_attention_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
27
+ "model.layers.1.post_attention_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
28
+ "model.layers.1.self_attn.k_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
29
+ "model.layers.1.self_attn.k_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
30
+ "model.layers.1.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
31
+ "model.layers.1.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
32
+ "model.layers.1.self_attn.v_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
33
+ "model.layers.1.self_attn.v_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
34
+ "model.layers.10.input_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
35
+ "model.layers.10.input_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
36
+ "model.layers.10.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
37
+ "model.layers.10.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
38
+ "model.layers.10.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
39
+ "model.layers.10.post_attention_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
40
+ "model.layers.10.post_attention_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
41
+ "model.layers.10.self_attn.k_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
42
+ "model.layers.10.self_attn.k_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
43
+ "model.layers.10.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
44
+ "model.layers.10.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
45
+ "model.layers.10.self_attn.v_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
46
+ "model.layers.10.self_attn.v_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
47
+ "model.layers.11.input_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
48
+ "model.layers.11.input_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
49
+ "model.layers.11.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
50
+ "model.layers.11.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
51
+ "model.layers.11.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
52
+ "model.layers.11.post_attention_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
53
+ "model.layers.11.post_attention_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
54
+ "model.layers.11.self_attn.k_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
55
+ "model.layers.11.self_attn.k_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
56
+ "model.layers.11.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
57
+ "model.layers.11.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
58
+ "model.layers.11.self_attn.v_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
59
+ "model.layers.11.self_attn.v_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
60
+ "model.layers.12.input_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
61
+ "model.layers.12.input_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
62
+ "model.layers.12.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
63
+ "model.layers.12.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
64
+ "model.layers.12.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
65
+ "model.layers.12.post_attention_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
66
+ "model.layers.12.post_attention_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
67
+ "model.layers.12.self_attn.k_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
68
+ "model.layers.12.self_attn.k_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
69
+ "model.layers.12.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
70
+ "model.layers.12.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
71
+ "model.layers.12.self_attn.v_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
72
+ "model.layers.12.self_attn.v_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
73
+ "model.layers.13.input_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
74
+ "model.layers.13.input_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
75
+ "model.layers.13.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
76
+ "model.layers.13.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
77
+ "model.layers.13.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
78
+ "model.layers.13.post_attention_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
79
+ "model.layers.13.post_attention_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
80
+ "model.layers.13.self_attn.k_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
81
+ "model.layers.13.self_attn.k_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
82
+ "model.layers.13.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
83
+ "model.layers.13.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
84
+ "model.layers.13.self_attn.v_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
85
+ "model.layers.13.self_attn.v_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
86
+ "model.layers.14.input_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
87
+ "model.layers.14.input_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
88
+ "model.layers.14.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
89
+ "model.layers.14.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
90
+ "model.layers.14.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
91
+ "model.layers.14.post_attention_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
92
+ "model.layers.14.post_attention_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
93
+ "model.layers.14.self_attn.k_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
94
+ "model.layers.14.self_attn.k_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
95
+ "model.layers.14.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
96
+ "model.layers.14.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
97
+ "model.layers.14.self_attn.v_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
98
+ "model.layers.14.self_attn.v_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
99
+ "model.layers.15.input_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
100
+ "model.layers.15.input_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
101
+ "model.layers.15.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
102
+ "model.layers.15.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
103
+ "model.layers.15.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
104
+ "model.layers.15.post_attention_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
105
+ "model.layers.15.post_attention_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
106
+ "model.layers.15.self_attn.k_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
107
+ "model.layers.15.self_attn.k_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
108
+ "model.layers.15.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
109
+ "model.layers.15.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
110
+ "model.layers.15.self_attn.v_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
111
+ "model.layers.15.self_attn.v_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
112
+ "model.layers.16.input_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
113
+ "model.layers.16.input_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
114
+ "model.layers.16.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
115
+ "model.layers.16.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
116
+ "model.layers.16.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
117
+ "model.layers.16.post_attention_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
118
+ "model.layers.16.post_attention_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
119
+ "model.layers.16.self_attn.k_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
120
+ "model.layers.16.self_attn.k_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
121
+ "model.layers.16.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
122
+ "model.layers.16.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
123
+ "model.layers.16.self_attn.v_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
124
+ "model.layers.16.self_attn.v_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
125
+ "model.layers.17.input_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
126
+ "model.layers.17.input_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
127
+ "model.layers.17.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
128
+ "model.layers.17.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
129
+ "model.layers.17.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
130
+ "model.layers.17.post_attention_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
131
+ "model.layers.17.post_attention_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
132
+ "model.layers.17.self_attn.k_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
133
+ "model.layers.17.self_attn.k_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
134
+ "model.layers.17.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
135
+ "model.layers.17.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
136
+ "model.layers.17.self_attn.v_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
137
+ "model.layers.17.self_attn.v_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
138
+ "model.layers.18.input_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
139
+ "model.layers.18.input_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
140
+ "model.layers.18.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
141
+ "model.layers.18.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
142
+ "model.layers.18.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
143
+ "model.layers.18.post_attention_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
144
+ "model.layers.18.post_attention_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
145
+ "model.layers.18.self_attn.k_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
146
+ "model.layers.18.self_attn.k_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
147
+ "model.layers.18.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
148
+ "model.layers.18.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
149
+ "model.layers.18.self_attn.v_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
150
+ "model.layers.18.self_attn.v_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
151
+ "model.layers.19.input_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
152
+ "model.layers.19.input_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
153
+ "model.layers.19.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
154
+ "model.layers.19.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
155
+ "model.layers.19.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
156
+ "model.layers.19.post_attention_layernorm.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
157
+ "model.layers.19.post_attention_layernorm.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
158
+ "model.layers.19.self_attn.k_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
159
+ "model.layers.19.self_attn.k_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
160
+ "model.layers.19.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
161
+ "model.layers.19.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
162
+ "model.layers.19.self_attn.v_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
163
+ "model.layers.19.self_attn.v_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
164
+ "model.layers.2.input_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
165
+ "model.layers.2.input_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
166
+ "model.layers.2.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
167
+ "model.layers.2.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
168
+ "model.layers.2.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
169
+ "model.layers.2.post_attention_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
170
+ "model.layers.2.post_attention_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
171
+ "model.layers.2.self_attn.k_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
172
+ "model.layers.2.self_attn.k_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
173
+ "model.layers.2.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
174
+ "model.layers.2.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
175
+ "model.layers.2.self_attn.v_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
176
+ "model.layers.2.self_attn.v_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
177
+ "model.layers.20.input_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
178
+ "model.layers.20.input_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
179
+ "model.layers.20.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
180
+ "model.layers.20.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
181
+ "model.layers.20.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
182
+ "model.layers.20.post_attention_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
183
+ "model.layers.20.post_attention_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
184
+ "model.layers.20.self_attn.k_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
185
+ "model.layers.20.self_attn.k_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
186
+ "model.layers.20.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
187
+ "model.layers.20.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
188
+ "model.layers.20.self_attn.v_proj.multiway.0.weight": "pytorch_model-00002-of-00004.bin",
189
+ "model.layers.20.self_attn.v_proj.multiway.1.weight": "pytorch_model-00002-of-00004.bin",
190
+ "model.layers.21.input_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
191
+ "model.layers.21.input_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
192
+ "model.layers.21.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
193
+ "model.layers.21.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
194
+ "model.layers.21.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
195
+ "model.layers.21.post_attention_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
196
+ "model.layers.21.post_attention_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
197
+ "model.layers.21.self_attn.k_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
198
+ "model.layers.21.self_attn.k_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
199
+ "model.layers.21.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
200
+ "model.layers.21.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
201
+ "model.layers.21.self_attn.v_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
202
+ "model.layers.21.self_attn.v_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
203
+ "model.layers.22.input_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
204
+ "model.layers.22.input_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
205
+ "model.layers.22.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
206
+ "model.layers.22.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
207
+ "model.layers.22.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
208
+ "model.layers.22.post_attention_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
209
+ "model.layers.22.post_attention_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
210
+ "model.layers.22.self_attn.k_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
211
+ "model.layers.22.self_attn.k_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
212
+ "model.layers.22.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
213
+ "model.layers.22.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
214
+ "model.layers.22.self_attn.v_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
215
+ "model.layers.22.self_attn.v_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
216
+ "model.layers.23.input_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
217
+ "model.layers.23.input_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
218
+ "model.layers.23.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
219
+ "model.layers.23.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
220
+ "model.layers.23.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
221
+ "model.layers.23.post_attention_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
222
+ "model.layers.23.post_attention_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
223
+ "model.layers.23.self_attn.k_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
224
+ "model.layers.23.self_attn.k_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
225
+ "model.layers.23.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
226
+ "model.layers.23.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
227
+ "model.layers.23.self_attn.v_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
228
+ "model.layers.23.self_attn.v_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
229
+ "model.layers.24.input_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
230
+ "model.layers.24.input_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
231
+ "model.layers.24.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
232
+ "model.layers.24.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
233
+ "model.layers.24.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
234
+ "model.layers.24.post_attention_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
235
+ "model.layers.24.post_attention_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
236
+ "model.layers.24.self_attn.k_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
237
+ "model.layers.24.self_attn.k_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
238
+ "model.layers.24.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
239
+ "model.layers.24.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
240
+ "model.layers.24.self_attn.v_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
241
+ "model.layers.24.self_attn.v_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
242
+ "model.layers.25.input_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
243
+ "model.layers.25.input_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
244
+ "model.layers.25.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
245
+ "model.layers.25.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
246
+ "model.layers.25.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
247
+ "model.layers.25.post_attention_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
248
+ "model.layers.25.post_attention_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
249
+ "model.layers.25.self_attn.k_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
250
+ "model.layers.25.self_attn.k_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
251
+ "model.layers.25.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
252
+ "model.layers.25.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
253
+ "model.layers.25.self_attn.v_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
254
+ "model.layers.25.self_attn.v_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
255
+ "model.layers.26.input_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
256
+ "model.layers.26.input_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
257
+ "model.layers.26.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
258
+ "model.layers.26.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
259
+ "model.layers.26.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
260
+ "model.layers.26.post_attention_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
261
+ "model.layers.26.post_attention_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
262
+ "model.layers.26.self_attn.k_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
263
+ "model.layers.26.self_attn.k_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
264
+ "model.layers.26.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
265
+ "model.layers.26.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
266
+ "model.layers.26.self_attn.v_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
267
+ "model.layers.26.self_attn.v_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
268
+ "model.layers.27.input_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
269
+ "model.layers.27.input_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
270
+ "model.layers.27.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
271
+ "model.layers.27.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
272
+ "model.layers.27.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
273
+ "model.layers.27.post_attention_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
274
+ "model.layers.27.post_attention_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
275
+ "model.layers.27.self_attn.k_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
276
+ "model.layers.27.self_attn.k_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
277
+ "model.layers.27.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
278
+ "model.layers.27.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
279
+ "model.layers.27.self_attn.v_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
280
+ "model.layers.27.self_attn.v_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
281
+ "model.layers.28.input_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
282
+ "model.layers.28.input_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
283
+ "model.layers.28.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
284
+ "model.layers.28.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
285
+ "model.layers.28.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
286
+ "model.layers.28.post_attention_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
287
+ "model.layers.28.post_attention_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
288
+ "model.layers.28.self_attn.k_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
289
+ "model.layers.28.self_attn.k_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
290
+ "model.layers.28.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
291
+ "model.layers.28.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
292
+ "model.layers.28.self_attn.v_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
293
+ "model.layers.28.self_attn.v_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
294
+ "model.layers.29.input_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
295
+ "model.layers.29.input_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
296
+ "model.layers.29.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
297
+ "model.layers.29.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
298
+ "model.layers.29.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
299
+ "model.layers.29.post_attention_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
300
+ "model.layers.29.post_attention_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
301
+ "model.layers.29.self_attn.k_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
302
+ "model.layers.29.self_attn.k_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
303
+ "model.layers.29.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
304
+ "model.layers.29.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
305
+ "model.layers.29.self_attn.v_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
306
+ "model.layers.29.self_attn.v_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
307
+ "model.layers.3.input_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
308
+ "model.layers.3.input_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
309
+ "model.layers.3.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
310
+ "model.layers.3.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
311
+ "model.layers.3.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
312
+ "model.layers.3.post_attention_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
313
+ "model.layers.3.post_attention_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
314
+ "model.layers.3.self_attn.k_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
315
+ "model.layers.3.self_attn.k_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
316
+ "model.layers.3.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
317
+ "model.layers.3.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
318
+ "model.layers.3.self_attn.v_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
319
+ "model.layers.3.self_attn.v_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
320
+ "model.layers.30.input_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
321
+ "model.layers.30.input_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
322
+ "model.layers.30.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
323
+ "model.layers.30.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
324
+ "model.layers.30.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
325
+ "model.layers.30.post_attention_layernorm.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
326
+ "model.layers.30.post_attention_layernorm.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
327
+ "model.layers.30.self_attn.k_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
328
+ "model.layers.30.self_attn.k_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
329
+ "model.layers.30.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
330
+ "model.layers.30.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
331
+ "model.layers.30.self_attn.v_proj.multiway.0.weight": "pytorch_model-00003-of-00004.bin",
332
+ "model.layers.30.self_attn.v_proj.multiway.1.weight": "pytorch_model-00003-of-00004.bin",
333
+ "model.layers.31.input_layernorm.multiway.0.weight": "pytorch_model-00004-of-00004.bin",
334
+ "model.layers.31.input_layernorm.multiway.1.weight": "pytorch_model-00004-of-00004.bin",
335
+ "model.layers.31.mlp.down_proj.weight": "pytorch_model-00004-of-00004.bin",
336
+ "model.layers.31.mlp.gate_proj.weight": "pytorch_model-00004-of-00004.bin",
337
+ "model.layers.31.mlp.up_proj.weight": "pytorch_model-00004-of-00004.bin",
338
+ "model.layers.31.post_attention_layernorm.multiway.0.weight": "pytorch_model-00004-of-00004.bin",
339
+ "model.layers.31.post_attention_layernorm.multiway.1.weight": "pytorch_model-00004-of-00004.bin",
340
+ "model.layers.31.self_attn.k_proj.multiway.0.weight": "pytorch_model-00004-of-00004.bin",
341
+ "model.layers.31.self_attn.k_proj.multiway.1.weight": "pytorch_model-00004-of-00004.bin",
342
+ "model.layers.31.self_attn.o_proj.weight": "pytorch_model-00004-of-00004.bin",
343
+ "model.layers.31.self_attn.q_proj.weight": "pytorch_model-00004-of-00004.bin",
344
+ "model.layers.31.self_attn.v_proj.multiway.0.weight": "pytorch_model-00004-of-00004.bin",
345
+ "model.layers.31.self_attn.v_proj.multiway.1.weight": "pytorch_model-00004-of-00004.bin",
346
+ "model.layers.4.input_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
347
+ "model.layers.4.input_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
348
+ "model.layers.4.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
349
+ "model.layers.4.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
350
+ "model.layers.4.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
351
+ "model.layers.4.post_attention_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
352
+ "model.layers.4.post_attention_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
353
+ "model.layers.4.self_attn.k_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
354
+ "model.layers.4.self_attn.k_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
355
+ "model.layers.4.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
356
+ "model.layers.4.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
357
+ "model.layers.4.self_attn.v_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
358
+ "model.layers.4.self_attn.v_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
359
+ "model.layers.5.input_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
360
+ "model.layers.5.input_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
361
+ "model.layers.5.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
362
+ "model.layers.5.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
363
+ "model.layers.5.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
364
+ "model.layers.5.post_attention_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
365
+ "model.layers.5.post_attention_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
366
+ "model.layers.5.self_attn.k_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
367
+ "model.layers.5.self_attn.k_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
368
+ "model.layers.5.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
369
+ "model.layers.5.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
370
+ "model.layers.5.self_attn.v_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
371
+ "model.layers.5.self_attn.v_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
372
+ "model.layers.6.input_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
373
+ "model.layers.6.input_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
374
+ "model.layers.6.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
375
+ "model.layers.6.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
376
+ "model.layers.6.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
377
+ "model.layers.6.post_attention_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
378
+ "model.layers.6.post_attention_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
379
+ "model.layers.6.self_attn.k_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
380
+ "model.layers.6.self_attn.k_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
381
+ "model.layers.6.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
382
+ "model.layers.6.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
383
+ "model.layers.6.self_attn.v_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
384
+ "model.layers.6.self_attn.v_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
385
+ "model.layers.7.input_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
386
+ "model.layers.7.input_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
387
+ "model.layers.7.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
388
+ "model.layers.7.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
389
+ "model.layers.7.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
390
+ "model.layers.7.post_attention_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
391
+ "model.layers.7.post_attention_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
392
+ "model.layers.7.self_attn.k_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
393
+ "model.layers.7.self_attn.k_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
394
+ "model.layers.7.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
395
+ "model.layers.7.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
396
+ "model.layers.7.self_attn.v_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
397
+ "model.layers.7.self_attn.v_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
398
+ "model.layers.8.input_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
399
+ "model.layers.8.input_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
400
+ "model.layers.8.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
401
+ "model.layers.8.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
402
+ "model.layers.8.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
403
+ "model.layers.8.post_attention_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
404
+ "model.layers.8.post_attention_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
405
+ "model.layers.8.self_attn.k_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
406
+ "model.layers.8.self_attn.k_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
407
+ "model.layers.8.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
408
+ "model.layers.8.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
409
+ "model.layers.8.self_attn.v_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
410
+ "model.layers.8.self_attn.v_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
411
+ "model.layers.9.input_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
412
+ "model.layers.9.input_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
413
+ "model.layers.9.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
414
+ "model.layers.9.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
415
+ "model.layers.9.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
416
+ "model.layers.9.post_attention_layernorm.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
417
+ "model.layers.9.post_attention_layernorm.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
418
+ "model.layers.9.self_attn.k_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
419
+ "model.layers.9.self_attn.k_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
420
+ "model.layers.9.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
421
+ "model.layers.9.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
422
+ "model.layers.9.self_attn.v_proj.multiway.0.weight": "pytorch_model-00001-of-00004.bin",
423
+ "model.layers.9.self_attn.v_proj.multiway.1.weight": "pytorch_model-00001-of-00004.bin",
424
+ "model.norm.weight": "pytorch_model-00004-of-00004.bin",
425
+ "model.vision_model.embeddings.cls_token": "pytorch_model-00004-of-00004.bin",
426
+ "model.vision_model.embeddings.patch_embed.weight": "pytorch_model-00004-of-00004.bin",
427
+ "model.vision_model.embeddings.position_embedding": "pytorch_model-00004-of-00004.bin",
428
+ "model.vision_model.embeddings.pre_layernorm.bias": "pytorch_model-00004-of-00004.bin",
429
+ "model.vision_model.embeddings.pre_layernorm.weight": "pytorch_model-00004-of-00004.bin",
430
+ "model.vision_model.encoder.layers.0.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
431
+ "model.vision_model.encoder.layers.0.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
432
+ "model.vision_model.encoder.layers.0.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
433
+ "model.vision_model.encoder.layers.0.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
434
+ "model.vision_model.encoder.layers.0.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
435
+ "model.vision_model.encoder.layers.0.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
436
+ "model.vision_model.encoder.layers.0.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
437
+ "model.vision_model.encoder.layers.0.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
438
+ "model.vision_model.encoder.layers.0.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
439
+ "model.vision_model.encoder.layers.0.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
440
+ "model.vision_model.encoder.layers.0.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
441
+ "model.vision_model.encoder.layers.0.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
442
+ "model.vision_model.encoder.layers.1.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
443
+ "model.vision_model.encoder.layers.1.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
444
+ "model.vision_model.encoder.layers.1.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
445
+ "model.vision_model.encoder.layers.1.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
446
+ "model.vision_model.encoder.layers.1.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
447
+ "model.vision_model.encoder.layers.1.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
448
+ "model.vision_model.encoder.layers.1.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
449
+ "model.vision_model.encoder.layers.1.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
450
+ "model.vision_model.encoder.layers.1.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
451
+ "model.vision_model.encoder.layers.1.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
452
+ "model.vision_model.encoder.layers.1.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
453
+ "model.vision_model.encoder.layers.1.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
454
+ "model.vision_model.encoder.layers.10.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
455
+ "model.vision_model.encoder.layers.10.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
456
+ "model.vision_model.encoder.layers.10.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
457
+ "model.vision_model.encoder.layers.10.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
458
+ "model.vision_model.encoder.layers.10.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
459
+ "model.vision_model.encoder.layers.10.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
460
+ "model.vision_model.encoder.layers.10.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
461
+ "model.vision_model.encoder.layers.10.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
462
+ "model.vision_model.encoder.layers.10.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
463
+ "model.vision_model.encoder.layers.10.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
464
+ "model.vision_model.encoder.layers.10.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
465
+ "model.vision_model.encoder.layers.10.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
466
+ "model.vision_model.encoder.layers.11.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
467
+ "model.vision_model.encoder.layers.11.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
468
+ "model.vision_model.encoder.layers.11.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
469
+ "model.vision_model.encoder.layers.11.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
470
+ "model.vision_model.encoder.layers.11.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
471
+ "model.vision_model.encoder.layers.11.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
472
+ "model.vision_model.encoder.layers.11.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
473
+ "model.vision_model.encoder.layers.11.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
474
+ "model.vision_model.encoder.layers.11.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
475
+ "model.vision_model.encoder.layers.11.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
476
+ "model.vision_model.encoder.layers.11.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
477
+ "model.vision_model.encoder.layers.11.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
478
+ "model.vision_model.encoder.layers.12.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
479
+ "model.vision_model.encoder.layers.12.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
480
+ "model.vision_model.encoder.layers.12.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
481
+ "model.vision_model.encoder.layers.12.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
482
+ "model.vision_model.encoder.layers.12.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
483
+ "model.vision_model.encoder.layers.12.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
484
+ "model.vision_model.encoder.layers.12.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
485
+ "model.vision_model.encoder.layers.12.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
486
+ "model.vision_model.encoder.layers.12.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
487
+ "model.vision_model.encoder.layers.12.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
488
+ "model.vision_model.encoder.layers.12.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
489
+ "model.vision_model.encoder.layers.12.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
490
+ "model.vision_model.encoder.layers.13.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
491
+ "model.vision_model.encoder.layers.13.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
492
+ "model.vision_model.encoder.layers.13.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
493
+ "model.vision_model.encoder.layers.13.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
494
+ "model.vision_model.encoder.layers.13.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
495
+ "model.vision_model.encoder.layers.13.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
496
+ "model.vision_model.encoder.layers.13.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
497
+ "model.vision_model.encoder.layers.13.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
498
+ "model.vision_model.encoder.layers.13.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
499
+ "model.vision_model.encoder.layers.13.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
500
+ "model.vision_model.encoder.layers.13.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
501
+ "model.vision_model.encoder.layers.13.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
502
+ "model.vision_model.encoder.layers.14.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
503
+ "model.vision_model.encoder.layers.14.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
504
+ "model.vision_model.encoder.layers.14.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
505
+ "model.vision_model.encoder.layers.14.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
506
+ "model.vision_model.encoder.layers.14.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
507
+ "model.vision_model.encoder.layers.14.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
508
+ "model.vision_model.encoder.layers.14.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
509
+ "model.vision_model.encoder.layers.14.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
510
+ "model.vision_model.encoder.layers.14.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
511
+ "model.vision_model.encoder.layers.14.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
512
+ "model.vision_model.encoder.layers.14.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
513
+ "model.vision_model.encoder.layers.14.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
514
+ "model.vision_model.encoder.layers.15.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
515
+ "model.vision_model.encoder.layers.15.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
516
+ "model.vision_model.encoder.layers.15.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
517
+ "model.vision_model.encoder.layers.15.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
518
+ "model.vision_model.encoder.layers.15.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
519
+ "model.vision_model.encoder.layers.15.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
520
+ "model.vision_model.encoder.layers.15.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
521
+ "model.vision_model.encoder.layers.15.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
522
+ "model.vision_model.encoder.layers.15.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
523
+ "model.vision_model.encoder.layers.15.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
524
+ "model.vision_model.encoder.layers.15.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
525
+ "model.vision_model.encoder.layers.15.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
526
+ "model.vision_model.encoder.layers.16.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
527
+ "model.vision_model.encoder.layers.16.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
528
+ "model.vision_model.encoder.layers.16.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
529
+ "model.vision_model.encoder.layers.16.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
530
+ "model.vision_model.encoder.layers.16.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
531
+ "model.vision_model.encoder.layers.16.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
532
+ "model.vision_model.encoder.layers.16.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
533
+ "model.vision_model.encoder.layers.16.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
534
+ "model.vision_model.encoder.layers.16.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
535
+ "model.vision_model.encoder.layers.16.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
536
+ "model.vision_model.encoder.layers.16.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
537
+ "model.vision_model.encoder.layers.16.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
538
+ "model.vision_model.encoder.layers.17.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
539
+ "model.vision_model.encoder.layers.17.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
540
+ "model.vision_model.encoder.layers.17.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
541
+ "model.vision_model.encoder.layers.17.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
542
+ "model.vision_model.encoder.layers.17.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
543
+ "model.vision_model.encoder.layers.17.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
544
+ "model.vision_model.encoder.layers.17.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
545
+ "model.vision_model.encoder.layers.17.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
546
+ "model.vision_model.encoder.layers.17.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
547
+ "model.vision_model.encoder.layers.17.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
548
+ "model.vision_model.encoder.layers.17.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
549
+ "model.vision_model.encoder.layers.17.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
550
+ "model.vision_model.encoder.layers.18.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
551
+ "model.vision_model.encoder.layers.18.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
552
+ "model.vision_model.encoder.layers.18.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
553
+ "model.vision_model.encoder.layers.18.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
554
+ "model.vision_model.encoder.layers.18.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
555
+ "model.vision_model.encoder.layers.18.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
556
+ "model.vision_model.encoder.layers.18.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
557
+ "model.vision_model.encoder.layers.18.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
558
+ "model.vision_model.encoder.layers.18.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
559
+ "model.vision_model.encoder.layers.18.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
560
+ "model.vision_model.encoder.layers.18.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
561
+ "model.vision_model.encoder.layers.18.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
562
+ "model.vision_model.encoder.layers.19.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
563
+ "model.vision_model.encoder.layers.19.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
564
+ "model.vision_model.encoder.layers.19.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
565
+ "model.vision_model.encoder.layers.19.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
566
+ "model.vision_model.encoder.layers.19.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
567
+ "model.vision_model.encoder.layers.19.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
568
+ "model.vision_model.encoder.layers.19.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
569
+ "model.vision_model.encoder.layers.19.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
570
+ "model.vision_model.encoder.layers.19.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
571
+ "model.vision_model.encoder.layers.19.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
572
+ "model.vision_model.encoder.layers.19.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
573
+ "model.vision_model.encoder.layers.19.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
574
+ "model.vision_model.encoder.layers.2.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
575
+ "model.vision_model.encoder.layers.2.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
576
+ "model.vision_model.encoder.layers.2.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
577
+ "model.vision_model.encoder.layers.2.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
578
+ "model.vision_model.encoder.layers.2.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
579
+ "model.vision_model.encoder.layers.2.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
580
+ "model.vision_model.encoder.layers.2.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
581
+ "model.vision_model.encoder.layers.2.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
582
+ "model.vision_model.encoder.layers.2.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
583
+ "model.vision_model.encoder.layers.2.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
584
+ "model.vision_model.encoder.layers.2.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
585
+ "model.vision_model.encoder.layers.2.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
586
+ "model.vision_model.encoder.layers.20.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
587
+ "model.vision_model.encoder.layers.20.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
588
+ "model.vision_model.encoder.layers.20.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
589
+ "model.vision_model.encoder.layers.20.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
590
+ "model.vision_model.encoder.layers.20.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
591
+ "model.vision_model.encoder.layers.20.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
592
+ "model.vision_model.encoder.layers.20.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
593
+ "model.vision_model.encoder.layers.20.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
594
+ "model.vision_model.encoder.layers.20.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
595
+ "model.vision_model.encoder.layers.20.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
596
+ "model.vision_model.encoder.layers.20.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
597
+ "model.vision_model.encoder.layers.20.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
598
+ "model.vision_model.encoder.layers.21.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
599
+ "model.vision_model.encoder.layers.21.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
600
+ "model.vision_model.encoder.layers.21.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
601
+ "model.vision_model.encoder.layers.21.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
602
+ "model.vision_model.encoder.layers.21.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
603
+ "model.vision_model.encoder.layers.21.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
604
+ "model.vision_model.encoder.layers.21.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
605
+ "model.vision_model.encoder.layers.21.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
606
+ "model.vision_model.encoder.layers.21.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
607
+ "model.vision_model.encoder.layers.21.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
608
+ "model.vision_model.encoder.layers.21.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
609
+ "model.vision_model.encoder.layers.21.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
610
+ "model.vision_model.encoder.layers.22.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
611
+ "model.vision_model.encoder.layers.22.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
612
+ "model.vision_model.encoder.layers.22.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
613
+ "model.vision_model.encoder.layers.22.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
614
+ "model.vision_model.encoder.layers.22.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
615
+ "model.vision_model.encoder.layers.22.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
616
+ "model.vision_model.encoder.layers.22.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
617
+ "model.vision_model.encoder.layers.22.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
618
+ "model.vision_model.encoder.layers.22.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
619
+ "model.vision_model.encoder.layers.22.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
620
+ "model.vision_model.encoder.layers.22.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
621
+ "model.vision_model.encoder.layers.22.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
622
+ "model.vision_model.encoder.layers.23.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
623
+ "model.vision_model.encoder.layers.23.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
624
+ "model.vision_model.encoder.layers.23.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
625
+ "model.vision_model.encoder.layers.23.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
626
+ "model.vision_model.encoder.layers.23.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
627
+ "model.vision_model.encoder.layers.23.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
628
+ "model.vision_model.encoder.layers.23.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
629
+ "model.vision_model.encoder.layers.23.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
630
+ "model.vision_model.encoder.layers.23.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
631
+ "model.vision_model.encoder.layers.23.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
632
+ "model.vision_model.encoder.layers.23.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
633
+ "model.vision_model.encoder.layers.23.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
634
+ "model.vision_model.encoder.layers.3.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
635
+ "model.vision_model.encoder.layers.3.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
636
+ "model.vision_model.encoder.layers.3.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
637
+ "model.vision_model.encoder.layers.3.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
638
+ "model.vision_model.encoder.layers.3.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
639
+ "model.vision_model.encoder.layers.3.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
640
+ "model.vision_model.encoder.layers.3.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
641
+ "model.vision_model.encoder.layers.3.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
642
+ "model.vision_model.encoder.layers.3.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
643
+ "model.vision_model.encoder.layers.3.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
644
+ "model.vision_model.encoder.layers.3.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
645
+ "model.vision_model.encoder.layers.3.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
646
+ "model.vision_model.encoder.layers.4.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
647
+ "model.vision_model.encoder.layers.4.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
648
+ "model.vision_model.encoder.layers.4.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
649
+ "model.vision_model.encoder.layers.4.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
650
+ "model.vision_model.encoder.layers.4.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
651
+ "model.vision_model.encoder.layers.4.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
652
+ "model.vision_model.encoder.layers.4.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
653
+ "model.vision_model.encoder.layers.4.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
654
+ "model.vision_model.encoder.layers.4.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
655
+ "model.vision_model.encoder.layers.4.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
656
+ "model.vision_model.encoder.layers.4.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
657
+ "model.vision_model.encoder.layers.4.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
658
+ "model.vision_model.encoder.layers.5.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
659
+ "model.vision_model.encoder.layers.5.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
660
+ "model.vision_model.encoder.layers.5.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
661
+ "model.vision_model.encoder.layers.5.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
662
+ "model.vision_model.encoder.layers.5.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
663
+ "model.vision_model.encoder.layers.5.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
664
+ "model.vision_model.encoder.layers.5.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
665
+ "model.vision_model.encoder.layers.5.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
666
+ "model.vision_model.encoder.layers.5.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
667
+ "model.vision_model.encoder.layers.5.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
668
+ "model.vision_model.encoder.layers.5.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
669
+ "model.vision_model.encoder.layers.5.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
670
+ "model.vision_model.encoder.layers.6.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
671
+ "model.vision_model.encoder.layers.6.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
672
+ "model.vision_model.encoder.layers.6.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
673
+ "model.vision_model.encoder.layers.6.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
674
+ "model.vision_model.encoder.layers.6.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
675
+ "model.vision_model.encoder.layers.6.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
676
+ "model.vision_model.encoder.layers.6.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
677
+ "model.vision_model.encoder.layers.6.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
678
+ "model.vision_model.encoder.layers.6.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
679
+ "model.vision_model.encoder.layers.6.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
680
+ "model.vision_model.encoder.layers.6.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
681
+ "model.vision_model.encoder.layers.6.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
682
+ "model.vision_model.encoder.layers.7.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
683
+ "model.vision_model.encoder.layers.7.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
684
+ "model.vision_model.encoder.layers.7.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
685
+ "model.vision_model.encoder.layers.7.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
686
+ "model.vision_model.encoder.layers.7.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
687
+ "model.vision_model.encoder.layers.7.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
688
+ "model.vision_model.encoder.layers.7.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
689
+ "model.vision_model.encoder.layers.7.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
690
+ "model.vision_model.encoder.layers.7.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
691
+ "model.vision_model.encoder.layers.7.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
692
+ "model.vision_model.encoder.layers.7.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
693
+ "model.vision_model.encoder.layers.7.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
694
+ "model.vision_model.encoder.layers.8.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
695
+ "model.vision_model.encoder.layers.8.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
696
+ "model.vision_model.encoder.layers.8.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
697
+ "model.vision_model.encoder.layers.8.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
698
+ "model.vision_model.encoder.layers.8.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
699
+ "model.vision_model.encoder.layers.8.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
700
+ "model.vision_model.encoder.layers.8.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
701
+ "model.vision_model.encoder.layers.8.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
702
+ "model.vision_model.encoder.layers.8.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
703
+ "model.vision_model.encoder.layers.8.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
704
+ "model.vision_model.encoder.layers.8.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
705
+ "model.vision_model.encoder.layers.8.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
706
+ "model.vision_model.encoder.layers.9.input_layernorm.bias": "pytorch_model-00004-of-00004.bin",
707
+ "model.vision_model.encoder.layers.9.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
708
+ "model.vision_model.encoder.layers.9.mlp.fc1.bias": "pytorch_model-00004-of-00004.bin",
709
+ "model.vision_model.encoder.layers.9.mlp.fc1.weight": "pytorch_model-00004-of-00004.bin",
710
+ "model.vision_model.encoder.layers.9.mlp.fc2.bias": "pytorch_model-00004-of-00004.bin",
711
+ "model.vision_model.encoder.layers.9.mlp.fc2.weight": "pytorch_model-00004-of-00004.bin",
712
+ "model.vision_model.encoder.layers.9.post_attention_layernorm.bias": "pytorch_model-00004-of-00004.bin",
713
+ "model.vision_model.encoder.layers.9.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
714
+ "model.vision_model.encoder.layers.9.self_attn.dense.bias": "pytorch_model-00004-of-00004.bin",
715
+ "model.vision_model.encoder.layers.9.self_attn.dense.weight": "pytorch_model-00004-of-00004.bin",
716
+ "model.vision_model.encoder.layers.9.self_attn.query_key_value.bias": "pytorch_model-00004-of-00004.bin",
717
+ "model.vision_model.encoder.layers.9.self_attn.query_key_value.weight": "pytorch_model-00004-of-00004.bin",
718
+ "model.vision_model.post_layernorm.bias": "pytorch_model-00004-of-00004.bin",
719
+ "model.vision_model.post_layernorm.weight": "pytorch_model-00004-of-00004.bin",
720
+ "model.visual_abstractor.encoder.layers.0.crossattention.attention.k_pos_embed": "pytorch_model-00004-of-00004.bin",
721
+ "model.visual_abstractor.encoder.layers.0.crossattention.attention.key.bias": "pytorch_model-00004-of-00004.bin",
722
+ "model.visual_abstractor.encoder.layers.0.crossattention.attention.key.weight": "pytorch_model-00004-of-00004.bin",
723
+ "model.visual_abstractor.encoder.layers.0.crossattention.attention.q_pos_embed": "pytorch_model-00004-of-00004.bin",
724
+ "model.visual_abstractor.encoder.layers.0.crossattention.attention.query.bias": "pytorch_model-00004-of-00004.bin",
725
+ "model.visual_abstractor.encoder.layers.0.crossattention.attention.query.weight": "pytorch_model-00004-of-00004.bin",
726
+ "model.visual_abstractor.encoder.layers.0.crossattention.attention.value.bias": "pytorch_model-00004-of-00004.bin",
727
+ "model.visual_abstractor.encoder.layers.0.crossattention.attention.value.weight": "pytorch_model-00004-of-00004.bin",
728
+ "model.visual_abstractor.encoder.layers.0.crossattention.norm1.bias": "pytorch_model-00004-of-00004.bin",
729
+ "model.visual_abstractor.encoder.layers.0.crossattention.norm1.weight": "pytorch_model-00004-of-00004.bin",
730
+ "model.visual_abstractor.encoder.layers.0.crossattention.normk.bias": "pytorch_model-00004-of-00004.bin",
731
+ "model.visual_abstractor.encoder.layers.0.crossattention.normk.weight": "pytorch_model-00004-of-00004.bin",
732
+ "model.visual_abstractor.encoder.layers.0.crossattention.output.mlp.ffn_ln.bias": "pytorch_model-00004-of-00004.bin",
733
+ "model.visual_abstractor.encoder.layers.0.crossattention.output.mlp.ffn_ln.weight": "pytorch_model-00004-of-00004.bin",
734
+ "model.visual_abstractor.encoder.layers.0.crossattention.output.mlp.w1.bias": "pytorch_model-00004-of-00004.bin",
735
+ "model.visual_abstractor.encoder.layers.0.crossattention.output.mlp.w1.weight": "pytorch_model-00004-of-00004.bin",
736
+ "model.visual_abstractor.encoder.layers.0.crossattention.output.mlp.w2.bias": "pytorch_model-00004-of-00004.bin",
737
+ "model.visual_abstractor.encoder.layers.0.crossattention.output.mlp.w2.weight": "pytorch_model-00004-of-00004.bin",
738
+ "model.visual_abstractor.encoder.layers.0.crossattention.output.mlp.w3.bias": "pytorch_model-00004-of-00004.bin",
739
+ "model.visual_abstractor.encoder.layers.0.crossattention.output.mlp.w3.weight": "pytorch_model-00004-of-00004.bin",
740
+ "model.visual_abstractor.encoder.layers.0.crossattention.output.norm2.bias": "pytorch_model-00004-of-00004.bin",
741
+ "model.visual_abstractor.encoder.layers.0.crossattention.output.norm2.weight": "pytorch_model-00004-of-00004.bin",
742
+ "model.visual_abstractor.encoder.layers.0.crossattention.output.out_proj.bias": "pytorch_model-00004-of-00004.bin",
743
+ "model.visual_abstractor.encoder.layers.0.crossattention.output.out_proj.weight": "pytorch_model-00004-of-00004.bin",
744
+ "model.visual_abstractor.encoder.layers.1.crossattention.attention.k_pos_embed": "pytorch_model-00004-of-00004.bin",
745
+ "model.visual_abstractor.encoder.layers.1.crossattention.attention.key.bias": "pytorch_model-00004-of-00004.bin",
746
+ "model.visual_abstractor.encoder.layers.1.crossattention.attention.key.weight": "pytorch_model-00004-of-00004.bin",
747
+ "model.visual_abstractor.encoder.layers.1.crossattention.attention.q_pos_embed": "pytorch_model-00004-of-00004.bin",
748
+ "model.visual_abstractor.encoder.layers.1.crossattention.attention.query.bias": "pytorch_model-00004-of-00004.bin",
749
+ "model.visual_abstractor.encoder.layers.1.crossattention.attention.query.weight": "pytorch_model-00004-of-00004.bin",
750
+ "model.visual_abstractor.encoder.layers.1.crossattention.attention.value.bias": "pytorch_model-00004-of-00004.bin",
751
+ "model.visual_abstractor.encoder.layers.1.crossattention.attention.value.weight": "pytorch_model-00004-of-00004.bin",
752
+ "model.visual_abstractor.encoder.layers.1.crossattention.norm1.bias": "pytorch_model-00004-of-00004.bin",
753
+ "model.visual_abstractor.encoder.layers.1.crossattention.norm1.weight": "pytorch_model-00004-of-00004.bin",
754
+ "model.visual_abstractor.encoder.layers.1.crossattention.normk.bias": "pytorch_model-00004-of-00004.bin",
755
+ "model.visual_abstractor.encoder.layers.1.crossattention.normk.weight": "pytorch_model-00004-of-00004.bin",
756
+ "model.visual_abstractor.encoder.layers.1.crossattention.output.mlp.ffn_ln.bias": "pytorch_model-00004-of-00004.bin",
757
+ "model.visual_abstractor.encoder.layers.1.crossattention.output.mlp.ffn_ln.weight": "pytorch_model-00004-of-00004.bin",
758
+ "model.visual_abstractor.encoder.layers.1.crossattention.output.mlp.w1.bias": "pytorch_model-00004-of-00004.bin",
759
+ "model.visual_abstractor.encoder.layers.1.crossattention.output.mlp.w1.weight": "pytorch_model-00004-of-00004.bin",
760
+ "model.visual_abstractor.encoder.layers.1.crossattention.output.mlp.w2.bias": "pytorch_model-00004-of-00004.bin",
761
+ "model.visual_abstractor.encoder.layers.1.crossattention.output.mlp.w2.weight": "pytorch_model-00004-of-00004.bin",
762
+ "model.visual_abstractor.encoder.layers.1.crossattention.output.mlp.w3.bias": "pytorch_model-00004-of-00004.bin",
763
+ "model.visual_abstractor.encoder.layers.1.crossattention.output.mlp.w3.weight": "pytorch_model-00004-of-00004.bin",
764
+ "model.visual_abstractor.encoder.layers.1.crossattention.output.norm2.bias": "pytorch_model-00004-of-00004.bin",
765
+ "model.visual_abstractor.encoder.layers.1.crossattention.output.norm2.weight": "pytorch_model-00004-of-00004.bin",
766
+ "model.visual_abstractor.encoder.layers.1.crossattention.output.out_proj.bias": "pytorch_model-00004-of-00004.bin",
767
+ "model.visual_abstractor.encoder.layers.1.crossattention.output.out_proj.weight": "pytorch_model-00004-of-00004.bin",
768
+ "model.visual_abstractor.encoder.layers.2.crossattention.attention.k_pos_embed": "pytorch_model-00004-of-00004.bin",
769
+ "model.visual_abstractor.encoder.layers.2.crossattention.attention.key.bias": "pytorch_model-00004-of-00004.bin",
770
+ "model.visual_abstractor.encoder.layers.2.crossattention.attention.key.weight": "pytorch_model-00004-of-00004.bin",
771
+ "model.visual_abstractor.encoder.layers.2.crossattention.attention.q_pos_embed": "pytorch_model-00004-of-00004.bin",
772
+ "model.visual_abstractor.encoder.layers.2.crossattention.attention.query.bias": "pytorch_model-00004-of-00004.bin",
773
+ "model.visual_abstractor.encoder.layers.2.crossattention.attention.query.weight": "pytorch_model-00004-of-00004.bin",
774
+ "model.visual_abstractor.encoder.layers.2.crossattention.attention.value.bias": "pytorch_model-00004-of-00004.bin",
775
+ "model.visual_abstractor.encoder.layers.2.crossattention.attention.value.weight": "pytorch_model-00004-of-00004.bin",
776
+ "model.visual_abstractor.encoder.layers.2.crossattention.norm1.bias": "pytorch_model-00004-of-00004.bin",
777
+ "model.visual_abstractor.encoder.layers.2.crossattention.norm1.weight": "pytorch_model-00004-of-00004.bin",
778
+ "model.visual_abstractor.encoder.layers.2.crossattention.normk.bias": "pytorch_model-00004-of-00004.bin",
779
+ "model.visual_abstractor.encoder.layers.2.crossattention.normk.weight": "pytorch_model-00004-of-00004.bin",
780
+ "model.visual_abstractor.encoder.layers.2.crossattention.output.mlp.ffn_ln.bias": "pytorch_model-00004-of-00004.bin",
781
+ "model.visual_abstractor.encoder.layers.2.crossattention.output.mlp.ffn_ln.weight": "pytorch_model-00004-of-00004.bin",
782
+ "model.visual_abstractor.encoder.layers.2.crossattention.output.mlp.w1.bias": "pytorch_model-00004-of-00004.bin",
783
+ "model.visual_abstractor.encoder.layers.2.crossattention.output.mlp.w1.weight": "pytorch_model-00004-of-00004.bin",
784
+ "model.visual_abstractor.encoder.layers.2.crossattention.output.mlp.w2.bias": "pytorch_model-00004-of-00004.bin",
785
+ "model.visual_abstractor.encoder.layers.2.crossattention.output.mlp.w2.weight": "pytorch_model-00004-of-00004.bin",
786
+ "model.visual_abstractor.encoder.layers.2.crossattention.output.mlp.w3.bias": "pytorch_model-00004-of-00004.bin",
787
+ "model.visual_abstractor.encoder.layers.2.crossattention.output.mlp.w3.weight": "pytorch_model-00004-of-00004.bin",
788
+ "model.visual_abstractor.encoder.layers.2.crossattention.output.norm2.bias": "pytorch_model-00004-of-00004.bin",
789
+ "model.visual_abstractor.encoder.layers.2.crossattention.output.norm2.weight": "pytorch_model-00004-of-00004.bin",
790
+ "model.visual_abstractor.encoder.layers.2.crossattention.output.out_proj.bias": "pytorch_model-00004-of-00004.bin",
791
+ "model.visual_abstractor.encoder.layers.2.crossattention.output.out_proj.weight": "pytorch_model-00004-of-00004.bin",
792
+ "model.visual_abstractor.encoder.layers.3.crossattention.attention.k_pos_embed": "pytorch_model-00004-of-00004.bin",
793
+ "model.visual_abstractor.encoder.layers.3.crossattention.attention.key.bias": "pytorch_model-00004-of-00004.bin",
794
+ "model.visual_abstractor.encoder.layers.3.crossattention.attention.key.weight": "pytorch_model-00004-of-00004.bin",
795
+ "model.visual_abstractor.encoder.layers.3.crossattention.attention.q_pos_embed": "pytorch_model-00004-of-00004.bin",
796
+ "model.visual_abstractor.encoder.layers.3.crossattention.attention.query.bias": "pytorch_model-00004-of-00004.bin",
797
+ "model.visual_abstractor.encoder.layers.3.crossattention.attention.query.weight": "pytorch_model-00004-of-00004.bin",
798
+ "model.visual_abstractor.encoder.layers.3.crossattention.attention.value.bias": "pytorch_model-00004-of-00004.bin",
799
+ "model.visual_abstractor.encoder.layers.3.crossattention.attention.value.weight": "pytorch_model-00004-of-00004.bin",
800
+ "model.visual_abstractor.encoder.layers.3.crossattention.norm1.bias": "pytorch_model-00004-of-00004.bin",
801
+ "model.visual_abstractor.encoder.layers.3.crossattention.norm1.weight": "pytorch_model-00004-of-00004.bin",
802
+ "model.visual_abstractor.encoder.layers.3.crossattention.normk.bias": "pytorch_model-00004-of-00004.bin",
803
+ "model.visual_abstractor.encoder.layers.3.crossattention.normk.weight": "pytorch_model-00004-of-00004.bin",
804
+ "model.visual_abstractor.encoder.layers.3.crossattention.output.mlp.ffn_ln.bias": "pytorch_model-00004-of-00004.bin",
805
+ "model.visual_abstractor.encoder.layers.3.crossattention.output.mlp.ffn_ln.weight": "pytorch_model-00004-of-00004.bin",
806
+ "model.visual_abstractor.encoder.layers.3.crossattention.output.mlp.w1.bias": "pytorch_model-00004-of-00004.bin",
807
+ "model.visual_abstractor.encoder.layers.3.crossattention.output.mlp.w1.weight": "pytorch_model-00004-of-00004.bin",
808
+ "model.visual_abstractor.encoder.layers.3.crossattention.output.mlp.w2.bias": "pytorch_model-00004-of-00004.bin",
809
+ "model.visual_abstractor.encoder.layers.3.crossattention.output.mlp.w2.weight": "pytorch_model-00004-of-00004.bin",
810
+ "model.visual_abstractor.encoder.layers.3.crossattention.output.mlp.w3.bias": "pytorch_model-00004-of-00004.bin",
811
+ "model.visual_abstractor.encoder.layers.3.crossattention.output.mlp.w3.weight": "pytorch_model-00004-of-00004.bin",
812
+ "model.visual_abstractor.encoder.layers.3.crossattention.output.norm2.bias": "pytorch_model-00004-of-00004.bin",
813
+ "model.visual_abstractor.encoder.layers.3.crossattention.output.norm2.weight": "pytorch_model-00004-of-00004.bin",
814
+ "model.visual_abstractor.encoder.layers.3.crossattention.output.out_proj.bias": "pytorch_model-00004-of-00004.bin",
815
+ "model.visual_abstractor.encoder.layers.3.crossattention.output.out_proj.weight": "pytorch_model-00004-of-00004.bin",
816
+ "model.visual_abstractor.encoder.layers.4.crossattention.attention.k_pos_embed": "pytorch_model-00004-of-00004.bin",
817
+ "model.visual_abstractor.encoder.layers.4.crossattention.attention.key.bias": "pytorch_model-00004-of-00004.bin",
818
+ "model.visual_abstractor.encoder.layers.4.crossattention.attention.key.weight": "pytorch_model-00004-of-00004.bin",
819
+ "model.visual_abstractor.encoder.layers.4.crossattention.attention.q_pos_embed": "pytorch_model-00004-of-00004.bin",
820
+ "model.visual_abstractor.encoder.layers.4.crossattention.attention.query.bias": "pytorch_model-00004-of-00004.bin",
821
+ "model.visual_abstractor.encoder.layers.4.crossattention.attention.query.weight": "pytorch_model-00004-of-00004.bin",
822
+ "model.visual_abstractor.encoder.layers.4.crossattention.attention.value.bias": "pytorch_model-00004-of-00004.bin",
823
+ "model.visual_abstractor.encoder.layers.4.crossattention.attention.value.weight": "pytorch_model-00004-of-00004.bin",
824
+ "model.visual_abstractor.encoder.layers.4.crossattention.norm1.bias": "pytorch_model-00004-of-00004.bin",
825
+ "model.visual_abstractor.encoder.layers.4.crossattention.norm1.weight": "pytorch_model-00004-of-00004.bin",
826
+ "model.visual_abstractor.encoder.layers.4.crossattention.normk.bias": "pytorch_model-00004-of-00004.bin",
827
+ "model.visual_abstractor.encoder.layers.4.crossattention.normk.weight": "pytorch_model-00004-of-00004.bin",
828
+ "model.visual_abstractor.encoder.layers.4.crossattention.output.mlp.ffn_ln.bias": "pytorch_model-00004-of-00004.bin",
829
+ "model.visual_abstractor.encoder.layers.4.crossattention.output.mlp.ffn_ln.weight": "pytorch_model-00004-of-00004.bin",
830
+ "model.visual_abstractor.encoder.layers.4.crossattention.output.mlp.w1.bias": "pytorch_model-00004-of-00004.bin",
831
+ "model.visual_abstractor.encoder.layers.4.crossattention.output.mlp.w1.weight": "pytorch_model-00004-of-00004.bin",
832
+ "model.visual_abstractor.encoder.layers.4.crossattention.output.mlp.w2.bias": "pytorch_model-00004-of-00004.bin",
833
+ "model.visual_abstractor.encoder.layers.4.crossattention.output.mlp.w2.weight": "pytorch_model-00004-of-00004.bin",
834
+ "model.visual_abstractor.encoder.layers.4.crossattention.output.mlp.w3.bias": "pytorch_model-00004-of-00004.bin",
835
+ "model.visual_abstractor.encoder.layers.4.crossattention.output.mlp.w3.weight": "pytorch_model-00004-of-00004.bin",
836
+ "model.visual_abstractor.encoder.layers.4.crossattention.output.norm2.bias": "pytorch_model-00004-of-00004.bin",
837
+ "model.visual_abstractor.encoder.layers.4.crossattention.output.norm2.weight": "pytorch_model-00004-of-00004.bin",
838
+ "model.visual_abstractor.encoder.layers.4.crossattention.output.out_proj.bias": "pytorch_model-00004-of-00004.bin",
839
+ "model.visual_abstractor.encoder.layers.4.crossattention.output.out_proj.weight": "pytorch_model-00004-of-00004.bin",
840
+ "model.visual_abstractor.encoder.layers.5.crossattention.attention.k_pos_embed": "pytorch_model-00004-of-00004.bin",
841
+ "model.visual_abstractor.encoder.layers.5.crossattention.attention.key.bias": "pytorch_model-00004-of-00004.bin",
842
+ "model.visual_abstractor.encoder.layers.5.crossattention.attention.key.weight": "pytorch_model-00004-of-00004.bin",
843
+ "model.visual_abstractor.encoder.layers.5.crossattention.attention.q_pos_embed": "pytorch_model-00004-of-00004.bin",
844
+ "model.visual_abstractor.encoder.layers.5.crossattention.attention.query.bias": "pytorch_model-00004-of-00004.bin",
845
+ "model.visual_abstractor.encoder.layers.5.crossattention.attention.query.weight": "pytorch_model-00004-of-00004.bin",
846
+ "model.visual_abstractor.encoder.layers.5.crossattention.attention.value.bias": "pytorch_model-00004-of-00004.bin",
847
+ "model.visual_abstractor.encoder.layers.5.crossattention.attention.value.weight": "pytorch_model-00004-of-00004.bin",
848
+ "model.visual_abstractor.encoder.layers.5.crossattention.norm1.bias": "pytorch_model-00004-of-00004.bin",
849
+ "model.visual_abstractor.encoder.layers.5.crossattention.norm1.weight": "pytorch_model-00004-of-00004.bin",
850
+ "model.visual_abstractor.encoder.layers.5.crossattention.normk.bias": "pytorch_model-00004-of-00004.bin",
851
+ "model.visual_abstractor.encoder.layers.5.crossattention.normk.weight": "pytorch_model-00004-of-00004.bin",
852
+ "model.visual_abstractor.encoder.layers.5.crossattention.output.mlp.ffn_ln.bias": "pytorch_model-00004-of-00004.bin",
853
+ "model.visual_abstractor.encoder.layers.5.crossattention.output.mlp.ffn_ln.weight": "pytorch_model-00004-of-00004.bin",
854
+ "model.visual_abstractor.encoder.layers.5.crossattention.output.mlp.w1.bias": "pytorch_model-00004-of-00004.bin",
855
+ "model.visual_abstractor.encoder.layers.5.crossattention.output.mlp.w1.weight": "pytorch_model-00004-of-00004.bin",
856
+ "model.visual_abstractor.encoder.layers.5.crossattention.output.mlp.w2.bias": "pytorch_model-00004-of-00004.bin",
857
+ "model.visual_abstractor.encoder.layers.5.crossattention.output.mlp.w2.weight": "pytorch_model-00004-of-00004.bin",
858
+ "model.visual_abstractor.encoder.layers.5.crossattention.output.mlp.w3.bias": "pytorch_model-00004-of-00004.bin",
859
+ "model.visual_abstractor.encoder.layers.5.crossattention.output.mlp.w3.weight": "pytorch_model-00004-of-00004.bin",
860
+ "model.visual_abstractor.encoder.layers.5.crossattention.output.norm2.bias": "pytorch_model-00004-of-00004.bin",
861
+ "model.visual_abstractor.encoder.layers.5.crossattention.output.norm2.weight": "pytorch_model-00004-of-00004.bin",
862
+ "model.visual_abstractor.encoder.layers.5.crossattention.output.out_proj.bias": "pytorch_model-00004-of-00004.bin",
863
+ "model.visual_abstractor.encoder.layers.5.crossattention.output.out_proj.weight": "pytorch_model-00004-of-00004.bin",
864
+ "model.visual_abstractor.query_embeds": "pytorch_model-00004-of-00004.bin",
865
+ "model.visual_abstractor.visual_fc.bias": "pytorch_model-00004-of-00004.bin",
866
+ "model.visual_abstractor.visual_fc.weight": "pytorch_model-00004-of-00004.bin",
867
+ "model.visual_abstractor.vit_eos": "pytorch_model-00004-of-00004.bin"
868
+ }
869
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "<unk>",
17
+ "unk_token": {
18
+ "content": "<unk>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ }
24
+ }
tokenizer.model ADDED
Binary file (500 kB). View file
 
tokenizer_config.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "bos_token": {
5
+ "__type": "AddedToken",
6
+ "content": "<s>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "clean_up_tokenization_spaces": false,
13
+ "eos_token": {
14
+ "__type": "AddedToken",
15
+ "content": "</s>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false
20
+ },
21
+ "legacy": false,
22
+ "model_max_length": 2048,
23
+ "pad_token": null,
24
+ "padding_side": "right",
25
+ "sp_model_kwargs": {},
26
+ "tokenizer_class": "LlamaTokenizer",
27
+ "unk_token": {
28
+ "__type": "AddedToken",
29
+ "content": "<unk>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false
34
+ }
35
+ }
trainer_state.json ADDED
@@ -0,0 +1,3432 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 3.0,
5
+ "eval_steps": 500,
6
+ "global_step": 567,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 0.01,
13
+ "learning_rate": 1.111111111111111e-06,
14
+ "loss": 0.4065,
15
+ "step": 1
16
+ },
17
+ {
18
+ "epoch": 0.01,
19
+ "learning_rate": 2.222222222222222e-06,
20
+ "loss": 0.4126,
21
+ "step": 2
22
+ },
23
+ {
24
+ "epoch": 0.02,
25
+ "learning_rate": 3.3333333333333333e-06,
26
+ "loss": 0.406,
27
+ "step": 3
28
+ },
29
+ {
30
+ "epoch": 0.02,
31
+ "learning_rate": 4.444444444444444e-06,
32
+ "loss": 0.3757,
33
+ "step": 4
34
+ },
35
+ {
36
+ "epoch": 0.03,
37
+ "learning_rate": 5.555555555555557e-06,
38
+ "loss": 0.2993,
39
+ "step": 5
40
+ },
41
+ {
42
+ "epoch": 0.03,
43
+ "learning_rate": 6.666666666666667e-06,
44
+ "loss": 0.2178,
45
+ "step": 6
46
+ },
47
+ {
48
+ "epoch": 0.04,
49
+ "learning_rate": 7.77777777777778e-06,
50
+ "loss": 0.1332,
51
+ "step": 7
52
+ },
53
+ {
54
+ "epoch": 0.04,
55
+ "learning_rate": 8.888888888888888e-06,
56
+ "loss": 0.1436,
57
+ "step": 8
58
+ },
59
+ {
60
+ "epoch": 0.05,
61
+ "learning_rate": 1e-05,
62
+ "loss": 0.1261,
63
+ "step": 9
64
+ },
65
+ {
66
+ "epoch": 0.05,
67
+ "learning_rate": 1.1111111111111113e-05,
68
+ "loss": 0.1156,
69
+ "step": 10
70
+ },
71
+ {
72
+ "epoch": 0.06,
73
+ "learning_rate": 1.2222222222222224e-05,
74
+ "loss": 0.0961,
75
+ "step": 11
76
+ },
77
+ {
78
+ "epoch": 0.06,
79
+ "learning_rate": 1.3333333333333333e-05,
80
+ "loss": 0.0911,
81
+ "step": 12
82
+ },
83
+ {
84
+ "epoch": 0.07,
85
+ "learning_rate": 1.4444444444444446e-05,
86
+ "loss": 0.0706,
87
+ "step": 13
88
+ },
89
+ {
90
+ "epoch": 0.07,
91
+ "learning_rate": 1.555555555555556e-05,
92
+ "loss": 0.1345,
93
+ "step": 14
94
+ },
95
+ {
96
+ "epoch": 0.08,
97
+ "learning_rate": 1.6666666666666667e-05,
98
+ "loss": 0.0871,
99
+ "step": 15
100
+ },
101
+ {
102
+ "epoch": 0.08,
103
+ "learning_rate": 1.7777777777777777e-05,
104
+ "loss": 0.0744,
105
+ "step": 16
106
+ },
107
+ {
108
+ "epoch": 0.09,
109
+ "learning_rate": 1.888888888888889e-05,
110
+ "loss": 0.1035,
111
+ "step": 17
112
+ },
113
+ {
114
+ "epoch": 0.1,
115
+ "learning_rate": 2e-05,
116
+ "loss": 0.0768,
117
+ "step": 18
118
+ },
119
+ {
120
+ "epoch": 0.1,
121
+ "learning_rate": 1.9999836271653566e-05,
122
+ "loss": 0.0895,
123
+ "step": 19
124
+ },
125
+ {
126
+ "epoch": 0.11,
127
+ "learning_rate": 1.9999345091975652e-05,
128
+ "loss": 0.0998,
129
+ "step": 20
130
+ },
131
+ {
132
+ "epoch": 0.11,
133
+ "learning_rate": 1.999852647705027e-05,
134
+ "loss": 0.1071,
135
+ "step": 21
136
+ },
137
+ {
138
+ "epoch": 0.12,
139
+ "learning_rate": 1.9997380453683513e-05,
140
+ "loss": 0.0921,
141
+ "step": 22
142
+ },
143
+ {
144
+ "epoch": 0.12,
145
+ "learning_rate": 1.999590705940268e-05,
146
+ "loss": 0.0948,
147
+ "step": 23
148
+ },
149
+ {
150
+ "epoch": 0.13,
151
+ "learning_rate": 1.9994106342455053e-05,
152
+ "loss": 0.095,
153
+ "step": 24
154
+ },
155
+ {
156
+ "epoch": 0.13,
157
+ "learning_rate": 1.999197836180632e-05,
158
+ "loss": 0.0547,
159
+ "step": 25
160
+ },
161
+ {
162
+ "epoch": 0.14,
163
+ "learning_rate": 1.9989523187138623e-05,
164
+ "loss": 0.0719,
165
+ "step": 26
166
+ },
167
+ {
168
+ "epoch": 0.14,
169
+ "learning_rate": 1.9986740898848306e-05,
170
+ "loss": 0.078,
171
+ "step": 27
172
+ },
173
+ {
174
+ "epoch": 0.15,
175
+ "learning_rate": 1.998363158804326e-05,
176
+ "loss": 0.0674,
177
+ "step": 28
178
+ },
179
+ {
180
+ "epoch": 0.15,
181
+ "learning_rate": 1.9980195356539944e-05,
182
+ "loss": 0.0602,
183
+ "step": 29
184
+ },
185
+ {
186
+ "epoch": 0.16,
187
+ "learning_rate": 1.9976432316860065e-05,
188
+ "loss": 0.055,
189
+ "step": 30
190
+ },
191
+ {
192
+ "epoch": 0.16,
193
+ "learning_rate": 1.9972342592226873e-05,
194
+ "loss": 0.0587,
195
+ "step": 31
196
+ },
197
+ {
198
+ "epoch": 0.17,
199
+ "learning_rate": 1.9967926316561136e-05,
200
+ "loss": 0.0601,
201
+ "step": 32
202
+ },
203
+ {
204
+ "epoch": 0.17,
205
+ "learning_rate": 1.9963183634476757e-05,
206
+ "loss": 0.0464,
207
+ "step": 33
208
+ },
209
+ {
210
+ "epoch": 0.18,
211
+ "learning_rate": 1.995811470127604e-05,
212
+ "loss": 0.0599,
213
+ "step": 34
214
+ },
215
+ {
216
+ "epoch": 0.19,
217
+ "learning_rate": 1.9952719682944588e-05,
218
+ "loss": 0.0483,
219
+ "step": 35
220
+ },
221
+ {
222
+ "epoch": 0.19,
223
+ "learning_rate": 1.9946998756145894e-05,
224
+ "loss": 0.0439,
225
+ "step": 36
226
+ },
227
+ {
228
+ "epoch": 0.2,
229
+ "learning_rate": 1.9940952108215526e-05,
230
+ "loss": 0.0474,
231
+ "step": 37
232
+ },
233
+ {
234
+ "epoch": 0.2,
235
+ "learning_rate": 1.993457993715503e-05,
236
+ "loss": 0.0598,
237
+ "step": 38
238
+ },
239
+ {
240
+ "epoch": 0.21,
241
+ "learning_rate": 1.99278824516254e-05,
242
+ "loss": 0.0459,
243
+ "step": 39
244
+ },
245
+ {
246
+ "epoch": 0.21,
247
+ "learning_rate": 1.9920859870940292e-05,
248
+ "loss": 0.0493,
249
+ "step": 40
250
+ },
251
+ {
252
+ "epoch": 0.22,
253
+ "learning_rate": 1.9913512425058803e-05,
254
+ "loss": 0.0404,
255
+ "step": 41
256
+ },
257
+ {
258
+ "epoch": 0.22,
259
+ "learning_rate": 1.990584035457797e-05,
260
+ "loss": 0.0405,
261
+ "step": 42
262
+ },
263
+ {
264
+ "epoch": 0.23,
265
+ "learning_rate": 1.9897843910724877e-05,
266
+ "loss": 0.0479,
267
+ "step": 43
268
+ },
269
+ {
270
+ "epoch": 0.23,
271
+ "learning_rate": 1.9889523355348427e-05,
272
+ "loss": 0.0446,
273
+ "step": 44
274
+ },
275
+ {
276
+ "epoch": 0.24,
277
+ "learning_rate": 1.9880878960910772e-05,
278
+ "loss": 0.0359,
279
+ "step": 45
280
+ },
281
+ {
282
+ "epoch": 0.24,
283
+ "learning_rate": 1.98719110104784e-05,
284
+ "loss": 0.0374,
285
+ "step": 46
286
+ },
287
+ {
288
+ "epoch": 0.25,
289
+ "learning_rate": 1.9862619797712845e-05,
290
+ "loss": 0.0383,
291
+ "step": 47
292
+ },
293
+ {
294
+ "epoch": 0.25,
295
+ "learning_rate": 1.985300562686109e-05,
296
+ "loss": 0.0384,
297
+ "step": 48
298
+ },
299
+ {
300
+ "epoch": 0.26,
301
+ "learning_rate": 1.9843068812745595e-05,
302
+ "loss": 0.0403,
303
+ "step": 49
304
+ },
305
+ {
306
+ "epoch": 0.26,
307
+ "learning_rate": 1.9832809680753985e-05,
308
+ "loss": 0.0313,
309
+ "step": 50
310
+ },
311
+ {
312
+ "epoch": 0.27,
313
+ "learning_rate": 1.982222856682841e-05,
314
+ "loss": 0.0382,
315
+ "step": 51
316
+ },
317
+ {
318
+ "epoch": 0.28,
319
+ "learning_rate": 1.9811325817454516e-05,
320
+ "loss": 0.0397,
321
+ "step": 52
322
+ },
323
+ {
324
+ "epoch": 0.28,
325
+ "learning_rate": 1.980010178965014e-05,
326
+ "loss": 0.0405,
327
+ "step": 53
328
+ },
329
+ {
330
+ "epoch": 0.29,
331
+ "learning_rate": 1.978855685095358e-05,
332
+ "loss": 0.0396,
333
+ "step": 54
334
+ },
335
+ {
336
+ "epoch": 0.29,
337
+ "learning_rate": 1.977669137941158e-05,
338
+ "loss": 0.0333,
339
+ "step": 55
340
+ },
341
+ {
342
+ "epoch": 0.3,
343
+ "learning_rate": 1.9764505763566945e-05,
344
+ "loss": 0.0414,
345
+ "step": 56
346
+ },
347
+ {
348
+ "epoch": 0.3,
349
+ "learning_rate": 1.9752000402445824e-05,
350
+ "loss": 0.0384,
351
+ "step": 57
352
+ },
353
+ {
354
+ "epoch": 0.31,
355
+ "learning_rate": 1.973917570554464e-05,
356
+ "loss": 0.0419,
357
+ "step": 58
358
+ },
359
+ {
360
+ "epoch": 0.31,
361
+ "learning_rate": 1.9726032092816672e-05,
362
+ "loss": 0.0366,
363
+ "step": 59
364
+ },
365
+ {
366
+ "epoch": 0.32,
367
+ "learning_rate": 1.9712569994658315e-05,
368
+ "loss": 0.0363,
369
+ "step": 60
370
+ },
371
+ {
372
+ "epoch": 0.32,
373
+ "learning_rate": 1.9698789851894986e-05,
374
+ "loss": 0.0358,
375
+ "step": 61
376
+ },
377
+ {
378
+ "epoch": 0.33,
379
+ "learning_rate": 1.9684692115766683e-05,
380
+ "loss": 0.0344,
381
+ "step": 62
382
+ },
383
+ {
384
+ "epoch": 0.33,
385
+ "learning_rate": 1.9670277247913205e-05,
386
+ "loss": 0.0373,
387
+ "step": 63
388
+ },
389
+ {
390
+ "epoch": 0.34,
391
+ "learning_rate": 1.9655545720359056e-05,
392
+ "loss": 0.0302,
393
+ "step": 64
394
+ },
395
+ {
396
+ "epoch": 0.34,
397
+ "learning_rate": 1.9640498015497956e-05,
398
+ "loss": 0.0455,
399
+ "step": 65
400
+ },
401
+ {
402
+ "epoch": 0.35,
403
+ "learning_rate": 1.9625134626077084e-05,
404
+ "loss": 0.0337,
405
+ "step": 66
406
+ },
407
+ {
408
+ "epoch": 0.35,
409
+ "learning_rate": 1.96094560551809e-05,
410
+ "loss": 0.0277,
411
+ "step": 67
412
+ },
413
+ {
414
+ "epoch": 0.36,
415
+ "learning_rate": 1.9593462816214698e-05,
416
+ "loss": 0.0352,
417
+ "step": 68
418
+ },
419
+ {
420
+ "epoch": 0.37,
421
+ "learning_rate": 1.9577155432887805e-05,
422
+ "loss": 0.031,
423
+ "step": 69
424
+ },
425
+ {
426
+ "epoch": 0.37,
427
+ "learning_rate": 1.956053443919639e-05,
428
+ "loss": 0.0298,
429
+ "step": 70
430
+ },
431
+ {
432
+ "epoch": 0.38,
433
+ "learning_rate": 1.9543600379406027e-05,
434
+ "loss": 0.0254,
435
+ "step": 71
436
+ },
437
+ {
438
+ "epoch": 0.38,
439
+ "learning_rate": 1.9526353808033827e-05,
440
+ "loss": 0.0312,
441
+ "step": 72
442
+ },
443
+ {
444
+ "epoch": 0.39,
445
+ "learning_rate": 1.950879528983032e-05,
446
+ "loss": 0.035,
447
+ "step": 73
448
+ },
449
+ {
450
+ "epoch": 0.39,
451
+ "learning_rate": 1.9490925399760928e-05,
452
+ "loss": 0.0298,
453
+ "step": 74
454
+ },
455
+ {
456
+ "epoch": 0.4,
457
+ "learning_rate": 1.947274472298717e-05,
458
+ "loss": 0.0368,
459
+ "step": 75
460
+ },
461
+ {
462
+ "epoch": 0.4,
463
+ "learning_rate": 1.9454253854847472e-05,
464
+ "loss": 0.0346,
465
+ "step": 76
466
+ },
467
+ {
468
+ "epoch": 0.41,
469
+ "learning_rate": 1.9435453400837683e-05,
470
+ "loss": 0.0361,
471
+ "step": 77
472
+ },
473
+ {
474
+ "epoch": 0.41,
475
+ "learning_rate": 1.941634397659126e-05,
476
+ "loss": 0.034,
477
+ "step": 78
478
+ },
479
+ {
480
+ "epoch": 0.42,
481
+ "learning_rate": 1.9396926207859085e-05,
482
+ "loss": 0.0361,
483
+ "step": 79
484
+ },
485
+ {
486
+ "epoch": 0.42,
487
+ "learning_rate": 1.937720073048899e-05,
488
+ "loss": 0.0359,
489
+ "step": 80
490
+ },
491
+ {
492
+ "epoch": 0.43,
493
+ "learning_rate": 1.9357168190404937e-05,
494
+ "loss": 0.0323,
495
+ "step": 81
496
+ },
497
+ {
498
+ "epoch": 0.43,
499
+ "learning_rate": 1.9336829243585856e-05,
500
+ "loss": 0.0435,
501
+ "step": 82
502
+ },
503
+ {
504
+ "epoch": 0.44,
505
+ "learning_rate": 1.9316184556044176e-05,
506
+ "loss": 0.0344,
507
+ "step": 83
508
+ },
509
+ {
510
+ "epoch": 0.44,
511
+ "learning_rate": 1.9295234803804005e-05,
512
+ "loss": 0.0272,
513
+ "step": 84
514
+ },
515
+ {
516
+ "epoch": 0.45,
517
+ "learning_rate": 1.9273980672879e-05,
518
+ "loss": 0.0387,
519
+ "step": 85
520
+ },
521
+ {
522
+ "epoch": 0.46,
523
+ "learning_rate": 1.925242285924991e-05,
524
+ "loss": 0.0331,
525
+ "step": 86
526
+ },
527
+ {
528
+ "epoch": 0.46,
529
+ "learning_rate": 1.9230562068841764e-05,
530
+ "loss": 0.0322,
531
+ "step": 87
532
+ },
533
+ {
534
+ "epoch": 0.47,
535
+ "learning_rate": 1.9208399017500773e-05,
536
+ "loss": 0.0351,
537
+ "step": 88
538
+ },
539
+ {
540
+ "epoch": 0.47,
541
+ "learning_rate": 1.9185934430970897e-05,
542
+ "loss": 0.0285,
543
+ "step": 89
544
+ },
545
+ {
546
+ "epoch": 0.48,
547
+ "learning_rate": 1.916316904487005e-05,
548
+ "loss": 0.0328,
549
+ "step": 90
550
+ },
551
+ {
552
+ "epoch": 0.48,
553
+ "learning_rate": 1.9140103604666035e-05,
554
+ "loss": 0.0374,
555
+ "step": 91
556
+ },
557
+ {
558
+ "epoch": 0.49,
559
+ "learning_rate": 1.9116738865652134e-05,
560
+ "loss": 0.036,
561
+ "step": 92
562
+ },
563
+ {
564
+ "epoch": 0.49,
565
+ "learning_rate": 1.909307559292236e-05,
566
+ "loss": 0.0313,
567
+ "step": 93
568
+ },
569
+ {
570
+ "epoch": 0.5,
571
+ "learning_rate": 1.906911456134642e-05,
572
+ "loss": 0.0331,
573
+ "step": 94
574
+ },
575
+ {
576
+ "epoch": 0.5,
577
+ "learning_rate": 1.9044856555544323e-05,
578
+ "loss": 0.0322,
579
+ "step": 95
580
+ },
581
+ {
582
+ "epoch": 0.51,
583
+ "learning_rate": 1.9020302369860708e-05,
584
+ "loss": 0.0301,
585
+ "step": 96
586
+ },
587
+ {
588
+ "epoch": 0.51,
589
+ "learning_rate": 1.8995452808338822e-05,
590
+ "loss": 0.0266,
591
+ "step": 97
592
+ },
593
+ {
594
+ "epoch": 0.52,
595
+ "learning_rate": 1.8970308684694186e-05,
596
+ "loss": 0.0274,
597
+ "step": 98
598
+ },
599
+ {
600
+ "epoch": 0.52,
601
+ "learning_rate": 1.8944870822287957e-05,
602
+ "loss": 0.0305,
603
+ "step": 99
604
+ },
605
+ {
606
+ "epoch": 0.53,
607
+ "learning_rate": 1.8919140054099966e-05,
608
+ "loss": 0.0273,
609
+ "step": 100
610
+ },
611
+ {
612
+ "epoch": 0.53,
613
+ "learning_rate": 1.8893117222701435e-05,
614
+ "loss": 0.0264,
615
+ "step": 101
616
+ },
617
+ {
618
+ "epoch": 0.54,
619
+ "learning_rate": 1.8866803180227403e-05,
620
+ "loss": 0.0319,
621
+ "step": 102
622
+ },
623
+ {
624
+ "epoch": 0.54,
625
+ "learning_rate": 1.8840198788348795e-05,
626
+ "loss": 0.03,
627
+ "step": 103
628
+ },
629
+ {
630
+ "epoch": 0.55,
631
+ "learning_rate": 1.881330491824423e-05,
632
+ "loss": 0.0268,
633
+ "step": 104
634
+ },
635
+ {
636
+ "epoch": 0.56,
637
+ "learning_rate": 1.8786122450571485e-05,
638
+ "loss": 0.0311,
639
+ "step": 105
640
+ },
641
+ {
642
+ "epoch": 0.56,
643
+ "learning_rate": 1.8758652275438657e-05,
644
+ "loss": 0.0269,
645
+ "step": 106
646
+ },
647
+ {
648
+ "epoch": 0.57,
649
+ "learning_rate": 1.8730895292375018e-05,
650
+ "loss": 0.0298,
651
+ "step": 107
652
+ },
653
+ {
654
+ "epoch": 0.57,
655
+ "learning_rate": 1.8702852410301556e-05,
656
+ "loss": 0.0275,
657
+ "step": 108
658
+ },
659
+ {
660
+ "epoch": 0.58,
661
+ "learning_rate": 1.8674524547501207e-05,
662
+ "loss": 0.0287,
663
+ "step": 109
664
+ },
665
+ {
666
+ "epoch": 0.58,
667
+ "learning_rate": 1.8645912631588806e-05,
668
+ "loss": 0.0314,
669
+ "step": 110
670
+ },
671
+ {
672
+ "epoch": 0.59,
673
+ "learning_rate": 1.861701759948068e-05,
674
+ "loss": 0.0307,
675
+ "step": 111
676
+ },
677
+ {
678
+ "epoch": 0.59,
679
+ "learning_rate": 1.8587840397364007e-05,
680
+ "loss": 0.0322,
681
+ "step": 112
682
+ },
683
+ {
684
+ "epoch": 0.6,
685
+ "learning_rate": 1.855838198066579e-05,
686
+ "loss": 0.0236,
687
+ "step": 113
688
+ },
689
+ {
690
+ "epoch": 0.6,
691
+ "learning_rate": 1.85286433140216e-05,
692
+ "loss": 0.0309,
693
+ "step": 114
694
+ },
695
+ {
696
+ "epoch": 0.61,
697
+ "learning_rate": 1.8498625371243978e-05,
698
+ "loss": 0.0273,
699
+ "step": 115
700
+ },
701
+ {
702
+ "epoch": 0.61,
703
+ "learning_rate": 1.8468329135290555e-05,
704
+ "loss": 0.0362,
705
+ "step": 116
706
+ },
707
+ {
708
+ "epoch": 0.62,
709
+ "learning_rate": 1.8437755598231857e-05,
710
+ "loss": 0.0238,
711
+ "step": 117
712
+ },
713
+ {
714
+ "epoch": 0.62,
715
+ "learning_rate": 1.8406905761218815e-05,
716
+ "loss": 0.0271,
717
+ "step": 118
718
+ },
719
+ {
720
+ "epoch": 0.63,
721
+ "learning_rate": 1.837578063444998e-05,
722
+ "loss": 0.0309,
723
+ "step": 119
724
+ },
725
+ {
726
+ "epoch": 0.63,
727
+ "learning_rate": 1.8344381237138473e-05,
728
+ "loss": 0.0305,
729
+ "step": 120
730
+ },
731
+ {
732
+ "epoch": 0.64,
733
+ "learning_rate": 1.831270859747857e-05,
734
+ "loss": 0.025,
735
+ "step": 121
736
+ },
737
+ {
738
+ "epoch": 0.65,
739
+ "learning_rate": 1.8280763752612052e-05,
740
+ "loss": 0.028,
741
+ "step": 122
742
+ },
743
+ {
744
+ "epoch": 0.65,
745
+ "learning_rate": 1.8248547748594246e-05,
746
+ "loss": 0.0257,
747
+ "step": 123
748
+ },
749
+ {
750
+ "epoch": 0.66,
751
+ "learning_rate": 1.8216061640359764e-05,
752
+ "loss": 0.0255,
753
+ "step": 124
754
+ },
755
+ {
756
+ "epoch": 0.66,
757
+ "learning_rate": 1.8183306491687968e-05,
758
+ "loss": 0.0288,
759
+ "step": 125
760
+ },
761
+ {
762
+ "epoch": 0.67,
763
+ "learning_rate": 1.8150283375168112e-05,
764
+ "loss": 0.0318,
765
+ "step": 126
766
+ },
767
+ {
768
+ "epoch": 0.67,
769
+ "learning_rate": 1.8116993372164265e-05,
770
+ "loss": 0.0282,
771
+ "step": 127
772
+ },
773
+ {
774
+ "epoch": 0.68,
775
+ "learning_rate": 1.8083437572779842e-05,
776
+ "loss": 0.0302,
777
+ "step": 128
778
+ },
779
+ {
780
+ "epoch": 0.68,
781
+ "learning_rate": 1.8049617075821962e-05,
782
+ "loss": 0.0264,
783
+ "step": 129
784
+ },
785
+ {
786
+ "epoch": 0.69,
787
+ "learning_rate": 1.8015532988765427e-05,
788
+ "loss": 0.027,
789
+ "step": 130
790
+ },
791
+ {
792
+ "epoch": 0.69,
793
+ "learning_rate": 1.7981186427716478e-05,
794
+ "loss": 0.0251,
795
+ "step": 131
796
+ },
797
+ {
798
+ "epoch": 0.7,
799
+ "learning_rate": 1.794657851737625e-05,
800
+ "loss": 0.0339,
801
+ "step": 132
802
+ },
803
+ {
804
+ "epoch": 0.7,
805
+ "learning_rate": 1.791171039100393e-05,
806
+ "loss": 0.0276,
807
+ "step": 133
808
+ },
809
+ {
810
+ "epoch": 0.71,
811
+ "learning_rate": 1.787658319037965e-05,
812
+ "loss": 0.0252,
813
+ "step": 134
814
+ },
815
+ {
816
+ "epoch": 0.71,
817
+ "learning_rate": 1.7841198065767107e-05,
818
+ "loss": 0.0262,
819
+ "step": 135
820
+ },
821
+ {
822
+ "epoch": 0.72,
823
+ "learning_rate": 1.7805556175875886e-05,
824
+ "loss": 0.0243,
825
+ "step": 136
826
+ },
827
+ {
828
+ "epoch": 0.72,
829
+ "learning_rate": 1.7769658687823525e-05,
830
+ "loss": 0.03,
831
+ "step": 137
832
+ },
833
+ {
834
+ "epoch": 0.73,
835
+ "learning_rate": 1.77335067770973e-05,
836
+ "loss": 0.0271,
837
+ "step": 138
838
+ },
839
+ {
840
+ "epoch": 0.74,
841
+ "learning_rate": 1.7697101627515722e-05,
842
+ "loss": 0.0296,
843
+ "step": 139
844
+ },
845
+ {
846
+ "epoch": 0.74,
847
+ "learning_rate": 1.766044443118978e-05,
848
+ "loss": 0.0221,
849
+ "step": 140
850
+ },
851
+ {
852
+ "epoch": 0.75,
853
+ "learning_rate": 1.7623536388483902e-05,
854
+ "loss": 0.0272,
855
+ "step": 141
856
+ },
857
+ {
858
+ "epoch": 0.75,
859
+ "learning_rate": 1.758637870797665e-05,
860
+ "loss": 0.0257,
861
+ "step": 142
862
+ },
863
+ {
864
+ "epoch": 0.76,
865
+ "learning_rate": 1.754897260642114e-05,
866
+ "loss": 0.0321,
867
+ "step": 143
868
+ },
869
+ {
870
+ "epoch": 0.76,
871
+ "learning_rate": 1.7511319308705198e-05,
872
+ "loss": 0.0276,
873
+ "step": 144
874
+ },
875
+ {
876
+ "epoch": 0.77,
877
+ "learning_rate": 1.747342004781127e-05,
878
+ "loss": 0.0314,
879
+ "step": 145
880
+ },
881
+ {
882
+ "epoch": 0.77,
883
+ "learning_rate": 1.7435276064776004e-05,
884
+ "loss": 0.0249,
885
+ "step": 146
886
+ },
887
+ {
888
+ "epoch": 0.78,
889
+ "learning_rate": 1.7396888608649673e-05,
890
+ "loss": 0.0289,
891
+ "step": 147
892
+ },
893
+ {
894
+ "epoch": 0.78,
895
+ "learning_rate": 1.7358258936455203e-05,
896
+ "loss": 0.0271,
897
+ "step": 148
898
+ },
899
+ {
900
+ "epoch": 0.79,
901
+ "learning_rate": 1.7319388313147067e-05,
902
+ "loss": 0.0231,
903
+ "step": 149
904
+ },
905
+ {
906
+ "epoch": 0.79,
907
+ "learning_rate": 1.7280278011569848e-05,
908
+ "loss": 0.0272,
909
+ "step": 150
910
+ },
911
+ {
912
+ "epoch": 0.8,
913
+ "learning_rate": 1.7240929312416545e-05,
914
+ "loss": 0.0307,
915
+ "step": 151
916
+ },
917
+ {
918
+ "epoch": 0.8,
919
+ "learning_rate": 1.7201343504186646e-05,
920
+ "loss": 0.0264,
921
+ "step": 152
922
+ },
923
+ {
924
+ "epoch": 0.81,
925
+ "learning_rate": 1.7161521883143936e-05,
926
+ "loss": 0.0295,
927
+ "step": 153
928
+ },
929
+ {
930
+ "epoch": 0.81,
931
+ "learning_rate": 1.7121465753274047e-05,
932
+ "loss": 0.0259,
933
+ "step": 154
934
+ },
935
+ {
936
+ "epoch": 0.82,
937
+ "learning_rate": 1.708117642624176e-05,
938
+ "loss": 0.0299,
939
+ "step": 155
940
+ },
941
+ {
942
+ "epoch": 0.83,
943
+ "learning_rate": 1.7040655221348057e-05,
944
+ "loss": 0.0261,
945
+ "step": 156
946
+ },
947
+ {
948
+ "epoch": 0.83,
949
+ "learning_rate": 1.6999903465486913e-05,
950
+ "loss": 0.0273,
951
+ "step": 157
952
+ },
953
+ {
954
+ "epoch": 0.84,
955
+ "learning_rate": 1.6958922493101844e-05,
956
+ "loss": 0.0269,
957
+ "step": 158
958
+ },
959
+ {
960
+ "epoch": 0.84,
961
+ "learning_rate": 1.6917713646142222e-05,
962
+ "loss": 0.0291,
963
+ "step": 159
964
+ },
965
+ {
966
+ "epoch": 0.85,
967
+ "learning_rate": 1.687627827401932e-05,
968
+ "loss": 0.0236,
969
+ "step": 160
970
+ },
971
+ {
972
+ "epoch": 0.85,
973
+ "learning_rate": 1.683461773356213e-05,
974
+ "loss": 0.0222,
975
+ "step": 161
976
+ },
977
+ {
978
+ "epoch": 0.86,
979
+ "learning_rate": 1.679273338897293e-05,
980
+ "loss": 0.0297,
981
+ "step": 162
982
+ },
983
+ {
984
+ "epoch": 0.86,
985
+ "learning_rate": 1.6750626611782624e-05,
986
+ "loss": 0.0275,
987
+ "step": 163
988
+ },
989
+ {
990
+ "epoch": 0.87,
991
+ "learning_rate": 1.6708298780805808e-05,
992
+ "loss": 0.0244,
993
+ "step": 164
994
+ },
995
+ {
996
+ "epoch": 0.87,
997
+ "learning_rate": 1.6665751282095634e-05,
998
+ "loss": 0.0226,
999
+ "step": 165
1000
+ },
1001
+ {
1002
+ "epoch": 0.88,
1003
+ "learning_rate": 1.6622985508898427e-05,
1004
+ "loss": 0.0293,
1005
+ "step": 166
1006
+ },
1007
+ {
1008
+ "epoch": 0.88,
1009
+ "learning_rate": 1.6580002861608053e-05,
1010
+ "loss": 0.0307,
1011
+ "step": 167
1012
+ },
1013
+ {
1014
+ "epoch": 0.89,
1015
+ "learning_rate": 1.653680474772006e-05,
1016
+ "loss": 0.0267,
1017
+ "step": 168
1018
+ },
1019
+ {
1020
+ "epoch": 0.89,
1021
+ "learning_rate": 1.6493392581785608e-05,
1022
+ "loss": 0.0295,
1023
+ "step": 169
1024
+ },
1025
+ {
1026
+ "epoch": 0.9,
1027
+ "learning_rate": 1.644976778536512e-05,
1028
+ "loss": 0.0274,
1029
+ "step": 170
1030
+ },
1031
+ {
1032
+ "epoch": 0.9,
1033
+ "learning_rate": 1.6405931786981753e-05,
1034
+ "loss": 0.0282,
1035
+ "step": 171
1036
+ },
1037
+ {
1038
+ "epoch": 0.91,
1039
+ "learning_rate": 1.6361886022074612e-05,
1040
+ "loss": 0.0245,
1041
+ "step": 172
1042
+ },
1043
+ {
1044
+ "epoch": 0.92,
1045
+ "learning_rate": 1.6317631932951754e-05,
1046
+ "loss": 0.0302,
1047
+ "step": 173
1048
+ },
1049
+ {
1050
+ "epoch": 0.92,
1051
+ "learning_rate": 1.6273170968742942e-05,
1052
+ "loss": 0.0271,
1053
+ "step": 174
1054
+ },
1055
+ {
1056
+ "epoch": 0.93,
1057
+ "learning_rate": 1.62285045853522e-05,
1058
+ "loss": 0.0267,
1059
+ "step": 175
1060
+ },
1061
+ {
1062
+ "epoch": 0.93,
1063
+ "learning_rate": 1.618363424541016e-05,
1064
+ "loss": 0.0201,
1065
+ "step": 176
1066
+ },
1067
+ {
1068
+ "epoch": 0.94,
1069
+ "learning_rate": 1.613856141822612e-05,
1070
+ "loss": 0.0324,
1071
+ "step": 177
1072
+ },
1073
+ {
1074
+ "epoch": 0.94,
1075
+ "learning_rate": 1.6093287579739983e-05,
1076
+ "loss": 0.0289,
1077
+ "step": 178
1078
+ },
1079
+ {
1080
+ "epoch": 0.95,
1081
+ "learning_rate": 1.604781421247389e-05,
1082
+ "loss": 0.0288,
1083
+ "step": 179
1084
+ },
1085
+ {
1086
+ "epoch": 0.95,
1087
+ "learning_rate": 1.6002142805483686e-05,
1088
+ "loss": 0.029,
1089
+ "step": 180
1090
+ },
1091
+ {
1092
+ "epoch": 0.96,
1093
+ "learning_rate": 1.5956274854310157e-05,
1094
+ "loss": 0.0242,
1095
+ "step": 181
1096
+ },
1097
+ {
1098
+ "epoch": 0.96,
1099
+ "learning_rate": 1.5910211860930063e-05,
1100
+ "loss": 0.0278,
1101
+ "step": 182
1102
+ },
1103
+ {
1104
+ "epoch": 0.97,
1105
+ "learning_rate": 1.586395533370696e-05,
1106
+ "loss": 0.0319,
1107
+ "step": 183
1108
+ },
1109
+ {
1110
+ "epoch": 0.97,
1111
+ "learning_rate": 1.5817506787341782e-05,
1112
+ "loss": 0.0247,
1113
+ "step": 184
1114
+ },
1115
+ {
1116
+ "epoch": 0.98,
1117
+ "learning_rate": 1.5770867742823268e-05,
1118
+ "loss": 0.0246,
1119
+ "step": 185
1120
+ },
1121
+ {
1122
+ "epoch": 0.98,
1123
+ "learning_rate": 1.572403972737815e-05,
1124
+ "loss": 0.0273,
1125
+ "step": 186
1126
+ },
1127
+ {
1128
+ "epoch": 0.99,
1129
+ "learning_rate": 1.567702427442113e-05,
1130
+ "loss": 0.0281,
1131
+ "step": 187
1132
+ },
1133
+ {
1134
+ "epoch": 0.99,
1135
+ "learning_rate": 1.5629822923504692e-05,
1136
+ "loss": 0.0289,
1137
+ "step": 188
1138
+ },
1139
+ {
1140
+ "epoch": 1.0,
1141
+ "learning_rate": 1.5582437220268648e-05,
1142
+ "loss": 0.026,
1143
+ "step": 189
1144
+ },
1145
+ {
1146
+ "epoch": 1.01,
1147
+ "learning_rate": 1.553486871638958e-05,
1148
+ "loss": 0.0183,
1149
+ "step": 190
1150
+ },
1151
+ {
1152
+ "epoch": 1.01,
1153
+ "learning_rate": 1.5487118969529973e-05,
1154
+ "loss": 0.0248,
1155
+ "step": 191
1156
+ },
1157
+ {
1158
+ "epoch": 1.02,
1159
+ "learning_rate": 1.5439189543287247e-05,
1160
+ "loss": 0.0309,
1161
+ "step": 192
1162
+ },
1163
+ {
1164
+ "epoch": 1.02,
1165
+ "learning_rate": 1.539108200714255e-05,
1166
+ "loss": 0.0274,
1167
+ "step": 193
1168
+ },
1169
+ {
1170
+ "epoch": 1.03,
1171
+ "learning_rate": 1.534279793640935e-05,
1172
+ "loss": 0.0235,
1173
+ "step": 194
1174
+ },
1175
+ {
1176
+ "epoch": 1.03,
1177
+ "learning_rate": 1.529433891218185e-05,
1178
+ "loss": 0.0276,
1179
+ "step": 195
1180
+ },
1181
+ {
1182
+ "epoch": 1.04,
1183
+ "learning_rate": 1.5245706521283246e-05,
1184
+ "loss": 0.0228,
1185
+ "step": 196
1186
+ },
1187
+ {
1188
+ "epoch": 1.04,
1189
+ "learning_rate": 1.5196902356213715e-05,
1190
+ "loss": 0.0213,
1191
+ "step": 197
1192
+ },
1193
+ {
1194
+ "epoch": 1.05,
1195
+ "learning_rate": 1.5147928015098309e-05,
1196
+ "loss": 0.0185,
1197
+ "step": 198
1198
+ },
1199
+ {
1200
+ "epoch": 1.05,
1201
+ "learning_rate": 1.5098785101634605e-05,
1202
+ "loss": 0.0231,
1203
+ "step": 199
1204
+ },
1205
+ {
1206
+ "epoch": 1.06,
1207
+ "learning_rate": 1.5049475225040202e-05,
1208
+ "loss": 0.0202,
1209
+ "step": 200
1210
+ },
1211
+ {
1212
+ "epoch": 1.06,
1213
+ "learning_rate": 1.5000000000000002e-05,
1214
+ "loss": 0.0236,
1215
+ "step": 201
1216
+ },
1217
+ {
1218
+ "epoch": 1.07,
1219
+ "learning_rate": 1.4950361046613367e-05,
1220
+ "loss": 0.0242,
1221
+ "step": 202
1222
+ },
1223
+ {
1224
+ "epoch": 1.07,
1225
+ "learning_rate": 1.4900559990341048e-05,
1226
+ "loss": 0.0254,
1227
+ "step": 203
1228
+ },
1229
+ {
1230
+ "epoch": 1.08,
1231
+ "learning_rate": 1.4850598461951963e-05,
1232
+ "loss": 0.0231,
1233
+ "step": 204
1234
+ },
1235
+ {
1236
+ "epoch": 1.08,
1237
+ "learning_rate": 1.4800478097469799e-05,
1238
+ "loss": 0.023,
1239
+ "step": 205
1240
+ },
1241
+ {
1242
+ "epoch": 1.09,
1243
+ "learning_rate": 1.4750200538119435e-05,
1244
+ "loss": 0.025,
1245
+ "step": 206
1246
+ },
1247
+ {
1248
+ "epoch": 1.1,
1249
+ "learning_rate": 1.4699767430273202e-05,
1250
+ "loss": 0.0231,
1251
+ "step": 207
1252
+ },
1253
+ {
1254
+ "epoch": 1.1,
1255
+ "learning_rate": 1.4649180425396972e-05,
1256
+ "loss": 0.0239,
1257
+ "step": 208
1258
+ },
1259
+ {
1260
+ "epoch": 1.11,
1261
+ "learning_rate": 1.4598441179996075e-05,
1262
+ "loss": 0.0277,
1263
+ "step": 209
1264
+ },
1265
+ {
1266
+ "epoch": 1.11,
1267
+ "learning_rate": 1.454755135556106e-05,
1268
+ "loss": 0.0231,
1269
+ "step": 210
1270
+ },
1271
+ {
1272
+ "epoch": 1.12,
1273
+ "learning_rate": 1.4496512618513289e-05,
1274
+ "loss": 0.0225,
1275
+ "step": 211
1276
+ },
1277
+ {
1278
+ "epoch": 1.12,
1279
+ "learning_rate": 1.444532664015037e-05,
1280
+ "loss": 0.0266,
1281
+ "step": 212
1282
+ },
1283
+ {
1284
+ "epoch": 1.13,
1285
+ "learning_rate": 1.4393995096591415e-05,
1286
+ "loss": 0.0204,
1287
+ "step": 213
1288
+ },
1289
+ {
1290
+ "epoch": 1.13,
1291
+ "learning_rate": 1.4342519668722184e-05,
1292
+ "loss": 0.0256,
1293
+ "step": 214
1294
+ },
1295
+ {
1296
+ "epoch": 1.14,
1297
+ "learning_rate": 1.4290902042140005e-05,
1298
+ "loss": 0.0231,
1299
+ "step": 215
1300
+ },
1301
+ {
1302
+ "epoch": 1.14,
1303
+ "learning_rate": 1.423914390709861e-05,
1304
+ "loss": 0.0203,
1305
+ "step": 216
1306
+ },
1307
+ {
1308
+ "epoch": 1.15,
1309
+ "learning_rate": 1.4187246958452772e-05,
1310
+ "loss": 0.0259,
1311
+ "step": 217
1312
+ },
1313
+ {
1314
+ "epoch": 1.15,
1315
+ "learning_rate": 1.413521289560281e-05,
1316
+ "loss": 0.0242,
1317
+ "step": 218
1318
+ },
1319
+ {
1320
+ "epoch": 1.16,
1321
+ "learning_rate": 1.4083043422438936e-05,
1322
+ "loss": 0.0219,
1323
+ "step": 219
1324
+ },
1325
+ {
1326
+ "epoch": 1.16,
1327
+ "learning_rate": 1.4030740247285466e-05,
1328
+ "loss": 0.0295,
1329
+ "step": 220
1330
+ },
1331
+ {
1332
+ "epoch": 1.17,
1333
+ "learning_rate": 1.3978305082844876e-05,
1334
+ "loss": 0.0188,
1335
+ "step": 221
1336
+ },
1337
+ {
1338
+ "epoch": 1.17,
1339
+ "learning_rate": 1.3925739646141721e-05,
1340
+ "loss": 0.0253,
1341
+ "step": 222
1342
+ },
1343
+ {
1344
+ "epoch": 1.18,
1345
+ "learning_rate": 1.3873045658466404e-05,
1346
+ "loss": 0.0284,
1347
+ "step": 223
1348
+ },
1349
+ {
1350
+ "epoch": 1.19,
1351
+ "learning_rate": 1.3820224845318821e-05,
1352
+ "loss": 0.0229,
1353
+ "step": 224
1354
+ },
1355
+ {
1356
+ "epoch": 1.19,
1357
+ "learning_rate": 1.3767278936351853e-05,
1358
+ "loss": 0.0209,
1359
+ "step": 225
1360
+ },
1361
+ {
1362
+ "epoch": 1.2,
1363
+ "learning_rate": 1.371420966531472e-05,
1364
+ "loss": 0.0266,
1365
+ "step": 226
1366
+ },
1367
+ {
1368
+ "epoch": 1.2,
1369
+ "learning_rate": 1.3661018769996228e-05,
1370
+ "loss": 0.0253,
1371
+ "step": 227
1372
+ },
1373
+ {
1374
+ "epoch": 1.21,
1375
+ "learning_rate": 1.3607707992167836e-05,
1376
+ "loss": 0.0247,
1377
+ "step": 228
1378
+ },
1379
+ {
1380
+ "epoch": 1.21,
1381
+ "learning_rate": 1.3554279077526648e-05,
1382
+ "loss": 0.0213,
1383
+ "step": 229
1384
+ },
1385
+ {
1386
+ "epoch": 1.22,
1387
+ "learning_rate": 1.3500733775638232e-05,
1388
+ "loss": 0.0321,
1389
+ "step": 230
1390
+ },
1391
+ {
1392
+ "epoch": 1.22,
1393
+ "learning_rate": 1.3447073839879339e-05,
1394
+ "loss": 0.0238,
1395
+ "step": 231
1396
+ },
1397
+ {
1398
+ "epoch": 1.23,
1399
+ "learning_rate": 1.3393301027380476e-05,
1400
+ "loss": 0.0228,
1401
+ "step": 232
1402
+ },
1403
+ {
1404
+ "epoch": 1.23,
1405
+ "learning_rate": 1.333941709896838e-05,
1406
+ "loss": 0.0227,
1407
+ "step": 233
1408
+ },
1409
+ {
1410
+ "epoch": 1.24,
1411
+ "learning_rate": 1.3285423819108349e-05,
1412
+ "loss": 0.022,
1413
+ "step": 234
1414
+ },
1415
+ {
1416
+ "epoch": 1.24,
1417
+ "learning_rate": 1.3231322955846469e-05,
1418
+ "loss": 0.0261,
1419
+ "step": 235
1420
+ },
1421
+ {
1422
+ "epoch": 1.25,
1423
+ "learning_rate": 1.3177116280751717e-05,
1424
+ "loss": 0.0194,
1425
+ "step": 236
1426
+ },
1427
+ {
1428
+ "epoch": 1.25,
1429
+ "learning_rate": 1.3122805568857948e-05,
1430
+ "loss": 0.0227,
1431
+ "step": 237
1432
+ },
1433
+ {
1434
+ "epoch": 1.26,
1435
+ "learning_rate": 1.3068392598605775e-05,
1436
+ "loss": 0.0217,
1437
+ "step": 238
1438
+ },
1439
+ {
1440
+ "epoch": 1.26,
1441
+ "learning_rate": 1.3013879151784321e-05,
1442
+ "loss": 0.0261,
1443
+ "step": 239
1444
+ },
1445
+ {
1446
+ "epoch": 1.27,
1447
+ "learning_rate": 1.2959267013472894e-05,
1448
+ "loss": 0.0243,
1449
+ "step": 240
1450
+ },
1451
+ {
1452
+ "epoch": 1.28,
1453
+ "learning_rate": 1.2904557971982514e-05,
1454
+ "loss": 0.0257,
1455
+ "step": 241
1456
+ },
1457
+ {
1458
+ "epoch": 1.28,
1459
+ "learning_rate": 1.2849753818797353e-05,
1460
+ "loss": 0.0227,
1461
+ "step": 242
1462
+ },
1463
+ {
1464
+ "epoch": 1.29,
1465
+ "learning_rate": 1.2794856348516095e-05,
1466
+ "loss": 0.0187,
1467
+ "step": 243
1468
+ },
1469
+ {
1470
+ "epoch": 1.29,
1471
+ "learning_rate": 1.2739867358793142e-05,
1472
+ "loss": 0.021,
1473
+ "step": 244
1474
+ },
1475
+ {
1476
+ "epoch": 1.3,
1477
+ "learning_rate": 1.2684788650279772e-05,
1478
+ "loss": 0.0249,
1479
+ "step": 245
1480
+ },
1481
+ {
1482
+ "epoch": 1.3,
1483
+ "learning_rate": 1.2629622026565147e-05,
1484
+ "loss": 0.0238,
1485
+ "step": 246
1486
+ },
1487
+ {
1488
+ "epoch": 1.31,
1489
+ "learning_rate": 1.2574369294117296e-05,
1490
+ "loss": 0.0261,
1491
+ "step": 247
1492
+ },
1493
+ {
1494
+ "epoch": 1.31,
1495
+ "learning_rate": 1.2519032262223913e-05,
1496
+ "loss": 0.0242,
1497
+ "step": 248
1498
+ },
1499
+ {
1500
+ "epoch": 1.32,
1501
+ "learning_rate": 1.2463612742933148e-05,
1502
+ "loss": 0.0219,
1503
+ "step": 249
1504
+ },
1505
+ {
1506
+ "epoch": 1.32,
1507
+ "learning_rate": 1.2408112550994253e-05,
1508
+ "loss": 0.0273,
1509
+ "step": 250
1510
+ },
1511
+ {
1512
+ "epoch": 1.33,
1513
+ "learning_rate": 1.2352533503798156e-05,
1514
+ "loss": 0.0245,
1515
+ "step": 251
1516
+ },
1517
+ {
1518
+ "epoch": 1.33,
1519
+ "learning_rate": 1.2296877421317958e-05,
1520
+ "loss": 0.0186,
1521
+ "step": 252
1522
+ },
1523
+ {
1524
+ "epoch": 1.34,
1525
+ "learning_rate": 1.2241146126049326e-05,
1526
+ "loss": 0.0159,
1527
+ "step": 253
1528
+ },
1529
+ {
1530
+ "epoch": 1.34,
1531
+ "learning_rate": 1.2185341442950829e-05,
1532
+ "loss": 0.0225,
1533
+ "step": 254
1534
+ },
1535
+ {
1536
+ "epoch": 1.35,
1537
+ "learning_rate": 1.2129465199384158e-05,
1538
+ "loss": 0.024,
1539
+ "step": 255
1540
+ },
1541
+ {
1542
+ "epoch": 1.35,
1543
+ "learning_rate": 1.2073519225054314e-05,
1544
+ "loss": 0.0224,
1545
+ "step": 256
1546
+ },
1547
+ {
1548
+ "epoch": 1.36,
1549
+ "learning_rate": 1.201750535194966e-05,
1550
+ "loss": 0.0178,
1551
+ "step": 257
1552
+ },
1553
+ {
1554
+ "epoch": 1.37,
1555
+ "learning_rate": 1.196142541428197e-05,
1556
+ "loss": 0.0227,
1557
+ "step": 258
1558
+ },
1559
+ {
1560
+ "epoch": 1.37,
1561
+ "learning_rate": 1.1905281248426333e-05,
1562
+ "loss": 0.0248,
1563
+ "step": 259
1564
+ },
1565
+ {
1566
+ "epoch": 1.38,
1567
+ "learning_rate": 1.1849074692861033e-05,
1568
+ "loss": 0.0231,
1569
+ "step": 260
1570
+ },
1571
+ {
1572
+ "epoch": 1.38,
1573
+ "learning_rate": 1.1792807588107358e-05,
1574
+ "loss": 0.0221,
1575
+ "step": 261
1576
+ },
1577
+ {
1578
+ "epoch": 1.39,
1579
+ "learning_rate": 1.1736481776669307e-05,
1580
+ "loss": 0.0237,
1581
+ "step": 262
1582
+ },
1583
+ {
1584
+ "epoch": 1.39,
1585
+ "learning_rate": 1.1680099102973271e-05,
1586
+ "loss": 0.0205,
1587
+ "step": 263
1588
+ },
1589
+ {
1590
+ "epoch": 1.4,
1591
+ "learning_rate": 1.1623661413307638e-05,
1592
+ "loss": 0.0295,
1593
+ "step": 264
1594
+ },
1595
+ {
1596
+ "epoch": 1.4,
1597
+ "learning_rate": 1.1567170555762335e-05,
1598
+ "loss": 0.0224,
1599
+ "step": 265
1600
+ },
1601
+ {
1602
+ "epoch": 1.41,
1603
+ "learning_rate": 1.1510628380168291e-05,
1604
+ "loss": 0.023,
1605
+ "step": 266
1606
+ },
1607
+ {
1608
+ "epoch": 1.41,
1609
+ "learning_rate": 1.14540367380369e-05,
1610
+ "loss": 0.0218,
1611
+ "step": 267
1612
+ },
1613
+ {
1614
+ "epoch": 1.42,
1615
+ "learning_rate": 1.1397397482499352e-05,
1616
+ "loss": 0.0185,
1617
+ "step": 268
1618
+ },
1619
+ {
1620
+ "epoch": 1.42,
1621
+ "learning_rate": 1.1340712468245977e-05,
1622
+ "loss": 0.0261,
1623
+ "step": 269
1624
+ },
1625
+ {
1626
+ "epoch": 1.43,
1627
+ "learning_rate": 1.1283983551465512e-05,
1628
+ "loss": 0.024,
1629
+ "step": 270
1630
+ },
1631
+ {
1632
+ "epoch": 1.43,
1633
+ "learning_rate": 1.1227212589784297e-05,
1634
+ "loss": 0.0235,
1635
+ "step": 271
1636
+ },
1637
+ {
1638
+ "epoch": 1.44,
1639
+ "learning_rate": 1.1170401442205475e-05,
1640
+ "loss": 0.0214,
1641
+ "step": 272
1642
+ },
1643
+ {
1644
+ "epoch": 1.44,
1645
+ "learning_rate": 1.1113551969048088e-05,
1646
+ "loss": 0.0218,
1647
+ "step": 273
1648
+ },
1649
+ {
1650
+ "epoch": 1.45,
1651
+ "learning_rate": 1.1056666031886193e-05,
1652
+ "loss": 0.0185,
1653
+ "step": 274
1654
+ },
1655
+ {
1656
+ "epoch": 1.46,
1657
+ "learning_rate": 1.099974549348787e-05,
1658
+ "loss": 0.0211,
1659
+ "step": 275
1660
+ },
1661
+ {
1662
+ "epoch": 1.46,
1663
+ "learning_rate": 1.0942792217754245e-05,
1664
+ "loss": 0.0229,
1665
+ "step": 276
1666
+ },
1667
+ {
1668
+ "epoch": 1.47,
1669
+ "learning_rate": 1.0885808069658452e-05,
1670
+ "loss": 0.0232,
1671
+ "step": 277
1672
+ },
1673
+ {
1674
+ "epoch": 1.47,
1675
+ "learning_rate": 1.0828794915184556e-05,
1676
+ "loss": 0.0227,
1677
+ "step": 278
1678
+ },
1679
+ {
1680
+ "epoch": 1.48,
1681
+ "learning_rate": 1.0771754621266466e-05,
1682
+ "loss": 0.025,
1683
+ "step": 279
1684
+ },
1685
+ {
1686
+ "epoch": 1.48,
1687
+ "learning_rate": 1.071468905572677e-05,
1688
+ "loss": 0.02,
1689
+ "step": 280
1690
+ },
1691
+ {
1692
+ "epoch": 1.49,
1693
+ "learning_rate": 1.0657600087215618e-05,
1694
+ "loss": 0.0253,
1695
+ "step": 281
1696
+ },
1697
+ {
1698
+ "epoch": 1.49,
1699
+ "learning_rate": 1.0600489585149485e-05,
1700
+ "loss": 0.0218,
1701
+ "step": 282
1702
+ },
1703
+ {
1704
+ "epoch": 1.5,
1705
+ "learning_rate": 1.0543359419649986e-05,
1706
+ "loss": 0.0212,
1707
+ "step": 283
1708
+ },
1709
+ {
1710
+ "epoch": 1.5,
1711
+ "learning_rate": 1.0486211461482625e-05,
1712
+ "loss": 0.0225,
1713
+ "step": 284
1714
+ },
1715
+ {
1716
+ "epoch": 1.51,
1717
+ "learning_rate": 1.0429047581995547e-05,
1718
+ "loss": 0.0216,
1719
+ "step": 285
1720
+ },
1721
+ {
1722
+ "epoch": 1.51,
1723
+ "learning_rate": 1.0371869653058235e-05,
1724
+ "loss": 0.0209,
1725
+ "step": 286
1726
+ },
1727
+ {
1728
+ "epoch": 1.52,
1729
+ "learning_rate": 1.0314679547000251e-05,
1730
+ "loss": 0.0228,
1731
+ "step": 287
1732
+ },
1733
+ {
1734
+ "epoch": 1.52,
1735
+ "learning_rate": 1.0257479136549889e-05,
1736
+ "loss": 0.0187,
1737
+ "step": 288
1738
+ },
1739
+ {
1740
+ "epoch": 1.53,
1741
+ "learning_rate": 1.0200270294772869e-05,
1742
+ "loss": 0.0172,
1743
+ "step": 289
1744
+ },
1745
+ {
1746
+ "epoch": 1.53,
1747
+ "learning_rate": 1.0143054895011011e-05,
1748
+ "loss": 0.0247,
1749
+ "step": 290
1750
+ },
1751
+ {
1752
+ "epoch": 1.54,
1753
+ "learning_rate": 1.0085834810820871e-05,
1754
+ "loss": 0.016,
1755
+ "step": 291
1756
+ },
1757
+ {
1758
+ "epoch": 1.54,
1759
+ "learning_rate": 1.0028611915912405e-05,
1760
+ "loss": 0.0187,
1761
+ "step": 292
1762
+ },
1763
+ {
1764
+ "epoch": 1.55,
1765
+ "learning_rate": 9.9713880840876e-06,
1766
+ "loss": 0.0221,
1767
+ "step": 293
1768
+ },
1769
+ {
1770
+ "epoch": 1.56,
1771
+ "learning_rate": 9.914165189179132e-06,
1772
+ "loss": 0.0246,
1773
+ "step": 294
1774
+ },
1775
+ {
1776
+ "epoch": 1.56,
1777
+ "learning_rate": 9.856945104988989e-06,
1778
+ "loss": 0.0241,
1779
+ "step": 295
1780
+ },
1781
+ {
1782
+ "epoch": 1.57,
1783
+ "learning_rate": 9.799729705227133e-06,
1784
+ "loss": 0.0213,
1785
+ "step": 296
1786
+ },
1787
+ {
1788
+ "epoch": 1.57,
1789
+ "learning_rate": 9.742520863450116e-06,
1790
+ "loss": 0.025,
1791
+ "step": 297
1792
+ },
1793
+ {
1794
+ "epoch": 1.58,
1795
+ "learning_rate": 9.68532045299975e-06,
1796
+ "loss": 0.0232,
1797
+ "step": 298
1798
+ },
1799
+ {
1800
+ "epoch": 1.58,
1801
+ "learning_rate": 9.628130346941767e-06,
1802
+ "loss": 0.0286,
1803
+ "step": 299
1804
+ },
1805
+ {
1806
+ "epoch": 1.59,
1807
+ "learning_rate": 9.570952418004455e-06,
1808
+ "loss": 0.0247,
1809
+ "step": 300
1810
+ },
1811
+ {
1812
+ "epoch": 1.59,
1813
+ "learning_rate": 9.513788538517375e-06,
1814
+ "loss": 0.0209,
1815
+ "step": 301
1816
+ },
1817
+ {
1818
+ "epoch": 1.6,
1819
+ "learning_rate": 9.456640580350019e-06,
1820
+ "loss": 0.0223,
1821
+ "step": 302
1822
+ },
1823
+ {
1824
+ "epoch": 1.6,
1825
+ "learning_rate": 9.399510414850518e-06,
1826
+ "loss": 0.026,
1827
+ "step": 303
1828
+ },
1829
+ {
1830
+ "epoch": 1.61,
1831
+ "learning_rate": 9.342399912784387e-06,
1832
+ "loss": 0.0231,
1833
+ "step": 304
1834
+ },
1835
+ {
1836
+ "epoch": 1.61,
1837
+ "learning_rate": 9.285310944273232e-06,
1838
+ "loss": 0.0206,
1839
+ "step": 305
1840
+ },
1841
+ {
1842
+ "epoch": 1.62,
1843
+ "learning_rate": 9.228245378733537e-06,
1844
+ "loss": 0.0206,
1845
+ "step": 306
1846
+ },
1847
+ {
1848
+ "epoch": 1.62,
1849
+ "learning_rate": 9.171205084815445e-06,
1850
+ "loss": 0.0244,
1851
+ "step": 307
1852
+ },
1853
+ {
1854
+ "epoch": 1.63,
1855
+ "learning_rate": 9.11419193034155e-06,
1856
+ "loss": 0.0214,
1857
+ "step": 308
1858
+ },
1859
+ {
1860
+ "epoch": 1.63,
1861
+ "learning_rate": 9.057207782245756e-06,
1862
+ "loss": 0.0242,
1863
+ "step": 309
1864
+ },
1865
+ {
1866
+ "epoch": 1.64,
1867
+ "learning_rate": 9.000254506512133e-06,
1868
+ "loss": 0.0187,
1869
+ "step": 310
1870
+ },
1871
+ {
1872
+ "epoch": 1.65,
1873
+ "learning_rate": 8.943333968113808e-06,
1874
+ "loss": 0.0186,
1875
+ "step": 311
1876
+ },
1877
+ {
1878
+ "epoch": 1.65,
1879
+ "learning_rate": 8.886448030951912e-06,
1880
+ "loss": 0.0255,
1881
+ "step": 312
1882
+ },
1883
+ {
1884
+ "epoch": 1.66,
1885
+ "learning_rate": 8.82959855779453e-06,
1886
+ "loss": 0.0229,
1887
+ "step": 313
1888
+ },
1889
+ {
1890
+ "epoch": 1.66,
1891
+ "learning_rate": 8.772787410215706e-06,
1892
+ "loss": 0.0202,
1893
+ "step": 314
1894
+ },
1895
+ {
1896
+ "epoch": 1.67,
1897
+ "learning_rate": 8.71601644853449e-06,
1898
+ "loss": 0.0179,
1899
+ "step": 315
1900
+ },
1901
+ {
1902
+ "epoch": 1.67,
1903
+ "learning_rate": 8.659287531754025e-06,
1904
+ "loss": 0.0224,
1905
+ "step": 316
1906
+ },
1907
+ {
1908
+ "epoch": 1.68,
1909
+ "learning_rate": 8.60260251750065e-06,
1910
+ "loss": 0.0211,
1911
+ "step": 317
1912
+ },
1913
+ {
1914
+ "epoch": 1.68,
1915
+ "learning_rate": 8.545963261963102e-06,
1916
+ "loss": 0.021,
1917
+ "step": 318
1918
+ },
1919
+ {
1920
+ "epoch": 1.69,
1921
+ "learning_rate": 8.48937161983171e-06,
1922
+ "loss": 0.0203,
1923
+ "step": 319
1924
+ },
1925
+ {
1926
+ "epoch": 1.69,
1927
+ "learning_rate": 8.432829444237667e-06,
1928
+ "loss": 0.0226,
1929
+ "step": 320
1930
+ },
1931
+ {
1932
+ "epoch": 1.7,
1933
+ "learning_rate": 8.376338586692367e-06,
1934
+ "loss": 0.0224,
1935
+ "step": 321
1936
+ },
1937
+ {
1938
+ "epoch": 1.7,
1939
+ "learning_rate": 8.319900897026734e-06,
1940
+ "loss": 0.0194,
1941
+ "step": 322
1942
+ },
1943
+ {
1944
+ "epoch": 1.71,
1945
+ "learning_rate": 8.263518223330698e-06,
1946
+ "loss": 0.0191,
1947
+ "step": 323
1948
+ },
1949
+ {
1950
+ "epoch": 1.71,
1951
+ "learning_rate": 8.207192411892645e-06,
1952
+ "loss": 0.0196,
1953
+ "step": 324
1954
+ },
1955
+ {
1956
+ "epoch": 1.72,
1957
+ "learning_rate": 8.150925307138968e-06,
1958
+ "loss": 0.0269,
1959
+ "step": 325
1960
+ },
1961
+ {
1962
+ "epoch": 1.72,
1963
+ "learning_rate": 8.094718751573669e-06,
1964
+ "loss": 0.0221,
1965
+ "step": 326
1966
+ },
1967
+ {
1968
+ "epoch": 1.73,
1969
+ "learning_rate": 8.038574585718032e-06,
1970
+ "loss": 0.021,
1971
+ "step": 327
1972
+ },
1973
+ {
1974
+ "epoch": 1.74,
1975
+ "learning_rate": 7.982494648050341e-06,
1976
+ "loss": 0.0257,
1977
+ "step": 328
1978
+ },
1979
+ {
1980
+ "epoch": 1.74,
1981
+ "learning_rate": 7.926480774945688e-06,
1982
+ "loss": 0.0224,
1983
+ "step": 329
1984
+ },
1985
+ {
1986
+ "epoch": 1.75,
1987
+ "learning_rate": 7.870534800615845e-06,
1988
+ "loss": 0.0219,
1989
+ "step": 330
1990
+ },
1991
+ {
1992
+ "epoch": 1.75,
1993
+ "learning_rate": 7.814658557049175e-06,
1994
+ "loss": 0.0228,
1995
+ "step": 331
1996
+ },
1997
+ {
1998
+ "epoch": 1.76,
1999
+ "learning_rate": 7.758853873950676e-06,
2000
+ "loss": 0.0238,
2001
+ "step": 332
2002
+ },
2003
+ {
2004
+ "epoch": 1.76,
2005
+ "learning_rate": 7.703122578682047e-06,
2006
+ "loss": 0.0211,
2007
+ "step": 333
2008
+ },
2009
+ {
2010
+ "epoch": 1.77,
2011
+ "learning_rate": 7.647466496201848e-06,
2012
+ "loss": 0.018,
2013
+ "step": 334
2014
+ },
2015
+ {
2016
+ "epoch": 1.77,
2017
+ "learning_rate": 7.591887449005748e-06,
2018
+ "loss": 0.0223,
2019
+ "step": 335
2020
+ },
2021
+ {
2022
+ "epoch": 1.78,
2023
+ "learning_rate": 7.536387257066854e-06,
2024
+ "loss": 0.0243,
2025
+ "step": 336
2026
+ },
2027
+ {
2028
+ "epoch": 1.78,
2029
+ "learning_rate": 7.480967737776089e-06,
2030
+ "loss": 0.0214,
2031
+ "step": 337
2032
+ },
2033
+ {
2034
+ "epoch": 1.79,
2035
+ "learning_rate": 7.425630705882707e-06,
2036
+ "loss": 0.0199,
2037
+ "step": 338
2038
+ },
2039
+ {
2040
+ "epoch": 1.79,
2041
+ "learning_rate": 7.370377973434854e-06,
2042
+ "loss": 0.0246,
2043
+ "step": 339
2044
+ },
2045
+ {
2046
+ "epoch": 1.8,
2047
+ "learning_rate": 7.315211349720231e-06,
2048
+ "loss": 0.0192,
2049
+ "step": 340
2050
+ },
2051
+ {
2052
+ "epoch": 1.8,
2053
+ "learning_rate": 7.260132641206861e-06,
2054
+ "loss": 0.0179,
2055
+ "step": 341
2056
+ },
2057
+ {
2058
+ "epoch": 1.81,
2059
+ "learning_rate": 7.2051436514839064e-06,
2060
+ "loss": 0.0188,
2061
+ "step": 342
2062
+ },
2063
+ {
2064
+ "epoch": 1.81,
2065
+ "learning_rate": 7.150246181202648e-06,
2066
+ "loss": 0.0193,
2067
+ "step": 343
2068
+ },
2069
+ {
2070
+ "epoch": 1.82,
2071
+ "learning_rate": 7.0954420280174915e-06,
2072
+ "loss": 0.0177,
2073
+ "step": 344
2074
+ },
2075
+ {
2076
+ "epoch": 1.83,
2077
+ "learning_rate": 7.040732986527108e-06,
2078
+ "loss": 0.0197,
2079
+ "step": 345
2080
+ },
2081
+ {
2082
+ "epoch": 1.83,
2083
+ "learning_rate": 6.9861208482156785e-06,
2084
+ "loss": 0.0214,
2085
+ "step": 346
2086
+ },
2087
+ {
2088
+ "epoch": 1.84,
2089
+ "learning_rate": 6.931607401394229e-06,
2090
+ "loss": 0.0175,
2091
+ "step": 347
2092
+ },
2093
+ {
2094
+ "epoch": 1.84,
2095
+ "learning_rate": 6.877194431142055e-06,
2096
+ "loss": 0.0202,
2097
+ "step": 348
2098
+ },
2099
+ {
2100
+ "epoch": 1.85,
2101
+ "learning_rate": 6.822883719248283e-06,
2102
+ "loss": 0.0194,
2103
+ "step": 349
2104
+ },
2105
+ {
2106
+ "epoch": 1.85,
2107
+ "learning_rate": 6.768677044153535e-06,
2108
+ "loss": 0.0242,
2109
+ "step": 350
2110
+ },
2111
+ {
2112
+ "epoch": 1.86,
2113
+ "learning_rate": 6.714576180891653e-06,
2114
+ "loss": 0.0248,
2115
+ "step": 351
2116
+ },
2117
+ {
2118
+ "epoch": 1.86,
2119
+ "learning_rate": 6.660582901031621e-06,
2120
+ "loss": 0.025,
2121
+ "step": 352
2122
+ },
2123
+ {
2124
+ "epoch": 1.87,
2125
+ "learning_rate": 6.6066989726195265e-06,
2126
+ "loss": 0.0195,
2127
+ "step": 353
2128
+ },
2129
+ {
2130
+ "epoch": 1.87,
2131
+ "learning_rate": 6.552926160120663e-06,
2132
+ "loss": 0.0189,
2133
+ "step": 354
2134
+ },
2135
+ {
2136
+ "epoch": 1.88,
2137
+ "learning_rate": 6.499266224361768e-06,
2138
+ "loss": 0.0201,
2139
+ "step": 355
2140
+ },
2141
+ {
2142
+ "epoch": 1.88,
2143
+ "learning_rate": 6.445720922473355e-06,
2144
+ "loss": 0.0227,
2145
+ "step": 356
2146
+ },
2147
+ {
2148
+ "epoch": 1.89,
2149
+ "learning_rate": 6.3922920078321685e-06,
2150
+ "loss": 0.0196,
2151
+ "step": 357
2152
+ },
2153
+ {
2154
+ "epoch": 1.89,
2155
+ "learning_rate": 6.3389812300037774e-06,
2156
+ "loss": 0.0233,
2157
+ "step": 358
2158
+ },
2159
+ {
2160
+ "epoch": 1.9,
2161
+ "learning_rate": 6.285790334685283e-06,
2162
+ "loss": 0.02,
2163
+ "step": 359
2164
+ },
2165
+ {
2166
+ "epoch": 1.9,
2167
+ "learning_rate": 6.232721063648148e-06,
2168
+ "loss": 0.0173,
2169
+ "step": 360
2170
+ },
2171
+ {
2172
+ "epoch": 1.91,
2173
+ "learning_rate": 6.179775154681184e-06,
2174
+ "loss": 0.0198,
2175
+ "step": 361
2176
+ },
2177
+ {
2178
+ "epoch": 1.92,
2179
+ "learning_rate": 6.1269543415336e-06,
2180
+ "loss": 0.0224,
2181
+ "step": 362
2182
+ },
2183
+ {
2184
+ "epoch": 1.92,
2185
+ "learning_rate": 6.074260353858283e-06,
2186
+ "loss": 0.0186,
2187
+ "step": 363
2188
+ },
2189
+ {
2190
+ "epoch": 1.93,
2191
+ "learning_rate": 6.0216949171551285e-06,
2192
+ "loss": 0.0236,
2193
+ "step": 364
2194
+ },
2195
+ {
2196
+ "epoch": 1.93,
2197
+ "learning_rate": 5.969259752714536e-06,
2198
+ "loss": 0.0182,
2199
+ "step": 365
2200
+ },
2201
+ {
2202
+ "epoch": 1.94,
2203
+ "learning_rate": 5.916956577561066e-06,
2204
+ "loss": 0.0215,
2205
+ "step": 366
2206
+ },
2207
+ {
2208
+ "epoch": 1.94,
2209
+ "learning_rate": 5.864787104397194e-06,
2210
+ "loss": 0.0234,
2211
+ "step": 367
2212
+ },
2213
+ {
2214
+ "epoch": 1.95,
2215
+ "learning_rate": 5.81275304154723e-06,
2216
+ "loss": 0.0228,
2217
+ "step": 368
2218
+ },
2219
+ {
2220
+ "epoch": 1.95,
2221
+ "learning_rate": 5.760856092901394e-06,
2222
+ "loss": 0.0247,
2223
+ "step": 369
2224
+ },
2225
+ {
2226
+ "epoch": 1.96,
2227
+ "learning_rate": 5.709097957860001e-06,
2228
+ "loss": 0.0215,
2229
+ "step": 370
2230
+ },
2231
+ {
2232
+ "epoch": 1.96,
2233
+ "learning_rate": 5.6574803312778196e-06,
2234
+ "loss": 0.0184,
2235
+ "step": 371
2236
+ },
2237
+ {
2238
+ "epoch": 1.97,
2239
+ "learning_rate": 5.6060049034085815e-06,
2240
+ "loss": 0.0245,
2241
+ "step": 372
2242
+ },
2243
+ {
2244
+ "epoch": 1.97,
2245
+ "learning_rate": 5.554673359849632e-06,
2246
+ "loss": 0.0209,
2247
+ "step": 373
2248
+ },
2249
+ {
2250
+ "epoch": 1.98,
2251
+ "learning_rate": 5.5034873814867125e-06,
2252
+ "loss": 0.022,
2253
+ "step": 374
2254
+ },
2255
+ {
2256
+ "epoch": 1.98,
2257
+ "learning_rate": 5.4524486444389455e-06,
2258
+ "loss": 0.0236,
2259
+ "step": 375
2260
+ },
2261
+ {
2262
+ "epoch": 1.99,
2263
+ "learning_rate": 5.40155882000393e-06,
2264
+ "loss": 0.0192,
2265
+ "step": 376
2266
+ },
2267
+ {
2268
+ "epoch": 1.99,
2269
+ "learning_rate": 5.3508195746030304e-06,
2270
+ "loss": 0.0241,
2271
+ "step": 377
2272
+ },
2273
+ {
2274
+ "epoch": 2.0,
2275
+ "learning_rate": 5.300232569726805e-06,
2276
+ "loss": 0.0193,
2277
+ "step": 378
2278
+ },
2279
+ {
2280
+ "epoch": 2.01,
2281
+ "learning_rate": 5.249799461880569e-06,
2282
+ "loss": 0.0196,
2283
+ "step": 379
2284
+ },
2285
+ {
2286
+ "epoch": 2.01,
2287
+ "learning_rate": 5.199521902530203e-06,
2288
+ "loss": 0.0222,
2289
+ "step": 380
2290
+ },
2291
+ {
2292
+ "epoch": 2.02,
2293
+ "learning_rate": 5.14940153804804e-06,
2294
+ "loss": 0.0222,
2295
+ "step": 381
2296
+ },
2297
+ {
2298
+ "epoch": 2.02,
2299
+ "learning_rate": 5.0994400096589565e-06,
2300
+ "loss": 0.0213,
2301
+ "step": 382
2302
+ },
2303
+ {
2304
+ "epoch": 2.03,
2305
+ "learning_rate": 5.049638953386635e-06,
2306
+ "loss": 0.0192,
2307
+ "step": 383
2308
+ },
2309
+ {
2310
+ "epoch": 2.03,
2311
+ "learning_rate": 5.000000000000003e-06,
2312
+ "loss": 0.0201,
2313
+ "step": 384
2314
+ },
2315
+ {
2316
+ "epoch": 2.04,
2317
+ "learning_rate": 4.950524774959801e-06,
2318
+ "loss": 0.0228,
2319
+ "step": 385
2320
+ },
2321
+ {
2322
+ "epoch": 2.04,
2323
+ "learning_rate": 4.901214898365396e-06,
2324
+ "loss": 0.0189,
2325
+ "step": 386
2326
+ },
2327
+ {
2328
+ "epoch": 2.05,
2329
+ "learning_rate": 4.852071984901696e-06,
2330
+ "loss": 0.0134,
2331
+ "step": 387
2332
+ },
2333
+ {
2334
+ "epoch": 2.05,
2335
+ "learning_rate": 4.803097643786289e-06,
2336
+ "loss": 0.0208,
2337
+ "step": 388
2338
+ },
2339
+ {
2340
+ "epoch": 2.06,
2341
+ "learning_rate": 4.754293478716755e-06,
2342
+ "loss": 0.0173,
2343
+ "step": 389
2344
+ },
2345
+ {
2346
+ "epoch": 2.06,
2347
+ "learning_rate": 4.705661087818149e-06,
2348
+ "loss": 0.0174,
2349
+ "step": 390
2350
+ },
2351
+ {
2352
+ "epoch": 2.07,
2353
+ "learning_rate": 4.6572020635906535e-06,
2354
+ "loss": 0.0163,
2355
+ "step": 391
2356
+ },
2357
+ {
2358
+ "epoch": 2.07,
2359
+ "learning_rate": 4.608917992857449e-06,
2360
+ "loss": 0.019,
2361
+ "step": 392
2362
+ },
2363
+ {
2364
+ "epoch": 2.08,
2365
+ "learning_rate": 4.560810456712754e-06,
2366
+ "loss": 0.0162,
2367
+ "step": 393
2368
+ },
2369
+ {
2370
+ "epoch": 2.08,
2371
+ "learning_rate": 4.51288103047003e-06,
2372
+ "loss": 0.0188,
2373
+ "step": 394
2374
+ },
2375
+ {
2376
+ "epoch": 2.09,
2377
+ "learning_rate": 4.465131283610425e-06,
2378
+ "loss": 0.0201,
2379
+ "step": 395
2380
+ },
2381
+ {
2382
+ "epoch": 2.1,
2383
+ "learning_rate": 4.417562779731355e-06,
2384
+ "loss": 0.0143,
2385
+ "step": 396
2386
+ },
2387
+ {
2388
+ "epoch": 2.1,
2389
+ "learning_rate": 4.370177076495312e-06,
2390
+ "loss": 0.0183,
2391
+ "step": 397
2392
+ },
2393
+ {
2394
+ "epoch": 2.11,
2395
+ "learning_rate": 4.322975725578871e-06,
2396
+ "loss": 0.018,
2397
+ "step": 398
2398
+ },
2399
+ {
2400
+ "epoch": 2.11,
2401
+ "learning_rate": 4.275960272621852e-06,
2402
+ "loss": 0.0164,
2403
+ "step": 399
2404
+ },
2405
+ {
2406
+ "epoch": 2.12,
2407
+ "learning_rate": 4.229132257176735e-06,
2408
+ "loss": 0.0161,
2409
+ "step": 400
2410
+ },
2411
+ {
2412
+ "epoch": 2.12,
2413
+ "learning_rate": 4.182493212658224e-06,
2414
+ "loss": 0.0179,
2415
+ "step": 401
2416
+ },
2417
+ {
2418
+ "epoch": 2.13,
2419
+ "learning_rate": 4.1360446662930445e-06,
2420
+ "loss": 0.02,
2421
+ "step": 402
2422
+ },
2423
+ {
2424
+ "epoch": 2.13,
2425
+ "learning_rate": 4.089788139069936e-06,
2426
+ "loss": 0.0206,
2427
+ "step": 403
2428
+ },
2429
+ {
2430
+ "epoch": 2.14,
2431
+ "learning_rate": 4.0437251456898465e-06,
2432
+ "loss": 0.0157,
2433
+ "step": 404
2434
+ },
2435
+ {
2436
+ "epoch": 2.14,
2437
+ "learning_rate": 3.997857194516321e-06,
2438
+ "loss": 0.0205,
2439
+ "step": 405
2440
+ },
2441
+ {
2442
+ "epoch": 2.15,
2443
+ "learning_rate": 3.952185787526112e-06,
2444
+ "loss": 0.0177,
2445
+ "step": 406
2446
+ },
2447
+ {
2448
+ "epoch": 2.15,
2449
+ "learning_rate": 3.90671242026002e-06,
2450
+ "loss": 0.0164,
2451
+ "step": 407
2452
+ },
2453
+ {
2454
+ "epoch": 2.16,
2455
+ "learning_rate": 3.86143858177388e-06,
2456
+ "loss": 0.0208,
2457
+ "step": 408
2458
+ },
2459
+ {
2460
+ "epoch": 2.16,
2461
+ "learning_rate": 3.816365754589845e-06,
2462
+ "loss": 0.0205,
2463
+ "step": 409
2464
+ },
2465
+ {
2466
+ "epoch": 2.17,
2467
+ "learning_rate": 3.7714954146478022e-06,
2468
+ "loss": 0.0176,
2469
+ "step": 410
2470
+ },
2471
+ {
2472
+ "epoch": 2.17,
2473
+ "learning_rate": 3.7268290312570622e-06,
2474
+ "loss": 0.0172,
2475
+ "step": 411
2476
+ },
2477
+ {
2478
+ "epoch": 2.18,
2479
+ "learning_rate": 3.6823680670482487e-06,
2480
+ "loss": 0.0203,
2481
+ "step": 412
2482
+ },
2483
+ {
2484
+ "epoch": 2.19,
2485
+ "learning_rate": 3.638113977925387e-06,
2486
+ "loss": 0.0198,
2487
+ "step": 413
2488
+ },
2489
+ {
2490
+ "epoch": 2.19,
2491
+ "learning_rate": 3.594068213018249e-06,
2492
+ "loss": 0.0195,
2493
+ "step": 414
2494
+ },
2495
+ {
2496
+ "epoch": 2.2,
2497
+ "learning_rate": 3.5502322146348843e-06,
2498
+ "loss": 0.0174,
2499
+ "step": 415
2500
+ },
2501
+ {
2502
+ "epoch": 2.2,
2503
+ "learning_rate": 3.506607418214395e-06,
2504
+ "loss": 0.0197,
2505
+ "step": 416
2506
+ },
2507
+ {
2508
+ "epoch": 2.21,
2509
+ "learning_rate": 3.4631952522799396e-06,
2510
+ "loss": 0.0214,
2511
+ "step": 417
2512
+ },
2513
+ {
2514
+ "epoch": 2.21,
2515
+ "learning_rate": 3.4199971383919538e-06,
2516
+ "loss": 0.0183,
2517
+ "step": 418
2518
+ },
2519
+ {
2520
+ "epoch": 2.22,
2521
+ "learning_rate": 3.377014491101577e-06,
2522
+ "loss": 0.0174,
2523
+ "step": 419
2524
+ },
2525
+ {
2526
+ "epoch": 2.22,
2527
+ "learning_rate": 3.334248717904368e-06,
2528
+ "loss": 0.0246,
2529
+ "step": 420
2530
+ },
2531
+ {
2532
+ "epoch": 2.23,
2533
+ "learning_rate": 3.2917012191941955e-06,
2534
+ "loss": 0.0208,
2535
+ "step": 421
2536
+ },
2537
+ {
2538
+ "epoch": 2.23,
2539
+ "learning_rate": 3.2493733882173794e-06,
2540
+ "loss": 0.0194,
2541
+ "step": 422
2542
+ },
2543
+ {
2544
+ "epoch": 2.24,
2545
+ "learning_rate": 3.207266611027069e-06,
2546
+ "loss": 0.0192,
2547
+ "step": 423
2548
+ },
2549
+ {
2550
+ "epoch": 2.24,
2551
+ "learning_rate": 3.165382266437874e-06,
2552
+ "loss": 0.0249,
2553
+ "step": 424
2554
+ },
2555
+ {
2556
+ "epoch": 2.25,
2557
+ "learning_rate": 3.123721725980683e-06,
2558
+ "loss": 0.0205,
2559
+ "step": 425
2560
+ },
2561
+ {
2562
+ "epoch": 2.25,
2563
+ "learning_rate": 3.082286353857782e-06,
2564
+ "loss": 0.026,
2565
+ "step": 426
2566
+ },
2567
+ {
2568
+ "epoch": 2.26,
2569
+ "learning_rate": 3.0410775068981615e-06,
2570
+ "loss": 0.0207,
2571
+ "step": 427
2572
+ },
2573
+ {
2574
+ "epoch": 2.26,
2575
+ "learning_rate": 3.0000965345130904e-06,
2576
+ "loss": 0.0197,
2577
+ "step": 428
2578
+ },
2579
+ {
2580
+ "epoch": 2.27,
2581
+ "learning_rate": 2.9593447786519424e-06,
2582
+ "loss": 0.0186,
2583
+ "step": 429
2584
+ },
2585
+ {
2586
+ "epoch": 2.28,
2587
+ "learning_rate": 2.9188235737582416e-06,
2588
+ "loss": 0.0208,
2589
+ "step": 430
2590
+ },
2591
+ {
2592
+ "epoch": 2.28,
2593
+ "learning_rate": 2.8785342467259568e-06,
2594
+ "loss": 0.015,
2595
+ "step": 431
2596
+ },
2597
+ {
2598
+ "epoch": 2.29,
2599
+ "learning_rate": 2.8384781168560693e-06,
2600
+ "loss": 0.019,
2601
+ "step": 432
2602
+ },
2603
+ {
2604
+ "epoch": 2.29,
2605
+ "learning_rate": 2.7986564958133564e-06,
2606
+ "loss": 0.0151,
2607
+ "step": 433
2608
+ },
2609
+ {
2610
+ "epoch": 2.3,
2611
+ "learning_rate": 2.7590706875834563e-06,
2612
+ "loss": 0.0168,
2613
+ "step": 434
2614
+ },
2615
+ {
2616
+ "epoch": 2.3,
2617
+ "learning_rate": 2.719721988430153e-06,
2618
+ "loss": 0.0186,
2619
+ "step": 435
2620
+ },
2621
+ {
2622
+ "epoch": 2.31,
2623
+ "learning_rate": 2.6806116868529364e-06,
2624
+ "loss": 0.0193,
2625
+ "step": 436
2626
+ },
2627
+ {
2628
+ "epoch": 2.31,
2629
+ "learning_rate": 2.6417410635448015e-06,
2630
+ "loss": 0.0165,
2631
+ "step": 437
2632
+ },
2633
+ {
2634
+ "epoch": 2.32,
2635
+ "learning_rate": 2.6031113913503337e-06,
2636
+ "loss": 0.023,
2637
+ "step": 438
2638
+ },
2639
+ {
2640
+ "epoch": 2.32,
2641
+ "learning_rate": 2.5647239352239948e-06,
2642
+ "loss": 0.0153,
2643
+ "step": 439
2644
+ },
2645
+ {
2646
+ "epoch": 2.33,
2647
+ "learning_rate": 2.526579952188735e-06,
2648
+ "loss": 0.0182,
2649
+ "step": 440
2650
+ },
2651
+ {
2652
+ "epoch": 2.33,
2653
+ "learning_rate": 2.4886806912948034e-06,
2654
+ "loss": 0.0179,
2655
+ "step": 441
2656
+ },
2657
+ {
2658
+ "epoch": 2.34,
2659
+ "learning_rate": 2.4510273935788632e-06,
2660
+ "loss": 0.0173,
2661
+ "step": 442
2662
+ },
2663
+ {
2664
+ "epoch": 2.34,
2665
+ "learning_rate": 2.413621292023349e-06,
2666
+ "loss": 0.0151,
2667
+ "step": 443
2668
+ },
2669
+ {
2670
+ "epoch": 2.35,
2671
+ "learning_rate": 2.376463611516098e-06,
2672
+ "loss": 0.0167,
2673
+ "step": 444
2674
+ },
2675
+ {
2676
+ "epoch": 2.35,
2677
+ "learning_rate": 2.339555568810221e-06,
2678
+ "loss": 0.0219,
2679
+ "step": 445
2680
+ },
2681
+ {
2682
+ "epoch": 2.36,
2683
+ "learning_rate": 2.302898372484278e-06,
2684
+ "loss": 0.0185,
2685
+ "step": 446
2686
+ },
2687
+ {
2688
+ "epoch": 2.37,
2689
+ "learning_rate": 2.2664932229027025e-06,
2690
+ "loss": 0.0175,
2691
+ "step": 447
2692
+ },
2693
+ {
2694
+ "epoch": 2.37,
2695
+ "learning_rate": 2.230341312176476e-06,
2696
+ "loss": 0.0196,
2697
+ "step": 448
2698
+ },
2699
+ {
2700
+ "epoch": 2.38,
2701
+ "learning_rate": 2.1944438241241185e-06,
2702
+ "loss": 0.0213,
2703
+ "step": 449
2704
+ },
2705
+ {
2706
+ "epoch": 2.38,
2707
+ "learning_rate": 2.158801934232897e-06,
2708
+ "loss": 0.0226,
2709
+ "step": 450
2710
+ },
2711
+ {
2712
+ "epoch": 2.39,
2713
+ "learning_rate": 2.123416809620351e-06,
2714
+ "loss": 0.0184,
2715
+ "step": 451
2716
+ },
2717
+ {
2718
+ "epoch": 2.39,
2719
+ "learning_rate": 2.0882896089960713e-06,
2720
+ "loss": 0.0178,
2721
+ "step": 452
2722
+ },
2723
+ {
2724
+ "epoch": 2.4,
2725
+ "learning_rate": 2.0534214826237486e-06,
2726
+ "loss": 0.0144,
2727
+ "step": 453
2728
+ },
2729
+ {
2730
+ "epoch": 2.4,
2731
+ "learning_rate": 2.0188135722835233e-06,
2732
+ "loss": 0.019,
2733
+ "step": 454
2734
+ },
2735
+ {
2736
+ "epoch": 2.41,
2737
+ "learning_rate": 1.9844670112345787e-06,
2738
+ "loss": 0.0195,
2739
+ "step": 455
2740
+ },
2741
+ {
2742
+ "epoch": 2.41,
2743
+ "learning_rate": 1.9503829241780416e-06,
2744
+ "loss": 0.0179,
2745
+ "step": 456
2746
+ },
2747
+ {
2748
+ "epoch": 2.42,
2749
+ "learning_rate": 1.9165624272201567e-06,
2750
+ "loss": 0.0185,
2751
+ "step": 457
2752
+ },
2753
+ {
2754
+ "epoch": 2.42,
2755
+ "learning_rate": 1.8830066278357395e-06,
2756
+ "loss": 0.0179,
2757
+ "step": 458
2758
+ },
2759
+ {
2760
+ "epoch": 2.43,
2761
+ "learning_rate": 1.8497166248318876e-06,
2762
+ "loss": 0.0199,
2763
+ "step": 459
2764
+ },
2765
+ {
2766
+ "epoch": 2.43,
2767
+ "learning_rate": 1.8166935083120351e-06,
2768
+ "loss": 0.0183,
2769
+ "step": 460
2770
+ },
2771
+ {
2772
+ "epoch": 2.44,
2773
+ "learning_rate": 1.7839383596402382e-06,
2774
+ "loss": 0.0208,
2775
+ "step": 461
2776
+ },
2777
+ {
2778
+ "epoch": 2.44,
2779
+ "learning_rate": 1.7514522514057552e-06,
2780
+ "loss": 0.0165,
2781
+ "step": 462
2782
+ },
2783
+ {
2784
+ "epoch": 2.45,
2785
+ "learning_rate": 1.719236247387951e-06,
2786
+ "loss": 0.0257,
2787
+ "step": 463
2788
+ },
2789
+ {
2790
+ "epoch": 2.46,
2791
+ "learning_rate": 1.6872914025214338e-06,
2792
+ "loss": 0.0193,
2793
+ "step": 464
2794
+ },
2795
+ {
2796
+ "epoch": 2.46,
2797
+ "learning_rate": 1.6556187628615273e-06,
2798
+ "loss": 0.0209,
2799
+ "step": 465
2800
+ },
2801
+ {
2802
+ "epoch": 2.47,
2803
+ "learning_rate": 1.6242193655500182e-06,
2804
+ "loss": 0.0184,
2805
+ "step": 466
2806
+ },
2807
+ {
2808
+ "epoch": 2.47,
2809
+ "learning_rate": 1.593094238781191e-06,
2810
+ "loss": 0.0184,
2811
+ "step": 467
2812
+ },
2813
+ {
2814
+ "epoch": 2.48,
2815
+ "learning_rate": 1.5622444017681438e-06,
2816
+ "loss": 0.0141,
2817
+ "step": 468
2818
+ },
2819
+ {
2820
+ "epoch": 2.48,
2821
+ "learning_rate": 1.5316708647094448e-06,
2822
+ "loss": 0.0166,
2823
+ "step": 469
2824
+ },
2825
+ {
2826
+ "epoch": 2.49,
2827
+ "learning_rate": 1.5013746287560227e-06,
2828
+ "loss": 0.0181,
2829
+ "step": 470
2830
+ },
2831
+ {
2832
+ "epoch": 2.49,
2833
+ "learning_rate": 1.4713566859784045e-06,
2834
+ "loss": 0.0197,
2835
+ "step": 471
2836
+ },
2837
+ {
2838
+ "epoch": 2.5,
2839
+ "learning_rate": 1.4416180193342143e-06,
2840
+ "loss": 0.0203,
2841
+ "step": 472
2842
+ },
2843
+ {
2844
+ "epoch": 2.5,
2845
+ "learning_rate": 1.4121596026359951e-06,
2846
+ "loss": 0.0214,
2847
+ "step": 473
2848
+ },
2849
+ {
2850
+ "epoch": 2.51,
2851
+ "learning_rate": 1.3829824005193183e-06,
2852
+ "loss": 0.0174,
2853
+ "step": 474
2854
+ },
2855
+ {
2856
+ "epoch": 2.51,
2857
+ "learning_rate": 1.3540873684111977e-06,
2858
+ "loss": 0.0164,
2859
+ "step": 475
2860
+ },
2861
+ {
2862
+ "epoch": 2.52,
2863
+ "learning_rate": 1.3254754524987956e-06,
2864
+ "loss": 0.0165,
2865
+ "step": 476
2866
+ },
2867
+ {
2868
+ "epoch": 2.52,
2869
+ "learning_rate": 1.2971475896984475e-06,
2870
+ "loss": 0.0178,
2871
+ "step": 477
2872
+ },
2873
+ {
2874
+ "epoch": 2.53,
2875
+ "learning_rate": 1.2691047076249852e-06,
2876
+ "loss": 0.02,
2877
+ "step": 478
2878
+ },
2879
+ {
2880
+ "epoch": 2.53,
2881
+ "learning_rate": 1.2413477245613438e-06,
2882
+ "loss": 0.0163,
2883
+ "step": 479
2884
+ },
2885
+ {
2886
+ "epoch": 2.54,
2887
+ "learning_rate": 1.2138775494285181e-06,
2888
+ "loss": 0.0179,
2889
+ "step": 480
2890
+ },
2891
+ {
2892
+ "epoch": 2.54,
2893
+ "learning_rate": 1.1866950817557743e-06,
2894
+ "loss": 0.0181,
2895
+ "step": 481
2896
+ },
2897
+ {
2898
+ "epoch": 2.55,
2899
+ "learning_rate": 1.1598012116512092e-06,
2900
+ "loss": 0.0249,
2901
+ "step": 482
2902
+ },
2903
+ {
2904
+ "epoch": 2.56,
2905
+ "learning_rate": 1.1331968197725985e-06,
2906
+ "loss": 0.0205,
2907
+ "step": 483
2908
+ },
2909
+ {
2910
+ "epoch": 2.56,
2911
+ "learning_rate": 1.1068827772985645e-06,
2912
+ "loss": 0.0191,
2913
+ "step": 484
2914
+ },
2915
+ {
2916
+ "epoch": 2.57,
2917
+ "learning_rate": 1.0808599459000368e-06,
2918
+ "loss": 0.0184,
2919
+ "step": 485
2920
+ },
2921
+ {
2922
+ "epoch": 2.57,
2923
+ "learning_rate": 1.0551291777120465e-06,
2924
+ "loss": 0.0189,
2925
+ "step": 486
2926
+ },
2927
+ {
2928
+ "epoch": 2.58,
2929
+ "learning_rate": 1.0296913153058164e-06,
2930
+ "loss": 0.0166,
2931
+ "step": 487
2932
+ },
2933
+ {
2934
+ "epoch": 2.58,
2935
+ "learning_rate": 1.004547191661178e-06,
2936
+ "loss": 0.021,
2937
+ "step": 488
2938
+ },
2939
+ {
2940
+ "epoch": 2.59,
2941
+ "learning_rate": 9.796976301392935e-07,
2942
+ "loss": 0.0182,
2943
+ "step": 489
2944
+ },
2945
+ {
2946
+ "epoch": 2.59,
2947
+ "learning_rate": 9.551434444556807e-07,
2948
+ "loss": 0.0205,
2949
+ "step": 490
2950
+ },
2951
+ {
2952
+ "epoch": 2.6,
2953
+ "learning_rate": 9.308854386535849e-07,
2954
+ "loss": 0.0206,
2955
+ "step": 491
2956
+ },
2957
+ {
2958
+ "epoch": 2.6,
2959
+ "learning_rate": 9.069244070776428e-07,
2960
+ "loss": 0.0157,
2961
+ "step": 492
2962
+ },
2963
+ {
2964
+ "epoch": 2.61,
2965
+ "learning_rate": 8.832611343478681e-07,
2966
+ "loss": 0.0174,
2967
+ "step": 493
2968
+ },
2969
+ {
2970
+ "epoch": 2.61,
2971
+ "learning_rate": 8.598963953339667e-07,
2972
+ "loss": 0.0246,
2973
+ "step": 494
2974
+ },
2975
+ {
2976
+ "epoch": 2.62,
2977
+ "learning_rate": 8.368309551299536e-07,
2978
+ "loss": 0.0166,
2979
+ "step": 495
2980
+ },
2981
+ {
2982
+ "epoch": 2.62,
2983
+ "learning_rate": 8.140655690291044e-07,
2984
+ "loss": 0.0184,
2985
+ "step": 496
2986
+ },
2987
+ {
2988
+ "epoch": 2.63,
2989
+ "learning_rate": 7.916009824992255e-07,
2990
+ "loss": 0.0168,
2991
+ "step": 497
2992
+ },
2993
+ {
2994
+ "epoch": 2.63,
2995
+ "learning_rate": 7.694379311582401e-07,
2996
+ "loss": 0.0189,
2997
+ "step": 498
2998
+ },
2999
+ {
3000
+ "epoch": 2.64,
3001
+ "learning_rate": 7.475771407500943e-07,
3002
+ "loss": 0.0186,
3003
+ "step": 499
3004
+ },
3005
+ {
3006
+ "epoch": 2.65,
3007
+ "learning_rate": 7.260193271210003e-07,
3008
+ "loss": 0.0188,
3009
+ "step": 500
3010
+ },
3011
+ {
3012
+ "epoch": 2.65,
3013
+ "learning_rate": 7.047651961959978e-07,
3014
+ "loss": 0.0164,
3015
+ "step": 501
3016
+ },
3017
+ {
3018
+ "epoch": 2.66,
3019
+ "learning_rate": 6.838154439558254e-07,
3020
+ "loss": 0.0197,
3021
+ "step": 502
3022
+ },
3023
+ {
3024
+ "epoch": 2.66,
3025
+ "learning_rate": 6.631707564141454e-07,
3026
+ "loss": 0.0179,
3027
+ "step": 503
3028
+ },
3029
+ {
3030
+ "epoch": 2.67,
3031
+ "learning_rate": 6.428318095950648e-07,
3032
+ "loss": 0.0219,
3033
+ "step": 504
3034
+ },
3035
+ {
3036
+ "epoch": 2.67,
3037
+ "learning_rate": 6.227992695110097e-07,
3038
+ "loss": 0.0147,
3039
+ "step": 505
3040
+ },
3041
+ {
3042
+ "epoch": 2.68,
3043
+ "learning_rate": 6.030737921409169e-07,
3044
+ "loss": 0.0172,
3045
+ "step": 506
3046
+ },
3047
+ {
3048
+ "epoch": 2.68,
3049
+ "learning_rate": 5.836560234087418e-07,
3050
+ "loss": 0.0206,
3051
+ "step": 507
3052
+ },
3053
+ {
3054
+ "epoch": 2.69,
3055
+ "learning_rate": 5.645465991623167e-07,
3056
+ "loss": 0.0176,
3057
+ "step": 508
3058
+ },
3059
+ {
3060
+ "epoch": 2.69,
3061
+ "learning_rate": 5.457461451525315e-07,
3062
+ "loss": 0.0187,
3063
+ "step": 509
3064
+ },
3065
+ {
3066
+ "epoch": 2.7,
3067
+ "learning_rate": 5.272552770128314e-07,
3068
+ "loss": 0.0183,
3069
+ "step": 510
3070
+ },
3071
+ {
3072
+ "epoch": 2.7,
3073
+ "learning_rate": 5.090746002390734e-07,
3074
+ "loss": 0.018,
3075
+ "step": 511
3076
+ },
3077
+ {
3078
+ "epoch": 2.71,
3079
+ "learning_rate": 4.912047101696848e-07,
3080
+ "loss": 0.018,
3081
+ "step": 512
3082
+ },
3083
+ {
3084
+ "epoch": 2.71,
3085
+ "learning_rate": 4.73646191966175e-07,
3086
+ "loss": 0.0162,
3087
+ "step": 513
3088
+ },
3089
+ {
3090
+ "epoch": 2.72,
3091
+ "learning_rate": 4.563996205939747e-07,
3092
+ "loss": 0.0189,
3093
+ "step": 514
3094
+ },
3095
+ {
3096
+ "epoch": 2.72,
3097
+ "learning_rate": 4.3946556080360916e-07,
3098
+ "loss": 0.0156,
3099
+ "step": 515
3100
+ },
3101
+ {
3102
+ "epoch": 2.73,
3103
+ "learning_rate": 4.2284456711219723e-07,
3104
+ "loss": 0.017,
3105
+ "step": 516
3106
+ },
3107
+ {
3108
+ "epoch": 2.74,
3109
+ "learning_rate": 4.065371837853016e-07,
3110
+ "loss": 0.0181,
3111
+ "step": 517
3112
+ },
3113
+ {
3114
+ "epoch": 2.74,
3115
+ "learning_rate": 3.9054394481910507e-07,
3116
+ "loss": 0.0167,
3117
+ "step": 518
3118
+ },
3119
+ {
3120
+ "epoch": 2.75,
3121
+ "learning_rate": 3.748653739229191e-07,
3122
+ "loss": 0.0198,
3123
+ "step": 519
3124
+ },
3125
+ {
3126
+ "epoch": 2.75,
3127
+ "learning_rate": 3.595019845020442e-07,
3128
+ "loss": 0.0162,
3129
+ "step": 520
3130
+ },
3131
+ {
3132
+ "epoch": 2.76,
3133
+ "learning_rate": 3.444542796409478e-07,
3134
+ "loss": 0.0151,
3135
+ "step": 521
3136
+ },
3137
+ {
3138
+ "epoch": 2.76,
3139
+ "learning_rate": 3.2972275208679625e-07,
3140
+ "loss": 0.0237,
3141
+ "step": 522
3142
+ },
3143
+ {
3144
+ "epoch": 2.77,
3145
+ "learning_rate": 3.1530788423332124e-07,
3146
+ "loss": 0.0172,
3147
+ "step": 523
3148
+ },
3149
+ {
3150
+ "epoch": 2.77,
3151
+ "learning_rate": 3.012101481050156e-07,
3152
+ "loss": 0.0224,
3153
+ "step": 524
3154
+ },
3155
+ {
3156
+ "epoch": 2.78,
3157
+ "learning_rate": 2.8743000534168673e-07,
3158
+ "loss": 0.0172,
3159
+ "step": 525
3160
+ },
3161
+ {
3162
+ "epoch": 2.78,
3163
+ "learning_rate": 2.739679071833301e-07,
3164
+ "loss": 0.0207,
3165
+ "step": 526
3166
+ },
3167
+ {
3168
+ "epoch": 2.79,
3169
+ "learning_rate": 2.608242944553607e-07,
3170
+ "loss": 0.0183,
3171
+ "step": 527
3172
+ },
3173
+ {
3174
+ "epoch": 2.79,
3175
+ "learning_rate": 2.479995975541749e-07,
3176
+ "loss": 0.0219,
3177
+ "step": 528
3178
+ },
3179
+ {
3180
+ "epoch": 2.8,
3181
+ "learning_rate": 2.354942364330559e-07,
3182
+ "loss": 0.0169,
3183
+ "step": 529
3184
+ },
3185
+ {
3186
+ "epoch": 2.8,
3187
+ "learning_rate": 2.2330862058842273e-07,
3188
+ "loss": 0.023,
3189
+ "step": 530
3190
+ },
3191
+ {
3192
+ "epoch": 2.81,
3193
+ "learning_rate": 2.1144314904642194e-07,
3194
+ "loss": 0.0138,
3195
+ "step": 531
3196
+ },
3197
+ {
3198
+ "epoch": 2.81,
3199
+ "learning_rate": 1.9989821034986034e-07,
3200
+ "loss": 0.0168,
3201
+ "step": 532
3202
+ },
3203
+ {
3204
+ "epoch": 2.82,
3205
+ "learning_rate": 1.8867418254548298e-07,
3206
+ "loss": 0.0163,
3207
+ "step": 533
3208
+ },
3209
+ {
3210
+ "epoch": 2.83,
3211
+ "learning_rate": 1.7777143317159407e-07,
3212
+ "loss": 0.0175,
3213
+ "step": 534
3214
+ },
3215
+ {
3216
+ "epoch": 2.83,
3217
+ "learning_rate": 1.6719031924601558e-07,
3218
+ "loss": 0.0172,
3219
+ "step": 535
3220
+ },
3221
+ {
3222
+ "epoch": 2.84,
3223
+ "learning_rate": 1.569311872544066e-07,
3224
+ "loss": 0.017,
3225
+ "step": 536
3226
+ },
3227
+ {
3228
+ "epoch": 2.84,
3229
+ "learning_rate": 1.4699437313891007e-07,
3230
+ "loss": 0.0166,
3231
+ "step": 537
3232
+ },
3233
+ {
3234
+ "epoch": 2.85,
3235
+ "learning_rate": 1.373802022871551e-07,
3236
+ "loss": 0.0165,
3237
+ "step": 538
3238
+ },
3239
+ {
3240
+ "epoch": 2.85,
3241
+ "learning_rate": 1.2808898952160198e-07,
3242
+ "loss": 0.018,
3243
+ "step": 539
3244
+ },
3245
+ {
3246
+ "epoch": 2.86,
3247
+ "learning_rate": 1.1912103908922945e-07,
3248
+ "loss": 0.0187,
3249
+ "step": 540
3250
+ },
3251
+ {
3252
+ "epoch": 2.86,
3253
+ "learning_rate": 1.1047664465157592e-07,
3254
+ "loss": 0.017,
3255
+ "step": 541
3256
+ },
3257
+ {
3258
+ "epoch": 2.87,
3259
+ "learning_rate": 1.02156089275125e-07,
3260
+ "loss": 0.0166,
3261
+ "step": 542
3262
+ },
3263
+ {
3264
+ "epoch": 2.87,
3265
+ "learning_rate": 9.415964542203059e-08,
3266
+ "loss": 0.0166,
3267
+ "step": 543
3268
+ },
3269
+ {
3270
+ "epoch": 2.88,
3271
+ "learning_rate": 8.648757494119752e-08,
3272
+ "loss": 0.0169,
3273
+ "step": 544
3274
+ },
3275
+ {
3276
+ "epoch": 2.88,
3277
+ "learning_rate": 7.914012905970936e-08,
3278
+ "loss": 0.02,
3279
+ "step": 545
3280
+ },
3281
+ {
3282
+ "epoch": 2.89,
3283
+ "learning_rate": 7.21175483745995e-08,
3284
+ "loss": 0.016,
3285
+ "step": 546
3286
+ },
3287
+ {
3288
+ "epoch": 2.89,
3289
+ "learning_rate": 6.542006284497304e-08,
3290
+ "loss": 0.0163,
3291
+ "step": 547
3292
+ },
3293
+ {
3294
+ "epoch": 2.9,
3295
+ "learning_rate": 5.90478917844739e-08,
3296
+ "loss": 0.0228,
3297
+ "step": 548
3298
+ },
3299
+ {
3300
+ "epoch": 2.9,
3301
+ "learning_rate": 5.300124385410943e-08,
3302
+ "loss": 0.0191,
3303
+ "step": 549
3304
+ },
3305
+ {
3306
+ "epoch": 2.91,
3307
+ "learning_rate": 4.728031705541369e-08,
3308
+ "loss": 0.0151,
3309
+ "step": 550
3310
+ },
3311
+ {
3312
+ "epoch": 2.92,
3313
+ "learning_rate": 4.188529872396374e-08,
3314
+ "loss": 0.0164,
3315
+ "step": 551
3316
+ },
3317
+ {
3318
+ "epoch": 2.92,
3319
+ "learning_rate": 3.681636552324452e-08,
3320
+ "loss": 0.0179,
3321
+ "step": 552
3322
+ },
3323
+ {
3324
+ "epoch": 2.93,
3325
+ "learning_rate": 3.2073683438866856e-08,
3326
+ "loss": 0.0175,
3327
+ "step": 553
3328
+ },
3329
+ {
3330
+ "epoch": 2.93,
3331
+ "learning_rate": 2.765740777313064e-08,
3332
+ "loss": 0.02,
3333
+ "step": 554
3334
+ },
3335
+ {
3336
+ "epoch": 2.94,
3337
+ "learning_rate": 2.3567683139936736e-08,
3338
+ "loss": 0.0158,
3339
+ "step": 555
3340
+ },
3341
+ {
3342
+ "epoch": 2.94,
3343
+ "learning_rate": 1.9804643460056284e-08,
3344
+ "loss": 0.0229,
3345
+ "step": 556
3346
+ },
3347
+ {
3348
+ "epoch": 2.95,
3349
+ "learning_rate": 1.636841195674199e-08,
3350
+ "loss": 0.0166,
3351
+ "step": 557
3352
+ },
3353
+ {
3354
+ "epoch": 2.95,
3355
+ "learning_rate": 1.325910115169471e-08,
3356
+ "loss": 0.0188,
3357
+ "step": 558
3358
+ },
3359
+ {
3360
+ "epoch": 2.96,
3361
+ "learning_rate": 1.0476812861377471e-08,
3362
+ "loss": 0.0186,
3363
+ "step": 559
3364
+ },
3365
+ {
3366
+ "epoch": 2.96,
3367
+ "learning_rate": 8.021638193682624e-09,
3368
+ "loss": 0.0188,
3369
+ "step": 560
3370
+ },
3371
+ {
3372
+ "epoch": 2.97,
3373
+ "learning_rate": 5.8936575449475284e-09,
3374
+ "loss": 0.0214,
3375
+ "step": 561
3376
+ },
3377
+ {
3378
+ "epoch": 2.97,
3379
+ "learning_rate": 4.092940597322237e-09,
3380
+ "loss": 0.0174,
3381
+ "step": 562
3382
+ },
3383
+ {
3384
+ "epoch": 2.98,
3385
+ "learning_rate": 2.6195463164901956e-09,
3386
+ "loss": 0.0193,
3387
+ "step": 563
3388
+ },
3389
+ {
3390
+ "epoch": 2.98,
3391
+ "learning_rate": 1.47352294973091e-09,
3392
+ "loss": 0.0151,
3393
+ "step": 564
3394
+ },
3395
+ {
3396
+ "epoch": 2.99,
3397
+ "learning_rate": 6.54908024348977e-10,
3398
+ "loss": 0.0151,
3399
+ "step": 565
3400
+ },
3401
+ {
3402
+ "epoch": 2.99,
3403
+ "learning_rate": 1.6372834643618718e-10,
3404
+ "loss": 0.0218,
3405
+ "step": 566
3406
+ },
3407
+ {
3408
+ "epoch": 3.0,
3409
+ "learning_rate": 0.0,
3410
+ "loss": 0.018,
3411
+ "step": 567
3412
+ },
3413
+ {
3414
+ "epoch": 3.0,
3415
+ "step": 567,
3416
+ "total_flos": 0.0,
3417
+ "train_loss": 0.030306552032524525,
3418
+ "train_runtime": 9233.9434,
3419
+ "train_samples_per_second": 7.819,
3420
+ "train_steps_per_second": 0.061
3421
+ }
3422
+ ],
3423
+ "logging_steps": 1.0,
3424
+ "max_steps": 567,
3425
+ "num_input_tokens_seen": 0,
3426
+ "num_train_epochs": 3,
3427
+ "save_steps": 500,
3428
+ "total_flos": 0.0,
3429
+ "train_batch_size": 16,
3430
+ "trial_name": null,
3431
+ "trial_params": null
3432
+ }
training_args.bin ADDED
Binary file (6.65 kB). View file
 
visual_encoder.py ADDED
@@ -0,0 +1,922 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ from typing import Any, Optional, Tuple, Union
3
+
4
+ from transformers.modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, BaseModelOutputWithPastAndCrossAttentions
5
+ from transformers.modeling_utils import PreTrainedModel
6
+ from transformers.pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
7
+
8
+ import numpy as np
9
+ import torch
10
+ import torch.nn as nn
11
+ import torch.utils.checkpoint
12
+ from icecream import ic
13
+
14
+ def get_abs_pos(abs_pos, tgt_size):
15
+ # abs_pos: L, C
16
+ # tgt_size: M
17
+ # return: M, C
18
+ src_size = int(math.sqrt(abs_pos.size(0)))
19
+ tgt_size = int(math.sqrt(tgt_size))
20
+ dtype = abs_pos.dtype
21
+
22
+ if src_size != tgt_size:
23
+ return F.interpolate(
24
+ abs_pos.float().reshape(1, src_size, src_size, -1).permute(0, 3, 1, 2),
25
+ size=(tgt_size, tgt_size),
26
+ mode="bicubic",
27
+ align_corners=False,
28
+ ).permute(0, 2, 3, 1).flatten(0, 2).to(dtype=dtype)
29
+ else:
30
+ return abs_pos
31
+
32
+ # https://github.com/facebookresearch/mae/blob/efb2a8062c206524e35e47d04501ed4f544c0ae8/util/pos_embed.py#L20
33
+ def get_2d_sincos_pos_embed(embed_dim, grid_size, cls_token=False):
34
+ """
35
+ grid_size: int of the grid height and width
36
+ return:
37
+ pos_embed: [grid_size*grid_size, embed_dim] or [1+grid_size*grid_size, embed_dim] (w/ or w/o cls_token)
38
+ """
39
+ grid_h = np.arange(grid_size, dtype=np.float32)
40
+ grid_w = np.arange(grid_size, dtype=np.float32)
41
+ grid = np.meshgrid(grid_w, grid_h) # here w goes first
42
+ grid = np.stack(grid, axis=0)
43
+
44
+ grid = grid.reshape([2, 1, grid_size, grid_size])
45
+ pos_embed = get_2d_sincos_pos_embed_from_grid(embed_dim, grid)
46
+ if cls_token:
47
+ pos_embed = np.concatenate([np.zeros([1, embed_dim]), pos_embed], axis=0)
48
+ return pos_embed
49
+
50
+
51
+ def get_2d_sincos_pos_embed_from_grid(embed_dim, grid):
52
+ assert embed_dim % 2 == 0
53
+
54
+ # use half of dimensions to encode grid_h
55
+ emb_h = get_1d_sincos_pos_embed_from_grid(embed_dim // 2, grid[0]) # (H*W, D/2)
56
+ emb_w = get_1d_sincos_pos_embed_from_grid(embed_dim // 2, grid[1]) # (H*W, D/2)
57
+
58
+ emb = np.concatenate([emb_h, emb_w], axis=1) # (H*W, D)
59
+ return emb
60
+
61
+
62
+ def get_1d_sincos_pos_embed_from_grid(embed_dim, pos):
63
+ """
64
+ embed_dim: output dimension for each position
65
+ pos: a list of positions to be encoded: size (M,)
66
+ out: (M, D)
67
+ """
68
+ assert embed_dim % 2 == 0
69
+ omega = np.arange(embed_dim // 2, dtype=np.float32)
70
+ omega /= embed_dim / 2.
71
+ omega = 1. / 10000**omega # (D/2,)
72
+
73
+ pos = pos.reshape(-1) # (M,)
74
+ out = np.einsum('m,d->md', pos, omega) # (M, D/2), outer product
75
+
76
+ emb_sin = np.sin(out) # (M, D/2)
77
+ emb_cos = np.cos(out) # (M, D/2)
78
+
79
+ emb = np.concatenate([emb_sin, emb_cos], axis=1) # (M, D)
80
+ return emb
81
+
82
+
83
+
84
+ class MplugOwlVisionEmbeddings(nn.Module):
85
+ def __init__(self, config):
86
+ super().__init__()
87
+ self.config = config
88
+ self.hidden_size = config.hidden_size
89
+ self.image_size = config.image_size
90
+ self.patch_size = config.patch_size
91
+
92
+ self.cls_token = nn.Parameter(torch.randn(1, 1, self.hidden_size))
93
+
94
+ self.patch_embed = nn.Conv2d(
95
+ in_channels=3,
96
+ out_channels=self.hidden_size,
97
+ kernel_size=self.patch_size,
98
+ stride=self.patch_size,
99
+ bias=False,
100
+ )
101
+
102
+ self.num_patches = (self.image_size // self.patch_size) ** 2
103
+
104
+ self.position_embedding = nn.Parameter(torch.randn(1, self.num_patches + 1, self.hidden_size))
105
+
106
+ self.pre_layernorm = nn.LayerNorm(self.hidden_size, eps=config.layer_norm_eps)
107
+
108
+ def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor:
109
+ batch_size = pixel_values.size(0)
110
+ image_embeds = self.patch_embed(pixel_values)
111
+ image_embeds = image_embeds.flatten(2).transpose(1, 2)
112
+
113
+ class_embeds = self.cls_token.expand(batch_size, 1, -1).to(image_embeds.dtype)
114
+ embeddings = torch.cat([class_embeds, image_embeds], dim=1)
115
+ embeddings = embeddings + self.position_embedding[:, : embeddings.size(1)].to(image_embeds.dtype)
116
+ embeddings = self.pre_layernorm(embeddings)
117
+ return embeddings
118
+
119
+
120
+
121
+ class MplugOwlVisionAttention(nn.Module):
122
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
123
+
124
+ def __init__(self, config):
125
+ super().__init__()
126
+ self.config = config
127
+ self.hidden_size = config.hidden_size
128
+ self.num_heads = config.num_attention_heads
129
+ self.head_dim = self.hidden_size // self.num_heads
130
+ if self.head_dim * self.num_heads != self.hidden_size:
131
+ raise ValueError(
132
+ f"hidden_size must be divisible by num_heads (got `hidden_size`: {self.hidden_size} and `num_heads`:"
133
+ f" {self.num_heads})."
134
+ )
135
+ self.scale = self.head_dim**-0.5
136
+ self.dropout = nn.Dropout(config.attention_dropout)
137
+
138
+ self.query_key_value = nn.Linear(self.hidden_size, 3 * self.hidden_size)
139
+ self.dense = nn.Linear(self.hidden_size, self.hidden_size)
140
+
141
+ def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
142
+ return tensor.view(bsz, seq_len, self.num_heads, self.head_dim).transpose(1, 2).contiguous()
143
+
144
+ def forward(
145
+ self,
146
+ hidden_states: torch.Tensor,
147
+ head_mask: Optional[torch.Tensor] = None,
148
+ output_attentions: Optional[bool] = False,
149
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
150
+ """Input shape: Batch x Time x Channel"""
151
+
152
+ bsz, seq_len, embed_dim = hidden_states.size()
153
+
154
+ mixed_qkv = self.query_key_value(hidden_states)
155
+
156
+ mixed_qkv = mixed_qkv.reshape(bsz, seq_len, self.num_heads, 3, embed_dim // self.num_heads).permute(
157
+ 3, 0, 2, 1, 4
158
+ ) # [3, b, np, sq, hn]
159
+ query_states, key_states, value_states = (
160
+ mixed_qkv[0],
161
+ mixed_qkv[1],
162
+ mixed_qkv[2],
163
+ )
164
+ # if self.config.use_flash_attn and flash_attn_func is not None:
165
+ if False:
166
+ # [b*sq, np, hn]
167
+ query_states = query_states.permute(0, 2, 1, 3).contiguous()
168
+ query_states = query_states.view(query_states.size(0) * query_states.size(1), query_states.size(2), -1)
169
+
170
+ key_states = key_states.permute(0, 2, 1, 3).contiguous()
171
+ key_states = key_states.view(key_states.size(0) * key_states.size(1), key_states.size(2), -1)
172
+
173
+ value_states = value_states.permute(0, 2, 1, 3).contiguous()
174
+ value_states = value_states.view(value_states.size(0) * value_states.size(1), value_states.size(2), -1)
175
+
176
+ cu_seqlens = torch.arange(
177
+ 0, (bsz + 1) * seq_len, step=seq_len, dtype=torch.int32, device=query_states.device
178
+ )
179
+
180
+ context_layer = flash_attn_func(
181
+ query_states,
182
+ key_states,
183
+ value_states,
184
+ cu_seqlens,
185
+ cu_seqlens,
186
+ seq_len,
187
+ seq_len,
188
+ self.dropout if self.training else 0.0,
189
+ softmax_scale=self.scale,
190
+ causal=False,
191
+ return_attn_probs=False,
192
+ )
193
+ # [b*sq, np, hn] => [b, sq, np, hn]
194
+ context_layer = context_layer.view(bsz, seq_len, context_layer.size(1), context_layer.size(2))
195
+ else:
196
+ # Take the dot product between "query" and "key" to get the raw attention scores.
197
+ attention_scores = torch.matmul(query_states, key_states.transpose(-1, -2))
198
+
199
+ attention_scores = attention_scores * self.scale
200
+
201
+ # Normalize the attention scores to probabilities.
202
+ attention_probs = torch.softmax(attention_scores, dim=-1)
203
+
204
+ # This is actually dropping out entire tokens to attend to, which might
205
+ # seem a bit unusual, but is taken from the original Transformer paper.
206
+ attention_probs = self.dropout(attention_probs)
207
+
208
+ # Mask heads if we want to
209
+ if head_mask is not None:
210
+ attention_probs = attention_probs * head_mask
211
+
212
+ context_layer = torch.matmul(attention_probs, value_states).permute(0, 2, 1, 3)
213
+
214
+ new_context_layer_shape = context_layer.size()[:-2] + (self.hidden_size,)
215
+ context_layer = context_layer.reshape(new_context_layer_shape)
216
+
217
+ output = self.dense(context_layer)
218
+
219
+ outputs = (output, attention_probs) if output_attentions else (output, None)
220
+
221
+ return outputs
222
+
223
+
224
+ class QuickGELU(nn.Module):
225
+ def forward(self, x: torch.Tensor):
226
+ return x * torch.sigmoid(1.702 * x)
227
+
228
+
229
+ class MplugOwlMLP(nn.Module):
230
+ def __init__(self, config):
231
+ super().__init__()
232
+ self.config = config
233
+ self.activation_fn = QuickGELU()
234
+ self.fc1 = nn.Linear(config.hidden_size, config.intermediate_size)
235
+ self.fc2 = nn.Linear(config.intermediate_size, config.hidden_size)
236
+
237
+ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
238
+ hidden_states = self.fc1(hidden_states)
239
+ hidden_states = self.activation_fn(hidden_states)
240
+ hidden_states = self.fc2(hidden_states)
241
+ return hidden_states
242
+
243
+
244
+ class MplugOwlVisionEncoderLayer(nn.Module):
245
+ def __init__(self, config):
246
+ super().__init__()
247
+ self.hidden_size = config.hidden_size
248
+ self.self_attn = MplugOwlVisionAttention(config)
249
+ self.input_layernorm = nn.LayerNorm(self.hidden_size, eps=config.layer_norm_eps)
250
+ self.mlp = MplugOwlMLP(config)
251
+ self.post_attention_layernorm = nn.LayerNorm(self.hidden_size, eps=config.layer_norm_eps)
252
+
253
+ def forward(
254
+ self,
255
+ hidden_states: torch.Tensor,
256
+ attention_mask: torch.Tensor,
257
+ output_attentions: Optional[bool] = False,
258
+ ) -> Tuple[torch.FloatTensor]:
259
+ """
260
+ Args:
261
+ hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)`
262
+ attention_mask (`torch.FloatTensor`): attention mask of size
263
+ `(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values.
264
+ `(config.encoder_attention_heads,)`.
265
+ output_attentions (`bool`, *optional*):
266
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under
267
+ returned tensors for more detail.
268
+ """
269
+ residual = hidden_states
270
+
271
+ hidden_states = self.input_layernorm(hidden_states)
272
+ hidden_states, attn_weights = self.self_attn(
273
+ hidden_states=hidden_states,
274
+ head_mask=attention_mask,
275
+ output_attentions=output_attentions,
276
+ )
277
+ hidden_states = hidden_states + residual
278
+ residual = hidden_states
279
+ hidden_states = self.post_attention_layernorm(hidden_states)
280
+ hidden_states = self.mlp(hidden_states)
281
+
282
+ hidden_states = hidden_states + residual
283
+
284
+ outputs = (hidden_states,)
285
+
286
+ if output_attentions:
287
+ outputs += (attn_weights,)
288
+
289
+ return outputs
290
+
291
+
292
+ class MplugOwlVisionEncoder(nn.Module):
293
+ """
294
+ Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a
295
+ [`MplugOwlVisionEncoderLayer`].
296
+
297
+ Args:
298
+ config (`MplugOwlVisionConfig`):
299
+ The corresponding vision configuration for the `MplugOwlEncoder`.
300
+ """
301
+
302
+ def __init__(self, config):
303
+ super().__init__()
304
+ self.config = config
305
+ self.layers = nn.ModuleList([MplugOwlVisionEncoderLayer(config) for _ in range(config.num_hidden_layers)])
306
+ self.gradient_checkpointing = True
307
+
308
+ def forward(
309
+ self,
310
+ inputs_embeds,
311
+ attention_mask: Optional[torch.Tensor] = None,
312
+ output_attentions: Optional[bool] = None,
313
+ output_hidden_states: Optional[bool] = None,
314
+ return_dict: Optional[bool] = None,
315
+ ) -> Union[Tuple, BaseModelOutput]:
316
+ r"""
317
+ Args:
318
+ inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
319
+ Embedded representation of the inputs. Should be float, not int tokens.
320
+ attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
321
+ Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
322
+
323
+ - 1 for tokens that are **not masked**,
324
+ - 0 for tokens that are **masked**.
325
+
326
+ [What are attention masks?](../glossary#attention-mask)
327
+ output_attentions (`bool`, *optional*):
328
+ Whether or not to return the attentions tensors of all attention layers. See `attentions` under
329
+ returned tensors for more detail.
330
+ output_hidden_states (`bool`, *optional*):
331
+ Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
332
+ for more detail.
333
+ return_dict (`bool`, *optional*):
334
+ Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
335
+ """
336
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
337
+ output_hidden_states = (
338
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
339
+ )
340
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
341
+
342
+ encoder_states = () if output_hidden_states else None
343
+ all_attentions = () if output_attentions else None
344
+
345
+ hidden_states = inputs_embeds
346
+ for idx, encoder_layer in enumerate(self.layers):
347
+ if output_hidden_states:
348
+ encoder_states = encoder_states + (hidden_states,)
349
+ if self.gradient_checkpointing and self.training:
350
+
351
+ def create_custom_forward(module):
352
+ def custom_forward(*inputs):
353
+ return module(*inputs, output_attentions)
354
+
355
+ return custom_forward
356
+
357
+ layer_outputs = torch.utils.checkpoint.checkpoint(
358
+ create_custom_forward(encoder_layer),
359
+ hidden_states,
360
+ attention_mask,
361
+ )
362
+ else:
363
+ layer_outputs = encoder_layer(
364
+ hidden_states,
365
+ attention_mask,
366
+ output_attentions=output_attentions,
367
+ )
368
+
369
+ hidden_states = layer_outputs[0]
370
+
371
+ if output_attentions:
372
+ all_attentions = all_attentions + (layer_outputs[1],)
373
+
374
+ if output_hidden_states:
375
+ encoder_states = encoder_states + (hidden_states,)
376
+
377
+ if not return_dict:
378
+ return tuple(v for v in [hidden_states, encoder_states, all_attentions] if v is not None)
379
+ return BaseModelOutput(
380
+ last_hidden_state=hidden_states, hidden_states=encoder_states, attentions=all_attentions
381
+ )
382
+
383
+
384
+ class MplugOwlVisionModel(PreTrainedModel):
385
+ main_input_name = "pixel_values"
386
+ _no_split_modules = ["MplugOwlVisionEncoderLayer"]
387
+
388
+ def __init__(self, config):
389
+ super().__init__(config)
390
+ self.config = config
391
+ self.hidden_size = config.hidden_size
392
+
393
+ self.embeddings = MplugOwlVisionEmbeddings(config)
394
+ self.encoder = MplugOwlVisionEncoder(config)
395
+ self.post_layernorm = nn.LayerNorm(self.hidden_size, eps=config.layer_norm_eps)
396
+
397
+ self.post_init()
398
+
399
+
400
+ def forward(
401
+ self,
402
+ pixel_values: Optional[torch.FloatTensor] = None,
403
+ output_attentions: Optional[bool] = None,
404
+ output_hidden_states: Optional[bool] = None,
405
+ return_dict: Optional[bool] = None,
406
+ ) -> Union[Tuple, BaseModelOutputWithPooling]:
407
+ r"""
408
+ Returns:
409
+
410
+ """
411
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
412
+ output_hidden_states = (
413
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
414
+ )
415
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
416
+
417
+ if pixel_values is None:
418
+ raise ValueError("You have to specify pixel_values")
419
+
420
+ hidden_states = self.embeddings(pixel_values)
421
+
422
+ encoder_outputs = self.encoder(
423
+ inputs_embeds=hidden_states,
424
+ output_attentions=output_attentions,
425
+ output_hidden_states=output_hidden_states,
426
+ return_dict=return_dict,
427
+ )
428
+
429
+ last_hidden_state = encoder_outputs[0]
430
+ last_hidden_state = self.post_layernorm(last_hidden_state)
431
+
432
+ pooled_output = last_hidden_state[:, 0, :]
433
+ pooled_output = self.post_layernorm(pooled_output)
434
+
435
+ if not return_dict:
436
+ return (last_hidden_state, pooled_output) + encoder_outputs[1:]
437
+
438
+ return BaseModelOutputWithPooling(
439
+ last_hidden_state=last_hidden_state,
440
+ pooler_output=pooled_output,
441
+ hidden_states=encoder_outputs.hidden_states,
442
+ attentions=encoder_outputs.attentions,
443
+ )
444
+
445
+ def get_input_embeddings(self):
446
+ return self.embeddings
447
+
448
+
449
+ class MplugOwlVisualAbstractorMLP(nn.Module):
450
+ def __init__(self, config):
451
+ super().__init__()
452
+ self.config = config
453
+ in_features = config.hidden_size
454
+ self.act = nn.SiLU()
455
+
456
+ self.w1 = nn.Linear(in_features, config.intermediate_size)
457
+ self.w2 = nn.Linear(config.intermediate_size, in_features)
458
+ self.w3 = nn.Linear(in_features, config.intermediate_size)
459
+ self.ffn_ln = nn.LayerNorm(config.intermediate_size, eps=config.layer_norm_eps)
460
+
461
+ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
462
+ hidden_states = self.act(self.w1(hidden_states)) * self.w3(hidden_states)
463
+ hidden_states = self.ffn_ln(hidden_states)
464
+ hidden_states = self.w2(hidden_states)
465
+ return hidden_states
466
+
467
+
468
+ class MplugOwlVisualAbstractorMultiHeadAttention(nn.Module):
469
+ def __init__(self, config):
470
+ super().__init__()
471
+ self.config = config
472
+ if config.hidden_size % config.num_attention_heads != 0:
473
+ raise ValueError(
474
+ "The hidden size (%d) is not a multiple of the number of attention heads (%d)"
475
+ % (config.hidden_size, config.num_attention_heads)
476
+ )
477
+
478
+ self.num_attention_heads = config.num_attention_heads
479
+ self.attention_head_size = int(config.hidden_size / config.num_attention_heads)
480
+ self.all_head_size = self.num_attention_heads * self.attention_head_size
481
+
482
+ self.query = nn.Linear(config.hidden_size, self.all_head_size)
483
+ self.key = nn.Linear(config.encoder_hidden_size, self.all_head_size)
484
+ self.value = nn.Linear(config.encoder_hidden_size, self.all_head_size)
485
+
486
+ self.dropout = nn.Dropout(config.attention_probs_dropout_prob)
487
+ self.save_attention = False
488
+
489
+ # self.q_pos_embed = nn.Parameter(
490
+ # torch.from_numpy(get_1d_sincos_pos_embed_from_grid(config.hidden_size, np.arange(config.num_learnable_queries, dtype=np.float32))).float()
491
+ # ).requires_grad_(False)
492
+ # grids = config.grid_size
493
+ # self.k_pos_embed = nn.Parameter(
494
+ # torch.from_numpy(get_2d_sincos_pos_embed(config.hidden_size, grids, cls_token=True)).float()
495
+ # ).requires_grad_(False)
496
+ grids = config.grid_size
497
+ self.register_buffer(
498
+ 'q_pos_embed',
499
+ torch.from_numpy(get_1d_sincos_pos_embed_from_grid(config.hidden_size, np.arange(config.num_learnable_queries, dtype=np.float32))).float()
500
+ )
501
+ self.register_buffer(
502
+ 'k_pos_embed',
503
+ torch.from_numpy(get_2d_sincos_pos_embed(config.hidden_size, grids, cls_token=True)).float()
504
+ )
505
+
506
+
507
+ def save_attn_gradients(self, attn_gradients):
508
+ self.attn_gradients = attn_gradients
509
+
510
+ def get_attn_gradients(self):
511
+ return self.attn_gradients
512
+
513
+ def save_attention_map(self, attention_map):
514
+ self.attention_map = attention_map
515
+
516
+ def get_attention_map(self):
517
+ return self.attention_map
518
+
519
+ def transpose_for_scores(self, x):
520
+ new_x_shape = x.size()[:-1] + (self.num_attention_heads, self.attention_head_size)
521
+ x = x.view(*new_x_shape)
522
+ return x.permute(0, 2, 1, 3)
523
+
524
+ def forward(
525
+ self,
526
+ hidden_states,
527
+ attention_mask=None,
528
+ head_mask=None,
529
+ encoder_hidden_states=None,
530
+ encoder_attention_mask=None,
531
+ past_key_value=None,
532
+ output_attentions=False,
533
+ ):
534
+ # If this is instantiated as a cross-attention module, the keys
535
+ # and values come from an encoder; the attention mask needs to be
536
+ # such that the encoder's padding tokens are not attended to.
537
+
538
+ qk_pos_embed = torch.cat([self.q_pos_embed, self.k_pos_embed], dim = 0).unsqueeze(0).to(dtype=hidden_states.dtype)
539
+
540
+ key_layer = self.transpose_for_scores(self.key(encoder_hidden_states + qk_pos_embed))
541
+ value_layer = self.transpose_for_scores(self.value(encoder_hidden_states))
542
+ attention_mask = encoder_attention_mask
543
+
544
+ mixed_query_layer = self.query(hidden_states + self.q_pos_embed.unsqueeze(0).to(dtype=hidden_states.dtype))
545
+
546
+ query_layer = self.transpose_for_scores(mixed_query_layer)
547
+
548
+ past_key_value = (key_layer, value_layer)
549
+
550
+ # Take the dot product between "query" and "key" to get the raw attention scores.
551
+ attention_scores = torch.matmul(query_layer, key_layer.transpose(-1, -2))
552
+
553
+ attention_scores = attention_scores / math.sqrt(self.attention_head_size)
554
+
555
+ if attention_mask is not None:
556
+ # Apply the attention mask is (precomputed for all layers in BertModel forward() function)
557
+ attention_scores = attention_scores + attention_mask
558
+
559
+ # Normalize the attention scores to probabilities.
560
+ attention_probs = nn.Softmax(dim=-1)(attention_scores)
561
+
562
+ if self.save_attention:
563
+ self.save_attention_map(attention_probs)
564
+ attention_probs.register_hook(self.save_attn_gradients)
565
+
566
+ # This is actually dropping out entire tokens to attend to, which might
567
+ # seem a bit unusual, but is taken from the original Transformer paper.
568
+ attention_probs_dropped = self.dropout(attention_probs)
569
+
570
+ # Mask heads if we want to
571
+ if head_mask is not None:
572
+ attention_probs_dropped = attention_probs_dropped * head_mask
573
+
574
+ context_layer = torch.matmul(attention_probs_dropped, value_layer)
575
+
576
+ context_layer = context_layer.permute(0, 2, 1, 3).contiguous()
577
+ new_context_layer_shape = context_layer.size()[:-2] + (self.all_head_size,)
578
+ context_layer = context_layer.view(*new_context_layer_shape)
579
+
580
+ outputs = (context_layer, attention_probs) if output_attentions else (context_layer,)
581
+
582
+ outputs = outputs + (past_key_value,)
583
+ return outputs
584
+
585
+
586
+ class MplugOwlVisualAbstractorCrossOutput(nn.Module):
587
+ def __init__(self, config):
588
+ super().__init__()
589
+ dim = config.hidden_size
590
+ self.out_proj = nn.Linear(dim, dim, bias=True)
591
+ self.norm2 = nn.LayerNorm(dim)
592
+ self.mlp = MplugOwlVisualAbstractorMLP(config)
593
+
594
+ def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
595
+ input_tensor = input_tensor + self.out_proj(hidden_states)
596
+ input_tensor = input_tensor + self.mlp(self.norm2(input_tensor))
597
+ return input_tensor
598
+
599
+
600
+ class MplugOwlVisualAbstractorAttention(nn.Module):
601
+ def __init__(self, config):
602
+ super().__init__()
603
+ self.attention = MplugOwlVisualAbstractorMultiHeadAttention(config)
604
+ self.output = MplugOwlVisualAbstractorCrossOutput(config)
605
+ self.pruned_heads = set()
606
+ self.norm1 = nn.LayerNorm(config.hidden_size)
607
+ self.normk = nn.LayerNorm(config.hidden_size)
608
+
609
+ def prune_heads(self, heads):
610
+ if len(heads) == 0:
611
+ return
612
+ heads, index = find_pruneable_heads_and_indices(
613
+ heads, self.attention.num_attention_heads, self.attention.attention_head_size, self.pruned_heads
614
+ )
615
+
616
+ # Prune linear layers
617
+ self.attention.query = prune_linear_layer(self.attention.query, index)
618
+ self.attention.key = prune_linear_layer(self.attention.key, index)
619
+ self.attention.value = prune_linear_layer(self.attention.value, index)
620
+ self.output.dense = prune_linear_layer(self.output.out_proj, index, dim=1)
621
+
622
+ # Update hyper params and store pruned heads
623
+ self.attention.num_attention_heads = self.attention.num_attention_heads - len(heads)
624
+ self.attention.all_head_size = self.attention.attention_head_size * self.attention.num_attention_heads
625
+ self.pruned_heads = self.pruned_heads.union(heads)
626
+
627
+ def forward(
628
+ self,
629
+ hidden_states: torch.Tensor,
630
+ attention_mask: Optional[torch.FloatTensor] = None,
631
+ head_mask: Optional[torch.FloatTensor] = None,
632
+ encoder_hidden_states: Optional[torch.FloatTensor] = None,
633
+ encoder_attention_mask: Optional[torch.FloatTensor] = None,
634
+ past_key_value: Optional[Tuple[Tuple[torch.FloatTensor]]] = None,
635
+ output_attentions: Optional[bool] = False,
636
+ ) -> Tuple[torch.Tensor]:
637
+ # HACK we apply norm on q and k
638
+ hidden_states = self.norm1(hidden_states)
639
+ encoder_hidden_states = self.normk(encoder_hidden_states)
640
+ encoder_hidden_states = torch.cat([hidden_states, encoder_hidden_states], dim=1)
641
+ encoder_attention_mask = torch.cat([attention_mask, encoder_attention_mask], dim=-1)
642
+ self_outputs = self.attention(
643
+ hidden_states,
644
+ attention_mask,
645
+ head_mask,
646
+ encoder_hidden_states,
647
+ encoder_attention_mask,
648
+ past_key_value,
649
+ output_attentions,
650
+ )
651
+ attention_output = self.output(self_outputs[0], hidden_states)
652
+ # add attentions if we output them
653
+ outputs = (attention_output,) + self_outputs[1:]
654
+ return outputs
655
+
656
+
657
+ class MplugOwlVisualAbstractorLayer(nn.Module):
658
+ def __init__(self, config, layer_idx):
659
+ super().__init__()
660
+ self.chunk_size_feed_forward = config.chunk_size_feed_forward
661
+ self.seq_len_dim = 1
662
+
663
+ self.layer_idx = layer_idx
664
+
665
+ self.crossattention = MplugOwlVisualAbstractorAttention(config)
666
+ self.has_cross_attention = True
667
+
668
+ def forward(
669
+ self,
670
+ hidden_states,
671
+ attention_mask=None,
672
+ head_mask=None,
673
+ encoder_hidden_states=None,
674
+ encoder_attention_mask=None,
675
+ output_attentions=False,
676
+ ):
677
+ if encoder_hidden_states is None:
678
+ raise ValueError("encoder_hidden_states must be given for cross-attention layers")
679
+ cross_attention_outputs = self.crossattention(
680
+ hidden_states,
681
+ attention_mask,
682
+ head_mask,
683
+ encoder_hidden_states,
684
+ encoder_attention_mask,
685
+ output_attentions=output_attentions,
686
+ )
687
+ query_attention_output = cross_attention_outputs[0]
688
+
689
+ outputs = (query_attention_output,)
690
+ return outputs
691
+
692
+
693
+ class MplugOwlVisualAbstractorEncoder(nn.Module):
694
+ def __init__(self, config):
695
+ super().__init__()
696
+ self.config = config
697
+ self.layers = nn.ModuleList(
698
+ [MplugOwlVisualAbstractorLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
699
+ )
700
+ self.gradient_checkpointing = True
701
+
702
+ def forward(
703
+ self,
704
+ hidden_states,
705
+ attention_mask=None,
706
+ head_mask=None,
707
+ encoder_hidden_states=None,
708
+ encoder_attention_mask=None,
709
+ past_key_values=None,
710
+ output_attentions=False,
711
+ output_hidden_states=False,
712
+ return_dict=True,
713
+ ):
714
+ all_hidden_states = () if output_hidden_states else None
715
+
716
+ for i in range(self.config.num_hidden_layers):
717
+ layer_module = self.layers[i]
718
+ if output_hidden_states:
719
+ all_hidden_states = all_hidden_states + (hidden_states,)
720
+
721
+ layer_head_mask = head_mask[i] if head_mask is not None else None
722
+ past_key_value = past_key_values[i] if past_key_values is not None else None
723
+
724
+ if getattr(self.config, "gradient_checkpointing", False) and self.training:
725
+
726
+ def create_custom_forward(module):
727
+ def custom_forward(*inputs):
728
+ return module(*inputs, past_key_value, output_attentions)
729
+
730
+ return custom_forward
731
+
732
+ layer_outputs = torch.utils.checkpoint.checkpoint(
733
+ create_custom_forward(layer_module),
734
+ hidden_states,
735
+ attention_mask,
736
+ layer_head_mask,
737
+ encoder_hidden_states,
738
+ encoder_attention_mask,
739
+ )
740
+ else:
741
+ layer_outputs = layer_module(
742
+ hidden_states,
743
+ attention_mask,
744
+ layer_head_mask,
745
+ encoder_hidden_states,
746
+ encoder_attention_mask,
747
+ output_attentions,
748
+ )
749
+
750
+ hidden_states = layer_outputs[0]
751
+
752
+ return BaseModelOutput(
753
+ last_hidden_state=hidden_states,
754
+ )
755
+
756
+
757
+ class MplugOwlVisualAbstractorModel(PreTrainedModel):
758
+ _no_split_modules = ["MplugOwlVisualAbstractorLayer"]
759
+ def __init__(self, config, language_hidden_size):
760
+ super().__init__(config)
761
+ self.config = config
762
+
763
+ self.encoder = MplugOwlVisualAbstractorEncoder(config)
764
+ self.visual_fc = torch.nn.Linear(config.hidden_size, language_hidden_size)
765
+ self.query_embeds = torch.nn.Parameter(torch.randn(1, config.num_learnable_queries, config.hidden_size))
766
+ self.vit_eos = torch.nn.Parameter(torch.randn(1, 1, language_hidden_size))
767
+
768
+ self.post_init()
769
+
770
+ def _prune_heads(self, heads_to_prune):
771
+ """
772
+ Prunes heads of the model. heads_to_prune: dict of {layer_num: list of heads to prune in this layer} See base
773
+ class PreTrainedModel
774
+ """
775
+ for layer, heads in heads_to_prune.items():
776
+ self.encoder.layer[layer].attention.prune_heads(heads)
777
+
778
+ def get_extended_attention_mask(
779
+ self,
780
+ attention_mask: torch.Tensor,
781
+ input_shape: Tuple[int],
782
+ device: torch.device,
783
+ ) -> torch.Tensor:
784
+ """
785
+ Makes broadcastable attention and causal masks so that future and masked tokens are ignored.
786
+
787
+ Arguments:
788
+ attention_mask (`torch.Tensor`):
789
+ Mask with ones indicating tokens to attend to, zeros for tokens to ignore.
790
+ input_shape (`Tuple[int]`):
791
+ The shape of the input to the model.
792
+ device: (`torch.device`):
793
+ The device of the input to the model.
794
+
795
+ Returns:
796
+ `torch.Tensor` The extended attention mask, with a the same dtype as `attention_mask.dtype`.
797
+ """
798
+ # We can provide a self-attention mask of dimensions [batch_size, from_seq_length, to_seq_length]
799
+ # ourselves in which case we just need to make it broadcastable to all heads.
800
+ if attention_mask.dim() == 3:
801
+ extended_attention_mask = attention_mask[:, None, :, :]
802
+ elif attention_mask.dim() == 2:
803
+ # Provided a padding mask of dimensions [batch_size, seq_length]
804
+ # - the model is an encoder, so make the mask broadcastable to [batch_size, num_heads, seq_length, seq_length]
805
+ extended_attention_mask = attention_mask[:, None, None, :]
806
+ else:
807
+ raise ValueError(
808
+ "Wrong shape for input_ids (shape {}) or attention_mask (shape {})".format(
809
+ input_shape, attention_mask.shape
810
+ )
811
+ )
812
+
813
+ # Since attention_mask is 1.0 for positions we want to attend and 0.0 for
814
+ # masked positions, this operation will create a tensor which is 0.0 for
815
+ # positions we want to attend and -10000.0 for masked positions.
816
+ # Since we are adding it to the raw scores before the softmax, this is
817
+ # effectively the same as removing these entirely.
818
+ extended_attention_mask = extended_attention_mask.to(dtype=self.dtype) # fp16 compatibility
819
+ extended_attention_mask = (1.0 - extended_attention_mask) * -10000.0
820
+ return extended_attention_mask
821
+
822
+ def forward(
823
+ self,
824
+ attention_mask=None,
825
+ head_mask=None,
826
+ encoder_hidden_states=None,
827
+ encoder_attention_mask=None,
828
+ past_key_values=None,
829
+ output_attentions=None,
830
+ output_hidden_states=None,
831
+ return_dict=None,
832
+ ):
833
+ r"""
834
+ encoder_hidden_states (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, `optional`):
835
+ Sequence of hidden-states at the output of the last layer of the encoder. Used in the cross-attention if
836
+ the model is configured as a decoder.
837
+ encoder_attention_mask (`torch.FloatTensor` of shape `(batch_size, sequence_length)`, `optional`):
838
+ Mask to avoid performing attention on the padding token indices of the encoder input. This mask is used in
839
+ the cross-attention if the model is configured as a decoder. Mask values selected in `[0, 1]`:
840
+ - 1 for tokens that are **not masked**,
841
+ - 0 for tokens that are **masked**.
842
+ past_key_values (`tuple(tuple(torch.FloatTensor))` of length `config.n_layers` with each tuple having 4 tensors of:
843
+ shape `(batch_size, num_heads, sequence_length - 1, embed_size_per_head)`): Contains precomputed key and
844
+ value hidden states of the attention blocks. Can be used to speed up decoding. If `past_key_values` are
845
+ used, the user can optionally input only the last `decoder_input_ids` (those that don't have their past key
846
+ value states given to this model) of shape `(batch_size, 1)` instead of all `decoder_input_ids` of shape
847
+ `(batch_size, sequence_length)`.
848
+ """
849
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
850
+ output_hidden_states = (
851
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
852
+ )
853
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
854
+
855
+ query_embeds = self.query_embeds.repeat(encoder_hidden_states.shape[0], 1, 1)
856
+ embedding_output = query_embeds
857
+ input_shape = embedding_output.size()[:-1]
858
+ batch_size, seq_length = input_shape
859
+ device = embedding_output.device
860
+
861
+ # We can provide a self-attention mask of dimensions [batch_size, from_seq_length, to_seq_length]
862
+ # ourselves in which case we just need to make it broadcastable to all heads.
863
+ if attention_mask is None:
864
+ attention_mask = torch.ones(
865
+ (query_embeds.shape[0], query_embeds.shape[1]), dtype=torch.long, device=query_embeds.device
866
+ )
867
+ extended_attention_mask = self.get_extended_attention_mask(attention_mask, input_shape, device)
868
+
869
+ # If a 2D or 3D attention mask is provided for the cross-attention
870
+ # we need to make broadcastable to [batch_size, num_heads, seq_length, seq_length]
871
+ if encoder_hidden_states is not None:
872
+ if type(encoder_hidden_states) == list:
873
+ encoder_batch_size, encoder_sequence_length, _ = encoder_hidden_states[0].size()
874
+ else:
875
+ (
876
+ encoder_batch_size,
877
+ encoder_sequence_length,
878
+ _,
879
+ ) = encoder_hidden_states.size()
880
+ encoder_hidden_shape = (encoder_batch_size, encoder_sequence_length)
881
+
882
+ if type(encoder_attention_mask) == list:
883
+ encoder_extended_attention_mask = [self.invert_attention_mask(mask) for mask in encoder_attention_mask]
884
+ elif encoder_attention_mask is None:
885
+ encoder_attention_mask = torch.ones(encoder_hidden_shape, device=device)
886
+ encoder_extended_attention_mask = self.invert_attention_mask(encoder_attention_mask)
887
+ else:
888
+ encoder_extended_attention_mask = self.invert_attention_mask(encoder_attention_mask)
889
+ else:
890
+ encoder_extended_attention_mask = None
891
+
892
+ # Prepare head mask if needed
893
+ # 1.0 in head_mask indicate we keep the head
894
+ # attention_probs has shape bsz x n_heads x N x N
895
+ # input head_mask has shape [num_heads] or [num_hidden_layers x num_heads]
896
+ # and head_mask is converted to shape [num_hidden_layers x batch x num_heads x seq_length x seq_length]
897
+ head_mask = self.get_head_mask(head_mask, self.config.num_hidden_layers)
898
+
899
+ encoder_outputs = self.encoder(
900
+ embedding_output,
901
+ attention_mask=extended_attention_mask,
902
+ head_mask=head_mask,
903
+ encoder_hidden_states=encoder_hidden_states,
904
+ encoder_attention_mask=encoder_extended_attention_mask,
905
+ past_key_values=past_key_values,
906
+ output_attentions=output_attentions,
907
+ output_hidden_states=output_hidden_states,
908
+ return_dict=return_dict,
909
+ )
910
+ sequence_output = encoder_outputs[0]
911
+ pooled_output = sequence_output[:, 0, :]
912
+
913
+ sequence_output = self.visual_fc(sequence_output)
914
+ sequence_output = torch.cat([sequence_output, self.vit_eos.repeat(sequence_output.shape[0], 1, 1)], dim=1)
915
+
916
+ return BaseModelOutputWithPooling(
917
+ last_hidden_state=sequence_output,
918
+ pooler_output=pooled_output,
919
+ hidden_states=encoder_outputs.hidden_states,
920
+ )
921
+
922
+