autoprogrammer commited on
Commit
e682cfb
·
verified ·
1 Parent(s): 4e41819

Upload sdar_4b_trace_sft-final

Browse files
README.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: other
4
+ base_model: JetLM/SDAR-4B-Chat
5
+ tags:
6
+ - llama-factory
7
+ - full
8
+ - generated_from_trainer
9
+ model-index:
10
+ - name: sft
11
+ results: []
12
+ ---
13
+
14
+ <!-- This model card has been generated automatically according to the information the Trainer had access to. You
15
+ should probably proofread and complete it, then remove this comment. -->
16
+
17
+ # sft
18
+
19
+ This model is a fine-tuned version of [./training/model/SDAR-4B-Chat](https://huggingface.co/./training/model/SDAR-4B-Chat) on an unknown dataset.
20
+
21
+ ## Model description
22
+
23
+ More information needed
24
+
25
+ ## Intended uses & limitations
26
+
27
+ More information needed
28
+
29
+ ## Training and evaluation data
30
+
31
+ More information needed
32
+
33
+ ## Training procedure
34
+
35
+ ### Training hyperparameters
36
+
37
+ The following hyperparameters were used during training:
38
+ - learning_rate: 1e-05
39
+ - train_batch_size: 4
40
+ - eval_batch_size: 8
41
+ - seed: 42
42
+ - distributed_type: multi-GPU
43
+ - num_devices: 8
44
+ - gradient_accumulation_steps: 2
45
+ - total_train_batch_size: 64
46
+ - total_eval_batch_size: 64
47
+ - optimizer: Use OptimizerNames.ADAMW_TORCH with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
48
+ - lr_scheduler_type: cosine
49
+ - lr_scheduler_warmup_ratio: 0.03
50
+ - num_epochs: 3.0
51
+
52
+ ### Training results
53
+
54
+
55
+
56
+ ### Framework versions
57
+
58
+ - Transformers 4.52.4
59
+ - Pytorch 2.8.0+cu128
60
+ - Datasets 3.6.0
61
+ - Tokenizers 0.21.1
added_tokens.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</think>": 151668,
3
+ "</tool_call>": 151658,
4
+ "</tool_response>": 151666,
5
+ "<think>": 151667,
6
+ "<tool_call>": 151657,
7
+ "<tool_response>": 151665,
8
+ "<|MASK|>": 151669,
9
+ "<|box_end|>": 151649,
10
+ "<|box_start|>": 151648,
11
+ "<|endoftext|>": 151643,
12
+ "<|file_sep|>": 151664,
13
+ "<|fim_middle|>": 151660,
14
+ "<|fim_pad|>": 151662,
15
+ "<|fim_prefix|>": 151659,
16
+ "<|fim_suffix|>": 151661,
17
+ "<|im_end|>": 151645,
18
+ "<|im_start|>": 151644,
19
+ "<|image_pad|>": 151655,
20
+ "<|object_ref_end|>": 151647,
21
+ "<|object_ref_start|>": 151646,
22
+ "<|quad_end|>": 151651,
23
+ "<|quad_start|>": 151650,
24
+ "<|repo_name|>": 151663,
25
+ "<|video_pad|>": 151656,
26
+ "<|vision_end|>": 151653,
27
+ "<|vision_pad|>": 151654,
28
+ "<|vision_start|>": 151652
29
+ }
all_results.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "effective_tokens_per_sec": 3457.623292260188,
3
+ "epoch": 3.0,
4
+ "total_flos": 1.0868263403315528e+18,
5
+ "train_loss": 0.12404776059961387,
6
+ "train_runtime": 1235.844,
7
+ "train_samples_per_second": 72.563,
8
+ "train_steps_per_second": 1.136
9
+ }
chat_template.jinja ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
27
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
28
+ {%- elif message.role == "assistant" %}
29
+ {%- set content = message.content %}
30
+ {%- set reasoning_content = '' %}
31
+ {%- if message.reasoning_content is defined and message.reasoning_content is not none %}
32
+ {%- set reasoning_content = message.reasoning_content %}
33
+ {%- else %}
34
+ {%- if '</think>' in message.content %}
35
+ {%- set content = message.content.split('</think>')[-1].lstrip('\n') %}
36
+ {%- set reasoning_content = message.content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
37
+ {%- endif %}
38
+ {%- endif %}
39
+ {%- if loop.index0 > ns.last_query_index %}
40
+ {%- if loop.last or (not loop.last and reasoning_content) %}
41
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
42
+ {%- else %}
43
+ {{- '<|im_start|>' + message.role + '\n' + content }}
44
+ {%- endif %}
45
+ {%- else %}
46
+ {{- '<|im_start|>' + message.role + '\n' + content }}
47
+ {%- endif %}
48
+ {%- if message.tool_calls %}
49
+ {%- for tool_call in message.tool_calls %}
50
+ {%- if (loop.first and content) or (not loop.first) %}
51
+ {{- '\n' }}
52
+ {%- endif %}
53
+ {%- if tool_call.function %}
54
+ {%- set tool_call = tool_call.function %}
55
+ {%- endif %}
56
+ {{- '<tool_call>\n{"name": "' }}
57
+ {{- tool_call.name }}
58
+ {{- '", "arguments": ' }}
59
+ {%- if tool_call.arguments is string %}
60
+ {{- tool_call.arguments }}
61
+ {%- else %}
62
+ {{- tool_call.arguments | tojson }}
63
+ {%- endif %}
64
+ {{- '}\n</tool_call>' }}
65
+ {%- endfor %}
66
+ {%- endif %}
67
+ {{- '<|im_end|>\n' }}
68
+ {%- elif message.role == "tool" %}
69
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
70
+ {{- '<|im_start|>user' }}
71
+ {%- endif %}
72
+ {{- '\n<tool_response>\n' }}
73
+ {{- message.content }}
74
+ {{- '\n</tool_response>' }}
75
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
76
+ {{- '<|im_end|>\n' }}
77
+ {%- endif %}
78
+ {%- endif %}
79
+ {%- endfor %}
80
+ {%- if add_generation_prompt %}
81
+ {{- '<|im_start|>assistant\n' }}
82
+ {%- if enable_thinking is defined and enable_thinking is false %}
83
+ {{- '<think>\n\n</think>\n\n' }}
84
+ {%- endif %}
85
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "SDARForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "auto_map": {
8
+ "AutoConfig": "configuration_sdar.SDARConfig",
9
+ "AutoModel": "modeling_sdar.SDARForCausalLM",
10
+ "AutoModelForCausalLM": "modeling_sdar.SDARForCausalLM"
11
+ },
12
+ "block_size": 4,
13
+ "bos_token_id": 151643,
14
+ "debug": false,
15
+ "eos_token_id": 151643,
16
+ "ep_size": 1,
17
+ "fuse_cross_entropy": true,
18
+ "head_dim": 128,
19
+ "hidden_act": "silu",
20
+ "hidden_size": 2560,
21
+ "initializer_range": 0.02,
22
+ "intermediate_size": 9728,
23
+ "mask_token_id": 151669,
24
+ "max_position_embeddings": 32768,
25
+ "max_window_layers": 36,
26
+ "micro_forward": false,
27
+ "model_type": "sdar",
28
+ "num_attention_heads": 32,
29
+ "num_hidden_layers": 36,
30
+ "num_key_value_heads": 8,
31
+ "rms_norm_eps": 1e-06,
32
+ "rope_scaling": null,
33
+ "rope_theta": 1000000,
34
+ "skip_checkpoint": false,
35
+ "sliding_window": null,
36
+ "tie_word_embeddings": false,
37
+ "torch_dtype": "bfloat16",
38
+ "transformers_version": "4.52.4",
39
+ "use_cache": false,
40
+ "use_deepep": false,
41
+ "use_sliding_window": false,
42
+ "vocab_size": 151936
43
+ }
configuration_sdar.py ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2024 The Qwen team, Alibaba Group and the HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """SDAR model configuration"""
16
+
17
+ from transformers.configuration_utils import PretrainedConfig
18
+ from transformers.modeling_rope_utils import rope_config_validation
19
+ from transformers.utils import logging
20
+
21
+
22
+ logger = logging.get_logger(__name__)
23
+
24
+
25
+ class SDARConfig(PretrainedConfig):
26
+ r"""
27
+ This is the configuration class to store the configuration of a [`SDARModel`]. It is used to instantiate a
28
+ SDAR model according to the specified arguments, defining the model architecture. Instantiating a configuration
29
+ with the defaults will yield a similar configuration to that of
30
+ SDAR-1.7B [DiffuOpen/SDAR-1.7B-Chat](https://huggingface.co/DiffuOpen/SDAR-1.7B-Chat/).
31
+
32
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
33
+ documentation from [`PretrainedConfig`] for more information.
34
+
35
+
36
+ Args:
37
+ vocab_size (`int`, *optional*, defaults to 151936):
38
+ Vocabulary size of the SDAR model. Defines the number of different tokens that can be represented by the
39
+ `inputs_ids` passed when calling [`SDARModel`]
40
+ hidden_size (`int`, *optional*, defaults to 4096):
41
+ Dimension of the hidden representations.
42
+ intermediate_size (`int`, *optional*, defaults to 22016):
43
+ Dimension of the MLP representations.
44
+ num_hidden_layers (`int`, *optional*, defaults to 32):
45
+ Number of hidden layers in the Transformer encoder.
46
+ num_attention_heads (`int`, *optional*, defaults to 32):
47
+ Number of attention heads for each attention layer in the Transformer encoder.
48
+ num_key_value_heads (`int`, *optional*, defaults to 32):
49
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
50
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
51
+ `num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
52
+ converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
53
+ by meanpooling all the original heads within that group. For more details checkout [this
54
+ paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to `32`.
55
+ head_dim (`int`, *optional*, defaults to 128):
56
+ The attention head dimension.
57
+ hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
58
+ The non-linear activation function (function or string) in the decoder.
59
+ max_position_embeddings (`int`, *optional*, defaults to 32768):
60
+ The maximum sequence length that this model might ever be used with.
61
+ initializer_range (`float`, *optional*, defaults to 0.02):
62
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
63
+ rms_norm_eps (`float`, *optional*, defaults to 1e-06):
64
+ The epsilon used by the rms normalization layers.
65
+ use_cache (`bool`, *optional*, defaults to `True`):
66
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
67
+ relevant if `config.is_decoder=True`.
68
+ tie_word_embeddings (`bool`, *optional*, defaults to `False`):
69
+ Whether the model's input and output word embeddings should be tied.
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. NOTE: if you apply new rope type
74
+ and you expect the model to work on longer `max_position_embeddings`, we recommend you to update this value
75
+ accordingly.
76
+ Expected contents:
77
+ `rope_type` (`str`):
78
+ The sub-variant of RoPE to use. Can be one of ['default', 'linear', 'dynamic', 'yarn', 'longrope',
79
+ 'llama3'], with 'default' being the original RoPE implementation.
80
+ `factor` (`float`, *optional*):
81
+ Used with all rope types except 'default'. The scaling factor to apply to the RoPE embeddings. In
82
+ most scaling types, a `factor` of x will enable the model to handle sequences of length x *
83
+ original maximum pre-trained length.
84
+ `original_max_position_embeddings` (`int`, *optional*):
85
+ Used with 'dynamic', 'longrope' and 'llama3'. The original max position embeddings used during
86
+ pretraining.
87
+ `attention_factor` (`float`, *optional*):
88
+ Used with 'yarn' and 'longrope'. The scaling factor to be applied on the attention
89
+ computation. If unspecified, it defaults to value recommended by the implementation, using the
90
+ `factor` field to infer the suggested value.
91
+ `beta_fast` (`float`, *optional*):
92
+ Only used with 'yarn'. Parameter to set the boundary for extrapolation (only) in the linear
93
+ ramp function. If unspecified, it defaults to 32.
94
+ `beta_slow` (`float`, *optional*):
95
+ Only used with 'yarn'. Parameter to set the boundary for interpolation (only) in the linear
96
+ ramp function. If unspecified, it defaults to 1.
97
+ `short_factor` (`List[float]`, *optional*):
98
+ Only used with 'longrope'. The scaling factor to be applied to short contexts (<
99
+ `original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
100
+ size divided by the number of attention heads divided by 2
101
+ `long_factor` (`List[float]`, *optional*):
102
+ Only used with 'longrope'. The scaling factor to be applied to long contexts (<
103
+ `original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
104
+ size divided by the number of attention heads divided by 2
105
+ `low_freq_factor` (`float`, *optional*):
106
+ Only used with 'llama3'. Scaling factor applied to low frequency components of the RoPE
107
+ `high_freq_factor` (`float`, *optional*):
108
+ Only used with 'llama3'. Scaling factor applied to high frequency components of the RoPE
109
+ attention_bias (`bool`, defaults to `False`, *optional*, defaults to `False`):
110
+ Whether to use a bias in the query, key, value and output projection layers during self-attention.
111
+ use_sliding_window (`bool`, *optional*, defaults to `False`):
112
+ Whether to use sliding window attention.
113
+ sliding_window (`int`, *optional*, defaults to 4096):
114
+ Sliding window attention (SWA) window size. If not specified, will default to `4096`.
115
+ max_window_layers (`int`, *optional*, defaults to 28):
116
+ The number of layers that use SWA (Sliding Window Attention). The bottom layers use SWA while the top use full attention.
117
+ attention_dropout (`float`, *optional*, defaults to 0.0):
118
+ The dropout ratio for the attention probabilities.
119
+
120
+ ```python
121
+ >>> from transformers import SDARModel, SDARConfig
122
+
123
+ >>> # Initializing a SDAR style configuration
124
+ >>> configuration = SDARConfig()
125
+
126
+ >>> # Initializing a model from the SDAR-8B style configuration
127
+ >>> model = SDARModel(configuration)
128
+
129
+ >>> # Accessing the model configuration
130
+ >>> configuration = model.config
131
+ ```"""
132
+
133
+ model_type = "sdar"
134
+ keys_to_ignore_at_inference = ["past_key_values"]
135
+
136
+ # Default tensor parallel plan for base model `SDAR`
137
+ base_model_tp_plan = {
138
+ "layers.*.self_attn.q_proj": "colwise",
139
+ "layers.*.self_attn.k_proj": "colwise",
140
+ "layers.*.self_attn.v_proj": "colwise",
141
+ "layers.*.self_attn.o_proj": "rowwise",
142
+ "layers.*.mlp.gate_proj": "colwise",
143
+ "layers.*.mlp.up_proj": "colwise",
144
+ "layers.*.mlp.down_proj": "rowwise",
145
+ }
146
+ base_model_pp_plan = {
147
+ "embed_tokens": (["input_ids"], ["inputs_embeds"]),
148
+ "layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
149
+ "norm": (["hidden_states"], ["hidden_states"]),
150
+ }
151
+
152
+ def __init__(
153
+ self,
154
+ vocab_size=151936,
155
+ hidden_size=4096,
156
+ intermediate_size=22016,
157
+ num_hidden_layers=32,
158
+ num_attention_heads=32,
159
+ num_key_value_heads=32,
160
+ head_dim=128,
161
+ hidden_act="silu",
162
+ max_position_embeddings=32768,
163
+ initializer_range=0.02,
164
+ rms_norm_eps=1e-6,
165
+ use_cache=True,
166
+ tie_word_embeddings=False,
167
+ rope_theta=10000.0,
168
+ rope_scaling=None,
169
+ attention_bias=False,
170
+ use_sliding_window=False,
171
+ sliding_window=4096,
172
+ max_window_layers=28,
173
+ attention_dropout=0.0,
174
+ **kwargs,
175
+ ):
176
+ self.vocab_size = vocab_size
177
+ self.max_position_embeddings = max_position_embeddings
178
+ self.hidden_size = hidden_size
179
+ self.intermediate_size = intermediate_size
180
+ self.num_hidden_layers = num_hidden_layers
181
+ self.num_attention_heads = num_attention_heads
182
+ self.use_sliding_window = use_sliding_window
183
+ self.sliding_window = sliding_window # we check `use_sliding_window` in the modeling code
184
+ self.max_window_layers = max_window_layers
185
+
186
+ # for backward compatibility
187
+ if num_key_value_heads is None:
188
+ num_key_value_heads = num_attention_heads
189
+
190
+ self.num_key_value_heads = num_key_value_heads
191
+ self.head_dim = head_dim
192
+ self.hidden_act = hidden_act
193
+ self.initializer_range = initializer_range
194
+ self.rms_norm_eps = rms_norm_eps
195
+ self.use_cache = use_cache
196
+ self.rope_theta = rope_theta
197
+ self.rope_scaling = rope_scaling
198
+ self.attention_bias = attention_bias
199
+ self.attention_dropout = attention_dropout
200
+ # Validate the correctness of rotary position embeddings parameters
201
+ # BC: if there is a 'type' field, move it to 'rope_type'.
202
+ if self.rope_scaling is not None and "type" in self.rope_scaling:
203
+ self.rope_scaling["rope_type"] = self.rope_scaling["type"]
204
+ rope_config_validation(self)
205
+
206
+ super().__init__(
207
+ tie_word_embeddings=tie_word_embeddings,
208
+ **kwargs,
209
+ )
210
+
211
+
212
+ __all__ = ["SDARConfig"]
fused_linear_diffusion_cross_entropy.py ADDED
@@ -0,0 +1,682 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+
3
+ # Code adapted from
4
+ # https://github.com/fla-org/flash-linear-attention/blob/main/fla/modules/fused_linear_cross_entropy.py
5
+ # Implementation of element-wise division of cross entropy loss
6
+
7
+
8
+ # Code adapted from
9
+ # https://github.com/linkedin/Liger-Kernel/blob/main/src/liger_kernel/ops/fused_linear_cross_entropy.py
10
+
11
+ from functools import partial
12
+ from typing import Optional, Tuple
13
+
14
+ import torch
15
+ import torch.nn as nn
16
+ import torch.nn.functional as F
17
+ import triton
18
+ import triton.language as tl
19
+ from torch.distributed import DeviceMesh
20
+ from torch.distributed.tensor import DTensor, Replicate, Shard, distribute_module
21
+ from torch.distributed.tensor.parallel import ParallelStyle
22
+
23
+ # The hard limit of TRITON_MAX_TENSOR_NUMEL is 1048576
24
+ # https://github.com/triton-lang/triton/blob/ba42a5c68fd0505f8c42f4202d53be0f8d9a5fe0/python/triton/language/core.py#L19
25
+ # However, setting limit as 65536 as in LayerNorm tutorial is faster because of less register spilling
26
+ # The optimal maximum block size depends on your hardware, your kernel, and your dtype
27
+ MAX_FUSED_SIZE = 65536 // 2
28
+
29
+
30
+ @triton.heuristics({
31
+ 'HAS_SCALE': lambda args: args['scale'] is not None
32
+ })
33
+ @triton.autotune(
34
+ configs=[
35
+ triton.Config({}, num_warps=num_warps)
36
+ for num_warps in [1, 2, 4, 8, 16, 32]
37
+ ],
38
+ key=['D']
39
+ )
40
+ @triton.jit
41
+ def logsumexp_fwd_kernel(
42
+ x,
43
+ z,
44
+ scale,
45
+ D: tl.constexpr,
46
+ B: tl.constexpr,
47
+ HAS_SCALE: tl.constexpr
48
+ ):
49
+ i_n, i_d = tl.program_id(0).to(tl.int64), tl.program_id(1).to(tl.int64)
50
+ o_d = i_d * B + tl.arange(0, B)
51
+ m_d = o_d < D
52
+
53
+ b_x = tl.load(x + i_n * D + o_d, mask=m_d, other=-float('inf'))
54
+ if HAS_SCALE:
55
+ b_x = b_x * scale
56
+ b_m = tl.max(b_x, 0)
57
+ b_z = tl.log(tl.sum(tl.exp(b_x - b_m), 0)) + b_m
58
+ tl.store(z + i_n * tl.cdiv(D, B) + i_d, b_z)
59
+
60
+
61
+ def logsumexp_fwd(
62
+ x,
63
+ scale: Optional[float] = None,
64
+ dtype: Optional[torch.dtype] = None
65
+ ):
66
+ r"""
67
+ Compute the logsumexp of the input tensor over the last dimension.
68
+
69
+ Args:
70
+ x (Tensor):
71
+ The input tensor of any shape.
72
+ scale (Optional[float]):
73
+ The scale applied to the input tensor. Default: `None`.
74
+ dtype (Optional[torch.dtype]):
75
+ The data type of the output tensor. Default: `None`.
76
+ Returns:
77
+ Tensor: The logsumexp of the input tensor.
78
+ """
79
+
80
+ shape = x.shape
81
+ x = x.view(-1, shape[-1])
82
+ N, D = x.shape
83
+ B = min(triton.next_power_of_2(D), 64 * 1024)
84
+ ND = triton.cdiv(D, B)
85
+
86
+ z = x.new_empty(N, ND, dtype=torch.float)
87
+ logsumexp_fwd_kernel[(N, ND)](
88
+ x=x,
89
+ z=z,
90
+ scale=scale,
91
+ D=D,
92
+ B=B
93
+ )
94
+ z = z.logsumexp(-1).view(*shape[:-1])
95
+ if dtype is not None and dtype != torch.float:
96
+ z = z.to(dtype)
97
+ return z
98
+
99
+ @triton.jit
100
+ def cross_entropy_kernel(
101
+ logits,
102
+ lse,
103
+ target,
104
+ p_mask,
105
+ loss,
106
+ total,
107
+ ignore_index,
108
+ label_smoothing: tl.constexpr,
109
+ logit_scale: tl.constexpr,
110
+ reduction: tl.constexpr,
111
+ V: tl.constexpr,
112
+ BV: tl.constexpr
113
+ ):
114
+ """
115
+ This kernel computes both cross entropy loss and the gradient of the input.
116
+ We only consider hard label + mean reduction for now.
117
+ Please refer to https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html for the math.
118
+
119
+ Args:
120
+ logits:
121
+ Pointer to logits tensor.
122
+ lse:
123
+ Pointer to logsumexp tensor.
124
+ target: Pointer to target tensor.
125
+ loss:
126
+ Pointer to tensor to store the loss.
127
+ V (int):
128
+ The number of columns in the input tensor.
129
+ total (int):
130
+ The number of non-ignored classes.
131
+ ignore_index (int):
132
+ The index to ignore in the target.
133
+ label_smoothing (float):
134
+ The amount of smoothing when computing the loss, where 0.0 means no smoothing.
135
+ reduction (str):
136
+ The string for the reduction to apply
137
+ BV (int):
138
+ The block size for vocab.
139
+ """
140
+
141
+ # https://github.com/triton-lang/triton/issues/1058
142
+ # If B*T*V is too large, i_n * stride will overflow out of int32, so we convert to int64
143
+ i_n = tl.program_id(0).to(tl.int64)
144
+ NV = tl.cdiv(V, BV)
145
+
146
+ # 1. Load target first because if the target is ignore_index, we can return right away
147
+ b_y = tl.load(target + i_n)
148
+ # load p_mask
149
+ b_p_mask = tl.load(p_mask + i_n)
150
+
151
+ # 2. locate the start index
152
+ logits += i_n * V
153
+
154
+ if b_y == ignore_index:
155
+ # set all x as 0
156
+ for i in range(0, V, BV):
157
+ o_v = i + tl.arange(0, BV)
158
+ tl.store(logits + o_v, 0.0, mask=o_v < V)
159
+ return
160
+
161
+ # Online softmax: 2 loads + 1 store (compared with 3 loads + 1 store for the safe softmax)
162
+ # Refer to Algorithm 3 in the paper: https://arxiv.org/pdf/1805.02867
163
+
164
+ # 3. [Online softmax] first pass: compute logsumexp
165
+ # we did this in anouter kernel
166
+ b_l = tl.load(logits + b_y) * logit_scale
167
+ b_lse = tl.load(lse + i_n)
168
+
169
+ # 4. Calculate the loss
170
+ # loss = lse - logits_l
171
+ # celoss = -log(q_y) = -log(softmax(x_y))
172
+ b_loss = (b_lse - b_l) / b_p_mask # Diffusion Scaled '1/t'
173
+
174
+ # Label smoothing is a general case of normal cross entropy
175
+ # See the full derivation at https://github.com/linkedin/Liger-Kernel/pull/198#issue-2503665310
176
+ b_z = 0.0
177
+ eps = label_smoothing / V
178
+
179
+ # We need tl.debug_barrier() as mentioned in
180
+ # https://github.com/triton-lang/triton/blob/ba42a5c68fd0505f8c42f4202d53be0f8d9a5fe0/python/triton/ops/cross_entropy.py#L34
181
+ tl.debug_barrier()
182
+
183
+ # 5. [Online Softmax] Second pass: compute gradients
184
+ # For 'mean' reduction, gradients are normalized by number of non-ignored elements
185
+ # dx_y = (softmax(x_y) - 1) / N
186
+ # dx_i = softmax(x_i) / N, i != y
187
+ # For label smoothing:
188
+ # dx_i = (softmax(x_y) - label_smoothing / V) / N, i != y
189
+ # dx_y = (softmax(x_y) - label_smoothing / V - (1 - label_smoothing)) / N
190
+ # = dx_i - (1 - label_smoothing) / N
191
+ for iv in range(0, NV):
192
+ o_v = iv * BV + tl.arange(0, BV)
193
+ b_logits = tl.load(logits + o_v, mask=o_v < V, other=float('-inf')) * logit_scale
194
+ if label_smoothing > 0:
195
+ # scale X beforehand to avoid overflow
196
+ b_z += tl.sum(tl.where(o_v < V, -eps * b_logits, 0.0))
197
+ b_p = (tl.exp(b_logits - b_lse) - eps) * logit_scale
198
+ b_p /= b_p_mask # 修改
199
+ if reduction == "mean":
200
+ b_p = b_p / total
201
+ tl.store(logits + o_v, b_p, mask=o_v < V)
202
+
203
+ tl.debug_barrier()
204
+
205
+ # Orginal loss = H(q, p), with label smoothing regularization = H(q', p) and (label_smoothing / V) = eps
206
+ # H(q', p) = (1 - label_smoothing) * H(q, p) + label_smoothing * H(u, p)
207
+ # = (1 - label_smoothing) * H(q, p) + eps * sum(logsoftmax(x_i))
208
+ # By using m (global max of xi) and d (sum of e^(xi-m)), we can simplify as:
209
+ # = (1 - label_smoothing) * H(q, p) + (-sum(x_i * eps) + label_smoothing * (m + logd))
210
+ # Refer to H(q', p) in section 7 of the paper:
211
+ # https://arxiv.org/pdf/1512.00567
212
+ # pytorch:
213
+ # https://github.com/pytorch/pytorch/blob/2981534f54d49fa3a9755c9b0855e7929c2527f0/aten/src/ATen/native/LossNLL.cpp#L516
214
+ # See full derivation at https://github.com/linkedin/Liger-Kernel/pull/198#issuecomment-2333753087
215
+ if label_smoothing > 0:
216
+ b_loss = b_loss * (1 - label_smoothing) + (b_z + label_smoothing * b_lse)
217
+
218
+ # 6. Specially handle the i==y case where `dx_y = (softmax(x_y) - (1 - label_smoothing) / N`
219
+ b_l = tl.load(logits + b_y)
220
+
221
+ # Normalize the loss by the number of non-ignored elements if reduction is "mean"
222
+ if reduction == 'mean':
223
+ b_loss = b_loss / total
224
+ # b_l += (label_smoothing - 1) / total * logit_scale
225
+ # b_l has already been divided by b_p_mask and total
226
+ b_l += (label_smoothing - 1) / b_p_mask / total * logit_scale
227
+ else:
228
+ # b_l += (label_smoothing - 1) * logit_scale
229
+ b_l += (label_smoothing - 1) / b_p_mask * logit_scale
230
+
231
+ tl.store(loss + i_n, b_loss)
232
+ tl.store(logits + b_y, b_l)
233
+
234
+
235
+ @triton.jit
236
+ def elementwise_mul_kernel(
237
+ x,
238
+ g,
239
+ N: tl.constexpr,
240
+ B: tl.constexpr
241
+ ):
242
+ """
243
+ This function multiplies each element of the tensor pointed by x with the value pointed by g.
244
+ The multiplication is performed in-place on the tensor pointed by x.
245
+
246
+ Parameters:
247
+ x:
248
+ Pointer to the input tensor.
249
+ g:
250
+ Pointer to the gradient output value.
251
+ N (int):
252
+ The number of columns in the input tensor.
253
+ B (int):
254
+ The block size for Triton operations.
255
+ """
256
+
257
+ # Get the program ID and convert it to int64 to avoid overflow
258
+ i_x = tl.program_id(0).to(tl.int64)
259
+ o_x = i_x * B + tl.arange(0, B)
260
+
261
+ # Load the gradient output value
262
+ b_g = tl.load(g)
263
+ b_x = tl.load(x + o_x, mask=o_x < N)
264
+ tl.store(x + o_x, b_x * b_g, mask=o_x < N)
265
+
266
+
267
+ def fused_linear_cross_entropy_forward(
268
+ x: torch.Tensor,
269
+ target: torch.LongTensor,
270
+ weight: torch.Tensor,
271
+ bias: torch.Tensor = None,
272
+ p_mask: torch.Tensor = None,
273
+ ignore_index: int = -100,
274
+ label_smoothing: float = 0.0,
275
+ logit_scale: float = 1.0,
276
+ num_chunks: int = 8,
277
+ reduction: str = "mean"
278
+ ):
279
+ device = x.device
280
+ # inputs have shape: [N, H]
281
+ # materialized activations will have shape: [N, V]
282
+ # the increase in memory = [N, V]
283
+ # reduction can be achieved by partitioning the number of tokens N into smaller chunks.
284
+
285
+ # ideally, we would like to achieve the same memory consumption as [N, H],
286
+ # so the expected chunk size should be:
287
+ # NC = ceil(V / H)
288
+ # C = ceil(N / NC)
289
+ # for ex: N = 4096*4, V = 32000, H = 4096 ==> NC = 8, C = ceil(N / NC) = 2048
290
+ N, H, V = *x.shape, weight.shape[0]
291
+ BV = min(MAX_FUSED_SIZE, triton.next_power_of_2(V))
292
+ # TODO: in real cases, we may need to limit the number of chunks NC to
293
+ # ensure the precisions of accumulated gradients
294
+ NC = min(num_chunks, triton.cdiv(V, H))
295
+ C = triton.next_power_of_2(triton.cdiv(N, NC))
296
+ NC = triton.cdiv(N, C)
297
+
298
+ # [N, H]
299
+ dx = torch.zeros_like(x, device=device)
300
+ # [V, H]
301
+ dw = torch.zeros_like(weight, device=device, dtype=torch.float) if weight is not None else None
302
+ # [V]
303
+ db = torch.zeros_like(bias, device=device, dtype=torch.float) if bias is not None else None
304
+ # [N]
305
+ loss = torch.zeros(N, device=device, dtype=torch.float)
306
+
307
+ total = target.ne(ignore_index).sum().item()
308
+
309
+ for ic in range(NC):
310
+ start, end = ic * C, min((ic + 1) * C, N)
311
+ # [C, N]
312
+ c_x = x[start:end]
313
+ # when doing matmul, use the original precision
314
+ # [C, V]
315
+ c_logits = F.linear(c_x, weight, bias)
316
+ c_target = target[start:end]
317
+ c_p_mask = p_mask[start:end]
318
+ # [C]
319
+ # keep lse in fp32 to maintain precision
320
+ c_lse = logsumexp_fwd(c_logits, scale=logit_scale, dtype=torch.float)
321
+
322
+ # unreduced loss
323
+ c_loss = loss[start:end]
324
+
325
+ # Here we calculate the gradient of c_logits in place so we can save memory.
326
+ cross_entropy_kernel[(c_logits.shape[0],)](
327
+ logits=c_logits,
328
+ lse=c_lse,
329
+ target=c_target,
330
+ p_mask=c_p_mask,
331
+ loss=c_loss,
332
+ total=total,
333
+ ignore_index=ignore_index,
334
+ label_smoothing=label_smoothing,
335
+ logit_scale=logit_scale,
336
+ reduction=reduction,
337
+ V=V,
338
+ BV=BV,
339
+ num_warps=32
340
+ )
341
+
342
+ # gradient of logits is computed in-place by the above triton kernel and is of shape: C x V
343
+ # thus dx should be of shape: C x H
344
+ dx[start:end] = torch.mm(c_logits, weight)
345
+
346
+ # keep dw in fp32 to maintain precision
347
+ if weight is not None:
348
+ dw += c_logits.t() @ c_x
349
+
350
+ if bias is not None:
351
+ torch.add(input=db, other=c_logits.sum(0), out=db)
352
+
353
+ loss = loss.sum()
354
+ if dw is not None:
355
+ dw = dw.to(weight)
356
+ if db is not None:
357
+ db = db.to(bias)
358
+ return loss, dx, dw, db
359
+
360
+
361
+ def fused_linear_cross_entropy_backward(
362
+ do: torch.Tensor,
363
+ dx: torch.Tensor,
364
+ dw: torch.Tensor,
365
+ db: torch.Tensor
366
+ ):
367
+ # If cross entropy is the last layer, do is 1.0. Skip the mul to save time
368
+ if torch.ne(do, torch.tensor(1.0, device=do.device)):
369
+ # We use a Triton kernel instead of a PyTorch operation because modifying inputs in-place
370
+ # for gradient storage and backward multiple times causes anomalies with PyTorch but not with Triton.
371
+ N, H = dx.shape
372
+ B = min(MAX_FUSED_SIZE, triton.next_power_of_2(H))
373
+
374
+ elementwise_mul_kernel[(triton.cdiv(N * H, B),)](
375
+ x=dx,
376
+ g=do,
377
+ N=N*H,
378
+ B=B,
379
+ num_warps=32,
380
+ )
381
+
382
+ # handle dw
383
+ if dw is not None:
384
+ V, H = dw.shape
385
+ elementwise_mul_kernel[(triton.cdiv(V * H, B),)](
386
+ x=dw,
387
+ g=do,
388
+ N=V*H,
389
+ B=B,
390
+ num_warps=32,
391
+ )
392
+
393
+ if db is not None:
394
+ V = db.shape[0]
395
+ elementwise_mul_kernel[(triton.cdiv(V, B),)](
396
+ x=db,
397
+ g=do,
398
+ N=V,
399
+ B=B,
400
+ num_warps=32,
401
+ )
402
+ return dx, dw, db
403
+
404
+
405
+ class FusedLinearCrossEntropyFunction(torch.autograd.Function):
406
+
407
+ @staticmethod
408
+ def forward(
409
+ ctx,
410
+ x: torch.Tensor,
411
+ target: torch.LongTensor,
412
+ weight: torch.Tensor,
413
+ bias: torch.Tensor = None,
414
+ p_mask: torch.Tensor = None,
415
+ ignore_index: int = -100,
416
+ label_smoothing: float = 0.0,
417
+ logit_scale: float = 1.0,
418
+ num_chunks: int = 8,
419
+ reduction: str = "mean"
420
+ ):
421
+ """
422
+ Fusing the last linear layer with cross-entropy loss
423
+ Reference: https://github.com/mgmalek/efficient_cross_entropy
424
+
425
+ Handle the forward and backward pass of the final linear layer via cross-entropy loss by avoiding
426
+ the materialization of the large logits tensor. Since Cross Entropy Loss is the last layer, we can
427
+ compute the gradient at the forward pass. By doing so, we don't have to store the x and target
428
+ for the backward pass.
429
+
430
+ x (torch.Tensor): [batch_size * seq_len, hidden_size]
431
+ target (torch.LongTensor): [batch_size * seq_len]
432
+ where each value is in [0, vocab_size).
433
+ weight (torch.Tensor): [vocab_size, hidden_size]
434
+ where `vocab_size` is the number of classes.
435
+ bias (Optional[torch.Tensor]): [vocab_size]
436
+ where `vocab_size` is the number of classes.
437
+ p_mask(torch.Tensor): [batch_size * seq_len]
438
+ Its shape should be same as target.
439
+ ignore_index:
440
+ the index to ignore in the target.
441
+ label_smoothing:
442
+ the amount of smoothing when computing the loss, where 0.0 means no smoothing.
443
+ logit_scale: float = 1.0,
444
+ A scaling factor applied to the logits. Default: 1.0
445
+ num_chunks: int
446
+ The number of chunks to split the input tensor into for processing.
447
+ This can help optimize memory usage and computation speed.
448
+ Default: 8
449
+ reduction:
450
+ Specifies the reduction to apply to the output: 'mean' | 'sum'.
451
+ 'mean': the weighted mean of the output is taken,
452
+ 'sum': the output will be summed.
453
+ Default: 'mean'.
454
+ """
455
+ loss, dx, dw, db = fused_linear_cross_entropy_forward(
456
+ x,
457
+ target,
458
+ weight,
459
+ bias,
460
+ p_mask,
461
+ ignore_index,
462
+ label_smoothing,
463
+ logit_scale,
464
+ num_chunks,
465
+ reduction
466
+ )
467
+ # downcast to dtype and store for backward
468
+ ctx.save_for_backward(
469
+ dx.detach(),
470
+ dw.detach() if weight is not None else None,
471
+ db.detach() if bias is not None else None,
472
+ )
473
+ return loss
474
+
475
+ @staticmethod
476
+ def backward(ctx, do):
477
+ dx, dw, db = ctx.saved_tensors
478
+ dx, dw, db = fused_linear_cross_entropy_backward(do, dx, dw, db)
479
+ # 10 gradients should be returned, with `p_mask` having no grads
480
+ # Check the number of arguments in the `forward` method
481
+ return dx, None, dw, db, None, None, None, None, None, None
482
+
483
+
484
+ def fused_linear_cross_entropy_loss(
485
+ x: torch.Tensor,
486
+ target: torch.LongTensor,
487
+ weight: torch.Tensor,
488
+ bias: torch.Tensor = None,
489
+ p_mask: torch.Tensor = None,
490
+ ignore_index: int = -100,
491
+ label_smoothing: float = 0.0,
492
+ logit_scale: float = 1.0,
493
+ num_chunks: int = 8,
494
+ reduction: str = "mean"
495
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
496
+ """
497
+ Args:
498
+ x (torch.Tensor): [batch_size * seq_len, hidden_size]
499
+ target (torch.LongTensor): [batch_size * seq_len]
500
+ where each value is in [0, vocab_size).
501
+ weight (torch.Tensor): [vocab_size, hidden_size]
502
+ where `vocab_size` is the number of classes.
503
+ bias (Optional[torch.Tensor]): [vocab_size]
504
+ where `vocab_size` is the number of classes.
505
+ p_mask(torch.Tensor): [batch_size * seq_len]
506
+ Its shape should be same as target.
507
+ ignore_index: int.
508
+ If target == ignore_index, the loss is set to 0.0.
509
+ label_smoothing: float
510
+ logit_scale: float
511
+ A scaling factor applied to the logits. Default: 1.0
512
+ num_chunks: int
513
+ The number of chunks to split the input tensor into for processing.
514
+ This can help optimize memory usage and computation speed.
515
+ Default: 8
516
+ reduction:
517
+ Specifies the reduction to apply to the output: 'mean' | 'sum'.
518
+ 'mean': the weighted mean of the output is taken,
519
+ 'sum': the output will be summed.
520
+ Default: 'mean'.
521
+ Returns:
522
+ losses: [batch,], float
523
+ """
524
+ return FusedLinearCrossEntropyFunction.apply(
525
+ x,
526
+ target,
527
+ weight,
528
+ bias,
529
+ p_mask,
530
+ ignore_index,
531
+ label_smoothing,
532
+ logit_scale,
533
+ num_chunks,
534
+ reduction
535
+ )
536
+
537
+
538
+ class FusedLinearDiffusionCrossEntropyLoss(nn.Module):
539
+
540
+ def __init__(
541
+ self,
542
+ ignore_index: int = -100,
543
+ label_smoothing: float = 0.0,
544
+ logit_scale: float = 1.0,
545
+ num_chunks: int = 8,
546
+ reduction: str = "mean"
547
+ ):
548
+ """
549
+ Args:
550
+ ignore_index: int.
551
+ If target == ignore_index, the loss is set to 0.0.
552
+ label_smoothing: float
553
+ logit_scale: float
554
+ A scaling factor applied to the logits. Default: 1.0
555
+ num_chunks: int
556
+ The number of chunks to split the input tensor into for processing.
557
+ This can help optimize memory usage and computation speed.
558
+ Default: 8
559
+ reduction:
560
+ Specifies the reduction to apply to the output: 'mean' | 'sum'.
561
+ 'mean': the weighted mean of the output is taken,
562
+ 'sum': the output will be summed.
563
+ Default: 'mean'.
564
+ """
565
+ super().__init__()
566
+
567
+ assert reduction in ["mean", "sum"], f"reduction: {reduction} is not supported"
568
+
569
+ self.ignore_index = ignore_index
570
+ self.label_smoothing = label_smoothing
571
+ self.logit_scale = logit_scale
572
+ self.num_chunks = num_chunks
573
+ self.reduction = reduction
574
+
575
+ @torch.compiler.disable
576
+ def forward(
577
+ self,
578
+ x: torch.Tensor,
579
+ target: torch.LongTensor,
580
+ weight: torch.Tensor,
581
+ bias: Optional[torch.Tensor] = None,
582
+ p_mask: torch.Tensor = None
583
+ ):
584
+ """
585
+ Args:
586
+ x (torch.Tensor): [batch_size, seq_len, hidden_size]
587
+ target (torch.LongTensor): [batch_size, seq_len]
588
+ where each value is in [0, V).
589
+ weight (torch.Tensor): [vocab_size, hidden_size]
590
+ where `vocab_size` is the number of classes.
591
+ bias (Optional[torch.Tensor]): [vocab_size]
592
+ where `vocab_size` is the number of classes.
593
+ p_mask(torch.Tensor): [batch_size, seq_len]
594
+ Its shape is same as target.
595
+ Shape: (1, packed_length) when varlen attn is used.
596
+ Returns:
597
+ loss
598
+
599
+ TODO:
600
+ follow https://github.com/ML-GSAI/LLaDA/blob/main/GUIDELINES.md#pre-training
601
+ ```py
602
+ unreduced_loss /= p_mask
603
+ ```
604
+ Scale the values of `unreduced_loss at different positions
605
+ """
606
+ if p_mask is None:
607
+ p_mask = torch.ones_like(target, dtype=torch.float, device=x.device)
608
+
609
+ x = x.contiguous().view(-1, x.shape[-1])
610
+ target = target.contiguous().view(-1)
611
+ weight = weight.contiguous()
612
+ bias = bias.contiguous() if bias else None
613
+ p_mask = p_mask.contiguous().view(-1)
614
+ l, d = x.shape
615
+ assert l == target.shape[0] == p_mask.shape[0], f"{x.shape=}, {target.shape=}, {p_mask.shape=}"
616
+
617
+ loss = fused_linear_cross_entropy_loss(
618
+ x,
619
+ target,
620
+ weight=weight,
621
+ bias=bias,
622
+ p_mask=p_mask,
623
+ ignore_index=self.ignore_index,
624
+ label_smoothing=self.label_smoothing,
625
+ logit_scale=self.logit_scale,
626
+ num_chunks=self.num_chunks,
627
+ reduction=self.reduction
628
+ )
629
+ return loss
630
+
631
+
632
+ class LinearLossParallel(ParallelStyle):
633
+ def __init__(
634
+ self,
635
+ *,
636
+ sequence_dim: int = 1,
637
+ use_local_output: bool = False,
638
+ ):
639
+ super().__init__()
640
+
641
+ self.sequence_sharding = (Shard(sequence_dim),)
642
+ self.use_local_output = use_local_output
643
+
644
+ @staticmethod
645
+ def _prepare_input_fn(sequence_sharding, mod, inputs, device_mesh):
646
+ x, target, weight, bias = inputs
647
+
648
+ if not isinstance(x, DTensor):
649
+ # assume the input passed in already sharded on the sequence dim and create the DTensor
650
+ x = DTensor.from_local(x, device_mesh, sequence_sharding)
651
+ if x.placements != sequence_sharding:
652
+ x = x.redistribute(placements=sequence_sharding, async_op=True)
653
+ if not isinstance(target, DTensor):
654
+ target = DTensor.from_local(target, device_mesh, [Replicate()])
655
+ if target.placements != sequence_sharding:
656
+ target = target.redistribute(placements=sequence_sharding, async_op=True)
657
+
658
+ if not isinstance(weight, DTensor):
659
+ weight = DTensor.from_local(weight, device_mesh, [Replicate()])
660
+ if weight.placements != [Replicate()]:
661
+ # we replicate the weight/bias in FLCE
662
+ weight = weight.redistribute(placements=[Replicate()], async_op=True)
663
+
664
+ if bias is not None and not isinstance(bias, DTensor):
665
+ bias = DTensor.from_local(bias, device_mesh, [Replicate()])
666
+ if bias is not None and bias.placements != [Replicate()]:
667
+ bias = bias.redistribute(placements=[Replicate()], async_op=True)
668
+
669
+ return x.to_local(), target.to_local(), weight.to_local(), bias.to_local() if bias is not None else bias
670
+
671
+ @staticmethod
672
+ def _prepare_output_fn(use_local_output, mod, outputs, device_mesh):
673
+ return outputs.to_local() if use_local_output else outputs
674
+
675
+ def _apply(self, module: nn.Module, device_mesh: DeviceMesh) -> nn.Module:
676
+ return distribute_module(
677
+ module,
678
+ device_mesh,
679
+ partition_fn=None,
680
+ input_fn=partial(self._prepare_input_fn, self.sequence_sharding),
681
+ output_fn=partial(self._prepare_output_fn, self.use_local_output)
682
+ )
generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "temperature": 0.6,
10
+ "top_k": 20,
11
+ "top_p": 0.95,
12
+ "transformers_version": "4.52.4"
13
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model-00001-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c135347007a7f8f4b876f332fea92bbc96ad149a56e1e24541a0b311bbc70be
3
+ size 4967215360
model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d8cff1213dac81625c62af1cf2c8da2b31962cb8e5a67241554e919c8359d353
3
+ size 3855679144
model.safetensors.index.json ADDED
@@ -0,0 +1,406 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 8822848512
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "model-00002-of-00002.safetensors",
7
+ "model.embed_tokens.weight": "model-00001-of-00002.safetensors",
8
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00002.safetensors",
9
+ "model.layers.0.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
10
+ "model.layers.0.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
11
+ "model.layers.0.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
12
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
13
+ "model.layers.0.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
14
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
15
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
16
+ "model.layers.0.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
17
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
18
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
19
+ "model.layers.1.input_layernorm.weight": "model-00001-of-00002.safetensors",
20
+ "model.layers.1.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
21
+ "model.layers.1.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
22
+ "model.layers.1.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
23
+ "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
24
+ "model.layers.1.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
25
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
26
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
27
+ "model.layers.1.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
28
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
29
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
30
+ "model.layers.10.input_layernorm.weight": "model-00001-of-00002.safetensors",
31
+ "model.layers.10.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
32
+ "model.layers.10.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
33
+ "model.layers.10.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
34
+ "model.layers.10.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
35
+ "model.layers.10.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
36
+ "model.layers.10.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
37
+ "model.layers.10.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
38
+ "model.layers.10.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
39
+ "model.layers.10.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
40
+ "model.layers.10.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
41
+ "model.layers.11.input_layernorm.weight": "model-00001-of-00002.safetensors",
42
+ "model.layers.11.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
43
+ "model.layers.11.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
44
+ "model.layers.11.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
45
+ "model.layers.11.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
46
+ "model.layers.11.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
47
+ "model.layers.11.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
48
+ "model.layers.11.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
49
+ "model.layers.11.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
50
+ "model.layers.11.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
51
+ "model.layers.11.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
52
+ "model.layers.12.input_layernorm.weight": "model-00001-of-00002.safetensors",
53
+ "model.layers.12.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
54
+ "model.layers.12.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
55
+ "model.layers.12.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
56
+ "model.layers.12.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
57
+ "model.layers.12.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
58
+ "model.layers.12.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
59
+ "model.layers.12.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
60
+ "model.layers.12.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
61
+ "model.layers.12.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
62
+ "model.layers.12.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
63
+ "model.layers.13.input_layernorm.weight": "model-00001-of-00002.safetensors",
64
+ "model.layers.13.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
65
+ "model.layers.13.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
66
+ "model.layers.13.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
67
+ "model.layers.13.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
68
+ "model.layers.13.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
69
+ "model.layers.13.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
70
+ "model.layers.13.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
71
+ "model.layers.13.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
72
+ "model.layers.13.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
73
+ "model.layers.13.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
74
+ "model.layers.14.input_layernorm.weight": "model-00001-of-00002.safetensors",
75
+ "model.layers.14.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
76
+ "model.layers.14.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
77
+ "model.layers.14.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
78
+ "model.layers.14.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
79
+ "model.layers.14.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
80
+ "model.layers.14.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
81
+ "model.layers.14.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
82
+ "model.layers.14.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
83
+ "model.layers.14.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
84
+ "model.layers.14.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
85
+ "model.layers.15.input_layernorm.weight": "model-00001-of-00002.safetensors",
86
+ "model.layers.15.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
87
+ "model.layers.15.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
88
+ "model.layers.15.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
89
+ "model.layers.15.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
90
+ "model.layers.15.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
91
+ "model.layers.15.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
92
+ "model.layers.15.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
93
+ "model.layers.15.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
94
+ "model.layers.15.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
95
+ "model.layers.15.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
96
+ "model.layers.16.input_layernorm.weight": "model-00001-of-00002.safetensors",
97
+ "model.layers.16.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
98
+ "model.layers.16.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
99
+ "model.layers.16.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
100
+ "model.layers.16.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
101
+ "model.layers.16.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
102
+ "model.layers.16.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
103
+ "model.layers.16.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
104
+ "model.layers.16.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
105
+ "model.layers.16.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
106
+ "model.layers.16.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
107
+ "model.layers.17.input_layernorm.weight": "model-00001-of-00002.safetensors",
108
+ "model.layers.17.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
109
+ "model.layers.17.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
110
+ "model.layers.17.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
111
+ "model.layers.17.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
112
+ "model.layers.17.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
113
+ "model.layers.17.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
114
+ "model.layers.17.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
115
+ "model.layers.17.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
116
+ "model.layers.17.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
117
+ "model.layers.17.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
118
+ "model.layers.18.input_layernorm.weight": "model-00001-of-00002.safetensors",
119
+ "model.layers.18.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
120
+ "model.layers.18.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
121
+ "model.layers.18.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
122
+ "model.layers.18.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
123
+ "model.layers.18.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
124
+ "model.layers.18.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
125
+ "model.layers.18.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
126
+ "model.layers.18.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
127
+ "model.layers.18.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
128
+ "model.layers.18.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
129
+ "model.layers.19.input_layernorm.weight": "model-00001-of-00002.safetensors",
130
+ "model.layers.19.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
131
+ "model.layers.19.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
132
+ "model.layers.19.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
133
+ "model.layers.19.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
134
+ "model.layers.19.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
135
+ "model.layers.19.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
136
+ "model.layers.19.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
137
+ "model.layers.19.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
138
+ "model.layers.19.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
139
+ "model.layers.19.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
140
+ "model.layers.2.input_layernorm.weight": "model-00001-of-00002.safetensors",
141
+ "model.layers.2.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
142
+ "model.layers.2.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
143
+ "model.layers.2.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
144
+ "model.layers.2.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
145
+ "model.layers.2.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
146
+ "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
147
+ "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
148
+ "model.layers.2.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
149
+ "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
150
+ "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
151
+ "model.layers.20.input_layernorm.weight": "model-00002-of-00002.safetensors",
152
+ "model.layers.20.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
153
+ "model.layers.20.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
154
+ "model.layers.20.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
155
+ "model.layers.20.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
156
+ "model.layers.20.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
157
+ "model.layers.20.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
158
+ "model.layers.20.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
159
+ "model.layers.20.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
160
+ "model.layers.20.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
161
+ "model.layers.20.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
162
+ "model.layers.21.input_layernorm.weight": "model-00002-of-00002.safetensors",
163
+ "model.layers.21.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
164
+ "model.layers.21.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
165
+ "model.layers.21.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
166
+ "model.layers.21.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
167
+ "model.layers.21.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
168
+ "model.layers.21.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
169
+ "model.layers.21.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
170
+ "model.layers.21.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
171
+ "model.layers.21.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
172
+ "model.layers.21.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
173
+ "model.layers.22.input_layernorm.weight": "model-00002-of-00002.safetensors",
174
+ "model.layers.22.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
175
+ "model.layers.22.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
176
+ "model.layers.22.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
177
+ "model.layers.22.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
178
+ "model.layers.22.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
179
+ "model.layers.22.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
180
+ "model.layers.22.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
181
+ "model.layers.22.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
182
+ "model.layers.22.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
183
+ "model.layers.22.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
184
+ "model.layers.23.input_layernorm.weight": "model-00002-of-00002.safetensors",
185
+ "model.layers.23.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
186
+ "model.layers.23.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
187
+ "model.layers.23.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
188
+ "model.layers.23.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
189
+ "model.layers.23.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
190
+ "model.layers.23.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
191
+ "model.layers.23.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
192
+ "model.layers.23.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
193
+ "model.layers.23.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
194
+ "model.layers.23.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
195
+ "model.layers.24.input_layernorm.weight": "model-00002-of-00002.safetensors",
196
+ "model.layers.24.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
197
+ "model.layers.24.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
198
+ "model.layers.24.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
199
+ "model.layers.24.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
200
+ "model.layers.24.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
201
+ "model.layers.24.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
202
+ "model.layers.24.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
203
+ "model.layers.24.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
204
+ "model.layers.24.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
205
+ "model.layers.24.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
206
+ "model.layers.25.input_layernorm.weight": "model-00002-of-00002.safetensors",
207
+ "model.layers.25.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
208
+ "model.layers.25.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
209
+ "model.layers.25.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
210
+ "model.layers.25.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
211
+ "model.layers.25.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
212
+ "model.layers.25.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
213
+ "model.layers.25.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
214
+ "model.layers.25.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
215
+ "model.layers.25.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
216
+ "model.layers.25.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
217
+ "model.layers.26.input_layernorm.weight": "model-00002-of-00002.safetensors",
218
+ "model.layers.26.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
219
+ "model.layers.26.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
220
+ "model.layers.26.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
221
+ "model.layers.26.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
222
+ "model.layers.26.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
223
+ "model.layers.26.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
224
+ "model.layers.26.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
225
+ "model.layers.26.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
226
+ "model.layers.26.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
227
+ "model.layers.26.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
228
+ "model.layers.27.input_layernorm.weight": "model-00002-of-00002.safetensors",
229
+ "model.layers.27.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
230
+ "model.layers.27.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
231
+ "model.layers.27.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
232
+ "model.layers.27.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
233
+ "model.layers.27.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
234
+ "model.layers.27.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
235
+ "model.layers.27.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
236
+ "model.layers.27.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
237
+ "model.layers.27.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
238
+ "model.layers.27.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
239
+ "model.layers.28.input_layernorm.weight": "model-00002-of-00002.safetensors",
240
+ "model.layers.28.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
241
+ "model.layers.28.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
242
+ "model.layers.28.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
243
+ "model.layers.28.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
244
+ "model.layers.28.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
245
+ "model.layers.28.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
246
+ "model.layers.28.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
247
+ "model.layers.28.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
248
+ "model.layers.28.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
249
+ "model.layers.28.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
250
+ "model.layers.29.input_layernorm.weight": "model-00002-of-00002.safetensors",
251
+ "model.layers.29.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
252
+ "model.layers.29.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
253
+ "model.layers.29.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
254
+ "model.layers.29.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
255
+ "model.layers.29.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
256
+ "model.layers.29.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
257
+ "model.layers.29.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
258
+ "model.layers.29.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
259
+ "model.layers.29.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
260
+ "model.layers.29.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
261
+ "model.layers.3.input_layernorm.weight": "model-00001-of-00002.safetensors",
262
+ "model.layers.3.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
263
+ "model.layers.3.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
264
+ "model.layers.3.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
265
+ "model.layers.3.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
266
+ "model.layers.3.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
267
+ "model.layers.3.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
268
+ "model.layers.3.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
269
+ "model.layers.3.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
270
+ "model.layers.3.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
271
+ "model.layers.3.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
272
+ "model.layers.30.input_layernorm.weight": "model-00002-of-00002.safetensors",
273
+ "model.layers.30.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
274
+ "model.layers.30.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
275
+ "model.layers.30.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
276
+ "model.layers.30.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
277
+ "model.layers.30.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
278
+ "model.layers.30.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
279
+ "model.layers.30.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
280
+ "model.layers.30.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
281
+ "model.layers.30.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
282
+ "model.layers.30.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
283
+ "model.layers.31.input_layernorm.weight": "model-00002-of-00002.safetensors",
284
+ "model.layers.31.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
285
+ "model.layers.31.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
286
+ "model.layers.31.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
287
+ "model.layers.31.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
288
+ "model.layers.31.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
289
+ "model.layers.31.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
290
+ "model.layers.31.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
291
+ "model.layers.31.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
292
+ "model.layers.31.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
293
+ "model.layers.31.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
294
+ "model.layers.32.input_layernorm.weight": "model-00002-of-00002.safetensors",
295
+ "model.layers.32.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
296
+ "model.layers.32.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
297
+ "model.layers.32.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
298
+ "model.layers.32.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
299
+ "model.layers.32.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
300
+ "model.layers.32.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
301
+ "model.layers.32.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
302
+ "model.layers.32.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
303
+ "model.layers.32.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
304
+ "model.layers.32.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
305
+ "model.layers.33.input_layernorm.weight": "model-00002-of-00002.safetensors",
306
+ "model.layers.33.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
307
+ "model.layers.33.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
308
+ "model.layers.33.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
309
+ "model.layers.33.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
310
+ "model.layers.33.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
311
+ "model.layers.33.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
312
+ "model.layers.33.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
313
+ "model.layers.33.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
314
+ "model.layers.33.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
315
+ "model.layers.33.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
316
+ "model.layers.34.input_layernorm.weight": "model-00002-of-00002.safetensors",
317
+ "model.layers.34.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
318
+ "model.layers.34.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
319
+ "model.layers.34.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
320
+ "model.layers.34.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
321
+ "model.layers.34.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
322
+ "model.layers.34.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
323
+ "model.layers.34.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
324
+ "model.layers.34.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
325
+ "model.layers.34.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
326
+ "model.layers.34.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
327
+ "model.layers.35.input_layernorm.weight": "model-00002-of-00002.safetensors",
328
+ "model.layers.35.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
329
+ "model.layers.35.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
330
+ "model.layers.35.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
331
+ "model.layers.35.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
332
+ "model.layers.35.self_attn.k_norm.weight": "model-00002-of-00002.safetensors",
333
+ "model.layers.35.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
334
+ "model.layers.35.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
335
+ "model.layers.35.self_attn.q_norm.weight": "model-00002-of-00002.safetensors",
336
+ "model.layers.35.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
337
+ "model.layers.35.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
338
+ "model.layers.4.input_layernorm.weight": "model-00001-of-00002.safetensors",
339
+ "model.layers.4.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
340
+ "model.layers.4.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
341
+ "model.layers.4.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
342
+ "model.layers.4.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
343
+ "model.layers.4.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
344
+ "model.layers.4.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
345
+ "model.layers.4.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
346
+ "model.layers.4.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
347
+ "model.layers.4.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
348
+ "model.layers.4.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
349
+ "model.layers.5.input_layernorm.weight": "model-00001-of-00002.safetensors",
350
+ "model.layers.5.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
351
+ "model.layers.5.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
352
+ "model.layers.5.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
353
+ "model.layers.5.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
354
+ "model.layers.5.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
355
+ "model.layers.5.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
356
+ "model.layers.5.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
357
+ "model.layers.5.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
358
+ "model.layers.5.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
359
+ "model.layers.5.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
360
+ "model.layers.6.input_layernorm.weight": "model-00001-of-00002.safetensors",
361
+ "model.layers.6.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
362
+ "model.layers.6.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
363
+ "model.layers.6.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
364
+ "model.layers.6.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
365
+ "model.layers.6.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
366
+ "model.layers.6.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
367
+ "model.layers.6.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
368
+ "model.layers.6.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
369
+ "model.layers.6.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
370
+ "model.layers.6.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
371
+ "model.layers.7.input_layernorm.weight": "model-00001-of-00002.safetensors",
372
+ "model.layers.7.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
373
+ "model.layers.7.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
374
+ "model.layers.7.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
375
+ "model.layers.7.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
376
+ "model.layers.7.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
377
+ "model.layers.7.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
378
+ "model.layers.7.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
379
+ "model.layers.7.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
380
+ "model.layers.7.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
381
+ "model.layers.7.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
382
+ "model.layers.8.input_layernorm.weight": "model-00001-of-00002.safetensors",
383
+ "model.layers.8.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
384
+ "model.layers.8.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
385
+ "model.layers.8.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
386
+ "model.layers.8.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
387
+ "model.layers.8.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
388
+ "model.layers.8.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
389
+ "model.layers.8.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
390
+ "model.layers.8.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
391
+ "model.layers.8.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
392
+ "model.layers.8.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
393
+ "model.layers.9.input_layernorm.weight": "model-00001-of-00002.safetensors",
394
+ "model.layers.9.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
395
+ "model.layers.9.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
396
+ "model.layers.9.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
397
+ "model.layers.9.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
398
+ "model.layers.9.self_attn.k_norm.weight": "model-00001-of-00002.safetensors",
399
+ "model.layers.9.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
400
+ "model.layers.9.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
401
+ "model.layers.9.self_attn.q_norm.weight": "model-00001-of-00002.safetensors",
402
+ "model.layers.9.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
403
+ "model.layers.9.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
404
+ "model.norm.weight": "model-00002-of-00002.safetensors"
405
+ }
406
+ }
modeling_sdar.py ADDED
@@ -0,0 +1,1507 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is modified based on https://github.com/huggingface/transformers/blob/v4.52.4/src/transformers/models/qwen3/modeling_qwen3.py.
2
+ #
3
+ # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
4
+ # This file was automatically generated from src/transformers/models/qwen3/modular_qwen3.py.
5
+ # Do NOT edit this file manually as any edits will be overwritten by the generation of
6
+ # the file from the modular. If any change should be done, please apply the change to the
7
+ # modular_qwen3.py file directly. One of our CI enforces this.
8
+ # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
9
+ # coding=utf-8
10
+ # Copyright 2025 The Qwen team, Alibaba Group and the HuggingFace Inc. team. All rights reserved.
11
+ #
12
+ # Licensed under the Apache License, Version 2.0 (the "License");
13
+ # you may not use this file except in compliance with the License.
14
+ # You may obtain a copy of the License at
15
+ #
16
+ # http://www.apache.org/licenses/LICENSE-2.0
17
+ #
18
+ # Unless required by applicable law or agreed to in writing, software
19
+ # distributed under the License is distributed on an "AS IS" BASIS,
20
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ # See the License for the specific language governing permissions and
22
+ # limitations under the License.
23
+
24
+ from typing import Callable, Optional, Tuple, Union, List
25
+
26
+ import torch
27
+ from torch import nn
28
+ from einops import rearrange
29
+
30
+ from transformers.activations import ACT2FN
31
+ from transformers.cache_utils import Cache, DynamicCache, SlidingWindowCache, StaticCache
32
+ from transformers.generation import GenerationMixin
33
+ from transformers.integrations import use_kernel_forward_from_hub
34
+ from transformers.modeling_attn_mask_utils import AttentionMaskConverter
35
+ from transformers.modeling_flash_attention_utils import FlashAttentionKwargs
36
+ from transformers.modeling_layers import GradientCheckpointingLayer
37
+ from transformers.modeling_outputs import (
38
+ BaseModelOutputWithPast,
39
+ CausalLMOutputWithPast,
40
+ QuestionAnsweringModelOutput,
41
+ SequenceClassifierOutputWithPast,
42
+ TokenClassifierOutput,
43
+ )
44
+ from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
45
+ from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
46
+ from transformers.processing_utils import Unpack
47
+ from transformers.utils import LossKwargs, auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging
48
+ from .configuration_sdar import SDARConfig
49
+ from .fused_linear_diffusion_cross_entropy import FusedLinearDiffusionCrossEntropyLoss
50
+
51
+ from flash_attn.ops.triton.layer_norm import rms_norm_fn as flash_rms_norm
52
+
53
+ import torch.nn.functional as F
54
+ try:
55
+ from flash_attn import flash_attn_func, flash_attn_varlen_func
56
+ from flash_attn.bert_padding import index_first_axis, pad_input, unpad_input
57
+ except:
58
+ pass
59
+
60
+ try:
61
+ from liger_kernel.ops.swiglu import LigerSiLUMulFunction # noqa: F401
62
+ liger_kernel_is_available = True
63
+ except ImportError:
64
+ liger_kernel_is_available = False
65
+
66
+
67
+ if is_torch_flex_attn_available():
68
+ from torch.nn.attention.flex_attention import BlockMask, create_block_mask, flex_attention
69
+ from transformers.integrations.flex_attention import make_flex_block_causal_mask
70
+
71
+
72
+ logger = logging.get_logger(__name__)
73
+
74
+
75
+ def modify_padded_position_ids_2d(position_ids: torch.LongTensor) -> torch.LongTensor:
76
+ """
77
+ 使用完全向量化的 PyTorch 操作修改一个 batch 的 packed position_ids。
78
+ 这个函数假设输入是一个 2D Tensor,形状为 (batch_size, sequence_length)。
79
+ 它会独立地处理 batch 中的每一行。
80
+
81
+ Args:
82
+ position_ids: 二维 PyTorch Tensor, shape (batch_size, sequence_length).
83
+
84
+ Returns:
85
+ 修改后的 position_ids Tensor, shape (batch_size, sequence_length).
86
+ """
87
+ if position_ids.dim() != 2:
88
+ raise ValueError(f"Input tensor must be 2D, but got {position_ids.dim()} dimensions.")
89
+
90
+ batch_size, seq_len = position_ids.shape
91
+ device = position_ids.device
92
+
93
+ col_indices = torch.arange(seq_len, device=device, dtype=position_ids.dtype).expand(batch_size, -1)
94
+ mask = (position_ids != 0)
95
+
96
+ masked_indices = col_indices * mask
97
+ last_nonzero_idx = torch.max(masked_indices, dim=1).values
98
+ has_nonzero = torch.any(mask, dim=1)
99
+ pad_start_idx = torch.where(has_nonzero, last_nonzero_idx + 1, torch.tensor(0, device=device, dtype=position_ids.dtype))
100
+
101
+ padding_mask = col_indices >= pad_start_idx.unsqueeze(1)
102
+ new_pad_values = col_indices - pad_start_idx.unsqueeze(1)
103
+ position_ids = torch.where(padding_mask, new_pad_values, position_ids)
104
+
105
+ return position_ids
106
+
107
+
108
+ def calculate_token_nums(position_ids: torch.Tensor):
109
+ """
110
+ 使用 PyTorch 高效计算一个批次中每个打包序列的长度。
111
+
112
+ Args:
113
+ position_ids (torch.Tensor): 一个 2D Tensor,形状为 (batch_size, sequence_length)。
114
+ 例如:tensor([[0,1,2,3,4,0,1,2,3,4,5,0,1,2,3,0,0,0]])
115
+ Returns:
116
+ list[list[int]]: 一个嵌套列表,包含每个批次项中各个序列的长度。
117
+ 例如:[[5, 6, 4, 1, 1, 1]]
118
+ """
119
+ # 检查输入是否为 2D Tensor
120
+ if position_ids.dim() != 2:
121
+ raise ValueError(f"输入必须是 2D Tensor,但得到了 {position_ids.dim()}D")
122
+
123
+ all_lengths = []
124
+
125
+ # 我们按批次逐行处理。因为每行的序列长度数量不同(ragged),
126
+ # 所以 Python 循环在批次维度上是最高效且最清晰的写法。
127
+ # 循环内部的操作是完全向量化的。
128
+ for pids_row in position_ids:
129
+ # 获取当前行的总长度
130
+ seq_len = pids_row.shape[0]
131
+
132
+ # 1. 找到所有值为 0 的元素的索引
133
+ # pids_row == 0 会返回一个布尔 Tensor: [True, False, ..., True, ...]
134
+ # torch.nonzero 会返回这些 True 值的索引
135
+ # .flatten() 将其从 (N, 1) 形状的 Tensor 变为 (N,) 形状
136
+ zero_indices = torch.nonzero(pids_row == 0).flatten()
137
+
138
+ # 2. 将序列的总长度作为一个额外的切分点添加到末尾
139
+ # 这对于计算最后一个序列的长度至关重要
140
+ # 注意:要确保新创建的 tensor 和原始 tensor 在同一个设备上 (cpu/cuda)
141
+ split_points = torch.cat([
142
+ zero_indices,
143
+ torch.tensor([seq_len], device=pids_row.device, dtype=zero_indices.dtype)
144
+ ])
145
+
146
+ # 3. 计算相邻切分点之间的差值,这就是我们想要的长度
147
+ # torch.diff([a, b, c, d]) 会返回 [b-a, c-b, d-c]
148
+ lengths = torch.diff(split_points)
149
+
150
+ all_lengths.append(lengths)
151
+
152
+ return all_lengths
153
+
154
+
155
+ def forward_add_noise_packed(
156
+ inputs_ids: torch.Tensor,
157
+ num_tokens_list: List[torch.Tensor],
158
+ prompt_mask: torch.Tensor,
159
+ mask_id: int,
160
+ eps: float = 1e-3,
161
+ max_tries: int = 10,
162
+ ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
163
+ """
164
+ 为一批打包(packed)序列的 token ID 添加噪声。
165
+
166
+ 此函数保留了为每个逻辑样本(在每个批次项内拼接)生成独立随机噪声率的逻辑。
167
+ 它会随机将一部分 token 的 ID 替换为 mask_id。
168
+ 这个过程会避开被 prompt_mask 标记的位置。
169
+
170
+ Args:
171
+ inputs_ids (torch.Tensor):
172
+ 输入的 token ID 张量,形状为 (bsz, total_tokens)。
173
+ num_tokens_list (List[torch.Tensor]):
174
+ 一个张量列表,长度为 bsz。列表中的每个张量记录了对应批次项中
175
+ 每个逻辑样本的长度。例如: [tensor([len1, len2]), tensor([len3, len4, len5])].
176
+ prompt_mask (torch.Tensor):
177
+ 布尔型张量,形状为 (bsz, total_tokens),值为 True 的位置表示是 prompt,
178
+ 不应添加噪声。
179
+ mask_id (int):
180
+ 用于替换的 mask token 的 ID。
181
+ eps (float):
182
+ 微小值,用于防止噪声率 t 恰好为 0,确保 p_mask > 0。
183
+ max_tries (int):
184
+ 为确保至少一个非 prompt token 被 mask,对每个批次项尝试的最大次数。
185
+
186
+ Returns:
187
+ Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
188
+ - noisy_input_ids (torch.Tensor):
189
+ 添加噪声后的 token ID 张量,形状为 (bsz, total_tokens)。
190
+ - final_masked_indices (torch.Tensor):
191
+ 布尔型张量,标记了哪些位置被实际 mask 了,形状为 (bsz, total_tokens)。
192
+ - p_masks (torch.Tensor):
193
+ 一个一维张量,包含了被 mask 的 token 对应的实际噪声率。
194
+ """
195
+ # 1. 验证和获取形状
196
+ bsz, total_tokens = inputs_ids.shape
197
+ device = inputs_ids.device
198
+
199
+ # 检查输入的一致性
200
+ assert len(num_tokens_list) == bsz, f"num_tokens_list 的长度 ({len(num_tokens_list)}) 必须等于 bsz ({bsz})"
201
+ assert prompt_mask.shape == (bsz, total_tokens), f"prompt_mask 形状不匹配, 期望 {(bsz, total_tokens)}, 得到 {prompt_mask.shape}"
202
+
203
+ # 准备结果容器
204
+ noisy_ids_list = []
205
+ final_masked_indices_list = []
206
+ p_masks_per_token_list = []
207
+
208
+ # 2. 在批次维度上迭代
209
+ # 这是处理不同打包结构最直接有效的方法
210
+ for i in range(bsz):
211
+ # 提取当前批次项的数据
212
+ current_ids = inputs_ids[i:i+1] # shape: (1, total_tokens)
213
+ current_num_tokens = num_tokens_list[i]
214
+ current_prompt_mask = prompt_mask[i:i+1] # shape: (1, total_tokens)
215
+
216
+ num_samples_in_item = len(current_num_tokens)
217
+ # 验证当前批次项的 token 总数是否匹配
218
+ assert total_tokens == torch.sum(current_num_tokens), \
219
+ f"批次项 {i} 的 num_tokens 之和 ({torch.sum(current_num_tokens)}) 与 total_tokens ({total_tokens}) 不匹配"
220
+
221
+ eligible_for_masking = ~current_prompt_mask
222
+
223
+ # 如果没有任何 token 可以被 mask,直接使用原始输入,并设置 p_mask 为 eps
224
+ if not eligible_for_masking.any():
225
+ noisy_ids_list.append(current_ids)
226
+ final_masked_indices_list.append(torch.zeros_like(current_prompt_mask, dtype=torch.bool))
227
+ # p_mask_per_token 的形状应为 (1, total_tokens) 以便后续拼接
228
+ p_masks_per_token_list.append(torch.full((1, total_tokens), eps, device=device, dtype=torch.float))
229
+ continue
230
+
231
+ # --- 尝试生成 mask,确保至少 mask 一个 token ---
232
+ final_masked_indices_item = torch.zeros_like(current_prompt_mask, dtype=torch.bool)
233
+ p_mask_per_token = None
234
+
235
+ for _ in range(max_tries):
236
+ # 为每个逻辑样本生成一个独立的噪声率 t
237
+ t = torch.rand(num_samples_in_item, device=device)
238
+ p_mask_per_sample = (1 - eps) * t + eps
239
+
240
+ # 将每个样本的噪声率扩展到其所有 token 上
241
+ p_mask_per_token_1d = torch.repeat_interleave(p_mask_per_sample, current_num_tokens)
242
+ p_mask_per_token = p_mask_per_token_1d.unsqueeze(0) # shape: (1, total_tokens)
243
+
244
+ # 根据噪声率生成随机 mask
245
+ masked_indices = torch.rand_like(p_mask_per_token) < p_mask_per_token
246
+ # 应用 prompt mask,确保 prompt 不被 mask
247
+ final_masked_indices_item = masked_indices & eligible_for_masking
248
+
249
+ # 如果成功 mask 了至少一个 token,则跳出尝试循环
250
+ if final_masked_indices_item.any():
251
+ break
252
+
253
+ # 如果 max_tries 之后仍然没有 mask 任何 token (极小概率),就强制 mask 一个可 mask 的 token
254
+ if not final_masked_indices_item.any():
255
+ eligible_indices = torch.nonzero(eligible_for_masking.squeeze(0), as_tuple=True)[0]
256
+ if len(eligible_indices) > 0:
257
+ # 随机选择一个可 mask 的位置
258
+ random_choice = torch.randint(0, len(eligible_indices), (1,)).item()
259
+ force_mask_idx = eligible_indices[random_choice]
260
+ final_masked_indices_item[0, force_mask_idx] = True
261
+
262
+
263
+ # --- 根据最终的 mask 生成带噪声的 IDs ---
264
+ noisy_ids_item = torch.where(
265
+ final_masked_indices_item,
266
+ mask_id,
267
+ current_ids
268
+ )
269
+
270
+ # 保存这个批次项的结果
271
+ noisy_ids_list.append(noisy_ids_item)
272
+ final_masked_indices_list.append(final_masked_indices_item)
273
+ p_masks_per_token_list.append(p_mask_per_token)
274
+
275
+ # 3. 将列表中的结果堆叠成最终的批处理张量
276
+ noisy_input_ids = torch.cat(noisy_ids_list, dim=0)
277
+ final_masked_indices = torch.cat(final_masked_indices_list, dim=0)
278
+ p_mask_full = torch.cat(p_masks_per_token_list, dim=0)
279
+
280
+ # 4. 提取被 mask 位置对应的噪声率
281
+ p_masks = p_mask_full[final_masked_indices]
282
+
283
+ return noisy_input_ids, final_masked_indices, p_masks
284
+
285
+
286
+ def block_diff_mask(b, h, q_idx, kv_idx, block_size=None, n=None):
287
+ """
288
+ Constructs the specialized block diffusion attention mask for training
289
+ composed of three masks:
290
+ - **Block Diagonal Mask (M_BD)**: Self-attention within noised blocks
291
+ - **Offset Block Causal Mask (M_OBC)**: Cross-attention for conditional context
292
+ - **Block Causal Mask (M_BC)**: Attention to update x0
293
+
294
+ Args:
295
+ b, h: Batch and head indices (ignored for mask logic).
296
+ q_idx, kv_idx: Query and Key indices.
297
+ seq_len: Total sequence length.
298
+ block_size: Defines the block structure.
299
+
300
+ Returns:
301
+ A boolean attention mask.
302
+ """
303
+
304
+ # Indicate whether token belongs to xt or x0
305
+ x0_flag_q = q_idx >= n
306
+ x0_flag_kv = kv_idx >= n
307
+
308
+ # Compute block indices
309
+ block_q = torch.where(
310
+ x0_flag_q == 1, (q_idx - n) // block_size, q_idx // block_size
311
+ )
312
+ block_kv = torch.where(
313
+ x0_flag_kv == 1, (kv_idx - n) // block_size, kv_idx // block_size
314
+ )
315
+
316
+ # **1. Block Diagonal Mask (M_BD) **
317
+ block_diagonal = (block_q == block_kv) & (x0_flag_q == x0_flag_kv)
318
+
319
+ # **2. Offset Block-Causal Mask (M_OBC) **
320
+ offset_block_causal = (block_q > block_kv) & (
321
+ x0_flag_kv == 1) & (x0_flag_q == 0)
322
+
323
+ # **3. Block-Causal Mask (M_BC) **
324
+ block_causal = (block_q >= block_kv) & (x0_flag_kv == 1) & (x0_flag_q == 1)
325
+
326
+ # **4. Combine Masks **
327
+ return block_diagonal | offset_block_causal | block_causal
328
+
329
+
330
+ def block_attn_mask(num_tokens, block_size, device):
331
+ masks = []
332
+ for i in range(len(num_tokens)):
333
+ cur_masks = []
334
+ for num in num_tokens[i]:
335
+ # 全部返回 n*n 而非 2n*2n
336
+ single_mask = block_diff_mask(
337
+ b=None,
338
+ h=None,
339
+ q_idx=torch.arange(num * 2, device=device)[:, None],
340
+ kv_idx=torch.arange(num * 2, device=device)[None, :],
341
+ block_size=block_size,
342
+ n=num,
343
+ )
344
+ cur_masks.append(single_mask)
345
+ masks.append(torch.block_diag(*cur_masks))
346
+ masks = torch.stack(masks, dim=0)
347
+ return masks
348
+
349
+
350
+ def create_causal_mask_from_labels(token_labels: torch.LongTensor, block_size: int) -> torch.Tensor:
351
+ """
352
+ Build a causal mask from token_labels for token-label SFT.
353
+
354
+ token_labels shape: (batch_size, seq_len)
355
+ - 0: prompt
356
+ - 1..block_size: clean block labels (generation steps)
357
+ - block_size + 1: mask block labels
358
+ - -1: padding
359
+ """
360
+ if token_labels.dim() != 2:
361
+ raise ValueError(f"`token_labels` must be 2D, got shape {tuple(token_labels.shape)}.")
362
+
363
+ bsz, _ = token_labels.shape
364
+ device = token_labels.device
365
+
366
+ is_prompt = token_labels == 0
367
+ is_data = (token_labels > 0) & (token_labels <= block_size)
368
+ is_mask = token_labels == (block_size + 1)
369
+ is_pad = token_labels == -1
370
+
371
+ time_steps = token_labels.clone().float()
372
+ for b in range(bsz):
373
+ data_vals = time_steps[b, is_data[b]]
374
+ mask_indices = torch.nonzero(is_mask[b], as_tuple=True)[0]
375
+ if mask_indices.numel() == 0:
376
+ continue
377
+ if mask_indices.numel() == data_vals.numel():
378
+ time_steps[b, mask_indices] = data_vals
379
+ else:
380
+ min_len = min(mask_indices.numel(), data_vals.numel())
381
+ time_steps[b, mask_indices[:min_len]] = data_vals[:min_len]
382
+
383
+ time_steps[is_pad] = float("inf")
384
+
385
+ type_i = torch.zeros_like(token_labels) # 1=data, 2=mask
386
+ type_i[is_data] = 1
387
+ type_i[is_mask] = 2
388
+ type_i = type_i.unsqueeze(1).unsqueeze(2) # (B, 1, L, 1)
389
+ type_j = type_i.view(bsz, 1, 1, -1) # (B, 1, 1, L)
390
+
391
+ time_i = time_steps.unsqueeze(1).unsqueeze(2)
392
+ time_j = time_steps.unsqueeze(1).unsqueeze(1)
393
+
394
+ is_prompt_j = is_prompt.view(bsz, 1, 1, -1)
395
+ is_pad_i = is_pad.view(bsz, 1, -1, 1)
396
+ is_pad_j = is_pad.view(bsz, 1, 1, -1)
397
+
398
+ mask_prompt = is_prompt_j
399
+ mask_data_data = (type_i == 1) & (type_j == 1) & (time_j <= time_i)
400
+ mask_data_mask = (type_i == 1) & (type_j == 2) & (time_j > time_i)
401
+ mask_mask_data = (type_i == 2) & (type_j == 1) & (time_j < time_i)
402
+ mask_mask_mask = (type_i == 2) & (type_j == 2) & (time_j >= time_i)
403
+ mask_prompt_internal = (token_labels.unsqueeze(1).unsqueeze(2) == 0) & is_prompt_j
404
+
405
+ final_mask = (
406
+ mask_prompt
407
+ | mask_data_data
408
+ | mask_data_mask
409
+ | mask_mask_data
410
+ | mask_mask_mask
411
+ | mask_prompt_internal
412
+ )
413
+ final_mask = final_mask & (~is_pad_i) & (~is_pad_j)
414
+ return final_mask.squeeze(1).to(dtype=torch.bool, device=device)
415
+
416
+
417
+ def create_multi_block_causal_mask(
418
+ token_labels: torch.LongTensor,
419
+ block_ids: torch.LongTensor,
420
+ block_size: int,
421
+ prompt_sees_mask: bool = True,
422
+ ) -> torch.Tensor:
423
+ """
424
+ Generate attention mask for multi-block causal mask training.
425
+
426
+ Args:
427
+ token_labels: (B, L) — 0=prompt, 1..block_size=data step, block_size+1=mask, -1=pad
428
+ block_ids: (B, L) — -1=prompt/pad, 0,1,2,...=block index
429
+ block_size: denoising steps per block
430
+ prompt_sees_mask: if True, prompt attends to all mask tokens
431
+
432
+ Returns:
433
+ attn_mask: (B, L, L) bool tensor (squeezed from (B,1,L,L)), True = visible
434
+ """
435
+ B, L = token_labels.shape
436
+ device = token_labels.device
437
+
438
+ is_prompt = (token_labels == 0)
439
+ is_data = (token_labels > 0) & (token_labels <= block_size)
440
+ is_mask = (token_labels == (block_size + 1))
441
+ is_pad = (token_labels == -1)
442
+
443
+ time_steps = token_labels.clone().float()
444
+ time_steps[is_pad] = float("inf")
445
+ time_steps[is_prompt] = 0
446
+
447
+ for b in range(B):
448
+ blk_vals = block_ids[b][block_ids[b] >= 0].unique()
449
+ for blk in blk_vals:
450
+ blk_mask = (block_ids[b] == blk)
451
+ data_in_blk = blk_mask & is_data[b]
452
+ mask_in_blk = blk_mask & is_mask[b]
453
+ data_steps = time_steps[b, data_in_blk]
454
+ mask_indices = torch.nonzero(mask_in_blk, as_tuple=True)[0]
455
+ n_data = data_steps.shape[0]
456
+ n_mask = mask_indices.shape[0]
457
+ if n_mask > 0 and n_data > 0:
458
+ min_len = min(n_data, n_mask)
459
+ time_steps[b, mask_indices[:min_len]] = data_steps[:min_len]
460
+
461
+ type_vals = torch.zeros_like(token_labels)
462
+ type_vals[is_data] = 1
463
+ type_vals[is_mask] = 2
464
+
465
+ type_i = type_vals[:, None, :, None]
466
+ type_j = type_vals[:, None, None, :]
467
+ time_i = time_steps[:, None, :, None]
468
+ time_j = time_steps[:, None, None, :]
469
+ blkid_i = block_ids[:, None, :, None].float()
470
+ blkid_j = block_ids[:, None, None, :].float()
471
+
472
+ is_prompt_i = is_prompt.view(B, 1, L, 1)
473
+ is_prompt_j = is_prompt.view(B, 1, 1, L)
474
+ is_pad_i = is_pad.view(B, 1, L, 1)
475
+ is_pad_j = is_pad.view(B, 1, 1, L)
476
+
477
+ rule_see_prompt = is_prompt_j.expand(B, 1, L, L)
478
+ rule_prompt_prompt = is_prompt_i & is_prompt_j
479
+
480
+ if prompt_sees_mask:
481
+ is_mask_j = is_mask.view(B, 1, 1, L)
482
+ rule_prompt_mask = is_prompt_i & is_mask_j
483
+ else:
484
+ rule_prompt_mask = torch.zeros(B, 1, L, L, dtype=torch.bool, device=device)
485
+
486
+ same_block = (blkid_i == blkid_j) & (blkid_i >= 0)
487
+ intra_dd = same_block & (type_i == 1) & (type_j == 1) & (time_j <= time_i)
488
+ intra_dm = same_block & (type_i == 1) & (type_j == 2) & (time_j > time_i)
489
+ intra_md = same_block & (type_i == 2) & (type_j == 1) & (time_j < time_i)
490
+ intra_mm = same_block & (type_i == 2) & (type_j == 2) & (time_j >= time_i)
491
+
492
+ cross_block_data = (blkid_i > blkid_j) & (blkid_j >= 0) & (type_j == 1)
493
+
494
+ final_mask = (
495
+ rule_see_prompt | rule_prompt_prompt | rule_prompt_mask
496
+ | intra_dd | intra_dm | intra_md | intra_mm
497
+ | cross_block_data
498
+ )
499
+ final_mask = final_mask & (~is_pad_i) & (~is_pad_j)
500
+ return final_mask.squeeze(1).to(dtype=torch.bool, device=device)
501
+
502
+
503
+ @torch.compile(fullgraph=True, mode="max-autotune-no-cudagraphs")
504
+ def fused_flex_attention(query, key, value, attention_mask, **kwargs):
505
+ return flex_attention(query, key, value, block_mask=attention_mask, **kwargs)
506
+
507
+
508
+ @use_kernel_forward_from_hub("RMSNorm")
509
+ class SDARRMSNorm(nn.Module):
510
+ def __init__(self, hidden_size, eps=1e-6):
511
+ """
512
+ SDARRMSNorm is equivalent to T5LayerNorm
513
+ """
514
+ super().__init__()
515
+ self.weight = nn.Parameter(torch.ones(hidden_size))
516
+ self.variance_epsilon = eps
517
+
518
+ def forward(self, hidden_states):
519
+ return flash_rms_norm(
520
+ hidden_states, weight=self.weight, bias=None, eps=self.variance_epsilon)
521
+ '''
522
+ input_dtype = hidden_states.dtype
523
+ hidden_states = hidden_states.to(torch.float32)
524
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
525
+ hidden_states = hidden_states * \
526
+ torch.rsqrt(variance + self.variance_epsilon)
527
+ return self.weight * hidden_states.to(input_dtype)
528
+ '''
529
+
530
+ def extra_repr(self):
531
+ return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}"
532
+
533
+
534
+ class SDARMLP(nn.Module):
535
+ def __init__(self, config):
536
+ super().__init__()
537
+ self.config = config
538
+ self.hidden_size = config.hidden_size
539
+ self.intermediate_size = config.intermediate_size
540
+ self.gate_proj = nn.Linear(
541
+ self.hidden_size, self.intermediate_size, bias=False)
542
+ self.up_proj = nn.Linear(
543
+ self.hidden_size, self.intermediate_size, bias=False)
544
+ self.down_proj = nn.Linear(
545
+ self.intermediate_size, self.hidden_size, bias=False)
546
+ self.act_fn = ACT2FN[config.hidden_act]
547
+
548
+ def forward(self, x):
549
+ if liger_kernel_is_available:
550
+ return self.down_proj(LigerSiLUMulFunction.apply(self.gate_proj(x), self.up_proj(x)))
551
+ else:
552
+ down_proj = self.down_proj(self.act_fn(
553
+ self.gate_proj(x)) * self.up_proj(x))
554
+ return down_proj
555
+
556
+
557
+ def rotate_half(x):
558
+ """Rotates half the hidden dims of the input."""
559
+ x1 = x[..., : x.shape[-1] // 2]
560
+ x2 = x[..., x.shape[-1] // 2:]
561
+ return torch.cat((-x2, x1), dim=-1)
562
+
563
+
564
+ def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_dim=1):
565
+ """Applies Rotary Position Embedding to the query and key tensors.
566
+
567
+ Args:
568
+ q (`torch.Tensor`): The query tensor.
569
+ k (`torch.Tensor`): The key tensor.
570
+ cos (`torch.Tensor`): The cosine part of the rotary embedding.
571
+ sin (`torch.Tensor`): The sine part of the rotary embedding.
572
+ position_ids (`torch.Tensor`, *optional*):
573
+ Deprecated and unused.
574
+ unsqueeze_dim (`int`, *optional*, defaults to 1):
575
+ The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
576
+ sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
577
+ that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
578
+ k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
579
+ cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
580
+ the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
581
+ Returns:
582
+ `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
583
+ """
584
+ cos = cos.unsqueeze(unsqueeze_dim)
585
+ sin = sin.unsqueeze(unsqueeze_dim)
586
+ q_embed = (q * cos) + (rotate_half(q) * sin)
587
+ k_embed = (k * cos) + (rotate_half(k) * sin)
588
+ return q_embed, k_embed
589
+
590
+
591
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
592
+ """
593
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
594
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
595
+ """
596
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
597
+ if n_rep == 1:
598
+ return hidden_states
599
+ hidden_states = hidden_states[:, :, None, :, :].expand(
600
+ batch, num_key_value_heads, n_rep, slen, head_dim)
601
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
602
+
603
+
604
+ def eager_attention_forward(
605
+ module: nn.Module,
606
+ query: torch.Tensor,
607
+ key: torch.Tensor,
608
+ value: torch.Tensor,
609
+ attention_mask: Optional[torch.Tensor],
610
+ scaling: float,
611
+ dropout: float = 0.0,
612
+ **kwargs,
613
+ ):
614
+ key_states = repeat_kv(key, module.num_key_value_groups)
615
+ value_states = repeat_kv(value, module.num_key_value_groups)
616
+
617
+ attn_weights = torch.matmul(query, key_states.transpose(2, 3)) * scaling
618
+ if attention_mask is not None:
619
+ causal_mask = attention_mask[:, :, :, : key_states.shape[-2]]
620
+ attn_weights = attn_weights + causal_mask
621
+
622
+ attn_weights = nn.functional.softmax(
623
+ attn_weights, dim=-1, dtype=torch.float32).to(query.dtype)
624
+ attn_weights = nn.functional.dropout(
625
+ attn_weights, p=dropout, training=module.training)
626
+ attn_output = torch.matmul(attn_weights, value_states)
627
+ attn_output = attn_output.transpose(1, 2).contiguous()
628
+
629
+ return attn_output, attn_weights
630
+
631
+
632
+ class SDARAttention(nn.Module):
633
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
634
+
635
+ def __init__(self, config: SDARConfig, layer_idx: int):
636
+ super().__init__()
637
+ self.config = config
638
+ self.layer_idx = layer_idx
639
+ self.head_dim = getattr(
640
+ config, "head_dim", config.hidden_size // config.num_attention_heads)
641
+ self.num_key_value_groups = config.num_attention_heads // config.num_key_value_heads
642
+ self.scaling = self.head_dim**-0.5
643
+ self.attention_dropout = config.attention_dropout
644
+ self.is_causal = True
645
+
646
+ self.hidden_size = config.hidden_size
647
+ self.num_attention_heads = config.num_attention_heads
648
+ self.num_key_value_heads = config.num_key_value_heads
649
+
650
+ self.q_proj = nn.Linear(
651
+ config.hidden_size, config.num_attention_heads * self.head_dim, bias=config.attention_bias
652
+ )
653
+ self.k_proj = nn.Linear(
654
+ config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias
655
+ )
656
+ self.v_proj = nn.Linear(
657
+ config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias
658
+ )
659
+ self.o_proj = nn.Linear(
660
+ config.num_attention_heads * self.head_dim, config.hidden_size, bias=config.attention_bias
661
+ )
662
+ # unlike olmo, only on the head dim!
663
+ self.q_norm = SDARRMSNorm(self.head_dim, eps=config.rms_norm_eps)
664
+ # thus post q_norm does not need reshape
665
+ self.k_norm = SDARRMSNorm(self.head_dim, eps=config.rms_norm_eps)
666
+ self.sliding_window = config.sliding_window
667
+ if not (
668
+ self.config.use_sliding_window
669
+ and getattr(self.config, "sliding_window", None) is not None
670
+ and self.layer_idx >= self.config.max_window_layers
671
+ ):
672
+ self.sliding_window = None
673
+
674
+ def forward(
675
+ self,
676
+ hidden_states: torch.Tensor,
677
+ position_embeddings: Tuple[torch.Tensor, torch.Tensor],
678
+ attention_mask: Optional[torch.Tensor],
679
+ past_key_value: Optional[Cache] = None,
680
+ cache_position: Optional[torch.LongTensor] = None,
681
+ **kwargs: Unpack[FlashAttentionKwargs],
682
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
683
+ input_shape = hidden_states.shape[:-1]
684
+ bsz, q_len = input_shape
685
+ hidden_shape = (*input_shape, -1, self.head_dim)
686
+
687
+ query_states = self.q_norm(self.q_proj(
688
+ hidden_states).view(hidden_shape)).transpose(1, 2)
689
+ key_states = self.k_norm(self.k_proj(
690
+ hidden_states).view(hidden_shape)).transpose(1, 2)
691
+ value_states = self.v_proj(hidden_states).view(
692
+ hidden_shape).transpose(1, 2)
693
+
694
+ cos, sin = position_embeddings
695
+ query_states, key_states = apply_rotary_pos_emb(
696
+ query_states, key_states, cos, sin)
697
+
698
+ if past_key_value is not None and kwargs.get("store_kv", False):
699
+ # sin and cos are specific to RoPE models; cache_position needed for the static cache
700
+ key_states, value_states = past_key_value.update(
701
+ key_states, value_states, self.layer_idx)
702
+ elif past_key_value is not None and not kwargs.get("store_kv", False) and len(past_key_value) > self.layer_idx:
703
+ # only retrive, do not store kv
704
+ past_key_states, past_value_states = past_key_value[self.layer_idx]
705
+ key_states = torch.cat(
706
+ [past_key_states, key_states], dim=-2)
707
+ value_states = torch.cat(
708
+ [past_value_states, value_states], dim=-2)
709
+
710
+ if self.training:
711
+ attn_output, attn_weights = fused_flex_attention(
712
+ query=query_states,
713
+ key=key_states,
714
+ value=value_states,
715
+ attention_mask=attention_mask,
716
+ enable_gqa=True,
717
+ scale=self.scaling,
718
+ return_lse=True
719
+ )
720
+ attn_weights = attn_weights.to(
721
+ value_states.dtype) if attn_weights is not None else None
722
+ attn_output = rearrange(attn_output, 'b h l d -> b l (h d)')
723
+ else:
724
+ attention_mask = attention_mask.bool() if attention_mask is not None else None
725
+ attn_weights = None
726
+ if torch.all(attention_mask): # decoding
727
+ query_states = query_states.transpose(1, 2)
728
+ key_states = key_states.transpose(1, 2)
729
+ value_states = value_states.transpose(1, 2)
730
+ attn_output = flash_attn_func(
731
+ query_states,
732
+ key_states,
733
+ value_states,
734
+ causal=False,
735
+ softmax_scale=self.scaling
736
+ )
737
+ attn_output = rearrange(attn_output, 'b l h d -> b l (h d)')
738
+ else: # prefilling
739
+ attn_output = F.scaled_dot_product_attention(
740
+ query=query_states,
741
+ key=key_states,
742
+ value=value_states,
743
+ attn_mask=attention_mask,
744
+ is_causal=False,
745
+ scale=self.scaling,
746
+ enable_gqa=True
747
+ )
748
+ attn_output = rearrange(attn_output, 'b h l d -> b l (h d)')
749
+ attn_output = self.o_proj(attn_output)
750
+ return attn_output, attn_weights # , attn_weights
751
+
752
+
753
+ class SDARDecoderLayer(GradientCheckpointingLayer):
754
+ def __init__(self, config: SDARConfig, layer_idx: int):
755
+ super().__init__()
756
+ self.hidden_size = config.hidden_size
757
+ self.self_attn = SDARAttention(config=config, layer_idx=layer_idx)
758
+ self.mlp = SDARMLP(config)
759
+ self.input_layernorm = SDARRMSNorm(
760
+ config.hidden_size, eps=config.rms_norm_eps)
761
+ self.post_attention_layernorm = SDARRMSNorm(
762
+ config.hidden_size, eps=config.rms_norm_eps)
763
+ if (
764
+ config.sliding_window and config._attn_implementation != "flash_attention_2"
765
+ ): # diff with Llama is this warning
766
+ logger.warning_once(
767
+ f"Sliding Window Attention is enabled but not implemented for `{config._attn_implementation}`; "
768
+ "unexpected results may be encountered."
769
+ )
770
+
771
+ def forward(
772
+ self,
773
+ hidden_states: torch.Tensor,
774
+ attention_mask: Optional[torch.Tensor] = None,
775
+ position_ids: Optional[torch.LongTensor] = None,
776
+ past_key_value: Optional[Cache] = None,
777
+ output_attentions: Optional[bool] = False,
778
+ use_cache: Optional[bool] = False,
779
+ store_kv: Optional[bool] = False,
780
+ cache_position: Optional[torch.LongTensor] = None,
781
+ # necessary, but kept here for BC
782
+ position_embeddings: Optional[Tuple[torch.Tensor,
783
+ torch.Tensor]] = None,
784
+ **kwargs: Unpack[FlashAttentionKwargs],
785
+ ) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
786
+ residual = hidden_states
787
+ hidden_states = self.input_layernorm(hidden_states)
788
+
789
+ # Self Attention
790
+ hidden_states, self_attn_weights = self.self_attn(
791
+ hidden_states=hidden_states,
792
+ attention_mask=attention_mask,
793
+ position_ids=position_ids,
794
+ past_key_value=past_key_value,
795
+ output_attentions=output_attentions,
796
+ use_cache=use_cache,
797
+ store_kv=store_kv,
798
+ cache_position=cache_position,
799
+ position_embeddings=position_embeddings,
800
+ **kwargs,
801
+ )
802
+ hidden_states = residual + hidden_states
803
+
804
+ # Fully Connected
805
+ residual = hidden_states
806
+ hidden_states = self.post_attention_layernorm(hidden_states)
807
+ hidden_states = self.mlp(hidden_states)
808
+ hidden_states = residual + hidden_states
809
+
810
+ outputs = (hidden_states,)
811
+ if output_attentions:
812
+ outputs += (self_attn_weights,)
813
+
814
+ return outputs
815
+
816
+
817
+ @auto_docstring
818
+ class SDARPreTrainedModel(PreTrainedModel):
819
+ config_class = SDARConfig
820
+ base_model_prefix = "model"
821
+ supports_gradient_checkpointing = True
822
+ _no_split_modules = ["SDARDecoderLayer"]
823
+ _skip_keys_device_placement = ["past_key_values"]
824
+ _supports_flash_attn_2 = True
825
+ _supports_sdpa = True
826
+ _supports_flex_attn = True
827
+ _supports_cache_class = True
828
+ _supports_quantized_cache = True
829
+ _supports_static_cache = True
830
+ _supports_attention_backend = True
831
+
832
+ def _init_weights(self, module):
833
+ std = self.config.initializer_range
834
+ if isinstance(module, nn.Linear):
835
+ module.weight.data.normal_(mean=0.0, std=std)
836
+ if module.bias is not None:
837
+ module.bias.data.zero_()
838
+ elif isinstance(module, nn.Embedding):
839
+ module.weight.data.normal_(mean=0.0, std=std)
840
+ if module.padding_idx is not None:
841
+ module.weight.data[module.padding_idx].zero_()
842
+ elif isinstance(module, SDARRMSNorm):
843
+ module.weight.data.fill_(1.0)
844
+
845
+
846
+ class SDARRotaryEmbedding(nn.Module):
847
+ def __init__(self, config: SDARConfig, device=None):
848
+ super().__init__()
849
+ # BC: "rope_type" was originally "type"
850
+ if hasattr(config, "rope_scaling") and config.rope_scaling is not None:
851
+ self.rope_type = config.rope_scaling.get(
852
+ "rope_type", config.rope_scaling.get("type"))
853
+ else:
854
+ self.rope_type = "default"
855
+ self.max_seq_len_cached = config.max_position_embeddings
856
+ self.original_max_seq_len = config.max_position_embeddings
857
+
858
+ self.config = config
859
+ self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
860
+
861
+ inv_freq, self.attention_scaling = self.rope_init_fn(
862
+ self.config, device)
863
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
864
+ self.original_inv_freq = self.inv_freq
865
+
866
+ @torch.no_grad()
867
+ # power user: used with advanced RoPE types (e.g. dynamic rope)
868
+ @dynamic_rope_update
869
+ def forward(self, x, position_ids, token_labels: Optional[torch.LongTensor] = None):
870
+ inv_freq_expanded = self.inv_freq[None, :, None].float().expand(
871
+ position_ids.shape[0], -1, 1).to(x.device)
872
+ position_ids_expanded = position_ids[:, None, :].float()
873
+
874
+ device_type = x.device.type if isinstance(
875
+ x.device.type, str) and x.device.type != "mps" else "cpu"
876
+ with torch.autocast(device_type=device_type, enabled=False): # Force float32
877
+ freqs = (inv_freq_expanded.float() @
878
+ position_ids_expanded.float()).transpose(1, 2)
879
+ emb = torch.cat((freqs, freqs), dim=-1)
880
+ cos = emb.cos() * self.attention_scaling
881
+ sin = emb.sin() * self.attention_scaling
882
+
883
+ cos = cos.to(dtype=x.dtype)
884
+ sin = sin.to(dtype=x.dtype)
885
+
886
+ if token_labels is not None:
887
+ if token_labels.shape != position_ids.shape:
888
+ raise ValueError(
889
+ f"`token_labels` shape {tuple(token_labels.shape)} must match `position_ids` shape {tuple(position_ids.shape)}."
890
+ )
891
+
892
+ clean_min_label = 1
893
+ clean_max_label = self.config.block_size
894
+ mask_label = self.config.block_size + 1
895
+ token_labels = token_labels.to(position_ids.device)
896
+ for batch_idx in range(token_labels.size(0)):
897
+ clean_indices = torch.nonzero(
898
+ (token_labels[batch_idx] >= clean_min_label) & (token_labels[batch_idx] <= clean_max_label),
899
+ as_tuple=True,
900
+ )[0]
901
+ mask_indices = torch.nonzero(token_labels[batch_idx] == mask_label, as_tuple=True)[0]
902
+ if mask_indices.numel() == 0:
903
+ continue
904
+ if clean_indices.numel() != mask_indices.numel():
905
+ raise ValueError(
906
+ "The clean block and mask block must have equal lengths for RoPE frequency copy."
907
+ )
908
+ cos[batch_idx, mask_indices] = cos[batch_idx, clean_indices]
909
+ sin[batch_idx, mask_indices] = sin[batch_idx, clean_indices]
910
+
911
+ return cos, sin
912
+
913
+
914
+ @auto_docstring
915
+ class SDARModel(SDARPreTrainedModel):
916
+ def __init__(self, config: SDARConfig):
917
+ super().__init__(config)
918
+ self.padding_idx = config.pad_token_id
919
+ self.vocab_size = config.vocab_size
920
+
921
+ self.embed_tokens = nn.Embedding(
922
+ config.vocab_size, config.hidden_size, self.padding_idx)
923
+ self.layers = nn.ModuleList(
924
+ [SDARDecoderLayer(config, layer_idx)
925
+ for layer_idx in range(config.num_hidden_layers)]
926
+ )
927
+ self.norm = SDARRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
928
+ self.rotary_emb = SDARRotaryEmbedding(config=config)
929
+ self.gradient_checkpointing = False
930
+
931
+ # Initialize weights and apply final processing
932
+ self.post_init()
933
+
934
+ def get_input_embeddings(self):
935
+ return self.embed_tokens
936
+
937
+ def set_input_embeddings(self, value):
938
+ self.embed_tokens = value
939
+
940
+ @can_return_tuple
941
+ @auto_docstring
942
+ def forward(
943
+ self,
944
+ input_ids: Optional[torch.LongTensor] = None,
945
+ attention_mask: Optional[torch.Tensor] = None,
946
+ position_ids: Optional[torch.LongTensor] = None,
947
+ token_labels: Optional[torch.LongTensor] = None,
948
+ past_key_values: Optional[Cache] = None,
949
+ inputs_embeds: Optional[torch.FloatTensor] = None,
950
+ use_cache: Optional[bool] = None,
951
+ store_kv: Optional[bool] = None,
952
+ output_attentions: Optional[bool] = None,
953
+ output_hidden_states: Optional[bool] = None,
954
+ cache_position: Optional[torch.LongTensor] = None,
955
+ **flash_attn_kwargs: Unpack[FlashAttentionKwargs],
956
+ ) -> BaseModelOutputWithPast:
957
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
958
+ output_hidden_states = (
959
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
960
+ )
961
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
962
+
963
+ if (input_ids is None) ^ (inputs_embeds is not None):
964
+ raise ValueError(
965
+ "You must specify exactly one of input_ids or inputs_embeds")
966
+
967
+ if self.gradient_checkpointing and self.training and use_cache:
968
+ logger.warning_once(
969
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`."
970
+ )
971
+ use_cache = False
972
+
973
+ # TODO (joao): remove this exception in v4.56 -- it exists for users that try to pass a legacy cache
974
+ if not isinstance(past_key_values, (type(None), Cache)):
975
+ raise ValueError(
976
+ "The `past_key_values` should be either a `Cache` object or `None`.")
977
+
978
+ if inputs_embeds is None:
979
+ inputs_embeds = self.embed_tokens(input_ids)
980
+
981
+ if use_cache and past_key_values is None:
982
+ past_key_values = DynamicCache()
983
+
984
+ if cache_position is None:
985
+ past_seen_tokens = past_key_values.get_seq_length(
986
+ ) if past_key_values is not None else 0
987
+ cache_position = torch.arange(
988
+ past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device
989
+ )
990
+
991
+ if position_ids is None:
992
+ position_ids = cache_position.unsqueeze(0).expand(inputs_embeds.shape[0], -1)
993
+
994
+ # causal_mask = self._update_causal_mask(
995
+ # attention_mask, inputs_embeds, cache_position, past_key_values, output_attentions
996
+ # )
997
+
998
+ hidden_states = inputs_embeds
999
+
1000
+ # create position embeddings to be shared across the decoder layers
1001
+ position_embeddings = self.rotary_emb(hidden_states, position_ids)
1002
+
1003
+ # RoPE frequency copy: for single-block training (without block_ids),
1004
+ # data and mask have different position_ids, so copy data's RoPE to mask.
1005
+ # For multi-block training (with block_ids), position_ids are already shared
1006
+ # between data and mask, so no copy is needed.
1007
+ if token_labels is not None and not hasattr(self, '_skip_rope_copy'):
1008
+ cos, sin = position_embeddings
1009
+ block_size = self.config.block_size
1010
+ clean_min_label, clean_max_label = 1, block_size
1011
+ mask_label = block_size + 1
1012
+ tl = token_labels.to(position_ids.device)
1013
+ for b_idx in range(tl.size(0)):
1014
+ clean_idx = torch.nonzero(
1015
+ (tl[b_idx] >= clean_min_label) & (tl[b_idx] <= clean_max_label), as_tuple=True
1016
+ )[0]
1017
+ mask_idx = torch.nonzero(tl[b_idx] == mask_label, as_tuple=True)[0]
1018
+ if mask_idx.numel() > 0 and clean_idx.numel() == mask_idx.numel():
1019
+ cos[b_idx, mask_idx] = cos[b_idx, clean_idx]
1020
+ sin[b_idx, mask_idx] = sin[b_idx, clean_idx]
1021
+ position_embeddings = (cos, sin)
1022
+
1023
+ # decoder layers
1024
+ all_hidden_states = () if output_hidden_states else None
1025
+ all_self_attns = () if output_attentions else None
1026
+
1027
+ for decoder_layer in self.layers[: self.config.num_hidden_layers]:
1028
+ if output_hidden_states:
1029
+ all_hidden_states += (hidden_states,)
1030
+
1031
+ layer_outputs = decoder_layer(
1032
+ hidden_states,
1033
+ attention_mask=attention_mask,
1034
+ position_ids=position_ids,
1035
+ past_key_value=past_key_values,
1036
+ output_attentions=output_attentions,
1037
+ use_cache=use_cache,
1038
+ store_kv=store_kv,
1039
+ cache_position=cache_position,
1040
+ position_embeddings=position_embeddings,
1041
+ **flash_attn_kwargs,
1042
+ )
1043
+
1044
+ hidden_states = layer_outputs[0]
1045
+
1046
+ if output_attentions:
1047
+ all_self_attns += (layer_outputs[1],)
1048
+
1049
+ hidden_states = self.norm(hidden_states)
1050
+
1051
+ # add hidden states from the last decoder layer
1052
+ if output_hidden_states:
1053
+ all_hidden_states += (hidden_states,)
1054
+
1055
+ return BaseModelOutputWithPast(
1056
+ last_hidden_state=hidden_states,
1057
+ past_key_values=past_key_values if use_cache else None,
1058
+ hidden_states=all_hidden_states,
1059
+ attentions=all_self_attns,
1060
+ )
1061
+
1062
+ def _update_causal_mask(
1063
+ self,
1064
+ attention_mask: Union[torch.Tensor, "BlockMask"],
1065
+ input_tensor: torch.Tensor,
1066
+ cache_position: torch.Tensor,
1067
+ past_key_values: Cache,
1068
+ output_attentions: bool = False,
1069
+ ):
1070
+ if self.config._attn_implementation == "flash_attention_2":
1071
+ if attention_mask is not None and past_key_values is not None:
1072
+ is_padding_right = attention_mask[:, -
1073
+ 1].sum().item() != input_tensor.size()[0]
1074
+ if is_padding_right:
1075
+ raise ValueError(
1076
+ "You are attempting to perform batched generation with padding_side='right'"
1077
+ " this may lead to unexpected behaviour for Flash Attention version of Qwen3. Make sure to "
1078
+ " call `tokenizer.padding_side = 'left'` before tokenizing the input. "
1079
+ )
1080
+ if attention_mask is not None and 0.0 in attention_mask:
1081
+ return attention_mask
1082
+ return None
1083
+ if self.config._attn_implementation == "flex_attention":
1084
+ if isinstance(attention_mask, torch.Tensor):
1085
+ seq_len_q, seq_len_kv = attention_mask.shape
1086
+ assert seq_len_q == seq_len_kv, f"got {attention_mask.shape=}"
1087
+ attention_mask = create_block_mask(
1088
+ # 2d bool tensor, shape: [2*seqlen, 2*seqlen]
1089
+ lambda b, h, q_idx, kv_idx: attention_mask[q_idx, kv_idx],
1090
+ B=None, H=None, Q_LEN=seq_len_q, KV_LEN=seq_len_kv,
1091
+ )
1092
+ else:
1093
+ # Here we pass in flex mask computed externally
1094
+ assert isinstance(attention_mask, BlockMask)
1095
+ return attention_mask
1096
+
1097
+ # For SDPA, when possible, we will rely on its `is_causal` argument instead of its `attn_mask` argument, in
1098
+ # order to dispatch on Flash Attention 2. This feature is not compatible with static cache, as SDPA will fail
1099
+ # to infer the attention mask.
1100
+ past_seen_tokens = past_key_values.get_seq_length(
1101
+ ) if past_key_values is not None else 0
1102
+ using_static_cache = isinstance(past_key_values, StaticCache)
1103
+ using_sliding_window_cache = isinstance(
1104
+ past_key_values, SlidingWindowCache)
1105
+
1106
+ # When output attentions is True, sdpa implementation's forward method calls the eager implementation's forward
1107
+ if (
1108
+ self.config._attn_implementation == "sdpa"
1109
+ and not (using_static_cache or using_sliding_window_cache)
1110
+ and not output_attentions
1111
+ ):
1112
+ if AttentionMaskConverter._ignore_causal_mask_sdpa(
1113
+ attention_mask,
1114
+ inputs_embeds=input_tensor,
1115
+ past_key_values_length=past_seen_tokens,
1116
+ sliding_window=self.config.sliding_window,
1117
+ is_training=self.training,
1118
+ ):
1119
+ return None
1120
+
1121
+ dtype = input_tensor.dtype
1122
+ min_dtype = torch.finfo(dtype).min
1123
+ sequence_length = input_tensor.shape[1]
1124
+ # SlidingWindowCache or StaticCache
1125
+ if using_sliding_window_cache or using_static_cache:
1126
+ target_length = past_key_values.get_max_cache_shape()
1127
+ # DynamicCache or no cache
1128
+ else:
1129
+ target_length = (
1130
+ attention_mask.shape[-1]
1131
+ if isinstance(attention_mask, torch.Tensor)
1132
+ else past_seen_tokens + sequence_length + 1
1133
+ )
1134
+
1135
+ # In case the provided `attention` mask is 2D, we generate a causal mask here (4D).
1136
+ causal_mask = self._prepare_4d_causal_attention_mask_with_cache_position(
1137
+ attention_mask,
1138
+ sequence_length=sequence_length,
1139
+ target_length=target_length,
1140
+ dtype=dtype,
1141
+ cache_position=cache_position,
1142
+ batch_size=input_tensor.shape[0],
1143
+ config=self.config,
1144
+ past_key_values=past_key_values,
1145
+ )
1146
+
1147
+ if (
1148
+ self.config._attn_implementation == "sdpa"
1149
+ and attention_mask is not None
1150
+ and attention_mask.device.type in ["cuda", "xpu", "npu"]
1151
+ and not output_attentions
1152
+ ):
1153
+ # Attend to all tokens in fully masked rows in the causal_mask, for example the relevant first rows when
1154
+ # using left padding. This is required by F.scaled_dot_product_attention memory-efficient attention path.
1155
+ # Details: https://github.com/pytorch/pytorch/issues/110213
1156
+ causal_mask = AttentionMaskConverter._unmask_unattended(
1157
+ causal_mask, min_dtype)
1158
+
1159
+ return causal_mask
1160
+
1161
+ @staticmethod
1162
+ def _prepare_4d_causal_attention_mask_with_cache_position(
1163
+ attention_mask: torch.Tensor,
1164
+ sequence_length: int,
1165
+ target_length: int,
1166
+ dtype: torch.dtype,
1167
+ cache_position: torch.Tensor,
1168
+ batch_size: int,
1169
+ config: SDARConfig,
1170
+ past_key_values: Cache,
1171
+ ):
1172
+ """
1173
+ Creates a causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)` from a 2D mask of shape
1174
+ `(batch_size, key_value_length)`, or if the input `attention_mask` is already 4D, do nothing.
1175
+
1176
+ Args:
1177
+ attention_mask (`torch.Tensor`):
1178
+ A 2D attention mask of shape `(batch_size, key_value_length)` or a 4D attention mask of shape `(batch_size, 1, query_length, key_value_length)`.
1179
+ sequence_length (`int`):
1180
+ The sequence length being processed.
1181
+ target_length (`int`):
1182
+ The target length: when generating with static cache, the mask should be as long as the static cache, to account for the 0 padding, the part of the cache that is not filled yet.
1183
+ dtype (`torch.dtype`):
1184
+ The dtype to use for the 4D attention mask.
1185
+ cache_position (`torch.Tensor`):
1186
+ Indices depicting the position of the input sequence tokens in the sequence.
1187
+ batch_size (`torch.Tensor`):
1188
+ Batch size.
1189
+ config (`SDARConfig`):
1190
+ The model's configuration class
1191
+ past_key_values (`Cache`):
1192
+ The cache class that is being used currently to generate
1193
+ """
1194
+ if attention_mask is not None and attention_mask.dim() == 4:
1195
+ # In this case we assume that the mask comes already in inverted form and requires no inversion or slicing.
1196
+ causal_mask = attention_mask
1197
+ else:
1198
+ min_dtype = torch.finfo(dtype).min
1199
+ causal_mask = torch.full(
1200
+ (sequence_length, target_length), fill_value=min_dtype, dtype=dtype, device=cache_position.device
1201
+ )
1202
+ diagonal_attend_mask = torch.arange(target_length, device=cache_position.device) > cache_position.reshape(
1203
+ -1, 1
1204
+ )
1205
+ text_config = config.get_text_config()
1206
+ if getattr(text_config, "use_sliding_window", True) and text_config.sliding_window is not None:
1207
+ # if we have sliding window, we should not attend to tokens beyond sliding window length, so we mask them out also
1208
+ # the check is needed to verify is current checkpoint was trained with sliding window or not
1209
+ if not isinstance(past_key_values, SlidingWindowCache) or sequence_length > target_length:
1210
+ sliding_attend_mask = torch.arange(target_length, device=cache_position.device) <= (
1211
+ cache_position.reshape(-1, 1) -
1212
+ text_config.sliding_window
1213
+ )
1214
+ diagonal_attend_mask.bitwise_or_(sliding_attend_mask)
1215
+ causal_mask *= diagonal_attend_mask
1216
+ causal_mask = causal_mask[None, None,
1217
+ :, :].expand(batch_size, 1, -1, -1)
1218
+ if attention_mask is not None:
1219
+ causal_mask = causal_mask.clone() # copy to contiguous memory for in-place edit
1220
+ if attention_mask.shape[-1] > target_length:
1221
+ attention_mask = attention_mask[:, :target_length]
1222
+ mask_length = attention_mask.shape[-1]
1223
+ padding_mask = causal_mask[:, :, :, :mask_length] + attention_mask[:, None, None, :].to(
1224
+ causal_mask.device
1225
+ )
1226
+ padding_mask = padding_mask == 0
1227
+ causal_mask[:, :, :, :mask_length] = causal_mask[:, :, :, :mask_length].masked_fill(
1228
+ padding_mask, min_dtype
1229
+ )
1230
+ return causal_mask
1231
+
1232
+
1233
+ class KwargsForCausalLM(FlashAttentionKwargs, LossKwargs):
1234
+ ...
1235
+
1236
+
1237
+ @auto_docstring
1238
+ class SDARForCausalLM(SDARPreTrainedModel, GenerationMixin):
1239
+ _tied_weights_keys = ["lm_head.weight"]
1240
+ _tp_plan = {"lm_head": "colwise_rep"}
1241
+ _pp_plan = {"lm_head": (["hidden_states"], ["logits"])}
1242
+
1243
+ def __init__(self, config):
1244
+ super().__init__(config)
1245
+ self.model = SDARModel(config)
1246
+ self.vocab_size = config.vocab_size
1247
+ self.lm_head = nn.Linear(
1248
+ config.hidden_size, config.vocab_size, bias=False)
1249
+
1250
+ # Initialize weights and apply final processing
1251
+ self.post_init()
1252
+
1253
+ def get_input_embeddings(self):
1254
+ return self.model.embed_tokens
1255
+
1256
+ def set_input_embeddings(self, value):
1257
+ self.model.embed_tokens = value
1258
+
1259
+ def get_output_embeddings(self):
1260
+ return self.lm_head
1261
+
1262
+ def set_output_embeddings(self, new_embeddings):
1263
+ self.lm_head = new_embeddings
1264
+
1265
+ def set_decoder(self, decoder):
1266
+ self.model = decoder
1267
+
1268
+ def get_decoder(self):
1269
+ return self.model
1270
+
1271
+ def prepare_for_bd_training(self, inputs_ids, position_ids, prompt_mask):
1272
+ bsz, seq_len = inputs_ids.shape
1273
+ num_tokens = calculate_token_nums(position_ids) # List[torch.Tensor]
1274
+ noisy_inputs_ids, logits_to_keep_half, p_mask = forward_add_noise_packed(
1275
+ inputs_ids=inputs_ids,
1276
+ num_tokens_list=num_tokens,
1277
+ prompt_mask=prompt_mask,
1278
+ mask_id=self.config.mask_token_id,
1279
+ )
1280
+ router_noisy_part_list = []
1281
+ for i in range(bsz):
1282
+ cur_router_noisy_part = (torch.arange(num_tokens[i].shape[0] *2) % 2 == 0).to(inputs_ids.device)
1283
+ cur_router_noisy_part = cur_router_noisy_part.repeat_interleave(num_tokens[i].repeat_interleave(2))
1284
+ router_noisy_part_list.append(cur_router_noisy_part)
1285
+ router_noisy_part = torch.stack(router_noisy_part_list, dim=0)
1286
+
1287
+ # concated inputs_ids: (bzs, seq_len x 2)
1288
+ concat_inputs_ids = inputs_ids.repeat(1, 2)
1289
+ # concated logits_to_keep: (bsz, seq_len x 2)
1290
+ logits_to_keep = torch.zeros(
1291
+ bsz, 2 * seq_len, dtype=torch.bool, device=inputs_ids.device)
1292
+ # concated position_ids: (bsz, seq_len x 2)
1293
+ concat_position_ids = torch.zeros(
1294
+ bsz, 2 * seq_len, dtype=position_ids.dtype, device=position_ids.device)
1295
+ for i in range(bsz):
1296
+ concat_inputs_ids[i][router_noisy_part[i]] = noisy_inputs_ids[i]
1297
+ concat_inputs_ids[i][~router_noisy_part[i]] = inputs_ids[i]
1298
+
1299
+ logits_to_keep[i][router_noisy_part[i]] = logits_to_keep_half[i]
1300
+
1301
+ concat_position_ids[i][router_noisy_part[i]] = position_ids[i]
1302
+ concat_position_ids[i][~router_noisy_part[i]] = position_ids[i]
1303
+
1304
+ # create flex_attention mask
1305
+ attention_mask = block_attn_mask(num_tokens, self.config.block_size, inputs_ids.device)
1306
+ flex_attention_mask_3d = create_block_mask(
1307
+ lambda b, h, q_idx, kv_idx: attention_mask[b, q_idx, kv_idx],
1308
+ B=attention_mask.size(0), H=None,
1309
+ Q_LEN=attention_mask.size(1), KV_LEN=attention_mask.size(2),
1310
+ )
1311
+
1312
+ return concat_inputs_ids, concat_position_ids, flex_attention_mask_3d, logits_to_keep_half, logits_to_keep, p_mask
1313
+
1314
+ @can_return_tuple
1315
+ @auto_docstring
1316
+ def forward(
1317
+ self,
1318
+ input_ids: Optional[torch.LongTensor] = None,
1319
+ attention_mask: Optional[torch.Tensor] = None,
1320
+ position_ids: Optional[torch.LongTensor] = None,
1321
+ token_labels: Optional[torch.LongTensor] = None,
1322
+ block_ids: Optional[torch.LongTensor] = None,
1323
+ past_key_values: Optional[Cache] = None,
1324
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1325
+ labels: Optional[torch.LongTensor] = None,
1326
+ use_cache: Optional[bool] = None,
1327
+ output_attentions: Optional[bool] = None,
1328
+ output_hidden_states: Optional[bool] = None,
1329
+ cache_position: Optional[torch.LongTensor] = None,
1330
+ logits_to_keep: Union[int, torch.Tensor] = 0,
1331
+ **kwargs: Unpack[KwargsForCausalLM],
1332
+ ) -> CausalLMOutputWithPast:
1333
+ r"""
1334
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1335
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
1336
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
1337
+ (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
1338
+
1339
+ Example:
1340
+
1341
+ ```python
1342
+ >>> from transformers import AutoTokenizer, SDARForCausalLM
1343
+
1344
+ >>> model = SDARForCausalLM.from_pretrained("DiffuOpen/SDAR-1.7B-Chat")
1345
+ >>> tokenizer = AutoTokenizer.from_pretrained("DiffuOpen/SDAR-1.7B-Chat")
1346
+
1347
+ >>> prompt = "Hey, are you conscious? Can you talk to me?"
1348
+ >>> inputs = tokenizer(prompt, return_tensors="pt")
1349
+
1350
+ >>> # Generate
1351
+ >>> generate_ids = model.generate(inputs.input_ids, max_length=30)
1352
+ >>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
1353
+ "Hey, are you conscious? Can you talk to me?\nI'm not conscious, but I can talk to you."
1354
+ ```"""
1355
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
1356
+ output_hidden_states = (
1357
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
1358
+ )
1359
+ if self.training:
1360
+ assert inputs_embeds is None, "only support input_ids during training"
1361
+ assert labels is not None, "Labels must be provided for training."
1362
+ # Trace SFT path: pre-computed block attention mask provided via kwargs
1363
+ block_attention_mask = kwargs.pop("block_attention_mask", None)
1364
+ if block_attention_mask is not None:
1365
+ # block_attention_mask: (B, L, L) boolean tensor
1366
+ flex_attention_mask_3d = create_block_mask(
1367
+ lambda b, h, q_idx, kv_idx: block_attention_mask[b, q_idx, kv_idx],
1368
+ B=block_attention_mask.size(0),
1369
+ H=None,
1370
+ Q_LEN=block_attention_mask.size(1),
1371
+ KV_LEN=block_attention_mask.size(2),
1372
+ )
1373
+ outputs = self.model(
1374
+ input_ids=input_ids,
1375
+ attention_mask=flex_attention_mask_3d,
1376
+ position_ids=position_ids,
1377
+ output_attentions=output_attentions,
1378
+ output_hidden_states=output_hidden_states,
1379
+ return_dict=True,
1380
+ cache_position=cache_position,
1381
+ )
1382
+ hidden_states = outputs.last_hidden_state
1383
+ logits = self.lm_head(hidden_states)
1384
+ # Unshifted cross-entropy loss (diffusion-style)
1385
+ loss = nn.CrossEntropyLoss(ignore_index=-100)(
1386
+ logits.view(-1, self.config.vocab_size), labels.view(-1)
1387
+ )
1388
+ logits = None
1389
+ elif token_labels is not None:
1390
+ if input_ids is None:
1391
+ raise ValueError("`input_ids` is required in token-label SFT training.")
1392
+ if token_labels.shape != input_ids.shape:
1393
+ raise ValueError(
1394
+ f"`token_labels` shape {tuple(token_labels.shape)} must match `input_ids` shape {tuple(input_ids.shape)}."
1395
+ )
1396
+ # Multi-block mask when block_ids provided, else single-block
1397
+ if block_ids is not None:
1398
+ token_label_mask = create_multi_block_causal_mask(
1399
+ token_labels, block_ids, self.config.block_size
1400
+ )
1401
+ else:
1402
+ token_label_mask = create_causal_mask_from_labels(token_labels, self.config.block_size)
1403
+ flex_attention_mask_3d = create_block_mask(
1404
+ lambda b, h, q_idx, kv_idx: token_label_mask[b, q_idx, kv_idx],
1405
+ B=token_label_mask.size(0),
1406
+ H=None,
1407
+ Q_LEN=token_label_mask.size(1),
1408
+ KV_LEN=token_label_mask.size(2),
1409
+ )
1410
+ outputs = self.model(
1411
+ input_ids=input_ids,
1412
+ attention_mask=flex_attention_mask_3d,
1413
+ position_ids=position_ids,
1414
+ token_labels=token_labels,
1415
+ output_attentions=output_attentions,
1416
+ output_hidden_states=output_hidden_states,
1417
+ return_dict=True,
1418
+ cache_position=cache_position,
1419
+ **kwargs,
1420
+ )
1421
+ hidden_states = outputs.last_hidden_state
1422
+ logits = self.lm_head(hidden_states)
1423
+ masked_labels = labels.masked_fill(token_labels != (self.config.block_size + 1), -100)
1424
+ if not torch.any(masked_labels != -100):
1425
+ raise ValueError("No valid supervision token found for token-label SFT loss.")
1426
+ loss = nn.CrossEntropyLoss(ignore_index=-100)(
1427
+ logits.view(-1, self.config.vocab_size), masked_labels.view(-1)
1428
+ )
1429
+ logits = None
1430
+ else:
1431
+ prompt_mask = labels == -100
1432
+ position_ids = modify_padded_position_ids_2d(position_ids)
1433
+ concat_inputs_ids, concat_position_ids, flex_attention_mask_3d, logits_to_keep_half, logits_to_keep, p_mask = self.prepare_for_bd_training(input_ids, position_ids, prompt_mask)
1434
+ outputs = self.model(
1435
+ input_ids=concat_inputs_ids,
1436
+ attention_mask=flex_attention_mask_3d,
1437
+ position_ids=concat_position_ids,
1438
+ output_attentions=output_attentions,
1439
+ output_hidden_states=output_hidden_states,
1440
+ return_dict=True,
1441
+ cache_position=cache_position,
1442
+ **kwargs,
1443
+ )
1444
+ hidden_states = outputs.last_hidden_state
1445
+ hidden_states = hidden_states[logits_to_keep].contiguous()
1446
+ answer_len = (labels != -100).sum()
1447
+ loss_fct = FusedLinearDiffusionCrossEntropyLoss(reduction='sum')
1448
+ loss = loss_fct( # it will return (sum_loss, unreduced_loss)
1449
+ # conduct `view(-1, V)` inside the function
1450
+ x=hidden_states,
1451
+ target=labels[logits_to_keep_half].contiguous(),
1452
+ weight=self.lm_head.weight,
1453
+ bias=self.lm_head.bias,
1454
+ p_mask=p_mask,
1455
+ )
1456
+ loss = loss / answer_len
1457
+ logits = None
1458
+ else:
1459
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
1460
+ outputs: BaseModelOutputWithPast = self.model(
1461
+ input_ids=input_ids,
1462
+ attention_mask=attention_mask,
1463
+ position_ids=position_ids,
1464
+ token_labels=token_labels,
1465
+ past_key_values=past_key_values,
1466
+ inputs_embeds=inputs_embeds,
1467
+ use_cache=use_cache,
1468
+ output_attentions=output_attentions,
1469
+ output_hidden_states=output_hidden_states,
1470
+ cache_position=cache_position,
1471
+ **kwargs,
1472
+ )
1473
+
1474
+ hidden_states = outputs.last_hidden_state
1475
+ # Only compute necessary logits, and do not upcast them to float if we are not computing the loss
1476
+ slice_indices = slice(-logits_to_keep,
1477
+ None) if isinstance(logits_to_keep, int) else logits_to_keep
1478
+ hidden_states = hidden_states[:, slice_indices, :].contiguous()
1479
+ fuse_linear_and_cross_entropy = self.config.fuse_cross_entropy and self.training
1480
+ if fuse_linear_and_cross_entropy:
1481
+ # When using fused_linear_ce_loss, we do not compute the whole logits on HBM
1482
+ logits = None
1483
+ else:
1484
+ logits = self.lm_head(hidden_states)
1485
+
1486
+ loss = None
1487
+ if labels is not None:
1488
+ # FusedLinearCrossEntropyLoss will be implemented by monkey patch when training
1489
+ # We don't use it when inferencing
1490
+ loss_fct = nn.CrossEntropyLoss() # nn.CE
1491
+ loss = loss_fct(
1492
+ logits.view(-1, self.config.vocab_size), labels.view(-1))
1493
+
1494
+ return CausalLMOutputWithPast(
1495
+ loss=loss,
1496
+ logits=logits,
1497
+ past_key_values=outputs.past_key_values,
1498
+ hidden_states=outputs.hidden_states,
1499
+ attentions=outputs.attentions,
1500
+ )
1501
+
1502
+
1503
+ __all__ = [
1504
+ "SDARForCausalLM",
1505
+ "SDARModel",
1506
+ "SDARPreTrainedModel",
1507
+ ]
special_tokens_map.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>",
16
+ "<|MASK|>"
17
+ ],
18
+ "eos_token": {
19
+ "content": "<|endoftext|>",
20
+ "lstrip": false,
21
+ "normalized": false,
22
+ "rstrip": false,
23
+ "single_word": false
24
+ },
25
+ "mask_token": {
26
+ "content": "<|MASK|>",
27
+ "lstrip": false,
28
+ "normalized": false,
29
+ "rstrip": false,
30
+ "single_word": false
31
+ },
32
+ "pad_token": {
33
+ "content": "<|endoftext|>",
34
+ "lstrip": false,
35
+ "normalized": false,
36
+ "rstrip": false,
37
+ "single_word": false
38
+ }
39
+ }
tokenization_qwen2.py ADDED
@@ -0,0 +1,342 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2024 The Qwen team, Alibaba Group and The HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """Tokenization classes for Qwen2."""
16
+
17
+ import json
18
+ import os
19
+ import unicodedata
20
+ from functools import lru_cache
21
+ from typing import Optional, Tuple
22
+
23
+ import regex as re
24
+
25
+ from transformers.tokenization_utils import AddedToken, PreTrainedTokenizer
26
+ from transformers.utils import logging
27
+
28
+
29
+ logger = logging.get_logger(__name__)
30
+
31
+ VOCAB_FILES_NAMES = {
32
+ "vocab_file": "vocab.json",
33
+ "merges_file": "merges.txt",
34
+ }
35
+
36
+
37
+ MAX_MODEL_INPUT_SIZES = {"qwen/qwen-tokenizer": 32768}
38
+
39
+ PRETOKENIZE_REGEX = r"""(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+"""
40
+
41
+
42
+ @lru_cache()
43
+ # Copied from transformers.models.gpt2.tokenization_gpt2.bytes_to_unicode
44
+ def bytes_to_unicode():
45
+ """
46
+ Returns list of utf-8 byte and a mapping to unicode strings. We specifically avoids mapping to whitespace/control
47
+ characters the bpe code barfs on.
48
+
49
+ The reversible bpe codes work on unicode strings. This means you need a large # of unicode characters in your vocab
50
+ if you want to avoid UNKs. When you're at something like a 10B token dataset you end up needing around 5K for
51
+ decent coverage. This is a significant percentage of your normal, say, 32K bpe vocab. To avoid that, we want lookup
52
+ tables between utf-8 bytes and unicode strings.
53
+ """
54
+ bs = (
55
+ list(range(ord("!"), ord("~") + 1)) + list(range(ord("¡"), ord("¬") + 1)) + list(range(ord("®"), ord("ÿ") + 1))
56
+ )
57
+ cs = bs[:]
58
+ n = 0
59
+ for b in range(2**8):
60
+ if b not in bs:
61
+ bs.append(b)
62
+ cs.append(2**8 + n)
63
+ n += 1
64
+ cs = [chr(n) for n in cs]
65
+ return dict(zip(bs, cs))
66
+
67
+
68
+ # Copied from transformers.models.gpt2.tokenization_gpt2.get_pairs
69
+ def get_pairs(word):
70
+ """
71
+ Return set of symbol pairs in a word.
72
+
73
+ Word is represented as tuple of symbols (symbols being variable-length strings).
74
+ """
75
+ pairs = set()
76
+ prev_char = word[0]
77
+ for char in word[1:]:
78
+ pairs.add((prev_char, char))
79
+ prev_char = char
80
+ return pairs
81
+
82
+
83
+ class Qwen2Tokenizer(PreTrainedTokenizer):
84
+ """
85
+ Construct a Qwen2 tokenizer. Based on byte-level Byte-Pair-Encoding.
86
+
87
+ Same with GPT2Tokenizer, this tokenizer has been trained to treat spaces like parts of the tokens so a word will
88
+ be encoded differently whether it is at the beginning of the sentence (without space) or not:
89
+
90
+ ```python
91
+ >>> from transformers import Qwen2Tokenizer
92
+
93
+ >>> tokenizer = Qwen2Tokenizer.from_pretrained("Qwen/Qwen-tokenizer")
94
+ >>> tokenizer("Hello world")["input_ids"]
95
+ [9707, 1879]
96
+
97
+ >>> tokenizer(" Hello world")["input_ids"]
98
+ [21927, 1879]
99
+ ```
100
+ This is expected.
101
+
102
+ You should not use GPT2Tokenizer instead, because of the different pretokenization rules.
103
+
104
+ This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
105
+ this superclass for more information regarding those methods.
106
+
107
+ Args:
108
+ vocab_file (`str`):
109
+ Path to the vocabulary file.
110
+ merges_file (`str`):
111
+ Path to the merges file.
112
+ errors (`str`, *optional*, defaults to `"replace"`):
113
+ Paradigm to follow when decoding bytes to UTF-8. See
114
+ [bytes.decode](https://docs.python.org/3/library/stdtypes.html#bytes.decode) for more information.
115
+ unk_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
116
+ The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
117
+ token instead.
118
+ bos_token (`str`, *optional*):
119
+ The beginning of sequence token. Not applicable for this tokenizer.
120
+ eos_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
121
+ The end of sequence token.
122
+ pad_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
123
+ The token used for padding, for example when batching sequences of different lengths.
124
+ clean_up_tokenization_spaces (`bool`, *optional*, defaults to `False`):
125
+ Whether or not the model should cleanup the spaces that were added when splitting the input text during the
126
+ tokenization process. Not applicable to this tokenizer, since tokenization does not add spaces.
127
+ split_special_tokens (`bool`, *optional*, defaults to `False`):
128
+ Whether or not the special tokens should be split during the tokenization process. The default behavior is
129
+ to not split special tokens. This means that if `<|endoftext|>` is the `eos_token`, then `tokenizer.tokenize("<|endoftext|>") =
130
+ ['<|endoftext|>`]. Otherwise, if `split_special_tokens=True`, then `tokenizer.tokenize("<|endoftext|>")` will be give `['<',
131
+ '|', 'endo', 'ft', 'ext', '|', '>']`. This argument is only supported for `slow` tokenizers for the moment.
132
+ """
133
+
134
+ vocab_files_names = VOCAB_FILES_NAMES
135
+ model_input_names = ["input_ids", "attention_mask"]
136
+
137
+ def __init__(
138
+ self,
139
+ vocab_file,
140
+ merges_file,
141
+ errors="replace",
142
+ unk_token="<|endoftext|>",
143
+ bos_token=None,
144
+ eos_token="<|endoftext|>",
145
+ pad_token="<|endoftext|>",
146
+ clean_up_tokenization_spaces=False,
147
+ split_special_tokens=False,
148
+ **kwargs,
149
+ ):
150
+ # Qwen vocab does not contain control tokens; added tokens need to be special
151
+ bos_token = (
152
+ AddedToken(bos_token, lstrip=False, rstrip=False, special=True, normalized=False)
153
+ if isinstance(bos_token, str)
154
+ else bos_token
155
+ )
156
+ eos_token = (
157
+ AddedToken(eos_token, lstrip=False, rstrip=False, special=True, normalized=False)
158
+ if isinstance(eos_token, str)
159
+ else eos_token
160
+ )
161
+ unk_token = (
162
+ AddedToken(unk_token, lstrip=False, rstrip=False, special=True, normalized=False)
163
+ if isinstance(unk_token, str)
164
+ else unk_token
165
+ )
166
+ pad_token = (
167
+ AddedToken(pad_token, lstrip=False, rstrip=False, special=True, normalized=False)
168
+ if isinstance(pad_token, str)
169
+ else pad_token
170
+ )
171
+
172
+ with open(vocab_file, encoding="utf-8") as vocab_handle:
173
+ self.encoder = json.load(vocab_handle)
174
+ self.decoder = {v: k for k, v in self.encoder.items()}
175
+ self.errors = errors # how to handle errors in decoding
176
+ self.byte_encoder = bytes_to_unicode()
177
+ self.byte_decoder = {v: k for k, v in self.byte_encoder.items()}
178
+ bpe_merges = []
179
+ with open(merges_file, encoding="utf-8") as merges_handle:
180
+ for i, line in enumerate(merges_handle):
181
+ line = line.strip()
182
+ if (i == 0 and line.startswith("#version:")) or not line:
183
+ continue
184
+ bpe_merges.append(tuple(line.split()))
185
+ self.bpe_ranks = dict(zip(bpe_merges, range(len(bpe_merges))))
186
+ # NOTE: the cache can grow without bound and will get really large for long running processes
187
+ # (esp. for texts of language that do not use space between word, e.g. Chinese); technically
188
+ # not a memory leak but appears as one.
189
+ # GPT2Tokenizer has the same problem, so let's be consistent.
190
+ self.cache = {}
191
+
192
+ self.pat = re.compile(PRETOKENIZE_REGEX)
193
+
194
+ if kwargs.get("add_prefix_space", False):
195
+ logger.warning_once(
196
+ f"{self.__class__.__name} does not support `add_prefix_space`, setting it to True has no effect."
197
+ )
198
+
199
+ super().__init__(
200
+ errors=errors,
201
+ bos_token=bos_token,
202
+ eos_token=eos_token,
203
+ pad_token=pad_token,
204
+ unk_token=unk_token,
205
+ clean_up_tokenization_spaces=clean_up_tokenization_spaces,
206
+ split_special_tokens=split_special_tokens,
207
+ **kwargs,
208
+ )
209
+
210
+ @property
211
+ def vocab_size(self) -> int:
212
+ return len(self.encoder)
213
+
214
+ # Copied from transformers.models.gpt2.tokenization_gpt2.GPT2Tokenizer.get_vocab
215
+ def get_vocab(self):
216
+ return dict(self.encoder, **self.added_tokens_encoder)
217
+
218
+ # Copied from transformers.models.gpt2.tokenization_gpt2.GPT2Tokenizer.bpe
219
+ def bpe(self, token):
220
+ if token in self.cache:
221
+ return self.cache[token]
222
+ word = tuple(token)
223
+ pairs = get_pairs(word)
224
+
225
+ if not pairs:
226
+ return token
227
+
228
+ while True:
229
+ bigram = min(pairs, key=lambda pair: self.bpe_ranks.get(pair, float("inf")))
230
+ if bigram not in self.bpe_ranks:
231
+ break
232
+ first, second = bigram
233
+ new_word = []
234
+ i = 0
235
+ while i < len(word):
236
+ try:
237
+ j = word.index(first, i)
238
+ except ValueError:
239
+ new_word.extend(word[i:])
240
+ break
241
+ else:
242
+ new_word.extend(word[i:j])
243
+ i = j
244
+
245
+ if word[i] == first and i < len(word) - 1 and word[i + 1] == second:
246
+ new_word.append(first + second)
247
+ i += 2
248
+ else:
249
+ new_word.append(word[i])
250
+ i += 1
251
+ new_word = tuple(new_word)
252
+ word = new_word
253
+ if len(word) == 1:
254
+ break
255
+ else:
256
+ pairs = get_pairs(word)
257
+ word = " ".join(word)
258
+ self.cache[token] = word
259
+ return word
260
+
261
+ # Copied from transformers.models.gpt2.tokenization_gpt2.GPT2Tokenizer._tokenize
262
+ def _tokenize(self, text):
263
+ """Tokenize a string."""
264
+ bpe_tokens = []
265
+ for token in re.findall(self.pat, text):
266
+ token = "".join(
267
+ self.byte_encoder[b] for b in token.encode("utf-8")
268
+ ) # Maps all our bytes to unicode strings, avoiding control tokens of the BPE (spaces in our case)
269
+ bpe_tokens.extend(bpe_token for bpe_token in self.bpe(token).split(" "))
270
+ return bpe_tokens
271
+
272
+ # Copied from transformers.models.gpt2.tokenization_gpt2.GPT2Tokenizer._convert_token_to_id
273
+ def _convert_token_to_id(self, token):
274
+ """Converts a token (str) in an id using the vocab."""
275
+ return self.encoder.get(token, self.encoder.get(self.unk_token))
276
+
277
+ # Copied from transformers.models.gpt2.tokenization_gpt2.GPT2Tokenizer._convert_id_to_token
278
+ def _convert_id_to_token(self, index):
279
+ """Converts an index (integer) in a token (str) using the vocab."""
280
+ return self.decoder.get(index)
281
+
282
+ # Copied from transformers.models.gpt2.tokenization_gpt2.GPT2Tokenizer.convert_tokens_to_string
283
+ def convert_tokens_to_string(self, tokens):
284
+ """Converts a sequence of tokens (string) in a single string."""
285
+ text = "".join(tokens)
286
+ text = bytearray([self.byte_decoder[c] for c in text]).decode("utf-8", errors=self.errors)
287
+ return text
288
+
289
+ def decode(
290
+ self,
291
+ token_ids,
292
+ skip_special_tokens: bool = False,
293
+ clean_up_tokenization_spaces: Optional[bool] = False,
294
+ spaces_between_special_tokens: bool = False,
295
+ **kwargs,
296
+ ) -> str:
297
+ # `spaces_between_special_tokens` defaults to True for _decode in slow tokenizers
298
+ # and cannot be configured elsewhere, but it should default to False for Qwen2Tokenizer
299
+ return super().decode(
300
+ token_ids,
301
+ skip_special_tokens=skip_special_tokens,
302
+ clean_up_tokenization_spaces=clean_up_tokenization_spaces,
303
+ spaces_between_special_tokens=spaces_between_special_tokens,
304
+ **kwargs,
305
+ )
306
+
307
+ # Copied from transformers.models.gpt2.tokenization_gpt2.GPT2Tokenizer.save_vocabulary
308
+ def save_vocabulary(self, save_directory: str, filename_prefix: Optional[str] = None) -> Tuple[str]:
309
+ if not os.path.isdir(save_directory):
310
+ logger.error(f"Vocabulary path ({save_directory}) should be a directory")
311
+ return
312
+ vocab_file = os.path.join(
313
+ save_directory, (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"]
314
+ )
315
+ merge_file = os.path.join(
316
+ save_directory, (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["merges_file"]
317
+ )
318
+
319
+ with open(vocab_file, "w", encoding="utf-8") as f:
320
+ f.write(json.dumps(self.encoder, indent=2, sort_keys=True, ensure_ascii=False) + "\n")
321
+
322
+ index = 0
323
+ with open(merge_file, "w", encoding="utf-8") as writer:
324
+ writer.write("#version: 0.2\n")
325
+ for bpe_tokens, token_index in sorted(self.bpe_ranks.items(), key=lambda kv: kv[1]):
326
+ if index != token_index:
327
+ logger.warning(
328
+ f"Saving vocabulary to {merge_file}: BPE merge indices are not consecutive."
329
+ " Please check that the tokenizer is not corrupted!"
330
+ )
331
+ index = token_index
332
+ writer.write(" ".join(bpe_tokens) + "\n")
333
+ index += 1
334
+
335
+ return vocab_file, merge_file
336
+
337
+ def prepare_for_tokenization(self, text, **kwargs):
338
+ text = unicodedata.normalize("NFC", text)
339
+ return (text, kwargs)
340
+
341
+
342
+ __all__ = ["Qwen2Tokenizer"]
tokenizer_config.json ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "151665": {
182
+ "content": "<tool_response>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": false
188
+ },
189
+ "151666": {
190
+ "content": "</tool_response>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": false
196
+ },
197
+ "151667": {
198
+ "content": "<think>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": false
204
+ },
205
+ "151668": {
206
+ "content": "</think>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": false
212
+ },
213
+ "151669": {
214
+ "content": "<|MASK|>",
215
+ "lstrip": false,
216
+ "normalized": false,
217
+ "rstrip": false,
218
+ "single_word": false,
219
+ "special": true
220
+ }
221
+ },
222
+ "additional_special_tokens": [
223
+ "<|im_start|>",
224
+ "<|im_end|>",
225
+ "<|object_ref_start|>",
226
+ "<|object_ref_end|>",
227
+ "<|box_start|>",
228
+ "<|box_end|>",
229
+ "<|quad_start|>",
230
+ "<|quad_end|>",
231
+ "<|vision_start|>",
232
+ "<|vision_end|>",
233
+ "<|vision_pad|>",
234
+ "<|image_pad|>",
235
+ "<|video_pad|>",
236
+ "<|MASK|>"
237
+ ],
238
+ "auto_map": {
239
+ "AutoTokenizer": [
240
+ "tokenization_qwen2.Qwen2Tokenizer",
241
+ null
242
+ ]
243
+ },
244
+ "bos_token": null,
245
+ "clean_up_tokenization_spaces": false,
246
+ "eos_token": "<|endoftext|>",
247
+ "errors": "replace",
248
+ "extra_special_tokens": {},
249
+ "mask_token": "<|MASK|>",
250
+ "model_max_length": 131072,
251
+ "pad_token": "<|endoftext|>",
252
+ "padding_side": "right",
253
+ "split_special_tokens": false,
254
+ "tokenizer_class": "Qwen2Tokenizer",
255
+ "unk_token": null
256
+ }
train_results.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "effective_tokens_per_sec": 3457.623292260188,
3
+ "epoch": 3.0,
4
+ "total_flos": 1.0868263403315528e+18,
5
+ "train_loss": 0.12404776059961387,
6
+ "train_runtime": 1235.844,
7
+ "train_samples_per_second": 72.563,
8
+ "train_steps_per_second": 1.136
9
+ }
trainer_log.jsonl ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"current_steps": 5, "total_steps": 1404, "loss": 0.3054, "lr": 9.30232558139535e-07, "epoch": 0.0106951871657754, "percentage": 0.36, "elapsed_time": "0:02:02", "remaining_time": "9:29:48"}
2
+ {"current_steps": 10, "total_steps": 1404, "loss": 0.2661, "lr": 2.0930232558139536e-06, "epoch": 0.0213903743315508, "percentage": 0.71, "elapsed_time": "0:02:05", "remaining_time": "4:51:48"}
3
+ {"current_steps": 15, "total_steps": 1404, "loss": 0.2409, "lr": 3.2558139534883724e-06, "epoch": 0.03208556149732621, "percentage": 1.07, "elapsed_time": "0:02:09", "remaining_time": "3:19:34"}
4
+ {"current_steps": 20, "total_steps": 1404, "loss": 0.2228, "lr": 4.418604651162791e-06, "epoch": 0.0427807486631016, "percentage": 1.42, "elapsed_time": "0:02:12", "remaining_time": "2:32:52"}
5
+ {"current_steps": 25, "total_steps": 1404, "loss": 0.2258, "lr": 5.58139534883721e-06, "epoch": 0.053475935828877004, "percentage": 1.78, "elapsed_time": "0:02:16", "remaining_time": "2:05:08"}
6
+ {"current_steps": 30, "total_steps": 1404, "loss": 0.2103, "lr": 6.744186046511628e-06, "epoch": 0.06417112299465241, "percentage": 2.14, "elapsed_time": "0:02:19", "remaining_time": "1:46:22"}
7
+ {"current_steps": 35, "total_steps": 1404, "loss": 0.2122, "lr": 7.906976744186048e-06, "epoch": 0.0748663101604278, "percentage": 2.49, "elapsed_time": "0:02:22", "remaining_time": "1:32:57"}
8
+ {"current_steps": 40, "total_steps": 1404, "loss": 0.1996, "lr": 9.069767441860465e-06, "epoch": 0.0855614973262032, "percentage": 2.85, "elapsed_time": "0:02:25", "remaining_time": "1:22:52"}
9
+ {"current_steps": 45, "total_steps": 1404, "loss": 0.2311, "lr": 9.999986679414613e-06, "epoch": 0.0962566844919786, "percentage": 3.21, "elapsed_time": "0:02:29", "remaining_time": "1:15:04"}
10
+ {"current_steps": 50, "total_steps": 1404, "loss": 0.2319, "lr": 9.999520466378376e-06, "epoch": 0.10695187165775401, "percentage": 3.56, "elapsed_time": "0:02:32", "remaining_time": "1:08:51"}
11
+ {"current_steps": 55, "total_steps": 1404, "loss": 0.2368, "lr": 9.998388295046227e-06, "epoch": 0.11764705882352941, "percentage": 3.92, "elapsed_time": "0:02:35", "remaining_time": "1:03:39"}
12
+ {"current_steps": 60, "total_steps": 1404, "loss": 0.2354, "lr": 9.996590316228402e-06, "epoch": 0.12834224598930483, "percentage": 4.27, "elapsed_time": "0:02:39", "remaining_time": "0:59:28"}
13
+ {"current_steps": 65, "total_steps": 1404, "loss": 0.234, "lr": 9.994126769423656e-06, "epoch": 0.13903743315508021, "percentage": 4.63, "elapsed_time": "0:02:42", "remaining_time": "0:55:47"}
14
+ {"current_steps": 70, "total_steps": 1404, "loss": 0.2541, "lr": 9.990997982787348e-06, "epoch": 0.1497326203208556, "percentage": 4.99, "elapsed_time": "0:02:46", "remaining_time": "0:52:44"}
15
+ {"current_steps": 75, "total_steps": 1404, "loss": 0.2496, "lr": 9.98720437308773e-06, "epoch": 0.16042780748663102, "percentage": 5.34, "elapsed_time": "0:02:49", "remaining_time": "0:49:59"}
16
+ {"current_steps": 80, "total_steps": 1404, "loss": 0.2797, "lr": 9.982746445650437e-06, "epoch": 0.1711229946524064, "percentage": 5.7, "elapsed_time": "0:02:52", "remaining_time": "0:47:33"}
17
+ {"current_steps": 85, "total_steps": 1404, "loss": 0.2518, "lr": 9.977624794291172e-06, "epoch": 0.18181818181818182, "percentage": 6.05, "elapsed_time": "0:02:55", "remaining_time": "0:45:25"}
18
+ {"current_steps": 90, "total_steps": 1404, "loss": 0.261, "lr": 9.97184010123661e-06, "epoch": 0.1925133689839572, "percentage": 6.41, "elapsed_time": "0:02:58", "remaining_time": "0:43:32"}
19
+ {"current_steps": 95, "total_steps": 1404, "loss": 0.2564, "lr": 9.965393137033512e-06, "epoch": 0.20320855614973263, "percentage": 6.77, "elapsed_time": "0:03:02", "remaining_time": "0:41:52"}
20
+ {"current_steps": 100, "total_steps": 1404, "loss": 0.2501, "lr": 9.958284760446104e-06, "epoch": 0.21390374331550802, "percentage": 7.12, "elapsed_time": "0:03:05", "remaining_time": "0:40:19"}
21
+ {"current_steps": 105, "total_steps": 1404, "loss": 0.2504, "lr": 9.950515918341666e-06, "epoch": 0.22459893048128343, "percentage": 7.48, "elapsed_time": "0:03:08", "remaining_time": "0:38:54"}
22
+ {"current_steps": 110, "total_steps": 1404, "loss": 0.2706, "lr": 9.942087645564415e-06, "epoch": 0.23529411764705882, "percentage": 7.83, "elapsed_time": "0:03:11", "remaining_time": "0:37:38"}
23
+ {"current_steps": 115, "total_steps": 1404, "loss": 0.2499, "lr": 9.93300106479766e-06, "epoch": 0.24598930481283424, "percentage": 8.19, "elapsed_time": "0:03:15", "remaining_time": "0:36:31"}
24
+ {"current_steps": 120, "total_steps": 1404, "loss": 0.2628, "lr": 9.923257386414253e-06, "epoch": 0.25668449197860965, "percentage": 8.55, "elapsed_time": "0:03:19", "remaining_time": "0:35:31"}
25
+ {"current_steps": 125, "total_steps": 1404, "loss": 0.2642, "lr": 9.912857908315363e-06, "epoch": 0.26737967914438504, "percentage": 8.9, "elapsed_time": "0:03:22", "remaining_time": "0:34:31"}
26
+ {"current_steps": 130, "total_steps": 1404, "loss": 0.2669, "lr": 9.901804015757588e-06, "epoch": 0.27807486631016043, "percentage": 9.26, "elapsed_time": "0:03:25", "remaining_time": "0:33:34"}
27
+ {"current_steps": 135, "total_steps": 1404, "loss": 0.2809, "lr": 9.89009718116843e-06, "epoch": 0.2887700534759358, "percentage": 9.62, "elapsed_time": "0:03:28", "remaining_time": "0:32:43"}
28
+ {"current_steps": 140, "total_steps": 1404, "loss": 0.2705, "lr": 9.877738963950175e-06, "epoch": 0.2994652406417112, "percentage": 9.97, "elapsed_time": "0:03:32", "remaining_time": "0:31:57"}
29
+ {"current_steps": 145, "total_steps": 1404, "loss": 0.2548, "lr": 9.864731010272152e-06, "epoch": 0.31016042780748665, "percentage": 10.33, "elapsed_time": "0:03:35", "remaining_time": "0:31:11"}
30
+ {"current_steps": 150, "total_steps": 1404, "loss": 0.2534, "lr": 9.851075052851476e-06, "epoch": 0.32085561497326204, "percentage": 10.68, "elapsed_time": "0:03:38", "remaining_time": "0:30:28"}
31
+ {"current_steps": 155, "total_steps": 1404, "loss": 0.2438, "lr": 9.83677291072223e-06, "epoch": 0.3315508021390374, "percentage": 11.04, "elapsed_time": "0:03:41", "remaining_time": "0:29:48"}
32
+ {"current_steps": 160, "total_steps": 1404, "loss": 0.2791, "lr": 9.821826488993168e-06, "epoch": 0.3422459893048128, "percentage": 11.4, "elapsed_time": "0:03:45", "remaining_time": "0:29:12"}
33
+ {"current_steps": 165, "total_steps": 1404, "loss": 0.2734, "lr": 9.806237778593941e-06, "epoch": 0.35294117647058826, "percentage": 11.75, "elapsed_time": "0:03:48", "remaining_time": "0:28:37"}
34
+ {"current_steps": 170, "total_steps": 1404, "loss": 0.2463, "lr": 9.790008856009902e-06, "epoch": 0.36363636363636365, "percentage": 12.11, "elapsed_time": "0:03:51", "remaining_time": "0:28:02"}
35
+ {"current_steps": 175, "total_steps": 1404, "loss": 0.2813, "lr": 9.773141883005507e-06, "epoch": 0.37433155080213903, "percentage": 12.46, "elapsed_time": "0:03:54", "remaining_time": "0:27:30"}
36
+ {"current_steps": 180, "total_steps": 1404, "loss": 0.2724, "lr": 9.755639106336347e-06, "epoch": 0.3850267379679144, "percentage": 12.82, "elapsed_time": "0:03:58", "remaining_time": "0:26:59"}
37
+ {"current_steps": 185, "total_steps": 1404, "loss": 0.271, "lr": 9.737502857449894e-06, "epoch": 0.39572192513368987, "percentage": 13.18, "elapsed_time": "0:04:01", "remaining_time": "0:26:32"}
38
+ {"current_steps": 190, "total_steps": 1404, "loss": 0.2467, "lr": 9.718735552174923e-06, "epoch": 0.40641711229946526, "percentage": 13.53, "elapsed_time": "0:04:04", "remaining_time": "0:26:04"}
39
+ {"current_steps": 195, "total_steps": 1404, "loss": 0.2621, "lr": 9.699339690399717e-06, "epoch": 0.41711229946524064, "percentage": 13.89, "elapsed_time": "0:04:08", "remaining_time": "0:25:38"}
40
+ {"current_steps": 200, "total_steps": 1404, "loss": 0.2791, "lr": 9.679317855739073e-06, "epoch": 0.42780748663101603, "percentage": 14.25, "elapsed_time": "0:04:11", "remaining_time": "0:25:13"}
41
+ {"current_steps": 205, "total_steps": 1404, "loss": 0.2829, "lr": 9.658672715190151e-06, "epoch": 0.4385026737967914, "percentage": 14.6, "elapsed_time": "0:04:14", "remaining_time": "0:24:49"}
42
+ {"current_steps": 210, "total_steps": 1404, "loss": 0.2866, "lr": 9.637407018777224e-06, "epoch": 0.44919786096256686, "percentage": 14.96, "elapsed_time": "0:04:18", "remaining_time": "0:24:27"}
43
+ {"current_steps": 215, "total_steps": 1404, "loss": 0.2422, "lr": 9.615523599185353e-06, "epoch": 0.45989304812834225, "percentage": 15.31, "elapsed_time": "0:04:21", "remaining_time": "0:24:04"}
44
+ {"current_steps": 220, "total_steps": 1404, "loss": 0.269, "lr": 9.593025371383064e-06, "epoch": 0.47058823529411764, "percentage": 15.67, "elapsed_time": "0:04:24", "remaining_time": "0:23:42"}
45
+ {"current_steps": 225, "total_steps": 1404, "loss": 0.2686, "lr": 9.569915332234068e-06, "epoch": 0.48128342245989303, "percentage": 16.03, "elapsed_time": "0:04:27", "remaining_time": "0:23:21"}
46
+ {"current_steps": 230, "total_steps": 1404, "loss": 0.273, "lr": 9.546196560098062e-06, "epoch": 0.4919786096256685, "percentage": 16.38, "elapsed_time": "0:04:30", "remaining_time": "0:23:03"}
47
+ {"current_steps": 235, "total_steps": 1404, "loss": 0.2395, "lr": 9.521872214420668e-06, "epoch": 0.5026737967914439, "percentage": 16.74, "elapsed_time": "0:04:34", "remaining_time": "0:22:43"}
48
+ {"current_steps": 240, "total_steps": 1404, "loss": 0.2682, "lr": 9.496945535312597e-06, "epoch": 0.5133689839572193, "percentage": 17.09, "elapsed_time": "0:04:37", "remaining_time": "0:22:25"}
49
+ {"current_steps": 245, "total_steps": 1404, "loss": 0.2557, "lr": 9.471419843118036e-06, "epoch": 0.5240641711229946, "percentage": 17.45, "elapsed_time": "0:04:40", "remaining_time": "0:22:06"}
50
+ {"current_steps": 250, "total_steps": 1404, "loss": 0.266, "lr": 9.44529853797238e-06, "epoch": 0.5347593582887701, "percentage": 17.81, "elapsed_time": "0:04:43", "remaining_time": "0:21:49"}
51
+ {"current_steps": 255, "total_steps": 1404, "loss": 0.2779, "lr": 9.418585099349306e-06, "epoch": 0.5454545454545454, "percentage": 18.16, "elapsed_time": "0:04:47", "remaining_time": "0:21:34"}
52
+ {"current_steps": 260, "total_steps": 1404, "loss": 0.2508, "lr": 9.391283085597299e-06, "epoch": 0.5561497326203209, "percentage": 18.52, "elapsed_time": "0:04:50", "remaining_time": "0:21:17"}
53
+ {"current_steps": 265, "total_steps": 1404, "loss": 0.2727, "lr": 9.36339613346565e-06, "epoch": 0.5668449197860963, "percentage": 18.87, "elapsed_time": "0:04:53", "remaining_time": "0:21:02"}
54
+ {"current_steps": 270, "total_steps": 1404, "loss": 0.2714, "lr": 9.33492795762005e-06, "epoch": 0.5775401069518716, "percentage": 19.23, "elapsed_time": "0:04:56", "remaining_time": "0:20:46"}
55
+ {"current_steps": 275, "total_steps": 1404, "loss": 0.2585, "lr": 9.305882350147763e-06, "epoch": 0.5882352941176471, "percentage": 19.59, "elapsed_time": "0:05:00", "remaining_time": "0:20:32"}
56
+ {"current_steps": 280, "total_steps": 1404, "loss": 0.2584, "lr": 9.276263180052498e-06, "epoch": 0.5989304812834224, "percentage": 19.94, "elapsed_time": "0:05:03", "remaining_time": "0:20:18"}
57
+ {"current_steps": 285, "total_steps": 1404, "loss": 0.2771, "lr": 9.246074392739057e-06, "epoch": 0.6096256684491979, "percentage": 20.3, "elapsed_time": "0:05:06", "remaining_time": "0:20:03"}
58
+ {"current_steps": 290, "total_steps": 1404, "loss": 0.265, "lr": 9.21532000948778e-06, "epoch": 0.6203208556149733, "percentage": 20.66, "elapsed_time": "0:05:09", "remaining_time": "0:19:50"}
59
+ {"current_steps": 295, "total_steps": 1404, "loss": 0.2653, "lr": 9.184004126918891e-06, "epoch": 0.6310160427807486, "percentage": 21.01, "elapsed_time": "0:05:12", "remaining_time": "0:19:36"}
60
+ {"current_steps": 300, "total_steps": 1404, "loss": 0.2373, "lr": 9.152130916446817e-06, "epoch": 0.6417112299465241, "percentage": 21.37, "elapsed_time": "0:05:16", "remaining_time": "0:19:24"}
61
+ {"current_steps": 305, "total_steps": 1404, "loss": 0.2779, "lr": 9.119704623724528e-06, "epoch": 0.6524064171122995, "percentage": 21.72, "elapsed_time": "0:05:19", "remaining_time": "0:19:12"}
62
+ {"current_steps": 310, "total_steps": 1404, "loss": 0.2813, "lr": 9.086729568078006e-06, "epoch": 0.6631016042780749, "percentage": 22.08, "elapsed_time": "0:05:22", "remaining_time": "0:18:59"}
63
+ {"current_steps": 315, "total_steps": 1404, "loss": 0.284, "lr": 9.05321014193089e-06, "epoch": 0.6737967914438503, "percentage": 22.44, "elapsed_time": "0:05:26", "remaining_time": "0:18:47"}
64
+ {"current_steps": 320, "total_steps": 1404, "loss": 0.2646, "lr": 9.019150810219376e-06, "epoch": 0.6844919786096256, "percentage": 22.79, "elapsed_time": "0:05:29", "remaining_time": "0:18:35"}
65
+ {"current_steps": 325, "total_steps": 1404, "loss": 0.2693, "lr": 8.984556109797484e-06, "epoch": 0.6951871657754011, "percentage": 23.15, "elapsed_time": "0:05:32", "remaining_time": "0:18:24"}
66
+ {"current_steps": 330, "total_steps": 1404, "loss": 0.2662, "lr": 8.949430648832716e-06, "epoch": 0.7058823529411765, "percentage": 23.5, "elapsed_time": "0:05:35", "remaining_time": "0:18:13"}
67
+ {"current_steps": 335, "total_steps": 1404, "loss": 0.2745, "lr": 8.91377910619223e-06, "epoch": 0.7165775401069518, "percentage": 23.86, "elapsed_time": "0:05:39", "remaining_time": "0:18:02"}
68
+ {"current_steps": 340, "total_steps": 1404, "loss": 0.2462, "lr": 8.8776062308196e-06, "epoch": 0.7272727272727273, "percentage": 24.22, "elapsed_time": "0:05:42", "remaining_time": "0:17:51"}
69
+ {"current_steps": 345, "total_steps": 1404, "loss": 0.2663, "lr": 8.84091684110223e-06, "epoch": 0.7379679144385026, "percentage": 24.57, "elapsed_time": "0:05:45", "remaining_time": "0:17:41"}
70
+ {"current_steps": 350, "total_steps": 1404, "loss": 0.2595, "lr": 8.803715824229525e-06, "epoch": 0.7486631016042781, "percentage": 24.93, "elapsed_time": "0:05:48", "remaining_time": "0:17:30"}
71
+ {"current_steps": 355, "total_steps": 1404, "loss": 0.2476, "lr": 8.766008135541896e-06, "epoch": 0.7593582887700535, "percentage": 25.28, "elapsed_time": "0:05:52", "remaining_time": "0:17:20"}
72
+ {"current_steps": 360, "total_steps": 1404, "loss": 0.2399, "lr": 8.727798797870688e-06, "epoch": 0.7700534759358288, "percentage": 25.64, "elapsed_time": "0:05:55", "remaining_time": "0:17:10"}
73
+ {"current_steps": 365, "total_steps": 1404, "loss": 0.2568, "lr": 8.689092900869112e-06, "epoch": 0.7807486631016043, "percentage": 26.0, "elapsed_time": "0:05:58", "remaining_time": "0:17:00"}
74
+ {"current_steps": 370, "total_steps": 1404, "loss": 0.2779, "lr": 8.649895600334284e-06, "epoch": 0.7914438502673797, "percentage": 26.35, "elapsed_time": "0:06:01", "remaining_time": "0:16:51"}
75
+ {"current_steps": 375, "total_steps": 1404, "loss": 0.2738, "lr": 8.610212117520453e-06, "epoch": 0.8021390374331551, "percentage": 26.71, "elapsed_time": "0:06:05", "remaining_time": "0:16:41"}
76
+ {"current_steps": 380, "total_steps": 1404, "loss": 0.2564, "lr": 8.570047738443502e-06, "epoch": 0.8128342245989305, "percentage": 27.07, "elapsed_time": "0:06:08", "remaining_time": "0:16:32"}
77
+ {"current_steps": 385, "total_steps": 1404, "loss": 0.2459, "lr": 8.52940781317683e-06, "epoch": 0.8235294117647058, "percentage": 27.42, "elapsed_time": "0:06:11", "remaining_time": "0:16:23"}
78
+ {"current_steps": 390, "total_steps": 1404, "loss": 0.2639, "lr": 8.48829775513869e-06, "epoch": 0.8342245989304813, "percentage": 27.78, "elapsed_time": "0:06:14", "remaining_time": "0:16:14"}
79
+ {"current_steps": 395, "total_steps": 1404, "loss": 0.2545, "lr": 8.446723040371114e-06, "epoch": 0.8449197860962567, "percentage": 28.13, "elapsed_time": "0:06:18", "remaining_time": "0:16:06"}
80
+ {"current_steps": 400, "total_steps": 1404, "loss": 0.2712, "lr": 8.40468920681047e-06, "epoch": 0.8556149732620321, "percentage": 28.49, "elapsed_time": "0:06:21", "remaining_time": "0:15:57"}
81
+ {"current_steps": 405, "total_steps": 1404, "loss": 0.27, "lr": 8.362201853549777e-06, "epoch": 0.8663101604278075, "percentage": 28.85, "elapsed_time": "0:06:24", "remaining_time": "0:15:48"}
82
+ {"current_steps": 410, "total_steps": 1404, "loss": 0.2823, "lr": 8.319266640092899e-06, "epoch": 0.8770053475935828, "percentage": 29.2, "elapsed_time": "0:06:27", "remaining_time": "0:15:39"}
83
+ {"current_steps": 415, "total_steps": 1404, "loss": 0.2555, "lr": 8.275889285600656e-06, "epoch": 0.8877005347593583, "percentage": 29.56, "elapsed_time": "0:06:31", "remaining_time": "0:15:32"}
84
+ {"current_steps": 420, "total_steps": 1404, "loss": 0.2615, "lr": 8.23207556812902e-06, "epoch": 0.8983957219251337, "percentage": 29.91, "elapsed_time": "0:06:34", "remaining_time": "0:15:23"}
85
+ {"current_steps": 425, "total_steps": 1404, "loss": 0.2512, "lr": 8.187831323859445e-06, "epoch": 0.9090909090909091, "percentage": 30.27, "elapsed_time": "0:06:37", "remaining_time": "0:15:15"}
86
+ {"current_steps": 430, "total_steps": 1404, "loss": 0.2568, "lr": 8.143162446321465e-06, "epoch": 0.9197860962566845, "percentage": 30.63, "elapsed_time": "0:06:40", "remaining_time": "0:15:07"}
87
+ {"current_steps": 435, "total_steps": 1404, "loss": 0.2506, "lr": 8.098074885607646e-06, "epoch": 0.93048128342246, "percentage": 30.98, "elapsed_time": "0:06:44", "remaining_time": "0:14:59"}
88
+ {"current_steps": 440, "total_steps": 1404, "loss": 0.2586, "lr": 8.052574647581009e-06, "epoch": 0.9411764705882353, "percentage": 31.34, "elapsed_time": "0:06:47", "remaining_time": "0:14:52"}
89
+ {"current_steps": 445, "total_steps": 1404, "loss": 0.2576, "lr": 8.006667793075026e-06, "epoch": 0.9518716577540107, "percentage": 31.7, "elapsed_time": "0:06:50", "remaining_time": "0:14:44"}
90
+ {"current_steps": 450, "total_steps": 1404, "loss": 0.2363, "lr": 7.960360437086287e-06, "epoch": 0.9625668449197861, "percentage": 32.05, "elapsed_time": "0:06:53", "remaining_time": "0:14:37"}
91
+ {"current_steps": 455, "total_steps": 1404, "loss": 0.2677, "lr": 7.91365874795995e-06, "epoch": 0.9732620320855615, "percentage": 32.41, "elapsed_time": "0:06:56", "remaining_time": "0:14:29"}
92
+ {"current_steps": 460, "total_steps": 1404, "loss": 0.2702, "lr": 7.866568946568107e-06, "epoch": 0.983957219251337, "percentage": 32.76, "elapsed_time": "0:07:00", "remaining_time": "0:14:22"}
93
+ {"current_steps": 465, "total_steps": 1404, "loss": 0.2487, "lr": 7.819097305481112e-06, "epoch": 0.9946524064171123, "percentage": 33.12, "elapsed_time": "0:07:03", "remaining_time": "0:14:15"}
94
+ {"current_steps": 470, "total_steps": 1404, "loss": 0.1638, "lr": 7.771250148132067e-06, "epoch": 1.0042780748663103, "percentage": 33.48, "elapsed_time": "0:08:13", "remaining_time": "0:16:20"}
95
+ {"current_steps": 475, "total_steps": 1404, "loss": 0.1013, "lr": 7.723033847974503e-06, "epoch": 1.0149732620320855, "percentage": 33.83, "elapsed_time": "0:08:16", "remaining_time": "0:16:11"}
96
+ {"current_steps": 480, "total_steps": 1404, "loss": 0.0924, "lr": 7.674454827633413e-06, "epoch": 1.025668449197861, "percentage": 34.19, "elapsed_time": "0:08:19", "remaining_time": "0:16:02"}
97
+ {"current_steps": 485, "total_steps": 1404, "loss": 0.1075, "lr": 7.625519558049722e-06, "epoch": 1.0363636363636364, "percentage": 34.54, "elapsed_time": "0:08:23", "remaining_time": "0:15:53"}
98
+ {"current_steps": 490, "total_steps": 1404, "loss": 0.0926, "lr": 7.576234557618336e-06, "epoch": 1.0470588235294118, "percentage": 34.9, "elapsed_time": "0:08:26", "remaining_time": "0:15:44"}
99
+ {"current_steps": 495, "total_steps": 1404, "loss": 0.1054, "lr": 7.526606391319862e-06, "epoch": 1.0577540106951873, "percentage": 35.26, "elapsed_time": "0:08:29", "remaining_time": "0:15:35"}
100
+ {"current_steps": 500, "total_steps": 1404, "loss": 0.0999, "lr": 7.476641669846121e-06, "epoch": 1.0684491978609625, "percentage": 35.61, "elapsed_time": "0:08:33", "remaining_time": "0:15:27"}
101
+ {"current_steps": 505, "total_steps": 1404, "loss": 0.1082, "lr": 7.426347048719577e-06, "epoch": 1.079144385026738, "percentage": 35.97, "elapsed_time": "0:08:36", "remaining_time": "0:15:18"}
102
+ {"current_steps": 510, "total_steps": 1404, "loss": 0.1227, "lr": 7.375729227406789e-06, "epoch": 1.0898395721925134, "percentage": 36.32, "elapsed_time": "0:08:39", "remaining_time": "0:15:10"}
103
+ {"current_steps": 515, "total_steps": 1404, "loss": 0.0943, "lr": 7.324794948426015e-06, "epoch": 1.1005347593582888, "percentage": 36.68, "elapsed_time": "0:08:42", "remaining_time": "0:15:01"}
104
+ {"current_steps": 520, "total_steps": 1404, "loss": 0.1038, "lr": 7.273550996449077e-06, "epoch": 1.1112299465240643, "percentage": 37.04, "elapsed_time": "0:08:45", "remaining_time": "0:14:54"}
105
+ {"current_steps": 525, "total_steps": 1404, "loss": 0.0956, "lr": 7.222004197397613e-06, "epoch": 1.1219251336898395, "percentage": 37.39, "elapsed_time": "0:08:49", "remaining_time": "0:14:45"}
106
+ {"current_steps": 530, "total_steps": 1404, "loss": 0.0946, "lr": 7.170161417533836e-06, "epoch": 1.132620320855615, "percentage": 37.75, "elapsed_time": "0:08:52", "remaining_time": "0:14:37"}
107
+ {"current_steps": 535, "total_steps": 1404, "loss": 0.0868, "lr": 7.118029562545915e-06, "epoch": 1.1433155080213904, "percentage": 38.11, "elapsed_time": "0:08:55", "remaining_time": "0:14:29"}
108
+ {"current_steps": 540, "total_steps": 1404, "loss": 0.1009, "lr": 7.065615576628107e-06, "epoch": 1.1540106951871658, "percentage": 38.46, "elapsed_time": "0:08:58", "remaining_time": "0:14:21"}
109
+ {"current_steps": 545, "total_steps": 1404, "loss": 0.1067, "lr": 7.0129264415557585e-06, "epoch": 1.1647058823529413, "percentage": 38.82, "elapsed_time": "0:09:01", "remaining_time": "0:14:14"}
110
+ {"current_steps": 550, "total_steps": 1404, "loss": 0.1009, "lr": 6.959969175755306e-06, "epoch": 1.1754010695187165, "percentage": 39.17, "elapsed_time": "0:09:05", "remaining_time": "0:14:06"}
111
+ {"current_steps": 555, "total_steps": 1404, "loss": 0.0912, "lr": 6.906750833369386e-06, "epoch": 1.186096256684492, "percentage": 39.53, "elapsed_time": "0:09:08", "remaining_time": "0:13:58"}
112
+ {"current_steps": 560, "total_steps": 1404, "loss": 0.1026, "lr": 6.8532785033171975e-06, "epoch": 1.1967914438502674, "percentage": 39.89, "elapsed_time": "0:09:11", "remaining_time": "0:13:51"}
113
+ {"current_steps": 565, "total_steps": 1404, "loss": 0.0985, "lr": 6.799559308350219e-06, "epoch": 1.2074866310160428, "percentage": 40.24, "elapsed_time": "0:09:14", "remaining_time": "0:13:44"}
114
+ {"current_steps": 570, "total_steps": 1404, "loss": 0.0982, "lr": 6.745600404103431e-06, "epoch": 1.2181818181818183, "percentage": 40.6, "elapsed_time": "0:09:18", "remaining_time": "0:13:36"}
115
+ {"current_steps": 575, "total_steps": 1404, "loss": 0.1084, "lr": 6.6914089781421535e-06, "epoch": 1.2288770053475937, "percentage": 40.95, "elapsed_time": "0:09:21", "remaining_time": "0:13:29"}
116
+ {"current_steps": 580, "total_steps": 1404, "loss": 0.1054, "lr": 6.636992249004629e-06, "epoch": 1.239572192513369, "percentage": 41.31, "elapsed_time": "0:09:24", "remaining_time": "0:13:21"}
117
+ {"current_steps": 585, "total_steps": 1404, "loss": 0.1045, "lr": 6.582357465240488e-06, "epoch": 1.2502673796791444, "percentage": 41.67, "elapsed_time": "0:09:27", "remaining_time": "0:13:14"}
118
+ {"current_steps": 590, "total_steps": 1404, "loss": 0.0883, "lr": 6.527511904445194e-06, "epoch": 1.2609625668449198, "percentage": 42.02, "elapsed_time": "0:09:31", "remaining_time": "0:13:07"}
119
+ {"current_steps": 595, "total_steps": 1404, "loss": 0.0946, "lr": 6.472462872290654e-06, "epoch": 1.2716577540106953, "percentage": 42.38, "elapsed_time": "0:09:34", "remaining_time": "0:13:00"}
120
+ {"current_steps": 600, "total_steps": 1404, "loss": 0.0996, "lr": 6.417217701552059e-06, "epoch": 1.2823529411764705, "percentage": 42.74, "elapsed_time": "0:09:37", "remaining_time": "0:12:53"}
121
+ {"current_steps": 605, "total_steps": 1404, "loss": 0.0963, "lr": 6.36178375113113e-06, "epoch": 1.293048128342246, "percentage": 43.09, "elapsed_time": "0:09:40", "remaining_time": "0:12:46"}
122
+ {"current_steps": 610, "total_steps": 1404, "loss": 0.0986, "lr": 6.3061684050758776e-06, "epoch": 1.3037433155080214, "percentage": 43.45, "elapsed_time": "0:09:43", "remaining_time": "0:12:39"}
123
+ {"current_steps": 615, "total_steps": 1404, "loss": 0.0925, "lr": 6.250379071597018e-06, "epoch": 1.3144385026737968, "percentage": 43.8, "elapsed_time": "0:09:47", "remaining_time": "0:12:33"}
124
+ {"current_steps": 620, "total_steps": 1404, "loss": 0.1125, "lr": 6.194423182081161e-06, "epoch": 1.3251336898395722, "percentage": 44.16, "elapsed_time": "0:09:50", "remaining_time": "0:12:26"}
125
+ {"current_steps": 625, "total_steps": 1404, "loss": 0.1038, "lr": 6.138308190100918e-06, "epoch": 1.3358288770053477, "percentage": 44.52, "elapsed_time": "0:09:53", "remaining_time": "0:12:19"}
126
+ {"current_steps": 630, "total_steps": 1404, "loss": 0.1097, "lr": 6.082041570422059e-06, "epoch": 1.346524064171123, "percentage": 44.87, "elapsed_time": "0:09:56", "remaining_time": "0:12:12"}
127
+ {"current_steps": 635, "total_steps": 1404, "loss": 0.1001, "lr": 6.025630818007833e-06, "epoch": 1.3572192513368984, "percentage": 45.23, "elapsed_time": "0:09:59", "remaining_time": "0:12:06"}
128
+ {"current_steps": 640, "total_steps": 1404, "loss": 0.1018, "lr": 5.969083447020606e-06, "epoch": 1.3679144385026738, "percentage": 45.58, "elapsed_time": "0:10:03", "remaining_time": "0:12:00"}
129
+ {"current_steps": 645, "total_steps": 1404, "loss": 0.1043, "lr": 5.912406989820948e-06, "epoch": 1.3786096256684492, "percentage": 45.94, "elapsed_time": "0:10:06", "remaining_time": "0:11:53"}
130
+ {"current_steps": 650, "total_steps": 1404, "loss": 0.0961, "lr": 5.855608995964283e-06, "epoch": 1.3893048128342245, "percentage": 46.3, "elapsed_time": "0:10:09", "remaining_time": "0:11:47"}
131
+ {"current_steps": 655, "total_steps": 1404, "loss": 0.1025, "lr": 5.798697031195257e-06, "epoch": 1.4, "percentage": 46.65, "elapsed_time": "0:10:12", "remaining_time": "0:11:40"}
132
+ {"current_steps": 660, "total_steps": 1404, "loss": 0.0993, "lr": 5.741678676439946e-06, "epoch": 1.4106951871657754, "percentage": 47.01, "elapsed_time": "0:10:16", "remaining_time": "0:11:34"}
133
+ {"current_steps": 665, "total_steps": 1404, "loss": 0.0968, "lr": 5.684561526796045e-06, "epoch": 1.4213903743315508, "percentage": 47.36, "elapsed_time": "0:10:19", "remaining_time": "0:11:28"}
134
+ {"current_steps": 670, "total_steps": 1404, "loss": 0.0824, "lr": 5.627353190521168e-06, "epoch": 1.4320855614973262, "percentage": 47.72, "elapsed_time": "0:10:22", "remaining_time": "0:11:22"}
135
+ {"current_steps": 675, "total_steps": 1404, "loss": 0.0994, "lr": 5.570061288019385e-06, "epoch": 1.4427807486631017, "percentage": 48.08, "elapsed_time": "0:10:25", "remaining_time": "0:11:15"}
136
+ {"current_steps": 680, "total_steps": 1404, "loss": 0.1007, "lr": 5.51269345082617e-06, "epoch": 1.4534759358288771, "percentage": 48.43, "elapsed_time": "0:10:29", "remaining_time": "0:11:09"}
137
+ {"current_steps": 685, "total_steps": 1404, "loss": 0.1021, "lr": 5.455257320591825e-06, "epoch": 1.4641711229946524, "percentage": 48.79, "elapsed_time": "0:10:32", "remaining_time": "0:11:03"}
138
+ {"current_steps": 690, "total_steps": 1404, "loss": 0.0918, "lr": 5.397760548063591e-06, "epoch": 1.4748663101604278, "percentage": 49.15, "elapsed_time": "0:10:35", "remaining_time": "0:10:57"}
139
+ {"current_steps": 695, "total_steps": 1404, "loss": 0.0967, "lr": 5.340210792066531e-06, "epoch": 1.4855614973262032, "percentage": 49.5, "elapsed_time": "0:10:38", "remaining_time": "0:10:51"}
140
+ {"current_steps": 700, "total_steps": 1404, "loss": 0.0859, "lr": 5.282615718483344e-06, "epoch": 1.4962566844919787, "percentage": 49.86, "elapsed_time": "0:10:41", "remaining_time": "0:10:45"}
141
+ {"current_steps": 705, "total_steps": 1404, "loss": 0.0858, "lr": 5.224982999233228e-06, "epoch": 1.506951871657754, "percentage": 50.21, "elapsed_time": "0:10:45", "remaining_time": "0:10:39"}
142
+ {"current_steps": 710, "total_steps": 1404, "loss": 0.1037, "lr": 5.167320311249951e-06, "epoch": 1.5176470588235293, "percentage": 50.57, "elapsed_time": "0:10:48", "remaining_time": "0:10:33"}
143
+ {"current_steps": 715, "total_steps": 1404, "loss": 0.0845, "lr": 5.109635335459256e-06, "epoch": 1.5283422459893048, "percentage": 50.93, "elapsed_time": "0:10:51", "remaining_time": "0:10:28"}
144
+ {"current_steps": 720, "total_steps": 1404, "loss": 0.0875, "lr": 5.051935755755713e-06, "epoch": 1.5390374331550802, "percentage": 51.28, "elapsed_time": "0:10:54", "remaining_time": "0:10:22"}
145
+ {"current_steps": 725, "total_steps": 1404, "loss": 0.0957, "lr": 4.9942292579791965e-06, "epoch": 1.5497326203208557, "percentage": 51.64, "elapsed_time": "0:10:58", "remaining_time": "0:10:16"}
146
+ {"current_steps": 730, "total_steps": 1404, "loss": 0.08, "lr": 4.936523528891111e-06, "epoch": 1.5604278074866311, "percentage": 51.99, "elapsed_time": "0:11:01", "remaining_time": "0:10:10"}
147
+ {"current_steps": 735, "total_steps": 1404, "loss": 0.1025, "lr": 4.878826255150453e-06, "epoch": 1.5711229946524066, "percentage": 52.35, "elapsed_time": "0:11:04", "remaining_time": "0:10:04"}
148
+ {"current_steps": 740, "total_steps": 1404, "loss": 0.0905, "lr": 4.821145122289941e-06, "epoch": 1.5818181818181818, "percentage": 52.71, "elapsed_time": "0:11:07", "remaining_time": "0:09:59"}
149
+ {"current_steps": 745, "total_steps": 1404, "loss": 0.0863, "lr": 4.763487813692252e-06, "epoch": 1.5925133689839572, "percentage": 53.06, "elapsed_time": "0:11:10", "remaining_time": "0:09:53"}
150
+ {"current_steps": 750, "total_steps": 1404, "loss": 0.0884, "lr": 4.705862009566564e-06, "epoch": 1.6032085561497325, "percentage": 53.42, "elapsed_time": "0:11:14", "remaining_time": "0:09:47"}
151
+ {"current_steps": 755, "total_steps": 1404, "loss": 0.0919, "lr": 4.648275385925522e-06, "epoch": 1.613903743315508, "percentage": 53.77, "elapsed_time": "0:11:18", "remaining_time": "0:09:42"}
152
+ {"current_steps": 760, "total_steps": 1404, "loss": 0.0956, "lr": 4.5907356135627605e-06, "epoch": 1.6245989304812833, "percentage": 54.13, "elapsed_time": "0:11:21", "remaining_time": "0:09:37"}
153
+ {"current_steps": 765, "total_steps": 1404, "loss": 0.1017, "lr": 4.533250357031104e-06, "epoch": 1.6352941176470588, "percentage": 54.49, "elapsed_time": "0:11:24", "remaining_time": "0:09:31"}
154
+ {"current_steps": 770, "total_steps": 1404, "loss": 0.0968, "lr": 4.475827273621639e-06, "epoch": 1.6459893048128342, "percentage": 54.84, "elapsed_time": "0:11:27", "remaining_time": "0:09:26"}
155
+ {"current_steps": 775, "total_steps": 1404, "loss": 0.0973, "lr": 4.418474012343711e-06, "epoch": 1.6566844919786097, "percentage": 55.2, "elapsed_time": "0:11:30", "remaining_time": "0:09:20"}
156
+ {"current_steps": 780, "total_steps": 1404, "loss": 0.0884, "lr": 4.361198212906048e-06, "epoch": 1.6673796791443851, "percentage": 55.56, "elapsed_time": "0:11:34", "remaining_time": "0:09:15"}
157
+ {"current_steps": 785, "total_steps": 1404, "loss": 0.087, "lr": 4.304007504699118e-06, "epoch": 1.6780748663101606, "percentage": 55.91, "elapsed_time": "0:11:37", "remaining_time": "0:09:09"}
158
+ {"current_steps": 790, "total_steps": 1404, "loss": 0.0772, "lr": 4.246909505778862e-06, "epoch": 1.6887700534759358, "percentage": 56.27, "elapsed_time": "0:11:40", "remaining_time": "0:09:04"}
159
+ {"current_steps": 795, "total_steps": 1404, "loss": 0.0973, "lr": 4.189911821851928e-06, "epoch": 1.6994652406417112, "percentage": 56.62, "elapsed_time": "0:11:44", "remaining_time": "0:08:59"}
160
+ {"current_steps": 800, "total_steps": 1404, "loss": 0.0869, "lr": 4.1330220452625644e-06, "epoch": 1.7101604278074867, "percentage": 56.98, "elapsed_time": "0:11:47", "remaining_time": "0:08:54"}
161
+ {"current_steps": 805, "total_steps": 1404, "loss": 0.0985, "lr": 4.076247753981285e-06, "epoch": 1.720855614973262, "percentage": 57.34, "elapsed_time": "0:11:50", "remaining_time": "0:08:48"}
162
+ {"current_steps": 810, "total_steps": 1404, "loss": 0.0862, "lr": 4.019596510595447e-06, "epoch": 1.7315508021390373, "percentage": 57.69, "elapsed_time": "0:11:53", "remaining_time": "0:08:43"}
163
+ {"current_steps": 815, "total_steps": 1404, "loss": 0.0933, "lr": 3.963075861301886e-06, "epoch": 1.7422459893048128, "percentage": 58.05, "elapsed_time": "0:11:57", "remaining_time": "0:08:38"}
164
+ {"current_steps": 820, "total_steps": 1404, "loss": 0.0883, "lr": 3.9066933349017165e-06, "epoch": 1.7529411764705882, "percentage": 58.4, "elapsed_time": "0:12:00", "remaining_time": "0:08:33"}
165
+ {"current_steps": 825, "total_steps": 1404, "loss": 0.0988, "lr": 3.8504564417974795e-06, "epoch": 1.7636363636363637, "percentage": 58.76, "elapsed_time": "0:12:03", "remaining_time": "0:08:28"}
166
+ {"current_steps": 830, "total_steps": 1404, "loss": 0.0922, "lr": 3.7943726729927154e-06, "epoch": 1.7743315508021391, "percentage": 59.12, "elapsed_time": "0:12:06", "remaining_time": "0:08:22"}
167
+ {"current_steps": 835, "total_steps": 1404, "loss": 0.0807, "lr": 3.738449499094121e-06, "epoch": 1.7850267379679146, "percentage": 59.47, "elapsed_time": "0:12:10", "remaining_time": "0:08:17"}
168
+ {"current_steps": 840, "total_steps": 1404, "loss": 0.0741, "lr": 3.682694369316446e-06, "epoch": 1.79572192513369, "percentage": 59.83, "elapsed_time": "0:12:13", "remaining_time": "0:08:12"}
169
+ {"current_steps": 845, "total_steps": 1404, "loss": 0.0836, "lr": 3.6271147104902192e-06, "epoch": 1.8064171122994652, "percentage": 60.19, "elapsed_time": "0:12:16", "remaining_time": "0:08:07"}
170
+ {"current_steps": 850, "total_steps": 1404, "loss": 0.0911, "lr": 3.5717179260724544e-06, "epoch": 1.8171122994652407, "percentage": 60.54, "elapsed_time": "0:12:19", "remaining_time": "0:08:02"}
171
+ {"current_steps": 855, "total_steps": 1404, "loss": 0.094, "lr": 3.5165113951604874e-06, "epoch": 1.8278074866310159, "percentage": 60.9, "elapsed_time": "0:12:23", "remaining_time": "0:07:57"}
172
+ {"current_steps": 860, "total_steps": 1404, "loss": 0.0818, "lr": 3.461502471509045e-06, "epoch": 1.8385026737967913, "percentage": 61.25, "elapsed_time": "0:12:26", "remaining_time": "0:07:52"}
173
+ {"current_steps": 865, "total_steps": 1404, "loss": 0.0891, "lr": 3.4066984825506855e-06, "epoch": 1.8491978609625668, "percentage": 61.61, "elapsed_time": "0:12:29", "remaining_time": "0:07:47"}
174
+ {"current_steps": 870, "total_steps": 1404, "loss": 0.0906, "lr": 3.35210672841976e-06, "epoch": 1.8598930481283422, "percentage": 61.97, "elapsed_time": "0:12:32", "remaining_time": "0:07:42"}
175
+ {"current_steps": 875, "total_steps": 1404, "loss": 0.0856, "lr": 3.297734480980002e-06, "epoch": 1.8705882352941177, "percentage": 62.32, "elapsed_time": "0:12:36", "remaining_time": "0:07:37"}
176
+ {"current_steps": 880, "total_steps": 1404, "loss": 0.0845, "lr": 3.2435889828558753e-06, "epoch": 1.881283422459893, "percentage": 62.68, "elapsed_time": "0:12:39", "remaining_time": "0:07:32"}
177
+ {"current_steps": 885, "total_steps": 1404, "loss": 0.0956, "lr": 3.1896774464678327e-06, "epoch": 1.8919786096256686, "percentage": 63.03, "elapsed_time": "0:12:42", "remaining_time": "0:07:27"}
178
+ {"current_steps": 890, "total_steps": 1404, "loss": 0.0824, "lr": 3.1360070530715885e-06, "epoch": 1.902673796791444, "percentage": 63.39, "elapsed_time": "0:12:45", "remaining_time": "0:07:22"}
179
+ {"current_steps": 895, "total_steps": 1404, "loss": 0.0873, "lr": 3.0825849518015334e-06, "epoch": 1.9133689839572192, "percentage": 63.75, "elapsed_time": "0:12:49", "remaining_time": "0:07:17"}
180
+ {"current_steps": 900, "total_steps": 1404, "loss": 0.0836, "lr": 3.029418258718454e-06, "epoch": 1.9240641711229947, "percentage": 64.1, "elapsed_time": "0:12:52", "remaining_time": "0:07:12"}
181
+ {"current_steps": 905, "total_steps": 1404, "loss": 0.0875, "lr": 2.9765140558616287e-06, "epoch": 1.93475935828877, "percentage": 64.46, "elapsed_time": "0:12:55", "remaining_time": "0:07:07"}
182
+ {"current_steps": 910, "total_steps": 1404, "loss": 0.0791, "lr": 2.9238793903054757e-06, "epoch": 1.9454545454545453, "percentage": 64.81, "elapsed_time": "0:12:59", "remaining_time": "0:07:03"}
183
+ {"current_steps": 915, "total_steps": 1404, "loss": 0.0777, "lr": 2.8715212732208523e-06, "epoch": 1.9561497326203208, "percentage": 65.17, "elapsed_time": "0:13:02", "remaining_time": "0:06:58"}
184
+ {"current_steps": 920, "total_steps": 1404, "loss": 0.0853, "lr": 2.819446678941126e-06, "epoch": 1.9668449197860962, "percentage": 65.53, "elapsed_time": "0:13:06", "remaining_time": "0:06:53"}
185
+ {"current_steps": 925, "total_steps": 1404, "loss": 0.08, "lr": 2.7676625440331756e-06, "epoch": 1.9775401069518717, "percentage": 65.88, "elapsed_time": "0:13:09", "remaining_time": "0:06:48"}
186
+ {"current_steps": 930, "total_steps": 1404, "loss": 0.0876, "lr": 2.7161757663734012e-06, "epoch": 1.988235294117647, "percentage": 66.24, "elapsed_time": "0:13:12", "remaining_time": "0:06:44"}
187
+ {"current_steps": 935, "total_steps": 1404, "loss": 0.0874, "lr": 2.6649932042288994e-06, "epoch": 1.9989304812834225, "percentage": 66.6, "elapsed_time": "0:13:16", "remaining_time": "0:06:39"}
188
+ {"current_steps": 940, "total_steps": 1404, "loss": 0.0265, "lr": 2.6141216753439115e-06, "epoch": 2.0085561497326205, "percentage": 66.95, "elapsed_time": "0:14:22", "remaining_time": "0:07:05"}
189
+ {"current_steps": 945, "total_steps": 1404, "loss": 0.026, "lr": 2.5635679560316703e-06, "epoch": 2.0192513368983955, "percentage": 67.31, "elapsed_time": "0:14:25", "remaining_time": "0:07:00"}
190
+ {"current_steps": 950, "total_steps": 1404, "loss": 0.0245, "lr": 2.5133387802717585e-06, "epoch": 2.029946524064171, "percentage": 67.66, "elapsed_time": "0:14:29", "remaining_time": "0:06:55"}
191
+ {"current_steps": 955, "total_steps": 1404, "loss": 0.0213, "lr": 2.4634408388131255e-06, "epoch": 2.0406417112299464, "percentage": 68.02, "elapsed_time": "0:14:32", "remaining_time": "0:06:50"}
192
+ {"current_steps": 960, "total_steps": 1404, "loss": 0.0217, "lr": 2.4138807782828423e-06, "epoch": 2.051336898395722, "percentage": 68.38, "elapsed_time": "0:14:35", "remaining_time": "0:06:45"}
193
+ {"current_steps": 965, "total_steps": 1404, "loss": 0.0213, "lr": 2.3646652003007348e-06, "epoch": 2.0620320855614973, "percentage": 68.73, "elapsed_time": "0:14:38", "remaining_time": "0:06:39"}
194
+ {"current_steps": 970, "total_steps": 1404, "loss": 0.0278, "lr": 2.3158006606000345e-06, "epoch": 2.0727272727272728, "percentage": 69.09, "elapsed_time": "0:14:41", "remaining_time": "0:06:34"}
195
+ {"current_steps": 975, "total_steps": 1404, "loss": 0.0239, "lr": 2.267293668154114e-06, "epoch": 2.083422459893048, "percentage": 69.44, "elapsed_time": "0:14:45", "remaining_time": "0:06:29"}
196
+ {"current_steps": 980, "total_steps": 1404, "loss": 0.0254, "lr": 2.2191506843094628e-06, "epoch": 2.0941176470588236, "percentage": 69.8, "elapsed_time": "0:14:48", "remaining_time": "0:06:24"}
197
+ {"current_steps": 985, "total_steps": 1404, "loss": 0.022, "lr": 2.1713781219250157e-06, "epoch": 2.104812834224599, "percentage": 70.16, "elapsed_time": "0:14:51", "remaining_time": "0:06:19"}
198
+ {"current_steps": 990, "total_steps": 1404, "loss": 0.0216, "lr": 2.1239823445179236e-06, "epoch": 2.1155080213903745, "percentage": 70.51, "elapsed_time": "0:14:55", "remaining_time": "0:06:14"}
199
+ {"current_steps": 995, "total_steps": 1404, "loss": 0.0211, "lr": 2.076969665415908e-06, "epoch": 2.1262032085561495, "percentage": 70.87, "elapsed_time": "0:14:58", "remaining_time": "0:06:09"}
200
+ {"current_steps": 1000, "total_steps": 1404, "loss": 0.0246, "lr": 2.0303463469163004e-06, "epoch": 2.136898395721925, "percentage": 71.23, "elapsed_time": "0:15:01", "remaining_time": "0:06:04"}
201
+ {"current_steps": 1005, "total_steps": 1404, "loss": 0.024, "lr": 1.984118599451866e-06, "epoch": 2.1475935828877004, "percentage": 71.58, "elapsed_time": "0:15:04", "remaining_time": "0:05:59"}
202
+ {"current_steps": 1010, "total_steps": 1404, "loss": 0.025, "lr": 1.938292580763561e-06, "epoch": 2.158288770053476, "percentage": 71.94, "elapsed_time": "0:15:08", "remaining_time": "0:05:54"}
203
+ {"current_steps": 1015, "total_steps": 1404, "loss": 0.0295, "lr": 1.8928743950802863e-06, "epoch": 2.1689839572192513, "percentage": 72.29, "elapsed_time": "0:15:11", "remaining_time": "0:05:49"}
204
+ {"current_steps": 1020, "total_steps": 1404, "loss": 0.0158, "lr": 1.847870092305773e-06, "epoch": 2.1796791443850267, "percentage": 72.65, "elapsed_time": "0:15:14", "remaining_time": "0:05:44"}
205
+ {"current_steps": 1025, "total_steps": 1404, "loss": 0.0211, "lr": 1.8032856672127191e-06, "epoch": 2.190374331550802, "percentage": 73.01, "elapsed_time": "0:15:18", "remaining_time": "0:05:39"}
206
+ {"current_steps": 1030, "total_steps": 1404, "loss": 0.0189, "lr": 1.7591270586442517e-06, "epoch": 2.2010695187165776, "percentage": 73.36, "elapsed_time": "0:15:21", "remaining_time": "0:05:34"}
207
+ {"current_steps": 1035, "total_steps": 1404, "loss": 0.0175, "lr": 1.7154001487228478e-06, "epoch": 2.211764705882353, "percentage": 73.72, "elapsed_time": "0:15:25", "remaining_time": "0:05:29"}
208
+ {"current_steps": 1040, "total_steps": 1404, "loss": 0.0215, "lr": 1.672110762066811e-06, "epoch": 2.2224598930481285, "percentage": 74.07, "elapsed_time": "0:15:28", "remaining_time": "0:05:25"}
209
+ {"current_steps": 1045, "total_steps": 1404, "loss": 0.0182, "lr": 1.6292646650144072e-06, "epoch": 2.233155080213904, "percentage": 74.43, "elapsed_time": "0:15:32", "remaining_time": "0:05:20"}
210
+ {"current_steps": 1050, "total_steps": 1404, "loss": 0.0176, "lr": 1.5868675648557568e-06, "epoch": 2.243850267379679, "percentage": 74.79, "elapsed_time": "0:15:35", "remaining_time": "0:05:15"}
211
+ {"current_steps": 1055, "total_steps": 1404, "loss": 0.02, "lr": 1.544925109072607e-06, "epoch": 2.2545454545454544, "percentage": 75.14, "elapsed_time": "0:15:39", "remaining_time": "0:05:10"}
212
+ {"current_steps": 1060, "total_steps": 1404, "loss": 0.0185, "lr": 1.50344288458606e-06, "epoch": 2.26524064171123, "percentage": 75.5, "elapsed_time": "0:15:42", "remaining_time": "0:05:05"}
213
+ {"current_steps": 1065, "total_steps": 1404, "loss": 0.0165, "lr": 1.462426417012361e-06, "epoch": 2.2759358288770053, "percentage": 75.85, "elapsed_time": "0:15:46", "remaining_time": "0:05:01"}
214
+ {"current_steps": 1070, "total_steps": 1404, "loss": 0.019, "lr": 1.4218811699268752e-06, "epoch": 2.2866310160427807, "percentage": 76.21, "elapsed_time": "0:15:49", "remaining_time": "0:04:56"}
215
+ {"current_steps": 1075, "total_steps": 1404, "loss": 0.0179, "lr": 1.38181254413631e-06, "epoch": 2.297326203208556, "percentage": 76.57, "elapsed_time": "0:15:52", "remaining_time": "0:04:51"}
216
+ {"current_steps": 1080, "total_steps": 1404, "loss": 0.0199, "lr": 1.3422258769592967e-06, "epoch": 2.3080213903743316, "percentage": 76.92, "elapsed_time": "0:15:55", "remaining_time": "0:04:46"}
217
+ {"current_steps": 1085, "total_steps": 1404, "loss": 0.0194, "lr": 1.3031264415154477e-06, "epoch": 2.318716577540107, "percentage": 77.28, "elapsed_time": "0:15:58", "remaining_time": "0:04:41"}
218
+ {"current_steps": 1090, "total_steps": 1404, "loss": 0.0213, "lr": 1.2645194460229454e-06, "epoch": 2.3294117647058825, "percentage": 77.64, "elapsed_time": "0:16:02", "remaining_time": "0:04:37"}
219
+ {"current_steps": 1095, "total_steps": 1404, "loss": 0.0216, "lr": 1.2264100331047878e-06, "epoch": 2.3401069518716575, "percentage": 77.99, "elapsed_time": "0:16:05", "remaining_time": "0:04:32"}
220
+ {"current_steps": 1100, "total_steps": 1404, "loss": 0.0198, "lr": 1.1888032791037697e-06, "epoch": 2.350802139037433, "percentage": 78.35, "elapsed_time": "0:16:09", "remaining_time": "0:04:27"}
221
+ {"current_steps": 1105, "total_steps": 1404, "loss": 0.019, "lr": 1.1517041934062834e-06, "epoch": 2.3614973262032084, "percentage": 78.7, "elapsed_time": "0:16:12", "remaining_time": "0:04:23"}
222
+ {"current_steps": 1110, "total_steps": 1404, "loss": 0.0169, "lr": 1.115117717775056e-06, "epoch": 2.372192513368984, "percentage": 79.06, "elapsed_time": "0:16:15", "remaining_time": "0:04:18"}
223
+ {"current_steps": 1115, "total_steps": 1404, "loss": 0.0219, "lr": 1.0790487256908826e-06, "epoch": 2.3828877005347593, "percentage": 79.42, "elapsed_time": "0:16:18", "remaining_time": "0:04:13"}
224
+ {"current_steps": 1120, "total_steps": 1404, "loss": 0.0273, "lr": 1.043502021703449e-06, "epoch": 2.3935828877005347, "percentage": 79.77, "elapsed_time": "0:16:22", "remaining_time": "0:04:09"}
225
+ {"current_steps": 1125, "total_steps": 1404, "loss": 0.0242, "lr": 1.0084823407913563e-06, "epoch": 2.40427807486631, "percentage": 80.13, "elapsed_time": "0:16:25", "remaining_time": "0:04:04"}
226
+ {"current_steps": 1130, "total_steps": 1404, "loss": 0.0171, "lr": 9.739943477313918e-07, "epoch": 2.4149732620320856, "percentage": 80.48, "elapsed_time": "0:16:28", "remaining_time": "0:03:59"}
227
+ {"current_steps": 1135, "total_steps": 1404, "loss": 0.0207, "lr": 9.400426364771648e-07, "epoch": 2.425668449197861, "percentage": 80.84, "elapsed_time": "0:16:31", "remaining_time": "0:03:55"}
228
+ {"current_steps": 1140, "total_steps": 1404, "loss": 0.0154, "lr": 9.066317295471688e-07, "epoch": 2.4363636363636365, "percentage": 81.2, "elapsed_time": "0:16:35", "remaining_time": "0:03:50"}
229
+ {"current_steps": 1145, "total_steps": 1404, "loss": 0.017, "lr": 8.737660774223655e-07, "epoch": 2.447058823529412, "percentage": 81.55, "elapsed_time": "0:16:38", "remaining_time": "0:03:45"}
230
+ {"current_steps": 1150, "total_steps": 1404, "loss": 0.0174, "lr": 8.414500579533536e-07, "epoch": 2.4577540106951874, "percentage": 81.91, "elapsed_time": "0:16:41", "remaining_time": "0:03:41"}
231
+ {"current_steps": 1155, "total_steps": 1404, "loss": 0.0268, "lr": 8.096879757772297e-07, "epoch": 2.4684491978609624, "percentage": 82.26, "elapsed_time": "0:16:44", "remaining_time": "0:03:36"}
232
+ {"current_steps": 1160, "total_steps": 1404, "loss": 0.0192, "lr": 7.784840617441858e-07, "epoch": 2.479144385026738, "percentage": 82.62, "elapsed_time": "0:16:48", "remaining_time": "0:03:32"}
233
+ {"current_steps": 1165, "total_steps": 1404, "loss": 0.0163, "lr": 7.47842472353939e-07, "epoch": 2.4898395721925133, "percentage": 82.98, "elapsed_time": "0:16:51", "remaining_time": "0:03:27"}
234
+ {"current_steps": 1170, "total_steps": 1404, "loss": 0.0195, "lr": 7.177672892020743e-07, "epoch": 2.5005347593582887, "percentage": 83.33, "elapsed_time": "0:16:54", "remaining_time": "0:03:22"}
235
+ {"current_steps": 1175, "total_steps": 1404, "loss": 0.0182, "lr": 6.882625184363534e-07, "epoch": 2.511229946524064, "percentage": 83.69, "elapsed_time": "0:16:57", "remaining_time": "0:03:18"}
236
+ {"current_steps": 1180, "total_steps": 1404, "loss": 0.0232, "lr": 6.593320902230748e-07, "epoch": 2.5219251336898396, "percentage": 84.05, "elapsed_time": "0:17:01", "remaining_time": "0:03:13"}
237
+ {"current_steps": 1185, "total_steps": 1404, "loss": 0.0178, "lr": 6.309798582235671e-07, "epoch": 2.532620320855615, "percentage": 84.4, "elapsed_time": "0:17:04", "remaining_time": "0:03:09"}
238
+ {"current_steps": 1190, "total_steps": 1404, "loss": 0.0193, "lr": 6.032095990808567e-07, "epoch": 2.5433155080213905, "percentage": 84.76, "elapsed_time": "0:17:07", "remaining_time": "0:03:04"}
239
+ {"current_steps": 1195, "total_steps": 1404, "loss": 0.0203, "lr": 5.760250119166061e-07, "epoch": 2.5540106951871655, "percentage": 85.11, "elapsed_time": "0:17:11", "remaining_time": "0:03:00"}
240
+ {"current_steps": 1200, "total_steps": 1404, "loss": 0.0194, "lr": 5.494297178383729e-07, "epoch": 2.564705882352941, "percentage": 85.47, "elapsed_time": "0:17:14", "remaining_time": "0:02:55"}
241
+ {"current_steps": 1205, "total_steps": 1404, "loss": 0.0172, "lr": 5.234272594572604e-07, "epoch": 2.5754010695187164, "percentage": 85.83, "elapsed_time": "0:17:17", "remaining_time": "0:02:51"}
242
+ {"current_steps": 1210, "total_steps": 1404, "loss": 0.0222, "lr": 4.980211004160306e-07, "epoch": 2.586096256684492, "percentage": 86.18, "elapsed_time": "0:17:20", "remaining_time": "0:02:46"}
243
+ {"current_steps": 1215, "total_steps": 1404, "loss": 0.0168, "lr": 4.7321462492772975e-07, "epoch": 2.5967914438502673, "percentage": 86.54, "elapsed_time": "0:17:24", "remaining_time": "0:02:42"}
244
+ {"current_steps": 1220, "total_steps": 1404, "loss": 0.0188, "lr": 4.490111373248918e-07, "epoch": 2.6074866310160427, "percentage": 86.89, "elapsed_time": "0:17:27", "remaining_time": "0:02:37"}
245
+ {"current_steps": 1225, "total_steps": 1404, "loss": 0.024, "lr": 4.2541386161939424e-07, "epoch": 2.618181818181818, "percentage": 87.25, "elapsed_time": "0:17:30", "remaining_time": "0:02:33"}
246
+ {"current_steps": 1230, "total_steps": 1404, "loss": 0.0204, "lr": 4.024259410730008e-07, "epoch": 2.6288770053475936, "percentage": 87.61, "elapsed_time": "0:17:33", "remaining_time": "0:02:29"}
247
+ {"current_steps": 1235, "total_steps": 1404, "loss": 0.0207, "lr": 3.800504377786651e-07, "epoch": 2.639572192513369, "percentage": 87.96, "elapsed_time": "0:17:37", "remaining_time": "0:02:24"}
248
+ {"current_steps": 1240, "total_steps": 1404, "loss": 0.0199, "lr": 3.582903322526482e-07, "epoch": 2.6502673796791445, "percentage": 88.32, "elapsed_time": "0:17:40", "remaining_time": "0:02:20"}
249
+ {"current_steps": 1245, "total_steps": 1404, "loss": 0.0226, "lr": 3.371485230374988e-07, "epoch": 2.66096256684492, "percentage": 88.68, "elapsed_time": "0:17:43", "remaining_time": "0:02:15"}
250
+ {"current_steps": 1250, "total_steps": 1404, "loss": 0.0166, "lr": 3.166278263159539e-07, "epoch": 2.6716577540106954, "percentage": 89.03, "elapsed_time": "0:17:47", "remaining_time": "0:02:11"}
251
+ {"current_steps": 1255, "total_steps": 1404, "loss": 0.0226, "lr": 2.9673097553581385e-07, "epoch": 2.682352941176471, "percentage": 89.39, "elapsed_time": "0:17:50", "remaining_time": "0:02:07"}
252
+ {"current_steps": 1260, "total_steps": 1404, "loss": 0.0164, "lr": 2.7746062104583473e-07, "epoch": 2.693048128342246, "percentage": 89.74, "elapsed_time": "0:17:53", "remaining_time": "0:02:02"}
253
+ {"current_steps": 1265, "total_steps": 1404, "loss": 0.0222, "lr": 2.588193297426844e-07, "epoch": 2.7037433155080213, "percentage": 90.1, "elapsed_time": "0:17:56", "remaining_time": "0:01:58"}
254
+ {"current_steps": 1270, "total_steps": 1404, "loss": 0.0226, "lr": 2.4080958472902873e-07, "epoch": 2.7144385026737967, "percentage": 90.46, "elapsed_time": "0:18:00", "remaining_time": "0:01:53"}
255
+ {"current_steps": 1275, "total_steps": 1404, "loss": 0.0145, "lr": 2.2343378498276391e-07, "epoch": 2.725133689839572, "percentage": 90.81, "elapsed_time": "0:18:03", "remaining_time": "0:01:49"}
256
+ {"current_steps": 1280, "total_steps": 1404, "loss": 0.0173, "lr": 2.0669424503746871e-07, "epoch": 2.7358288770053476, "percentage": 91.17, "elapsed_time": "0:18:06", "remaining_time": "0:01:45"}
257
+ {"current_steps": 1285, "total_steps": 1404, "loss": 0.0185, "lr": 1.9059319467409244e-07, "epoch": 2.746524064171123, "percentage": 91.52, "elapsed_time": "0:18:09", "remaining_time": "0:01:40"}
258
+ {"current_steps": 1290, "total_steps": 1404, "loss": 0.0143, "lr": 1.7513277862394263e-07, "epoch": 2.7572192513368985, "percentage": 91.88, "elapsed_time": "0:18:13", "remaining_time": "0:01:36"}
259
+ {"current_steps": 1295, "total_steps": 1404, "loss": 0.0212, "lr": 1.603150562829936e-07, "epoch": 2.767914438502674, "percentage": 92.24, "elapsed_time": "0:18:16", "remaining_time": "0:01:32"}
260
+ {"current_steps": 1300, "total_steps": 1404, "loss": 0.0156, "lr": 1.4614200143756975e-07, "epoch": 2.778609625668449, "percentage": 92.59, "elapsed_time": "0:18:19", "remaining_time": "0:01:27"}
261
+ {"current_steps": 1305, "total_steps": 1404, "loss": 0.0163, "lr": 1.3261550200142415e-07, "epoch": 2.7893048128342244, "percentage": 92.95, "elapsed_time": "0:18:22", "remaining_time": "0:01:23"}
262
+ {"current_steps": 1310, "total_steps": 1404, "loss": 0.0176, "lr": 1.197373597642637e-07, "epoch": 2.8, "percentage": 93.3, "elapsed_time": "0:18:25", "remaining_time": "0:01:19"}
263
+ {"current_steps": 1315, "total_steps": 1404, "loss": 0.0127, "lr": 1.0750929015174216e-07, "epoch": 2.8106951871657753, "percentage": 93.66, "elapsed_time": "0:18:29", "remaining_time": "0:01:15"}
264
+ {"current_steps": 1320, "total_steps": 1404, "loss": 0.0166, "lr": 9.593292199695403e-08, "epoch": 2.8213903743315507, "percentage": 94.02, "elapsed_time": "0:18:32", "remaining_time": "0:01:10"}
265
+ {"current_steps": 1325, "total_steps": 1404, "loss": 0.0189, "lr": 8.500979732347259e-08, "epoch": 2.832085561497326, "percentage": 94.37, "elapsed_time": "0:18:35", "remaining_time": "0:01:06"}
266
+ {"current_steps": 1330, "total_steps": 1404, "loss": 0.0178, "lr": 7.47413711399414e-08, "epoch": 2.8427807486631016, "percentage": 94.73, "elapsed_time": "0:18:38", "remaining_time": "0:01:02"}
267
+ {"current_steps": 1335, "total_steps": 1404, "loss": 0.0139, "lr": 6.51290112462627e-08, "epoch": 2.853475935828877, "percentage": 95.09, "elapsed_time": "0:18:42", "remaining_time": "0:00:57"}
268
+ {"current_steps": 1340, "total_steps": 1404, "loss": 0.0144, "lr": 5.617399805139867e-08, "epoch": 2.8641711229946525, "percentage": 95.44, "elapsed_time": "0:18:45", "remaining_time": "0:00:53"}
269
+ {"current_steps": 1345, "total_steps": 1404, "loss": 0.0129, "lr": 4.7877524402817345e-08, "epoch": 2.874866310160428, "percentage": 95.8, "elapsed_time": "0:18:48", "remaining_time": "0:00:49"}
270
+ {"current_steps": 1350, "total_steps": 1404, "loss": 0.0191, "lr": 4.024069542759801e-08, "epoch": 2.8855614973262034, "percentage": 96.15, "elapsed_time": "0:18:51", "remaining_time": "0:00:45"}
271
+ {"current_steps": 1355, "total_steps": 1404, "loss": 0.0169, "lr": 3.3264528385225094e-08, "epoch": 2.896256684491979, "percentage": 96.51, "elapsed_time": "0:18:55", "remaining_time": "0:00:41"}
272
+ {"current_steps": 1360, "total_steps": 1404, "loss": 0.0157, "lr": 2.6949952532083768e-08, "epoch": 2.9069518716577543, "percentage": 96.87, "elapsed_time": "0:18:58", "remaining_time": "0:00:36"}
273
+ {"current_steps": 1365, "total_steps": 1404, "loss": 0.0194, "lr": 2.1297808997678417e-08, "epoch": 2.9176470588235293, "percentage": 97.22, "elapsed_time": "0:19:01", "remaining_time": "0:00:32"}
274
+ {"current_steps": 1370, "total_steps": 1404, "loss": 0.0148, "lr": 1.6308850672591692e-08, "epoch": 2.9283422459893047, "percentage": 97.58, "elapsed_time": "0:19:05", "remaining_time": "0:00:28"}
275
+ {"current_steps": 1375, "total_steps": 1404, "loss": 0.0168, "lr": 1.1983742108195862e-08, "epoch": 2.93903743315508, "percentage": 97.93, "elapsed_time": "0:19:09", "remaining_time": "0:00:24"}
276
+ {"current_steps": 1380, "total_steps": 1404, "loss": 0.0153, "lr": 8.323059428130831e-09, "epoch": 2.9497326203208556, "percentage": 98.29, "elapsed_time": "0:19:12", "remaining_time": "0:00:20"}
277
+ {"current_steps": 1385, "total_steps": 1404, "loss": 0.0208, "lr": 5.3272902515622e-09, "epoch": 2.960427807486631, "percentage": 98.65, "elapsed_time": "0:19:15", "remaining_time": "0:00:15"}
278
+ {"current_steps": 1390, "total_steps": 1404, "loss": 0.017, "lr": 2.996833628228779e-09, "epoch": 2.9711229946524065, "percentage": 99.0, "elapsed_time": "0:19:19", "remaining_time": "0:00:11"}
279
+ {"current_steps": 1395, "total_steps": 1404, "loss": 0.0144, "lr": 1.3319999852867692e-09, "epoch": 2.981818181818182, "percentage": 99.36, "elapsed_time": "0:19:22", "remaining_time": "0:00:07"}
280
+ {"current_steps": 1400, "total_steps": 1404, "loss": 0.02, "lr": 3.330110859600666e-10, "epoch": 2.9925133689839574, "percentage": 99.72, "elapsed_time": "0:19:25", "remaining_time": "0:00:03"}
281
+ {"current_steps": 1404, "total_steps": 1404, "epoch": 3.0, "percentage": 100.0, "elapsed_time": "0:20:33", "remaining_time": "0:00:00"}
trainer_state.json ADDED
@@ -0,0 +1,2003 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": null,
3
+ "best_metric": null,
4
+ "best_model_checkpoint": null,
5
+ "epoch": 3.0,
6
+ "eval_steps": 500,
7
+ "global_step": 1404,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "epoch": 0.0106951871657754,
14
+ "grad_norm": 5.869461536407471,
15
+ "learning_rate": 9.30232558139535e-07,
16
+ "loss": 0.3054,
17
+ "step": 5
18
+ },
19
+ {
20
+ "epoch": 0.0213903743315508,
21
+ "grad_norm": 4.7690653800964355,
22
+ "learning_rate": 2.0930232558139536e-06,
23
+ "loss": 0.2661,
24
+ "step": 10
25
+ },
26
+ {
27
+ "epoch": 0.03208556149732621,
28
+ "grad_norm": 4.248436450958252,
29
+ "learning_rate": 3.2558139534883724e-06,
30
+ "loss": 0.2409,
31
+ "step": 15
32
+ },
33
+ {
34
+ "epoch": 0.0427807486631016,
35
+ "grad_norm": 4.08921480178833,
36
+ "learning_rate": 4.418604651162791e-06,
37
+ "loss": 0.2228,
38
+ "step": 20
39
+ },
40
+ {
41
+ "epoch": 0.053475935828877004,
42
+ "grad_norm": 4.846882343292236,
43
+ "learning_rate": 5.58139534883721e-06,
44
+ "loss": 0.2258,
45
+ "step": 25
46
+ },
47
+ {
48
+ "epoch": 0.06417112299465241,
49
+ "grad_norm": 4.230620384216309,
50
+ "learning_rate": 6.744186046511628e-06,
51
+ "loss": 0.2103,
52
+ "step": 30
53
+ },
54
+ {
55
+ "epoch": 0.0748663101604278,
56
+ "grad_norm": 4.4064130783081055,
57
+ "learning_rate": 7.906976744186048e-06,
58
+ "loss": 0.2122,
59
+ "step": 35
60
+ },
61
+ {
62
+ "epoch": 0.0855614973262032,
63
+ "grad_norm": 4.86531400680542,
64
+ "learning_rate": 9.069767441860465e-06,
65
+ "loss": 0.1996,
66
+ "step": 40
67
+ },
68
+ {
69
+ "epoch": 0.0962566844919786,
70
+ "grad_norm": 5.53223991394043,
71
+ "learning_rate": 9.999986679414613e-06,
72
+ "loss": 0.2311,
73
+ "step": 45
74
+ },
75
+ {
76
+ "epoch": 0.10695187165775401,
77
+ "grad_norm": 4.2916178703308105,
78
+ "learning_rate": 9.999520466378376e-06,
79
+ "loss": 0.2319,
80
+ "step": 50
81
+ },
82
+ {
83
+ "epoch": 0.11764705882352941,
84
+ "grad_norm": 4.200897216796875,
85
+ "learning_rate": 9.998388295046227e-06,
86
+ "loss": 0.2368,
87
+ "step": 55
88
+ },
89
+ {
90
+ "epoch": 0.12834224598930483,
91
+ "grad_norm": 4.808861255645752,
92
+ "learning_rate": 9.996590316228402e-06,
93
+ "loss": 0.2354,
94
+ "step": 60
95
+ },
96
+ {
97
+ "epoch": 0.13903743315508021,
98
+ "grad_norm": 4.5134077072143555,
99
+ "learning_rate": 9.994126769423656e-06,
100
+ "loss": 0.234,
101
+ "step": 65
102
+ },
103
+ {
104
+ "epoch": 0.1497326203208556,
105
+ "grad_norm": 4.348900318145752,
106
+ "learning_rate": 9.990997982787348e-06,
107
+ "loss": 0.2541,
108
+ "step": 70
109
+ },
110
+ {
111
+ "epoch": 0.16042780748663102,
112
+ "grad_norm": 4.4039306640625,
113
+ "learning_rate": 9.98720437308773e-06,
114
+ "loss": 0.2496,
115
+ "step": 75
116
+ },
117
+ {
118
+ "epoch": 0.1711229946524064,
119
+ "grad_norm": 4.726532936096191,
120
+ "learning_rate": 9.982746445650437e-06,
121
+ "loss": 0.2797,
122
+ "step": 80
123
+ },
124
+ {
125
+ "epoch": 0.18181818181818182,
126
+ "grad_norm": 4.256592273712158,
127
+ "learning_rate": 9.977624794291172e-06,
128
+ "loss": 0.2518,
129
+ "step": 85
130
+ },
131
+ {
132
+ "epoch": 0.1925133689839572,
133
+ "grad_norm": 4.330168724060059,
134
+ "learning_rate": 9.97184010123661e-06,
135
+ "loss": 0.261,
136
+ "step": 90
137
+ },
138
+ {
139
+ "epoch": 0.20320855614973263,
140
+ "grad_norm": 4.281119346618652,
141
+ "learning_rate": 9.965393137033512e-06,
142
+ "loss": 0.2564,
143
+ "step": 95
144
+ },
145
+ {
146
+ "epoch": 0.21390374331550802,
147
+ "grad_norm": 4.247673511505127,
148
+ "learning_rate": 9.958284760446104e-06,
149
+ "loss": 0.2501,
150
+ "step": 100
151
+ },
152
+ {
153
+ "epoch": 0.22459893048128343,
154
+ "grad_norm": 3.930504322052002,
155
+ "learning_rate": 9.950515918341666e-06,
156
+ "loss": 0.2504,
157
+ "step": 105
158
+ },
159
+ {
160
+ "epoch": 0.23529411764705882,
161
+ "grad_norm": 4.084280967712402,
162
+ "learning_rate": 9.942087645564415e-06,
163
+ "loss": 0.2706,
164
+ "step": 110
165
+ },
166
+ {
167
+ "epoch": 0.24598930481283424,
168
+ "grad_norm": 3.869400978088379,
169
+ "learning_rate": 9.93300106479766e-06,
170
+ "loss": 0.2499,
171
+ "step": 115
172
+ },
173
+ {
174
+ "epoch": 0.25668449197860965,
175
+ "grad_norm": 4.0887675285339355,
176
+ "learning_rate": 9.923257386414253e-06,
177
+ "loss": 0.2628,
178
+ "step": 120
179
+ },
180
+ {
181
+ "epoch": 0.26737967914438504,
182
+ "grad_norm": 4.140570163726807,
183
+ "learning_rate": 9.912857908315363e-06,
184
+ "loss": 0.2642,
185
+ "step": 125
186
+ },
187
+ {
188
+ "epoch": 0.27807486631016043,
189
+ "grad_norm": 4.731294631958008,
190
+ "learning_rate": 9.901804015757588e-06,
191
+ "loss": 0.2669,
192
+ "step": 130
193
+ },
194
+ {
195
+ "epoch": 0.2887700534759358,
196
+ "grad_norm": 4.113650321960449,
197
+ "learning_rate": 9.89009718116843e-06,
198
+ "loss": 0.2809,
199
+ "step": 135
200
+ },
201
+ {
202
+ "epoch": 0.2994652406417112,
203
+ "grad_norm": 3.8770499229431152,
204
+ "learning_rate": 9.877738963950175e-06,
205
+ "loss": 0.2705,
206
+ "step": 140
207
+ },
208
+ {
209
+ "epoch": 0.31016042780748665,
210
+ "grad_norm": 4.077112197875977,
211
+ "learning_rate": 9.864731010272152e-06,
212
+ "loss": 0.2548,
213
+ "step": 145
214
+ },
215
+ {
216
+ "epoch": 0.32085561497326204,
217
+ "grad_norm": 4.771427631378174,
218
+ "learning_rate": 9.851075052851476e-06,
219
+ "loss": 0.2534,
220
+ "step": 150
221
+ },
222
+ {
223
+ "epoch": 0.3315508021390374,
224
+ "grad_norm": 3.84387469291687,
225
+ "learning_rate": 9.83677291072223e-06,
226
+ "loss": 0.2438,
227
+ "step": 155
228
+ },
229
+ {
230
+ "epoch": 0.3422459893048128,
231
+ "grad_norm": 4.427935600280762,
232
+ "learning_rate": 9.821826488993168e-06,
233
+ "loss": 0.2791,
234
+ "step": 160
235
+ },
236
+ {
237
+ "epoch": 0.35294117647058826,
238
+ "grad_norm": 4.1868767738342285,
239
+ "learning_rate": 9.806237778593941e-06,
240
+ "loss": 0.2734,
241
+ "step": 165
242
+ },
243
+ {
244
+ "epoch": 0.36363636363636365,
245
+ "grad_norm": 3.8055779933929443,
246
+ "learning_rate": 9.790008856009902e-06,
247
+ "loss": 0.2463,
248
+ "step": 170
249
+ },
250
+ {
251
+ "epoch": 0.37433155080213903,
252
+ "grad_norm": 4.041962623596191,
253
+ "learning_rate": 9.773141883005507e-06,
254
+ "loss": 0.2813,
255
+ "step": 175
256
+ },
257
+ {
258
+ "epoch": 0.3850267379679144,
259
+ "grad_norm": 3.6363329887390137,
260
+ "learning_rate": 9.755639106336347e-06,
261
+ "loss": 0.2724,
262
+ "step": 180
263
+ },
264
+ {
265
+ "epoch": 0.39572192513368987,
266
+ "grad_norm": 3.50486421585083,
267
+ "learning_rate": 9.737502857449894e-06,
268
+ "loss": 0.271,
269
+ "step": 185
270
+ },
271
+ {
272
+ "epoch": 0.40641711229946526,
273
+ "grad_norm": 3.4967920780181885,
274
+ "learning_rate": 9.718735552174923e-06,
275
+ "loss": 0.2467,
276
+ "step": 190
277
+ },
278
+ {
279
+ "epoch": 0.41711229946524064,
280
+ "grad_norm": 3.3797831535339355,
281
+ "learning_rate": 9.699339690399717e-06,
282
+ "loss": 0.2621,
283
+ "step": 195
284
+ },
285
+ {
286
+ "epoch": 0.42780748663101603,
287
+ "grad_norm": 15.109771728515625,
288
+ "learning_rate": 9.679317855739073e-06,
289
+ "loss": 0.2791,
290
+ "step": 200
291
+ },
292
+ {
293
+ "epoch": 0.4385026737967914,
294
+ "grad_norm": 3.828474760055542,
295
+ "learning_rate": 9.658672715190151e-06,
296
+ "loss": 0.2829,
297
+ "step": 205
298
+ },
299
+ {
300
+ "epoch": 0.44919786096256686,
301
+ "grad_norm": 3.2750980854034424,
302
+ "learning_rate": 9.637407018777224e-06,
303
+ "loss": 0.2866,
304
+ "step": 210
305
+ },
306
+ {
307
+ "epoch": 0.45989304812834225,
308
+ "grad_norm": 3.615290880203247,
309
+ "learning_rate": 9.615523599185353e-06,
310
+ "loss": 0.2422,
311
+ "step": 215
312
+ },
313
+ {
314
+ "epoch": 0.47058823529411764,
315
+ "grad_norm": 3.5919339656829834,
316
+ "learning_rate": 9.593025371383064e-06,
317
+ "loss": 0.269,
318
+ "step": 220
319
+ },
320
+ {
321
+ "epoch": 0.48128342245989303,
322
+ "grad_norm": 4.708985805511475,
323
+ "learning_rate": 9.569915332234068e-06,
324
+ "loss": 0.2686,
325
+ "step": 225
326
+ },
327
+ {
328
+ "epoch": 0.4919786096256685,
329
+ "grad_norm": 3.5988545417785645,
330
+ "learning_rate": 9.546196560098062e-06,
331
+ "loss": 0.273,
332
+ "step": 230
333
+ },
334
+ {
335
+ "epoch": 0.5026737967914439,
336
+ "grad_norm": 3.4772067070007324,
337
+ "learning_rate": 9.521872214420668e-06,
338
+ "loss": 0.2395,
339
+ "step": 235
340
+ },
341
+ {
342
+ "epoch": 0.5133689839572193,
343
+ "grad_norm": 3.7974278926849365,
344
+ "learning_rate": 9.496945535312597e-06,
345
+ "loss": 0.2682,
346
+ "step": 240
347
+ },
348
+ {
349
+ "epoch": 0.5240641711229946,
350
+ "grad_norm": 3.69970440864563,
351
+ "learning_rate": 9.471419843118036e-06,
352
+ "loss": 0.2557,
353
+ "step": 245
354
+ },
355
+ {
356
+ "epoch": 0.5347593582887701,
357
+ "grad_norm": 3.470737934112549,
358
+ "learning_rate": 9.44529853797238e-06,
359
+ "loss": 0.266,
360
+ "step": 250
361
+ },
362
+ {
363
+ "epoch": 0.5454545454545454,
364
+ "grad_norm": 3.733236312866211,
365
+ "learning_rate": 9.418585099349306e-06,
366
+ "loss": 0.2779,
367
+ "step": 255
368
+ },
369
+ {
370
+ "epoch": 0.5561497326203209,
371
+ "grad_norm": 3.434349298477173,
372
+ "learning_rate": 9.391283085597299e-06,
373
+ "loss": 0.2508,
374
+ "step": 260
375
+ },
376
+ {
377
+ "epoch": 0.5668449197860963,
378
+ "grad_norm": 3.5163183212280273,
379
+ "learning_rate": 9.36339613346565e-06,
380
+ "loss": 0.2727,
381
+ "step": 265
382
+ },
383
+ {
384
+ "epoch": 0.5775401069518716,
385
+ "grad_norm": 4.07936429977417,
386
+ "learning_rate": 9.33492795762005e-06,
387
+ "loss": 0.2714,
388
+ "step": 270
389
+ },
390
+ {
391
+ "epoch": 0.5882352941176471,
392
+ "grad_norm": 3.171149492263794,
393
+ "learning_rate": 9.305882350147763e-06,
394
+ "loss": 0.2585,
395
+ "step": 275
396
+ },
397
+ {
398
+ "epoch": 0.5989304812834224,
399
+ "grad_norm": 3.424302101135254,
400
+ "learning_rate": 9.276263180052498e-06,
401
+ "loss": 0.2584,
402
+ "step": 280
403
+ },
404
+ {
405
+ "epoch": 0.6096256684491979,
406
+ "grad_norm": 3.800421714782715,
407
+ "learning_rate": 9.246074392739057e-06,
408
+ "loss": 0.2771,
409
+ "step": 285
410
+ },
411
+ {
412
+ "epoch": 0.6203208556149733,
413
+ "grad_norm": 3.4711737632751465,
414
+ "learning_rate": 9.21532000948778e-06,
415
+ "loss": 0.265,
416
+ "step": 290
417
+ },
418
+ {
419
+ "epoch": 0.6310160427807486,
420
+ "grad_norm": 3.5598926544189453,
421
+ "learning_rate": 9.184004126918891e-06,
422
+ "loss": 0.2653,
423
+ "step": 295
424
+ },
425
+ {
426
+ "epoch": 0.6417112299465241,
427
+ "grad_norm": 3.320875644683838,
428
+ "learning_rate": 9.152130916446817e-06,
429
+ "loss": 0.2373,
430
+ "step": 300
431
+ },
432
+ {
433
+ "epoch": 0.6524064171122995,
434
+ "grad_norm": 3.606067419052124,
435
+ "learning_rate": 9.119704623724528e-06,
436
+ "loss": 0.2779,
437
+ "step": 305
438
+ },
439
+ {
440
+ "epoch": 0.6631016042780749,
441
+ "grad_norm": 3.189316511154175,
442
+ "learning_rate": 9.086729568078006e-06,
443
+ "loss": 0.2813,
444
+ "step": 310
445
+ },
446
+ {
447
+ "epoch": 0.6737967914438503,
448
+ "grad_norm": 3.725550651550293,
449
+ "learning_rate": 9.05321014193089e-06,
450
+ "loss": 0.284,
451
+ "step": 315
452
+ },
453
+ {
454
+ "epoch": 0.6844919786096256,
455
+ "grad_norm": 3.6915953159332275,
456
+ "learning_rate": 9.019150810219376e-06,
457
+ "loss": 0.2646,
458
+ "step": 320
459
+ },
460
+ {
461
+ "epoch": 0.6951871657754011,
462
+ "grad_norm": 3.499095916748047,
463
+ "learning_rate": 8.984556109797484e-06,
464
+ "loss": 0.2693,
465
+ "step": 325
466
+ },
467
+ {
468
+ "epoch": 0.7058823529411765,
469
+ "grad_norm": 3.671689510345459,
470
+ "learning_rate": 8.949430648832716e-06,
471
+ "loss": 0.2662,
472
+ "step": 330
473
+ },
474
+ {
475
+ "epoch": 0.7165775401069518,
476
+ "grad_norm": 3.549403429031372,
477
+ "learning_rate": 8.91377910619223e-06,
478
+ "loss": 0.2745,
479
+ "step": 335
480
+ },
481
+ {
482
+ "epoch": 0.7272727272727273,
483
+ "grad_norm": 3.2107975482940674,
484
+ "learning_rate": 8.8776062308196e-06,
485
+ "loss": 0.2462,
486
+ "step": 340
487
+ },
488
+ {
489
+ "epoch": 0.7379679144385026,
490
+ "grad_norm": 3.040982246398926,
491
+ "learning_rate": 8.84091684110223e-06,
492
+ "loss": 0.2663,
493
+ "step": 345
494
+ },
495
+ {
496
+ "epoch": 0.7486631016042781,
497
+ "grad_norm": 3.460141658782959,
498
+ "learning_rate": 8.803715824229525e-06,
499
+ "loss": 0.2595,
500
+ "step": 350
501
+ },
502
+ {
503
+ "epoch": 0.7593582887700535,
504
+ "grad_norm": 3.5115394592285156,
505
+ "learning_rate": 8.766008135541896e-06,
506
+ "loss": 0.2476,
507
+ "step": 355
508
+ },
509
+ {
510
+ "epoch": 0.7700534759358288,
511
+ "grad_norm": 3.2345032691955566,
512
+ "learning_rate": 8.727798797870688e-06,
513
+ "loss": 0.2399,
514
+ "step": 360
515
+ },
516
+ {
517
+ "epoch": 0.7807486631016043,
518
+ "grad_norm": 3.489104986190796,
519
+ "learning_rate": 8.689092900869112e-06,
520
+ "loss": 0.2568,
521
+ "step": 365
522
+ },
523
+ {
524
+ "epoch": 0.7914438502673797,
525
+ "grad_norm": 3.4822070598602295,
526
+ "learning_rate": 8.649895600334284e-06,
527
+ "loss": 0.2779,
528
+ "step": 370
529
+ },
530
+ {
531
+ "epoch": 0.8021390374331551,
532
+ "grad_norm": 3.6014904975891113,
533
+ "learning_rate": 8.610212117520453e-06,
534
+ "loss": 0.2738,
535
+ "step": 375
536
+ },
537
+ {
538
+ "epoch": 0.8128342245989305,
539
+ "grad_norm": 3.3353493213653564,
540
+ "learning_rate": 8.570047738443502e-06,
541
+ "loss": 0.2564,
542
+ "step": 380
543
+ },
544
+ {
545
+ "epoch": 0.8235294117647058,
546
+ "grad_norm": 3.1294198036193848,
547
+ "learning_rate": 8.52940781317683e-06,
548
+ "loss": 0.2459,
549
+ "step": 385
550
+ },
551
+ {
552
+ "epoch": 0.8342245989304813,
553
+ "grad_norm": 3.2122206687927246,
554
+ "learning_rate": 8.48829775513869e-06,
555
+ "loss": 0.2639,
556
+ "step": 390
557
+ },
558
+ {
559
+ "epoch": 0.8449197860962567,
560
+ "grad_norm": 3.2475640773773193,
561
+ "learning_rate": 8.446723040371114e-06,
562
+ "loss": 0.2545,
563
+ "step": 395
564
+ },
565
+ {
566
+ "epoch": 0.8556149732620321,
567
+ "grad_norm": 3.113609552383423,
568
+ "learning_rate": 8.40468920681047e-06,
569
+ "loss": 0.2712,
570
+ "step": 400
571
+ },
572
+ {
573
+ "epoch": 0.8663101604278075,
574
+ "grad_norm": 3.231935501098633,
575
+ "learning_rate": 8.362201853549777e-06,
576
+ "loss": 0.27,
577
+ "step": 405
578
+ },
579
+ {
580
+ "epoch": 0.8770053475935828,
581
+ "grad_norm": 3.3826744556427,
582
+ "learning_rate": 8.319266640092899e-06,
583
+ "loss": 0.2823,
584
+ "step": 410
585
+ },
586
+ {
587
+ "epoch": 0.8877005347593583,
588
+ "grad_norm": 3.3691983222961426,
589
+ "learning_rate": 8.275889285600656e-06,
590
+ "loss": 0.2555,
591
+ "step": 415
592
+ },
593
+ {
594
+ "epoch": 0.8983957219251337,
595
+ "grad_norm": 3.4460556507110596,
596
+ "learning_rate": 8.23207556812902e-06,
597
+ "loss": 0.2615,
598
+ "step": 420
599
+ },
600
+ {
601
+ "epoch": 0.9090909090909091,
602
+ "grad_norm": 3.0713820457458496,
603
+ "learning_rate": 8.187831323859445e-06,
604
+ "loss": 0.2512,
605
+ "step": 425
606
+ },
607
+ {
608
+ "epoch": 0.9197860962566845,
609
+ "grad_norm": 2.781736373901367,
610
+ "learning_rate": 8.143162446321465e-06,
611
+ "loss": 0.2568,
612
+ "step": 430
613
+ },
614
+ {
615
+ "epoch": 0.93048128342246,
616
+ "grad_norm": 3.0802292823791504,
617
+ "learning_rate": 8.098074885607646e-06,
618
+ "loss": 0.2506,
619
+ "step": 435
620
+ },
621
+ {
622
+ "epoch": 0.9411764705882353,
623
+ "grad_norm": 3.0498411655426025,
624
+ "learning_rate": 8.052574647581009e-06,
625
+ "loss": 0.2586,
626
+ "step": 440
627
+ },
628
+ {
629
+ "epoch": 0.9518716577540107,
630
+ "grad_norm": 3.0598437786102295,
631
+ "learning_rate": 8.006667793075026e-06,
632
+ "loss": 0.2576,
633
+ "step": 445
634
+ },
635
+ {
636
+ "epoch": 0.9625668449197861,
637
+ "grad_norm": 2.935920238494873,
638
+ "learning_rate": 7.960360437086287e-06,
639
+ "loss": 0.2363,
640
+ "step": 450
641
+ },
642
+ {
643
+ "epoch": 0.9732620320855615,
644
+ "grad_norm": 3.2348110675811768,
645
+ "learning_rate": 7.91365874795995e-06,
646
+ "loss": 0.2677,
647
+ "step": 455
648
+ },
649
+ {
650
+ "epoch": 0.983957219251337,
651
+ "grad_norm": 3.4138996601104736,
652
+ "learning_rate": 7.866568946568107e-06,
653
+ "loss": 0.2702,
654
+ "step": 460
655
+ },
656
+ {
657
+ "epoch": 0.9946524064171123,
658
+ "grad_norm": 2.949201822280884,
659
+ "learning_rate": 7.819097305481112e-06,
660
+ "loss": 0.2487,
661
+ "step": 465
662
+ },
663
+ {
664
+ "epoch": 1.0042780748663103,
665
+ "grad_norm": 2.0031890869140625,
666
+ "learning_rate": 7.771250148132067e-06,
667
+ "loss": 0.1638,
668
+ "step": 470
669
+ },
670
+ {
671
+ "epoch": 1.0149732620320855,
672
+ "grad_norm": 2.1339635848999023,
673
+ "learning_rate": 7.723033847974503e-06,
674
+ "loss": 0.1013,
675
+ "step": 475
676
+ },
677
+ {
678
+ "epoch": 1.025668449197861,
679
+ "grad_norm": 2.822927474975586,
680
+ "learning_rate": 7.674454827633413e-06,
681
+ "loss": 0.0924,
682
+ "step": 480
683
+ },
684
+ {
685
+ "epoch": 1.0363636363636364,
686
+ "grad_norm": 3.7076971530914307,
687
+ "learning_rate": 7.625519558049722e-06,
688
+ "loss": 0.1075,
689
+ "step": 485
690
+ },
691
+ {
692
+ "epoch": 1.0470588235294118,
693
+ "grad_norm": 2.7152915000915527,
694
+ "learning_rate": 7.576234557618336e-06,
695
+ "loss": 0.0926,
696
+ "step": 490
697
+ },
698
+ {
699
+ "epoch": 1.0577540106951873,
700
+ "grad_norm": 3.0349481105804443,
701
+ "learning_rate": 7.526606391319862e-06,
702
+ "loss": 0.1054,
703
+ "step": 495
704
+ },
705
+ {
706
+ "epoch": 1.0684491978609625,
707
+ "grad_norm": 2.7987284660339355,
708
+ "learning_rate": 7.476641669846121e-06,
709
+ "loss": 0.0999,
710
+ "step": 500
711
+ },
712
+ {
713
+ "epoch": 1.079144385026738,
714
+ "grad_norm": 2.2019879817962646,
715
+ "learning_rate": 7.426347048719577e-06,
716
+ "loss": 0.1082,
717
+ "step": 505
718
+ },
719
+ {
720
+ "epoch": 1.0898395721925134,
721
+ "grad_norm": 2.8885598182678223,
722
+ "learning_rate": 7.375729227406789e-06,
723
+ "loss": 0.1227,
724
+ "step": 510
725
+ },
726
+ {
727
+ "epoch": 1.1005347593582888,
728
+ "grad_norm": 2.8309147357940674,
729
+ "learning_rate": 7.324794948426015e-06,
730
+ "loss": 0.0943,
731
+ "step": 515
732
+ },
733
+ {
734
+ "epoch": 1.1112299465240643,
735
+ "grad_norm": 2.788823366165161,
736
+ "learning_rate": 7.273550996449077e-06,
737
+ "loss": 0.1038,
738
+ "step": 520
739
+ },
740
+ {
741
+ "epoch": 1.1219251336898395,
742
+ "grad_norm": 2.1967334747314453,
743
+ "learning_rate": 7.222004197397613e-06,
744
+ "loss": 0.0956,
745
+ "step": 525
746
+ },
747
+ {
748
+ "epoch": 1.132620320855615,
749
+ "grad_norm": 2.6466832160949707,
750
+ "learning_rate": 7.170161417533836e-06,
751
+ "loss": 0.0946,
752
+ "step": 530
753
+ },
754
+ {
755
+ "epoch": 1.1433155080213904,
756
+ "grad_norm": 2.3864052295684814,
757
+ "learning_rate": 7.118029562545915e-06,
758
+ "loss": 0.0868,
759
+ "step": 535
760
+ },
761
+ {
762
+ "epoch": 1.1540106951871658,
763
+ "grad_norm": 2.6868040561676025,
764
+ "learning_rate": 7.065615576628107e-06,
765
+ "loss": 0.1009,
766
+ "step": 540
767
+ },
768
+ {
769
+ "epoch": 1.1647058823529413,
770
+ "grad_norm": 2.748037815093994,
771
+ "learning_rate": 7.0129264415557585e-06,
772
+ "loss": 0.1067,
773
+ "step": 545
774
+ },
775
+ {
776
+ "epoch": 1.1754010695187165,
777
+ "grad_norm": 3.183288097381592,
778
+ "learning_rate": 6.959969175755306e-06,
779
+ "loss": 0.1009,
780
+ "step": 550
781
+ },
782
+ {
783
+ "epoch": 1.186096256684492,
784
+ "grad_norm": 2.472684383392334,
785
+ "learning_rate": 6.906750833369386e-06,
786
+ "loss": 0.0912,
787
+ "step": 555
788
+ },
789
+ {
790
+ "epoch": 1.1967914438502674,
791
+ "grad_norm": 3.301072359085083,
792
+ "learning_rate": 6.8532785033171975e-06,
793
+ "loss": 0.1026,
794
+ "step": 560
795
+ },
796
+ {
797
+ "epoch": 1.2074866310160428,
798
+ "grad_norm": 2.607532262802124,
799
+ "learning_rate": 6.799559308350219e-06,
800
+ "loss": 0.0985,
801
+ "step": 565
802
+ },
803
+ {
804
+ "epoch": 1.2181818181818183,
805
+ "grad_norm": 2.714355230331421,
806
+ "learning_rate": 6.745600404103431e-06,
807
+ "loss": 0.0982,
808
+ "step": 570
809
+ },
810
+ {
811
+ "epoch": 1.2288770053475937,
812
+ "grad_norm": 3.1020829677581787,
813
+ "learning_rate": 6.6914089781421535e-06,
814
+ "loss": 0.1084,
815
+ "step": 575
816
+ },
817
+ {
818
+ "epoch": 1.239572192513369,
819
+ "grad_norm": 3.3140673637390137,
820
+ "learning_rate": 6.636992249004629e-06,
821
+ "loss": 0.1054,
822
+ "step": 580
823
+ },
824
+ {
825
+ "epoch": 1.2502673796791444,
826
+ "grad_norm": 2.7101094722747803,
827
+ "learning_rate": 6.582357465240488e-06,
828
+ "loss": 0.1045,
829
+ "step": 585
830
+ },
831
+ {
832
+ "epoch": 1.2609625668449198,
833
+ "grad_norm": 2.9788272380828857,
834
+ "learning_rate": 6.527511904445194e-06,
835
+ "loss": 0.0883,
836
+ "step": 590
837
+ },
838
+ {
839
+ "epoch": 1.2716577540106953,
840
+ "grad_norm": 3.2309136390686035,
841
+ "learning_rate": 6.472462872290654e-06,
842
+ "loss": 0.0946,
843
+ "step": 595
844
+ },
845
+ {
846
+ "epoch": 1.2823529411764705,
847
+ "grad_norm": 2.4168930053710938,
848
+ "learning_rate": 6.417217701552059e-06,
849
+ "loss": 0.0996,
850
+ "step": 600
851
+ },
852
+ {
853
+ "epoch": 1.293048128342246,
854
+ "grad_norm": 2.6719398498535156,
855
+ "learning_rate": 6.36178375113113e-06,
856
+ "loss": 0.0963,
857
+ "step": 605
858
+ },
859
+ {
860
+ "epoch": 1.3037433155080214,
861
+ "grad_norm": 2.4402902126312256,
862
+ "learning_rate": 6.3061684050758776e-06,
863
+ "loss": 0.0986,
864
+ "step": 610
865
+ },
866
+ {
867
+ "epoch": 1.3144385026737968,
868
+ "grad_norm": 3.2404541969299316,
869
+ "learning_rate": 6.250379071597018e-06,
870
+ "loss": 0.0925,
871
+ "step": 615
872
+ },
873
+ {
874
+ "epoch": 1.3251336898395722,
875
+ "grad_norm": 2.904754161834717,
876
+ "learning_rate": 6.194423182081161e-06,
877
+ "loss": 0.1125,
878
+ "step": 620
879
+ },
880
+ {
881
+ "epoch": 1.3358288770053477,
882
+ "grad_norm": 3.329714059829712,
883
+ "learning_rate": 6.138308190100918e-06,
884
+ "loss": 0.1038,
885
+ "step": 625
886
+ },
887
+ {
888
+ "epoch": 1.346524064171123,
889
+ "grad_norm": 3.2199363708496094,
890
+ "learning_rate": 6.082041570422059e-06,
891
+ "loss": 0.1097,
892
+ "step": 630
893
+ },
894
+ {
895
+ "epoch": 1.3572192513368984,
896
+ "grad_norm": 2.6863086223602295,
897
+ "learning_rate": 6.025630818007833e-06,
898
+ "loss": 0.1001,
899
+ "step": 635
900
+ },
901
+ {
902
+ "epoch": 1.3679144385026738,
903
+ "grad_norm": 2.825577735900879,
904
+ "learning_rate": 5.969083447020606e-06,
905
+ "loss": 0.1018,
906
+ "step": 640
907
+ },
908
+ {
909
+ "epoch": 1.3786096256684492,
910
+ "grad_norm": 2.606800079345703,
911
+ "learning_rate": 5.912406989820948e-06,
912
+ "loss": 0.1043,
913
+ "step": 645
914
+ },
915
+ {
916
+ "epoch": 1.3893048128342245,
917
+ "grad_norm": 2.4628851413726807,
918
+ "learning_rate": 5.855608995964283e-06,
919
+ "loss": 0.0961,
920
+ "step": 650
921
+ },
922
+ {
923
+ "epoch": 1.4,
924
+ "grad_norm": 2.584479331970215,
925
+ "learning_rate": 5.798697031195257e-06,
926
+ "loss": 0.1025,
927
+ "step": 655
928
+ },
929
+ {
930
+ "epoch": 1.4106951871657754,
931
+ "grad_norm": 2.4871041774749756,
932
+ "learning_rate": 5.741678676439946e-06,
933
+ "loss": 0.0993,
934
+ "step": 660
935
+ },
936
+ {
937
+ "epoch": 1.4213903743315508,
938
+ "grad_norm": 2.876145601272583,
939
+ "learning_rate": 5.684561526796045e-06,
940
+ "loss": 0.0968,
941
+ "step": 665
942
+ },
943
+ {
944
+ "epoch": 1.4320855614973262,
945
+ "grad_norm": 3.0748062133789062,
946
+ "learning_rate": 5.627353190521168e-06,
947
+ "loss": 0.0824,
948
+ "step": 670
949
+ },
950
+ {
951
+ "epoch": 1.4427807486631017,
952
+ "grad_norm": 2.5074338912963867,
953
+ "learning_rate": 5.570061288019385e-06,
954
+ "loss": 0.0994,
955
+ "step": 675
956
+ },
957
+ {
958
+ "epoch": 1.4534759358288771,
959
+ "grad_norm": 2.8043177127838135,
960
+ "learning_rate": 5.51269345082617e-06,
961
+ "loss": 0.1007,
962
+ "step": 680
963
+ },
964
+ {
965
+ "epoch": 1.4641711229946524,
966
+ "grad_norm": 2.6914560794830322,
967
+ "learning_rate": 5.455257320591825e-06,
968
+ "loss": 0.1021,
969
+ "step": 685
970
+ },
971
+ {
972
+ "epoch": 1.4748663101604278,
973
+ "grad_norm": 2.208425521850586,
974
+ "learning_rate": 5.397760548063591e-06,
975
+ "loss": 0.0918,
976
+ "step": 690
977
+ },
978
+ {
979
+ "epoch": 1.4855614973262032,
980
+ "grad_norm": 2.6503446102142334,
981
+ "learning_rate": 5.340210792066531e-06,
982
+ "loss": 0.0967,
983
+ "step": 695
984
+ },
985
+ {
986
+ "epoch": 1.4962566844919787,
987
+ "grad_norm": 2.4122114181518555,
988
+ "learning_rate": 5.282615718483344e-06,
989
+ "loss": 0.0859,
990
+ "step": 700
991
+ },
992
+ {
993
+ "epoch": 1.506951871657754,
994
+ "grad_norm": 2.084665060043335,
995
+ "learning_rate": 5.224982999233228e-06,
996
+ "loss": 0.0858,
997
+ "step": 705
998
+ },
999
+ {
1000
+ "epoch": 1.5176470588235293,
1001
+ "grad_norm": 3.171128034591675,
1002
+ "learning_rate": 5.167320311249951e-06,
1003
+ "loss": 0.1037,
1004
+ "step": 710
1005
+ },
1006
+ {
1007
+ "epoch": 1.5283422459893048,
1008
+ "grad_norm": 3.304917573928833,
1009
+ "learning_rate": 5.109635335459256e-06,
1010
+ "loss": 0.0845,
1011
+ "step": 715
1012
+ },
1013
+ {
1014
+ "epoch": 1.5390374331550802,
1015
+ "grad_norm": 2.538336992263794,
1016
+ "learning_rate": 5.051935755755713e-06,
1017
+ "loss": 0.0875,
1018
+ "step": 720
1019
+ },
1020
+ {
1021
+ "epoch": 1.5497326203208557,
1022
+ "grad_norm": 3.2048041820526123,
1023
+ "learning_rate": 4.9942292579791965e-06,
1024
+ "loss": 0.0957,
1025
+ "step": 725
1026
+ },
1027
+ {
1028
+ "epoch": 1.5604278074866311,
1029
+ "grad_norm": 2.32966685295105,
1030
+ "learning_rate": 4.936523528891111e-06,
1031
+ "loss": 0.08,
1032
+ "step": 730
1033
+ },
1034
+ {
1035
+ "epoch": 1.5711229946524066,
1036
+ "grad_norm": 2.5276477336883545,
1037
+ "learning_rate": 4.878826255150453e-06,
1038
+ "loss": 0.1025,
1039
+ "step": 735
1040
+ },
1041
+ {
1042
+ "epoch": 1.5818181818181818,
1043
+ "grad_norm": 2.489506244659424,
1044
+ "learning_rate": 4.821145122289941e-06,
1045
+ "loss": 0.0905,
1046
+ "step": 740
1047
+ },
1048
+ {
1049
+ "epoch": 1.5925133689839572,
1050
+ "grad_norm": 2.0386905670166016,
1051
+ "learning_rate": 4.763487813692252e-06,
1052
+ "loss": 0.0863,
1053
+ "step": 745
1054
+ },
1055
+ {
1056
+ "epoch": 1.6032085561497325,
1057
+ "grad_norm": 3.1131086349487305,
1058
+ "learning_rate": 4.705862009566564e-06,
1059
+ "loss": 0.0884,
1060
+ "step": 750
1061
+ },
1062
+ {
1063
+ "epoch": 1.613903743315508,
1064
+ "grad_norm": 2.19130277633667,
1065
+ "learning_rate": 4.648275385925522e-06,
1066
+ "loss": 0.0919,
1067
+ "step": 755
1068
+ },
1069
+ {
1070
+ "epoch": 1.6245989304812833,
1071
+ "grad_norm": 2.7279891967773438,
1072
+ "learning_rate": 4.5907356135627605e-06,
1073
+ "loss": 0.0956,
1074
+ "step": 760
1075
+ },
1076
+ {
1077
+ "epoch": 1.6352941176470588,
1078
+ "grad_norm": 2.4997522830963135,
1079
+ "learning_rate": 4.533250357031104e-06,
1080
+ "loss": 0.1017,
1081
+ "step": 765
1082
+ },
1083
+ {
1084
+ "epoch": 1.6459893048128342,
1085
+ "grad_norm": 2.488523006439209,
1086
+ "learning_rate": 4.475827273621639e-06,
1087
+ "loss": 0.0968,
1088
+ "step": 770
1089
+ },
1090
+ {
1091
+ "epoch": 1.6566844919786097,
1092
+ "grad_norm": 2.9442784786224365,
1093
+ "learning_rate": 4.418474012343711e-06,
1094
+ "loss": 0.0973,
1095
+ "step": 775
1096
+ },
1097
+ {
1098
+ "epoch": 1.6673796791443851,
1099
+ "grad_norm": 2.7047040462493896,
1100
+ "learning_rate": 4.361198212906048e-06,
1101
+ "loss": 0.0884,
1102
+ "step": 780
1103
+ },
1104
+ {
1105
+ "epoch": 1.6780748663101606,
1106
+ "grad_norm": 2.4104325771331787,
1107
+ "learning_rate": 4.304007504699118e-06,
1108
+ "loss": 0.087,
1109
+ "step": 785
1110
+ },
1111
+ {
1112
+ "epoch": 1.6887700534759358,
1113
+ "grad_norm": 2.9229371547698975,
1114
+ "learning_rate": 4.246909505778862e-06,
1115
+ "loss": 0.0772,
1116
+ "step": 790
1117
+ },
1118
+ {
1119
+ "epoch": 1.6994652406417112,
1120
+ "grad_norm": 2.7569501399993896,
1121
+ "learning_rate": 4.189911821851928e-06,
1122
+ "loss": 0.0973,
1123
+ "step": 795
1124
+ },
1125
+ {
1126
+ "epoch": 1.7101604278074867,
1127
+ "grad_norm": 2.2701845169067383,
1128
+ "learning_rate": 4.1330220452625644e-06,
1129
+ "loss": 0.0869,
1130
+ "step": 800
1131
+ },
1132
+ {
1133
+ "epoch": 1.720855614973262,
1134
+ "grad_norm": 2.91239857673645,
1135
+ "learning_rate": 4.076247753981285e-06,
1136
+ "loss": 0.0985,
1137
+ "step": 805
1138
+ },
1139
+ {
1140
+ "epoch": 1.7315508021390373,
1141
+ "grad_norm": 2.3714444637298584,
1142
+ "learning_rate": 4.019596510595447e-06,
1143
+ "loss": 0.0862,
1144
+ "step": 810
1145
+ },
1146
+ {
1147
+ "epoch": 1.7422459893048128,
1148
+ "grad_norm": 2.617003917694092,
1149
+ "learning_rate": 3.963075861301886e-06,
1150
+ "loss": 0.0933,
1151
+ "step": 815
1152
+ },
1153
+ {
1154
+ "epoch": 1.7529411764705882,
1155
+ "grad_norm": 2.6759443283081055,
1156
+ "learning_rate": 3.9066933349017165e-06,
1157
+ "loss": 0.0883,
1158
+ "step": 820
1159
+ },
1160
+ {
1161
+ "epoch": 1.7636363636363637,
1162
+ "grad_norm": 3.302290439605713,
1163
+ "learning_rate": 3.8504564417974795e-06,
1164
+ "loss": 0.0988,
1165
+ "step": 825
1166
+ },
1167
+ {
1168
+ "epoch": 1.7743315508021391,
1169
+ "grad_norm": 2.1597912311553955,
1170
+ "learning_rate": 3.7943726729927154e-06,
1171
+ "loss": 0.0922,
1172
+ "step": 830
1173
+ },
1174
+ {
1175
+ "epoch": 1.7850267379679146,
1176
+ "grad_norm": 2.2167508602142334,
1177
+ "learning_rate": 3.738449499094121e-06,
1178
+ "loss": 0.0807,
1179
+ "step": 835
1180
+ },
1181
+ {
1182
+ "epoch": 1.79572192513369,
1183
+ "grad_norm": 2.180342197418213,
1184
+ "learning_rate": 3.682694369316446e-06,
1185
+ "loss": 0.0741,
1186
+ "step": 840
1187
+ },
1188
+ {
1189
+ "epoch": 1.8064171122994652,
1190
+ "grad_norm": 3.1924726963043213,
1191
+ "learning_rate": 3.6271147104902192e-06,
1192
+ "loss": 0.0836,
1193
+ "step": 845
1194
+ },
1195
+ {
1196
+ "epoch": 1.8171122994652407,
1197
+ "grad_norm": 3.1651058197021484,
1198
+ "learning_rate": 3.5717179260724544e-06,
1199
+ "loss": 0.0911,
1200
+ "step": 850
1201
+ },
1202
+ {
1203
+ "epoch": 1.8278074866310159,
1204
+ "grad_norm": 3.11163330078125,
1205
+ "learning_rate": 3.5165113951604874e-06,
1206
+ "loss": 0.094,
1207
+ "step": 855
1208
+ },
1209
+ {
1210
+ "epoch": 1.8385026737967913,
1211
+ "grad_norm": 2.2718892097473145,
1212
+ "learning_rate": 3.461502471509045e-06,
1213
+ "loss": 0.0818,
1214
+ "step": 860
1215
+ },
1216
+ {
1217
+ "epoch": 1.8491978609625668,
1218
+ "grad_norm": 2.625342607498169,
1219
+ "learning_rate": 3.4066984825506855e-06,
1220
+ "loss": 0.0891,
1221
+ "step": 865
1222
+ },
1223
+ {
1224
+ "epoch": 1.8598930481283422,
1225
+ "grad_norm": 2.286201000213623,
1226
+ "learning_rate": 3.35210672841976e-06,
1227
+ "loss": 0.0906,
1228
+ "step": 870
1229
+ },
1230
+ {
1231
+ "epoch": 1.8705882352941177,
1232
+ "grad_norm": 2.516383171081543,
1233
+ "learning_rate": 3.297734480980002e-06,
1234
+ "loss": 0.0856,
1235
+ "step": 875
1236
+ },
1237
+ {
1238
+ "epoch": 1.881283422459893,
1239
+ "grad_norm": 3.1512904167175293,
1240
+ "learning_rate": 3.2435889828558753e-06,
1241
+ "loss": 0.0845,
1242
+ "step": 880
1243
+ },
1244
+ {
1245
+ "epoch": 1.8919786096256686,
1246
+ "grad_norm": 3.0289194583892822,
1247
+ "learning_rate": 3.1896774464678327e-06,
1248
+ "loss": 0.0956,
1249
+ "step": 885
1250
+ },
1251
+ {
1252
+ "epoch": 1.902673796791444,
1253
+ "grad_norm": 2.4393064975738525,
1254
+ "learning_rate": 3.1360070530715885e-06,
1255
+ "loss": 0.0824,
1256
+ "step": 890
1257
+ },
1258
+ {
1259
+ "epoch": 1.9133689839572192,
1260
+ "grad_norm": 2.774142026901245,
1261
+ "learning_rate": 3.0825849518015334e-06,
1262
+ "loss": 0.0873,
1263
+ "step": 895
1264
+ },
1265
+ {
1266
+ "epoch": 1.9240641711229947,
1267
+ "grad_norm": 2.386697292327881,
1268
+ "learning_rate": 3.029418258718454e-06,
1269
+ "loss": 0.0836,
1270
+ "step": 900
1271
+ },
1272
+ {
1273
+ "epoch": 1.93475935828877,
1274
+ "grad_norm": 2.7990691661834717,
1275
+ "learning_rate": 2.9765140558616287e-06,
1276
+ "loss": 0.0875,
1277
+ "step": 905
1278
+ },
1279
+ {
1280
+ "epoch": 1.9454545454545453,
1281
+ "grad_norm": 2.4611012935638428,
1282
+ "learning_rate": 2.9238793903054757e-06,
1283
+ "loss": 0.0791,
1284
+ "step": 910
1285
+ },
1286
+ {
1287
+ "epoch": 1.9561497326203208,
1288
+ "grad_norm": 2.292494058609009,
1289
+ "learning_rate": 2.8715212732208523e-06,
1290
+ "loss": 0.0777,
1291
+ "step": 915
1292
+ },
1293
+ {
1294
+ "epoch": 1.9668449197860962,
1295
+ "grad_norm": 2.5736472606658936,
1296
+ "learning_rate": 2.819446678941126e-06,
1297
+ "loss": 0.0853,
1298
+ "step": 920
1299
+ },
1300
+ {
1301
+ "epoch": 1.9775401069518717,
1302
+ "grad_norm": 2.792259693145752,
1303
+ "learning_rate": 2.7676625440331756e-06,
1304
+ "loss": 0.08,
1305
+ "step": 925
1306
+ },
1307
+ {
1308
+ "epoch": 1.988235294117647,
1309
+ "grad_norm": 2.7590394020080566,
1310
+ "learning_rate": 2.7161757663734012e-06,
1311
+ "loss": 0.0876,
1312
+ "step": 930
1313
+ },
1314
+ {
1315
+ "epoch": 1.9989304812834225,
1316
+ "grad_norm": 3.141918420791626,
1317
+ "learning_rate": 2.6649932042288994e-06,
1318
+ "loss": 0.0874,
1319
+ "step": 935
1320
+ },
1321
+ {
1322
+ "epoch": 2.0085561497326205,
1323
+ "grad_norm": 1.2265775203704834,
1324
+ "learning_rate": 2.6141216753439115e-06,
1325
+ "loss": 0.0265,
1326
+ "step": 940
1327
+ },
1328
+ {
1329
+ "epoch": 2.0192513368983955,
1330
+ "grad_norm": 1.1748132705688477,
1331
+ "learning_rate": 2.5635679560316703e-06,
1332
+ "loss": 0.026,
1333
+ "step": 945
1334
+ },
1335
+ {
1336
+ "epoch": 2.029946524064171,
1337
+ "grad_norm": 1.9212442636489868,
1338
+ "learning_rate": 2.5133387802717585e-06,
1339
+ "loss": 0.0245,
1340
+ "step": 950
1341
+ },
1342
+ {
1343
+ "epoch": 2.0406417112299464,
1344
+ "grad_norm": 1.0849891901016235,
1345
+ "learning_rate": 2.4634408388131255e-06,
1346
+ "loss": 0.0213,
1347
+ "step": 955
1348
+ },
1349
+ {
1350
+ "epoch": 2.051336898395722,
1351
+ "grad_norm": 2.341118812561035,
1352
+ "learning_rate": 2.4138807782828423e-06,
1353
+ "loss": 0.0217,
1354
+ "step": 960
1355
+ },
1356
+ {
1357
+ "epoch": 2.0620320855614973,
1358
+ "grad_norm": 1.3080765008926392,
1359
+ "learning_rate": 2.3646652003007348e-06,
1360
+ "loss": 0.0213,
1361
+ "step": 965
1362
+ },
1363
+ {
1364
+ "epoch": 2.0727272727272728,
1365
+ "grad_norm": 1.187409520149231,
1366
+ "learning_rate": 2.3158006606000345e-06,
1367
+ "loss": 0.0278,
1368
+ "step": 970
1369
+ },
1370
+ {
1371
+ "epoch": 2.083422459893048,
1372
+ "grad_norm": 2.2584495544433594,
1373
+ "learning_rate": 2.267293668154114e-06,
1374
+ "loss": 0.0239,
1375
+ "step": 975
1376
+ },
1377
+ {
1378
+ "epoch": 2.0941176470588236,
1379
+ "grad_norm": 2.2861719131469727,
1380
+ "learning_rate": 2.2191506843094628e-06,
1381
+ "loss": 0.0254,
1382
+ "step": 980
1383
+ },
1384
+ {
1385
+ "epoch": 2.104812834224599,
1386
+ "grad_norm": 1.3212783336639404,
1387
+ "learning_rate": 2.1713781219250157e-06,
1388
+ "loss": 0.022,
1389
+ "step": 985
1390
+ },
1391
+ {
1392
+ "epoch": 2.1155080213903745,
1393
+ "grad_norm": 1.6825640201568604,
1394
+ "learning_rate": 2.1239823445179236e-06,
1395
+ "loss": 0.0216,
1396
+ "step": 990
1397
+ },
1398
+ {
1399
+ "epoch": 2.1262032085561495,
1400
+ "grad_norm": 2.0671329498291016,
1401
+ "learning_rate": 2.076969665415908e-06,
1402
+ "loss": 0.0211,
1403
+ "step": 995
1404
+ },
1405
+ {
1406
+ "epoch": 2.136898395721925,
1407
+ "grad_norm": 1.9904191493988037,
1408
+ "learning_rate": 2.0303463469163004e-06,
1409
+ "loss": 0.0246,
1410
+ "step": 1000
1411
+ },
1412
+ {
1413
+ "epoch": 2.1475935828877004,
1414
+ "grad_norm": 1.6527910232543945,
1415
+ "learning_rate": 1.984118599451866e-06,
1416
+ "loss": 0.024,
1417
+ "step": 1005
1418
+ },
1419
+ {
1420
+ "epoch": 2.158288770053476,
1421
+ "grad_norm": 1.7971508502960205,
1422
+ "learning_rate": 1.938292580763561e-06,
1423
+ "loss": 0.025,
1424
+ "step": 1010
1425
+ },
1426
+ {
1427
+ "epoch": 2.1689839572192513,
1428
+ "grad_norm": 1.7470921277999878,
1429
+ "learning_rate": 1.8928743950802863e-06,
1430
+ "loss": 0.0295,
1431
+ "step": 1015
1432
+ },
1433
+ {
1434
+ "epoch": 2.1796791443850267,
1435
+ "grad_norm": 1.0844634771347046,
1436
+ "learning_rate": 1.847870092305773e-06,
1437
+ "loss": 0.0158,
1438
+ "step": 1020
1439
+ },
1440
+ {
1441
+ "epoch": 2.190374331550802,
1442
+ "grad_norm": 1.632693886756897,
1443
+ "learning_rate": 1.8032856672127191e-06,
1444
+ "loss": 0.0211,
1445
+ "step": 1025
1446
+ },
1447
+ {
1448
+ "epoch": 2.2010695187165776,
1449
+ "grad_norm": 1.0532259941101074,
1450
+ "learning_rate": 1.7591270586442517e-06,
1451
+ "loss": 0.0189,
1452
+ "step": 1030
1453
+ },
1454
+ {
1455
+ "epoch": 2.211764705882353,
1456
+ "grad_norm": 1.5501878261566162,
1457
+ "learning_rate": 1.7154001487228478e-06,
1458
+ "loss": 0.0175,
1459
+ "step": 1035
1460
+ },
1461
+ {
1462
+ "epoch": 2.2224598930481285,
1463
+ "grad_norm": 1.4238228797912598,
1464
+ "learning_rate": 1.672110762066811e-06,
1465
+ "loss": 0.0215,
1466
+ "step": 1040
1467
+ },
1468
+ {
1469
+ "epoch": 2.233155080213904,
1470
+ "grad_norm": 1.4649953842163086,
1471
+ "learning_rate": 1.6292646650144072e-06,
1472
+ "loss": 0.0182,
1473
+ "step": 1045
1474
+ },
1475
+ {
1476
+ "epoch": 2.243850267379679,
1477
+ "grad_norm": 2.2017998695373535,
1478
+ "learning_rate": 1.5868675648557568e-06,
1479
+ "loss": 0.0176,
1480
+ "step": 1050
1481
+ },
1482
+ {
1483
+ "epoch": 2.2545454545454544,
1484
+ "grad_norm": 1.6893876791000366,
1485
+ "learning_rate": 1.544925109072607e-06,
1486
+ "loss": 0.02,
1487
+ "step": 1055
1488
+ },
1489
+ {
1490
+ "epoch": 2.26524064171123,
1491
+ "grad_norm": 1.3076281547546387,
1492
+ "learning_rate": 1.50344288458606e-06,
1493
+ "loss": 0.0185,
1494
+ "step": 1060
1495
+ },
1496
+ {
1497
+ "epoch": 2.2759358288770053,
1498
+ "grad_norm": 1.342536449432373,
1499
+ "learning_rate": 1.462426417012361e-06,
1500
+ "loss": 0.0165,
1501
+ "step": 1065
1502
+ },
1503
+ {
1504
+ "epoch": 2.2866310160427807,
1505
+ "grad_norm": 2.3762521743774414,
1506
+ "learning_rate": 1.4218811699268752e-06,
1507
+ "loss": 0.019,
1508
+ "step": 1070
1509
+ },
1510
+ {
1511
+ "epoch": 2.297326203208556,
1512
+ "grad_norm": 1.6990896463394165,
1513
+ "learning_rate": 1.38181254413631e-06,
1514
+ "loss": 0.0179,
1515
+ "step": 1075
1516
+ },
1517
+ {
1518
+ "epoch": 2.3080213903743316,
1519
+ "grad_norm": 1.9363665580749512,
1520
+ "learning_rate": 1.3422258769592967e-06,
1521
+ "loss": 0.0199,
1522
+ "step": 1080
1523
+ },
1524
+ {
1525
+ "epoch": 2.318716577540107,
1526
+ "grad_norm": 1.7887779474258423,
1527
+ "learning_rate": 1.3031264415154477e-06,
1528
+ "loss": 0.0194,
1529
+ "step": 1085
1530
+ },
1531
+ {
1532
+ "epoch": 2.3294117647058825,
1533
+ "grad_norm": 1.9284300804138184,
1534
+ "learning_rate": 1.2645194460229454e-06,
1535
+ "loss": 0.0213,
1536
+ "step": 1090
1537
+ },
1538
+ {
1539
+ "epoch": 2.3401069518716575,
1540
+ "grad_norm": 2.6546132564544678,
1541
+ "learning_rate": 1.2264100331047878e-06,
1542
+ "loss": 0.0216,
1543
+ "step": 1095
1544
+ },
1545
+ {
1546
+ "epoch": 2.350802139037433,
1547
+ "grad_norm": 1.0779314041137695,
1548
+ "learning_rate": 1.1888032791037697e-06,
1549
+ "loss": 0.0198,
1550
+ "step": 1100
1551
+ },
1552
+ {
1553
+ "epoch": 2.3614973262032084,
1554
+ "grad_norm": 2.0439534187316895,
1555
+ "learning_rate": 1.1517041934062834e-06,
1556
+ "loss": 0.019,
1557
+ "step": 1105
1558
+ },
1559
+ {
1560
+ "epoch": 2.372192513368984,
1561
+ "grad_norm": 1.9515999555587769,
1562
+ "learning_rate": 1.115117717775056e-06,
1563
+ "loss": 0.0169,
1564
+ "step": 1110
1565
+ },
1566
+ {
1567
+ "epoch": 2.3828877005347593,
1568
+ "grad_norm": 1.5731124877929688,
1569
+ "learning_rate": 1.0790487256908826e-06,
1570
+ "loss": 0.0219,
1571
+ "step": 1115
1572
+ },
1573
+ {
1574
+ "epoch": 2.3935828877005347,
1575
+ "grad_norm": 2.9910495281219482,
1576
+ "learning_rate": 1.043502021703449e-06,
1577
+ "loss": 0.0273,
1578
+ "step": 1120
1579
+ },
1580
+ {
1581
+ "epoch": 2.40427807486631,
1582
+ "grad_norm": 1.1649227142333984,
1583
+ "learning_rate": 1.0084823407913563e-06,
1584
+ "loss": 0.0242,
1585
+ "step": 1125
1586
+ },
1587
+ {
1588
+ "epoch": 2.4149732620320856,
1589
+ "grad_norm": 1.618787407875061,
1590
+ "learning_rate": 9.739943477313918e-07,
1591
+ "loss": 0.0171,
1592
+ "step": 1130
1593
+ },
1594
+ {
1595
+ "epoch": 2.425668449197861,
1596
+ "grad_norm": 1.1850640773773193,
1597
+ "learning_rate": 9.400426364771648e-07,
1598
+ "loss": 0.0207,
1599
+ "step": 1135
1600
+ },
1601
+ {
1602
+ "epoch": 2.4363636363636365,
1603
+ "grad_norm": 1.6684306859970093,
1604
+ "learning_rate": 9.066317295471688e-07,
1605
+ "loss": 0.0154,
1606
+ "step": 1140
1607
+ },
1608
+ {
1609
+ "epoch": 2.447058823529412,
1610
+ "grad_norm": 1.5794020891189575,
1611
+ "learning_rate": 8.737660774223655e-07,
1612
+ "loss": 0.017,
1613
+ "step": 1145
1614
+ },
1615
+ {
1616
+ "epoch": 2.4577540106951874,
1617
+ "grad_norm": 1.608679175376892,
1618
+ "learning_rate": 8.414500579533536e-07,
1619
+ "loss": 0.0174,
1620
+ "step": 1150
1621
+ },
1622
+ {
1623
+ "epoch": 2.4684491978609624,
1624
+ "grad_norm": 2.3195552825927734,
1625
+ "learning_rate": 8.096879757772297e-07,
1626
+ "loss": 0.0268,
1627
+ "step": 1155
1628
+ },
1629
+ {
1630
+ "epoch": 2.479144385026738,
1631
+ "grad_norm": 1.937566876411438,
1632
+ "learning_rate": 7.784840617441858e-07,
1633
+ "loss": 0.0192,
1634
+ "step": 1160
1635
+ },
1636
+ {
1637
+ "epoch": 2.4898395721925133,
1638
+ "grad_norm": 1.0479762554168701,
1639
+ "learning_rate": 7.47842472353939e-07,
1640
+ "loss": 0.0163,
1641
+ "step": 1165
1642
+ },
1643
+ {
1644
+ "epoch": 2.5005347593582887,
1645
+ "grad_norm": 1.6187900304794312,
1646
+ "learning_rate": 7.177672892020743e-07,
1647
+ "loss": 0.0195,
1648
+ "step": 1170
1649
+ },
1650
+ {
1651
+ "epoch": 2.511229946524064,
1652
+ "grad_norm": 2.198720932006836,
1653
+ "learning_rate": 6.882625184363534e-07,
1654
+ "loss": 0.0182,
1655
+ "step": 1175
1656
+ },
1657
+ {
1658
+ "epoch": 2.5219251336898396,
1659
+ "grad_norm": 1.8759390115737915,
1660
+ "learning_rate": 6.593320902230748e-07,
1661
+ "loss": 0.0232,
1662
+ "step": 1180
1663
+ },
1664
+ {
1665
+ "epoch": 2.532620320855615,
1666
+ "grad_norm": 1.2502473592758179,
1667
+ "learning_rate": 6.309798582235671e-07,
1668
+ "loss": 0.0178,
1669
+ "step": 1185
1670
+ },
1671
+ {
1672
+ "epoch": 2.5433155080213905,
1673
+ "grad_norm": 1.6022732257843018,
1674
+ "learning_rate": 6.032095990808567e-07,
1675
+ "loss": 0.0193,
1676
+ "step": 1190
1677
+ },
1678
+ {
1679
+ "epoch": 2.5540106951871655,
1680
+ "grad_norm": 1.390811562538147,
1681
+ "learning_rate": 5.760250119166061e-07,
1682
+ "loss": 0.0203,
1683
+ "step": 1195
1684
+ },
1685
+ {
1686
+ "epoch": 2.564705882352941,
1687
+ "grad_norm": 1.4281519651412964,
1688
+ "learning_rate": 5.494297178383729e-07,
1689
+ "loss": 0.0194,
1690
+ "step": 1200
1691
+ },
1692
+ {
1693
+ "epoch": 2.5754010695187164,
1694
+ "grad_norm": 1.2555127143859863,
1695
+ "learning_rate": 5.234272594572604e-07,
1696
+ "loss": 0.0172,
1697
+ "step": 1205
1698
+ },
1699
+ {
1700
+ "epoch": 2.586096256684492,
1701
+ "grad_norm": 2.223867654800415,
1702
+ "learning_rate": 4.980211004160306e-07,
1703
+ "loss": 0.0222,
1704
+ "step": 1210
1705
+ },
1706
+ {
1707
+ "epoch": 2.5967914438502673,
1708
+ "grad_norm": 0.8818890452384949,
1709
+ "learning_rate": 4.7321462492772975e-07,
1710
+ "loss": 0.0168,
1711
+ "step": 1215
1712
+ },
1713
+ {
1714
+ "epoch": 2.6074866310160427,
1715
+ "grad_norm": 2.0135138034820557,
1716
+ "learning_rate": 4.490111373248918e-07,
1717
+ "loss": 0.0188,
1718
+ "step": 1220
1719
+ },
1720
+ {
1721
+ "epoch": 2.618181818181818,
1722
+ "grad_norm": 2.228736400604248,
1723
+ "learning_rate": 4.2541386161939424e-07,
1724
+ "loss": 0.024,
1725
+ "step": 1225
1726
+ },
1727
+ {
1728
+ "epoch": 2.6288770053475936,
1729
+ "grad_norm": 1.993802547454834,
1730
+ "learning_rate": 4.024259410730008e-07,
1731
+ "loss": 0.0204,
1732
+ "step": 1230
1733
+ },
1734
+ {
1735
+ "epoch": 2.639572192513369,
1736
+ "grad_norm": 1.5609642267227173,
1737
+ "learning_rate": 3.800504377786651e-07,
1738
+ "loss": 0.0207,
1739
+ "step": 1235
1740
+ },
1741
+ {
1742
+ "epoch": 2.6502673796791445,
1743
+ "grad_norm": 2.098813772201538,
1744
+ "learning_rate": 3.582903322526482e-07,
1745
+ "loss": 0.0199,
1746
+ "step": 1240
1747
+ },
1748
+ {
1749
+ "epoch": 2.66096256684492,
1750
+ "grad_norm": 1.1627248525619507,
1751
+ "learning_rate": 3.371485230374988e-07,
1752
+ "loss": 0.0226,
1753
+ "step": 1245
1754
+ },
1755
+ {
1756
+ "epoch": 2.6716577540106954,
1757
+ "grad_norm": 1.6938384771347046,
1758
+ "learning_rate": 3.166278263159539e-07,
1759
+ "loss": 0.0166,
1760
+ "step": 1250
1761
+ },
1762
+ {
1763
+ "epoch": 2.682352941176471,
1764
+ "grad_norm": 2.4418842792510986,
1765
+ "learning_rate": 2.9673097553581385e-07,
1766
+ "loss": 0.0226,
1767
+ "step": 1255
1768
+ },
1769
+ {
1770
+ "epoch": 2.693048128342246,
1771
+ "grad_norm": 1.8153109550476074,
1772
+ "learning_rate": 2.7746062104583473e-07,
1773
+ "loss": 0.0164,
1774
+ "step": 1260
1775
+ },
1776
+ {
1777
+ "epoch": 2.7037433155080213,
1778
+ "grad_norm": 1.7912057638168335,
1779
+ "learning_rate": 2.588193297426844e-07,
1780
+ "loss": 0.0222,
1781
+ "step": 1265
1782
+ },
1783
+ {
1784
+ "epoch": 2.7144385026737967,
1785
+ "grad_norm": 1.2618776559829712,
1786
+ "learning_rate": 2.4080958472902873e-07,
1787
+ "loss": 0.0226,
1788
+ "step": 1270
1789
+ },
1790
+ {
1791
+ "epoch": 2.725133689839572,
1792
+ "grad_norm": 1.1699613332748413,
1793
+ "learning_rate": 2.2343378498276391e-07,
1794
+ "loss": 0.0145,
1795
+ "step": 1275
1796
+ },
1797
+ {
1798
+ "epoch": 2.7358288770053476,
1799
+ "grad_norm": 1.2414964437484741,
1800
+ "learning_rate": 2.0669424503746871e-07,
1801
+ "loss": 0.0173,
1802
+ "step": 1280
1803
+ },
1804
+ {
1805
+ "epoch": 2.746524064171123,
1806
+ "grad_norm": 1.5833706855773926,
1807
+ "learning_rate": 1.9059319467409244e-07,
1808
+ "loss": 0.0185,
1809
+ "step": 1285
1810
+ },
1811
+ {
1812
+ "epoch": 2.7572192513368985,
1813
+ "grad_norm": 1.5452425479888916,
1814
+ "learning_rate": 1.7513277862394263e-07,
1815
+ "loss": 0.0143,
1816
+ "step": 1290
1817
+ },
1818
+ {
1819
+ "epoch": 2.767914438502674,
1820
+ "grad_norm": 2.001614809036255,
1821
+ "learning_rate": 1.603150562829936e-07,
1822
+ "loss": 0.0212,
1823
+ "step": 1295
1824
+ },
1825
+ {
1826
+ "epoch": 2.778609625668449,
1827
+ "grad_norm": 1.535340428352356,
1828
+ "learning_rate": 1.4614200143756975e-07,
1829
+ "loss": 0.0156,
1830
+ "step": 1300
1831
+ },
1832
+ {
1833
+ "epoch": 2.7893048128342244,
1834
+ "grad_norm": 2.188175678253174,
1835
+ "learning_rate": 1.3261550200142415e-07,
1836
+ "loss": 0.0163,
1837
+ "step": 1305
1838
+ },
1839
+ {
1840
+ "epoch": 2.8,
1841
+ "grad_norm": 1.8125184774398804,
1842
+ "learning_rate": 1.197373597642637e-07,
1843
+ "loss": 0.0176,
1844
+ "step": 1310
1845
+ },
1846
+ {
1847
+ "epoch": 2.8106951871657753,
1848
+ "grad_norm": 1.2068591117858887,
1849
+ "learning_rate": 1.0750929015174216e-07,
1850
+ "loss": 0.0127,
1851
+ "step": 1315
1852
+ },
1853
+ {
1854
+ "epoch": 2.8213903743315507,
1855
+ "grad_norm": 2.0283000469207764,
1856
+ "learning_rate": 9.593292199695403e-08,
1857
+ "loss": 0.0166,
1858
+ "step": 1320
1859
+ },
1860
+ {
1861
+ "epoch": 2.832085561497326,
1862
+ "grad_norm": 1.5842273235321045,
1863
+ "learning_rate": 8.500979732347259e-08,
1864
+ "loss": 0.0189,
1865
+ "step": 1325
1866
+ },
1867
+ {
1868
+ "epoch": 2.8427807486631016,
1869
+ "grad_norm": 1.509087085723877,
1870
+ "learning_rate": 7.47413711399414e-08,
1871
+ "loss": 0.0178,
1872
+ "step": 1330
1873
+ },
1874
+ {
1875
+ "epoch": 2.853475935828877,
1876
+ "grad_norm": 1.6988673210144043,
1877
+ "learning_rate": 6.51290112462627e-08,
1878
+ "loss": 0.0139,
1879
+ "step": 1335
1880
+ },
1881
+ {
1882
+ "epoch": 2.8641711229946525,
1883
+ "grad_norm": 1.3389947414398193,
1884
+ "learning_rate": 5.617399805139867e-08,
1885
+ "loss": 0.0144,
1886
+ "step": 1340
1887
+ },
1888
+ {
1889
+ "epoch": 2.874866310160428,
1890
+ "grad_norm": 1.2916324138641357,
1891
+ "learning_rate": 4.7877524402817345e-08,
1892
+ "loss": 0.0129,
1893
+ "step": 1345
1894
+ },
1895
+ {
1896
+ "epoch": 2.8855614973262034,
1897
+ "grad_norm": 1.6901161670684814,
1898
+ "learning_rate": 4.024069542759801e-08,
1899
+ "loss": 0.0191,
1900
+ "step": 1350
1901
+ },
1902
+ {
1903
+ "epoch": 2.896256684491979,
1904
+ "grad_norm": 2.0415706634521484,
1905
+ "learning_rate": 3.3264528385225094e-08,
1906
+ "loss": 0.0169,
1907
+ "step": 1355
1908
+ },
1909
+ {
1910
+ "epoch": 2.9069518716577543,
1911
+ "grad_norm": 1.594831943511963,
1912
+ "learning_rate": 2.6949952532083768e-08,
1913
+ "loss": 0.0157,
1914
+ "step": 1360
1915
+ },
1916
+ {
1917
+ "epoch": 2.9176470588235293,
1918
+ "grad_norm": 1.7152241468429565,
1919
+ "learning_rate": 2.1297808997678417e-08,
1920
+ "loss": 0.0194,
1921
+ "step": 1365
1922
+ },
1923
+ {
1924
+ "epoch": 2.9283422459893047,
1925
+ "grad_norm": 1.6763319969177246,
1926
+ "learning_rate": 1.6308850672591692e-08,
1927
+ "loss": 0.0148,
1928
+ "step": 1370
1929
+ },
1930
+ {
1931
+ "epoch": 2.93903743315508,
1932
+ "grad_norm": 1.905222773551941,
1933
+ "learning_rate": 1.1983742108195862e-08,
1934
+ "loss": 0.0168,
1935
+ "step": 1375
1936
+ },
1937
+ {
1938
+ "epoch": 2.9497326203208556,
1939
+ "grad_norm": 0.8023597002029419,
1940
+ "learning_rate": 8.323059428130831e-09,
1941
+ "loss": 0.0153,
1942
+ "step": 1380
1943
+ },
1944
+ {
1945
+ "epoch": 2.960427807486631,
1946
+ "grad_norm": 1.5736637115478516,
1947
+ "learning_rate": 5.3272902515622e-09,
1948
+ "loss": 0.0208,
1949
+ "step": 1385
1950
+ },
1951
+ {
1952
+ "epoch": 2.9711229946524065,
1953
+ "grad_norm": 1.540812373161316,
1954
+ "learning_rate": 2.996833628228779e-09,
1955
+ "loss": 0.017,
1956
+ "step": 1390
1957
+ },
1958
+ {
1959
+ "epoch": 2.981818181818182,
1960
+ "grad_norm": 1.0774410963058472,
1961
+ "learning_rate": 1.3319999852867692e-09,
1962
+ "loss": 0.0144,
1963
+ "step": 1395
1964
+ },
1965
+ {
1966
+ "epoch": 2.9925133689839574,
1967
+ "grad_norm": 1.853932499885559,
1968
+ "learning_rate": 3.330110859600666e-10,
1969
+ "loss": 0.02,
1970
+ "step": 1400
1971
+ },
1972
+ {
1973
+ "epoch": 3.0,
1974
+ "step": 1404,
1975
+ "total_flos": 1.0868263403315528e+18,
1976
+ "train_loss": 0.12404776059961387,
1977
+ "train_runtime": 1235.844,
1978
+ "train_samples_per_second": 72.563,
1979
+ "train_steps_per_second": 1.136
1980
+ }
1981
+ ],
1982
+ "logging_steps": 5,
1983
+ "max_steps": 1404,
1984
+ "num_input_tokens_seen": 0,
1985
+ "num_train_epochs": 3,
1986
+ "save_steps": 500,
1987
+ "stateful_callbacks": {
1988
+ "TrainerControl": {
1989
+ "args": {
1990
+ "should_epoch_stop": false,
1991
+ "should_evaluate": false,
1992
+ "should_log": false,
1993
+ "should_save": true,
1994
+ "should_training_stop": true
1995
+ },
1996
+ "attributes": {}
1997
+ }
1998
+ },
1999
+ "total_flos": 1.0868263403315528e+18,
2000
+ "train_batch_size": 4,
2001
+ "trial_name": null,
2002
+ "trial_params": null
2003
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:48da39cfc05cefbe97979354d6740c1e47eabd2e92aaed966809ac0d2147850c
3
+ size 7825
training_loss.png ADDED
vocab.json ADDED
The diff for this file is too large to render. See raw diff