DatPySci commited on
Commit
1587618
·
verified ·
1 Parent(s): 7b03500

Delete Qwen3.4B-Math-R1-CoT-SFT

Browse files
Qwen3.4B-Math-R1-CoT-SFT/README.md DELETED
@@ -1,61 +0,0 @@
1
- ---
2
- library_name: transformers
3
- license: other
4
- base_model: models/SDAR-4B-Base
5
- tags:
6
- - llama-factory
7
- - full
8
- - generated_from_trainer
9
- model-index:
10
- - name: sft_block_4
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_block_4
18
-
19
- This model is a fine-tuned version of [models/SDAR-4B-Base](https://huggingface.co/models/SDAR-4B-Base) on the open_thoughts 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: 5e-05
39
- - train_batch_size: 2
40
- - eval_batch_size: 8
41
- - seed: 42
42
- - distributed_type: multi-GPU
43
- - num_devices: 2
44
- - gradient_accumulation_steps: 16
45
- - total_train_batch_size: 64
46
- - total_eval_batch_size: 16
47
- - optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED 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.05
50
- - num_epochs: 4.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.4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/added_tokens.json DELETED
@@ -1,29 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/all_results.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "effective_tokens_per_sec": 16342.776477265266,
3
- "epoch": 3.9988184324537217,
4
- "total_flos": 4.3565600076592054e+19,
5
- "train_loss": 1.895302517482642,
6
- "train_runtime": 61070.1581,
7
- "train_samples_per_second": 2.661,
8
- "train_steps_per_second": 0.042
9
- }
 
 
 
 
 
 
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/chat_template.jinja DELETED
@@ -1,85 +0,0 @@
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 %}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/config.json DELETED
@@ -1,43 +0,0 @@
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": true,
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/configuration_sdar.py DELETED
@@ -1,212 +0,0 @@
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"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/fused_linear_diffusion_cross_entropy.py DELETED
@@ -1,682 +0,0 @@
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
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/generation_config.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "_from_model_config": true,
3
- "bos_token_id": 151643,
4
- "eos_token_id": 151643,
5
- "transformers_version": "4.52.4",
6
- "use_cache": false
7
- }
 
 
 
 
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/merges.txt DELETED
The diff for this file is too large to render. See raw diff
 
Qwen3.4B-Math-R1-CoT-SFT/model-00001-of-00002.safetensors DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:3cf721838f56081281667205fd4e2d29858a804aad837977f092eb179b428b35
3
- size 4967215360
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/model-00002-of-00002.safetensors DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:309f36d853f5db682e8771eceee6fb90e8a963e9f64e0f8e8bb12178c7ce5baa
3
- size 3855679144
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/model.safetensors.index.json DELETED
@@ -1,406 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/modeling_sdar.py DELETED
@@ -1,1233 +0,0 @@
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
- @torch.compile(fullgraph=True, mode="max-autotune-no-cudagraphs")
351
- def fused_flex_attention(query, key, value, attention_mask, **kwargs):
352
- return flex_attention(query, key, value, block_mask=attention_mask, **kwargs)
353
-
354
-
355
- @use_kernel_forward_from_hub("RMSNorm")
356
- class SDARRMSNorm(nn.Module):
357
- def __init__(self, hidden_size, eps=1e-6):
358
- """
359
- SDARRMSNorm is equivalent to T5LayerNorm
360
- """
361
- super().__init__()
362
- self.weight = nn.Parameter(torch.ones(hidden_size))
363
- self.variance_epsilon = eps
364
-
365
- def forward(self, hidden_states):
366
- return flash_rms_norm(
367
- hidden_states, weight=self.weight, bias=None, eps=self.variance_epsilon)
368
- '''
369
- input_dtype = hidden_states.dtype
370
- hidden_states = hidden_states.to(torch.float32)
371
- variance = hidden_states.pow(2).mean(-1, keepdim=True)
372
- hidden_states = hidden_states * \
373
- torch.rsqrt(variance + self.variance_epsilon)
374
- return self.weight * hidden_states.to(input_dtype)
375
- '''
376
-
377
- def extra_repr(self):
378
- return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}"
379
-
380
-
381
- class SDARMLP(nn.Module):
382
- def __init__(self, config):
383
- super().__init__()
384
- self.config = config
385
- self.hidden_size = config.hidden_size
386
- self.intermediate_size = config.intermediate_size
387
- self.gate_proj = nn.Linear(
388
- self.hidden_size, self.intermediate_size, bias=False)
389
- self.up_proj = nn.Linear(
390
- self.hidden_size, self.intermediate_size, bias=False)
391
- self.down_proj = nn.Linear(
392
- self.intermediate_size, self.hidden_size, bias=False)
393
- self.act_fn = ACT2FN[config.hidden_act]
394
-
395
- def forward(self, x):
396
- if liger_kernel_is_available:
397
- return self.down_proj(LigerSiLUMulFunction.apply(self.gate_proj(x), self.up_proj(x)))
398
- else:
399
- down_proj = self.down_proj(self.act_fn(
400
- self.gate_proj(x)) * self.up_proj(x))
401
- return down_proj
402
-
403
-
404
- def rotate_half(x):
405
- """Rotates half the hidden dims of the input."""
406
- x1 = x[..., : x.shape[-1] // 2]
407
- x2 = x[..., x.shape[-1] // 2:]
408
- return torch.cat((-x2, x1), dim=-1)
409
-
410
-
411
- def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_dim=1):
412
- """Applies Rotary Position Embedding to the query and key tensors.
413
-
414
- Args:
415
- q (`torch.Tensor`): The query tensor.
416
- k (`torch.Tensor`): The key tensor.
417
- cos (`torch.Tensor`): The cosine part of the rotary embedding.
418
- sin (`torch.Tensor`): The sine part of the rotary embedding.
419
- position_ids (`torch.Tensor`, *optional*):
420
- Deprecated and unused.
421
- unsqueeze_dim (`int`, *optional*, defaults to 1):
422
- The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
423
- sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
424
- that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
425
- k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
426
- cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
427
- the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
428
- Returns:
429
- `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
430
- """
431
- cos = cos.unsqueeze(unsqueeze_dim)
432
- sin = sin.unsqueeze(unsqueeze_dim)
433
- q_embed = (q * cos) + (rotate_half(q) * sin)
434
- k_embed = (k * cos) + (rotate_half(k) * sin)
435
- return q_embed, k_embed
436
-
437
-
438
- def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
439
- """
440
- This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
441
- num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
442
- """
443
- batch, num_key_value_heads, slen, head_dim = hidden_states.shape
444
- if n_rep == 1:
445
- return hidden_states
446
- hidden_states = hidden_states[:, :, None, :, :].expand(
447
- batch, num_key_value_heads, n_rep, slen, head_dim)
448
- return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
449
-
450
-
451
- def eager_attention_forward(
452
- module: nn.Module,
453
- query: torch.Tensor,
454
- key: torch.Tensor,
455
- value: torch.Tensor,
456
- attention_mask: Optional[torch.Tensor],
457
- scaling: float,
458
- dropout: float = 0.0,
459
- **kwargs,
460
- ):
461
- key_states = repeat_kv(key, module.num_key_value_groups)
462
- value_states = repeat_kv(value, module.num_key_value_groups)
463
-
464
- attn_weights = torch.matmul(query, key_states.transpose(2, 3)) * scaling
465
- if attention_mask is not None:
466
- causal_mask = attention_mask[:, :, :, : key_states.shape[-2]]
467
- attn_weights = attn_weights + causal_mask
468
-
469
- attn_weights = nn.functional.softmax(
470
- attn_weights, dim=-1, dtype=torch.float32).to(query.dtype)
471
- attn_weights = nn.functional.dropout(
472
- attn_weights, p=dropout, training=module.training)
473
- attn_output = torch.matmul(attn_weights, value_states)
474
- attn_output = attn_output.transpose(1, 2).contiguous()
475
-
476
- return attn_output, attn_weights
477
-
478
-
479
- class SDARAttention(nn.Module):
480
- """Multi-headed attention from 'Attention Is All You Need' paper"""
481
-
482
- def __init__(self, config: SDARConfig, layer_idx: int):
483
- super().__init__()
484
- self.config = config
485
- self.layer_idx = layer_idx
486
- self.head_dim = getattr(
487
- config, "head_dim", config.hidden_size // config.num_attention_heads)
488
- self.num_key_value_groups = config.num_attention_heads // config.num_key_value_heads
489
- self.scaling = self.head_dim**-0.5
490
- self.attention_dropout = config.attention_dropout
491
- self.is_causal = True
492
-
493
- self.hidden_size = config.hidden_size
494
- self.num_attention_heads = config.num_attention_heads
495
- self.num_key_value_heads = config.num_key_value_heads
496
-
497
- self.q_proj = nn.Linear(
498
- config.hidden_size, config.num_attention_heads * self.head_dim, bias=config.attention_bias
499
- )
500
- self.k_proj = nn.Linear(
501
- config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias
502
- )
503
- self.v_proj = nn.Linear(
504
- config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias
505
- )
506
- self.o_proj = nn.Linear(
507
- config.num_attention_heads * self.head_dim, config.hidden_size, bias=config.attention_bias
508
- )
509
- # unlike olmo, only on the head dim!
510
- self.q_norm = SDARRMSNorm(self.head_dim, eps=config.rms_norm_eps)
511
- # thus post q_norm does not need reshape
512
- self.k_norm = SDARRMSNorm(self.head_dim, eps=config.rms_norm_eps)
513
- self.sliding_window = config.sliding_window
514
- if not (
515
- self.config.use_sliding_window
516
- and getattr(self.config, "sliding_window", None) is not None
517
- and self.layer_idx >= self.config.max_window_layers
518
- ):
519
- self.sliding_window = None
520
-
521
- def forward(
522
- self,
523
- hidden_states: torch.Tensor,
524
- position_embeddings: Tuple[torch.Tensor, torch.Tensor],
525
- attention_mask: Optional[torch.Tensor],
526
- past_key_value: Optional[Cache] = None,
527
- cache_position: Optional[torch.LongTensor] = None,
528
- **kwargs: Unpack[FlashAttentionKwargs],
529
- ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
530
- input_shape = hidden_states.shape[:-1]
531
- bsz, q_len = input_shape
532
- hidden_shape = (*input_shape, -1, self.head_dim)
533
-
534
- query_states = self.q_norm(self.q_proj(
535
- hidden_states).view(hidden_shape)).transpose(1, 2)
536
- key_states = self.k_norm(self.k_proj(
537
- hidden_states).view(hidden_shape)).transpose(1, 2)
538
- value_states = self.v_proj(hidden_states).view(
539
- hidden_shape).transpose(1, 2)
540
-
541
- cos, sin = position_embeddings
542
- query_states, key_states = apply_rotary_pos_emb(
543
- query_states, key_states, cos, sin)
544
-
545
- if past_key_value is not None and kwargs.get("store_kv", False):
546
- # sin and cos are specific to RoPE models; cache_position needed for the static cache
547
- key_states, value_states = past_key_value.update(
548
- key_states, value_states, self.layer_idx)
549
- elif past_key_value is not None and not kwargs.get("store_kv", False) and len(past_key_value) > self.layer_idx:
550
- # only retrive, do not store kv
551
- past_key_states, past_value_states = past_key_value[self.layer_idx]
552
- key_states = torch.cat(
553
- [past_key_states, key_states], dim=-2)
554
- value_states = torch.cat(
555
- [past_value_states, value_states], dim=-2)
556
-
557
- if self.training:
558
- attn_output, attn_weights = fused_flex_attention(
559
- query=query_states,
560
- key=key_states,
561
- value=value_states,
562
- attention_mask=attention_mask,
563
- enable_gqa=True,
564
- scale=self.scaling,
565
- return_lse=True
566
- )
567
- attn_weights = attn_weights.to(
568
- value_states.dtype) if attn_weights is not None else None
569
- attn_output = rearrange(attn_output, 'b h l d -> b l (h d)')
570
- else:
571
- attention_mask = attention_mask.bool() if attention_mask is not None else None
572
- attn_weights = None
573
- if torch.all(attention_mask): # decoding
574
- query_states = query_states.transpose(1, 2)
575
- key_states = key_states.transpose(1, 2)
576
- value_states = value_states.transpose(1, 2)
577
- attn_output = flash_attn_func(
578
- query_states,
579
- key_states,
580
- value_states,
581
- causal=False,
582
- softmax_scale=self.scaling
583
- )
584
- attn_output = rearrange(attn_output, 'b l h d -> b l (h d)')
585
- else: # prefilling
586
- attn_output = F.scaled_dot_product_attention(
587
- query=query_states,
588
- key=key_states,
589
- value=value_states,
590
- attn_mask=attention_mask,
591
- is_causal=False,
592
- scale=self.scaling,
593
- enable_gqa=True
594
- )
595
- attn_output = rearrange(attn_output, 'b h l d -> b l (h d)')
596
- attn_output = self.o_proj(attn_output)
597
- return attn_output, attn_weights # , attn_weights
598
-
599
-
600
- class SDARDecoderLayer(GradientCheckpointingLayer):
601
- def __init__(self, config: SDARConfig, layer_idx: int):
602
- super().__init__()
603
- self.hidden_size = config.hidden_size
604
- self.self_attn = SDARAttention(config=config, layer_idx=layer_idx)
605
- self.mlp = SDARMLP(config)
606
- self.input_layernorm = SDARRMSNorm(
607
- config.hidden_size, eps=config.rms_norm_eps)
608
- self.post_attention_layernorm = SDARRMSNorm(
609
- config.hidden_size, eps=config.rms_norm_eps)
610
- if (
611
- config.sliding_window and config._attn_implementation != "flash_attention_2"
612
- ): # diff with Llama is this warning
613
- logger.warning_once(
614
- f"Sliding Window Attention is enabled but not implemented for `{config._attn_implementation}`; "
615
- "unexpected results may be encountered."
616
- )
617
-
618
- def forward(
619
- self,
620
- hidden_states: torch.Tensor,
621
- attention_mask: Optional[torch.Tensor] = None,
622
- position_ids: Optional[torch.LongTensor] = None,
623
- past_key_value: Optional[Cache] = None,
624
- output_attentions: Optional[bool] = False,
625
- use_cache: Optional[bool] = False,
626
- store_kv: Optional[bool] = False,
627
- cache_position: Optional[torch.LongTensor] = None,
628
- # necessary, but kept here for BC
629
- position_embeddings: Optional[Tuple[torch.Tensor,
630
- torch.Tensor]] = None,
631
- **kwargs: Unpack[FlashAttentionKwargs],
632
- ) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
633
- residual = hidden_states
634
- hidden_states = self.input_layernorm(hidden_states)
635
-
636
- # Self Attention
637
- hidden_states, self_attn_weights = self.self_attn(
638
- hidden_states=hidden_states,
639
- attention_mask=attention_mask,
640
- position_ids=position_ids,
641
- past_key_value=past_key_value,
642
- output_attentions=output_attentions,
643
- use_cache=use_cache,
644
- store_kv=store_kv,
645
- cache_position=cache_position,
646
- position_embeddings=position_embeddings,
647
- **kwargs,
648
- )
649
- hidden_states = residual + hidden_states
650
-
651
- # Fully Connected
652
- residual = hidden_states
653
- hidden_states = self.post_attention_layernorm(hidden_states)
654
- hidden_states = self.mlp(hidden_states)
655
- hidden_states = residual + hidden_states
656
-
657
- outputs = (hidden_states,)
658
- if output_attentions:
659
- outputs += (self_attn_weights,)
660
-
661
- return outputs
662
-
663
-
664
- @auto_docstring
665
- class SDARPreTrainedModel(PreTrainedModel):
666
- config_class = SDARConfig
667
- base_model_prefix = "model"
668
- supports_gradient_checkpointing = True
669
- _no_split_modules = ["SDARDecoderLayer"]
670
- _skip_keys_device_placement = ["past_key_values"]
671
- _supports_flash_attn_2 = True
672
- _supports_sdpa = True
673
- _supports_flex_attn = True
674
- _supports_cache_class = True
675
- _supports_quantized_cache = True
676
- _supports_static_cache = True
677
- _supports_attention_backend = True
678
-
679
- def _init_weights(self, module):
680
- std = self.config.initializer_range
681
- if isinstance(module, nn.Linear):
682
- module.weight.data.normal_(mean=0.0, std=std)
683
- if module.bias is not None:
684
- module.bias.data.zero_()
685
- elif isinstance(module, nn.Embedding):
686
- module.weight.data.normal_(mean=0.0, std=std)
687
- if module.padding_idx is not None:
688
- module.weight.data[module.padding_idx].zero_()
689
- elif isinstance(module, SDARRMSNorm):
690
- module.weight.data.fill_(1.0)
691
-
692
-
693
- class SDARRotaryEmbedding(nn.Module):
694
- def __init__(self, config: SDARConfig, device=None):
695
- super().__init__()
696
- # BC: "rope_type" was originally "type"
697
- if hasattr(config, "rope_scaling") and config.rope_scaling is not None:
698
- self.rope_type = config.rope_scaling.get(
699
- "rope_type", config.rope_scaling.get("type"))
700
- else:
701
- self.rope_type = "default"
702
- self.max_seq_len_cached = config.max_position_embeddings
703
- self.original_max_seq_len = config.max_position_embeddings
704
-
705
- self.config = config
706
- self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
707
-
708
- inv_freq, self.attention_scaling = self.rope_init_fn(
709
- self.config, device)
710
- self.register_buffer("inv_freq", inv_freq, persistent=False)
711
- self.original_inv_freq = self.inv_freq
712
-
713
- @torch.no_grad()
714
- # power user: used with advanced RoPE types (e.g. dynamic rope)
715
- @dynamic_rope_update
716
- def forward(self, x, position_ids):
717
- inv_freq_expanded = self.inv_freq[None, :, None].float().expand(
718
- position_ids.shape[0], -1, 1).to(x.device)
719
- position_ids_expanded = position_ids[:, None, :].float()
720
-
721
- device_type = x.device.type if isinstance(
722
- x.device.type, str) and x.device.type != "mps" else "cpu"
723
- with torch.autocast(device_type=device_type, enabled=False): # Force float32
724
- freqs = (inv_freq_expanded.float() @
725
- position_ids_expanded.float()).transpose(1, 2)
726
- emb = torch.cat((freqs, freqs), dim=-1)
727
- cos = emb.cos() * self.attention_scaling
728
- sin = emb.sin() * self.attention_scaling
729
-
730
- return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
731
-
732
-
733
- @auto_docstring
734
- class SDARModel(SDARPreTrainedModel):
735
- def __init__(self, config: SDARConfig):
736
- super().__init__(config)
737
- self.padding_idx = config.pad_token_id
738
- self.vocab_size = config.vocab_size
739
-
740
- self.embed_tokens = nn.Embedding(
741
- config.vocab_size, config.hidden_size, self.padding_idx)
742
- self.layers = nn.ModuleList(
743
- [SDARDecoderLayer(config, layer_idx)
744
- for layer_idx in range(config.num_hidden_layers)]
745
- )
746
- self.norm = SDARRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
747
- self.rotary_emb = SDARRotaryEmbedding(config=config)
748
- self.gradient_checkpointing = False
749
-
750
- # Initialize weights and apply final processing
751
- self.post_init()
752
-
753
- def get_input_embeddings(self):
754
- return self.embed_tokens
755
-
756
- def set_input_embeddings(self, value):
757
- self.embed_tokens = value
758
-
759
- @can_return_tuple
760
- @auto_docstring
761
- def forward(
762
- self,
763
- input_ids: Optional[torch.LongTensor] = None,
764
- attention_mask: Optional[torch.Tensor] = None,
765
- position_ids: Optional[torch.LongTensor] = None,
766
- past_key_values: Optional[Cache] = None,
767
- inputs_embeds: Optional[torch.FloatTensor] = None,
768
- use_cache: Optional[bool] = None,
769
- store_kv: Optional[bool] = None,
770
- output_attentions: Optional[bool] = None,
771
- output_hidden_states: Optional[bool] = None,
772
- cache_position: Optional[torch.LongTensor] = None,
773
- **flash_attn_kwargs: Unpack[FlashAttentionKwargs],
774
- ) -> BaseModelOutputWithPast:
775
- output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
776
- output_hidden_states = (
777
- output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
778
- )
779
- use_cache = use_cache if use_cache is not None else self.config.use_cache
780
-
781
- if (input_ids is None) ^ (inputs_embeds is not None):
782
- raise ValueError(
783
- "You must specify exactly one of input_ids or inputs_embeds")
784
-
785
- if self.gradient_checkpointing and self.training and use_cache:
786
- logger.warning_once(
787
- "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`."
788
- )
789
- use_cache = False
790
-
791
- # TODO (joao): remove this exception in v4.56 -- it exists for users that try to pass a legacy cache
792
- if not isinstance(past_key_values, (type(None), Cache)):
793
- raise ValueError(
794
- "The `past_key_values` should be either a `Cache` object or `None`.")
795
-
796
- if inputs_embeds is None:
797
- inputs_embeds = self.embed_tokens(input_ids)
798
-
799
- if use_cache and past_key_values is None:
800
- past_key_values = DynamicCache()
801
-
802
- if cache_position is None:
803
- past_seen_tokens = past_key_values.get_seq_length(
804
- ) if past_key_values is not None else 0
805
- cache_position = torch.arange(
806
- past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device
807
- )
808
-
809
- if position_ids is None:
810
- position_ids = cache_position.unsqueeze(0)
811
-
812
- # causal_mask = self._update_causal_mask(
813
- # attention_mask, inputs_embeds, cache_position, past_key_values, output_attentions
814
- # )
815
-
816
- hidden_states = inputs_embeds
817
-
818
- # create position embeddings to be shared across the decoder layers
819
- position_embeddings = self.rotary_emb(hidden_states, position_ids)
820
-
821
- # decoder layers
822
- all_hidden_states = () if output_hidden_states else None
823
- all_self_attns = () if output_attentions else None
824
-
825
- for decoder_layer in self.layers[: self.config.num_hidden_layers]:
826
- if output_hidden_states:
827
- all_hidden_states += (hidden_states,)
828
-
829
- layer_outputs = decoder_layer(
830
- hidden_states,
831
- attention_mask=attention_mask,
832
- position_ids=position_ids,
833
- past_key_value=past_key_values,
834
- output_attentions=output_attentions,
835
- use_cache=use_cache,
836
- store_kv=store_kv,
837
- cache_position=cache_position,
838
- position_embeddings=position_embeddings,
839
- **flash_attn_kwargs,
840
- )
841
-
842
- hidden_states = layer_outputs[0]
843
-
844
- if output_attentions:
845
- all_self_attns += (layer_outputs[1],)
846
-
847
- hidden_states = self.norm(hidden_states)
848
-
849
- # add hidden states from the last decoder layer
850
- if output_hidden_states:
851
- all_hidden_states += (hidden_states,)
852
-
853
- return BaseModelOutputWithPast(
854
- last_hidden_state=hidden_states,
855
- past_key_values=past_key_values if use_cache else None,
856
- hidden_states=all_hidden_states,
857
- attentions=all_self_attns,
858
- )
859
-
860
- def _update_causal_mask(
861
- self,
862
- attention_mask: Union[torch.Tensor, "BlockMask"],
863
- input_tensor: torch.Tensor,
864
- cache_position: torch.Tensor,
865
- past_key_values: Cache,
866
- output_attentions: bool = False,
867
- ):
868
- if self.config._attn_implementation == "flash_attention_2":
869
- if attention_mask is not None and past_key_values is not None:
870
- is_padding_right = attention_mask[:, -
871
- 1].sum().item() != input_tensor.size()[0]
872
- if is_padding_right:
873
- raise ValueError(
874
- "You are attempting to perform batched generation with padding_side='right'"
875
- " this may lead to unexpected behaviour for Flash Attention version of Qwen3. Make sure to "
876
- " call `tokenizer.padding_side = 'left'` before tokenizing the input. "
877
- )
878
- if attention_mask is not None and 0.0 in attention_mask:
879
- return attention_mask
880
- return None
881
- if self.config._attn_implementation == "flex_attention":
882
- if isinstance(attention_mask, torch.Tensor):
883
- seq_len_q, seq_len_kv = attention_mask.shape
884
- assert seq_len_q == seq_len_kv, f"got {attention_mask.shape=}"
885
- attention_mask = create_block_mask(
886
- # 2d bool tensor, shape: [2*seqlen, 2*seqlen]
887
- lambda b, h, q_idx, kv_idx: attention_mask[q_idx, kv_idx],
888
- B=None, H=None, Q_LEN=seq_len_q, KV_LEN=seq_len_kv,
889
- )
890
- else:
891
- # Here we pass in flex mask computed externally
892
- assert isinstance(attention_mask, BlockMask)
893
- return attention_mask
894
-
895
- # For SDPA, when possible, we will rely on its `is_causal` argument instead of its `attn_mask` argument, in
896
- # order to dispatch on Flash Attention 2. This feature is not compatible with static cache, as SDPA will fail
897
- # to infer the attention mask.
898
- past_seen_tokens = past_key_values.get_seq_length(
899
- ) if past_key_values is not None else 0
900
- using_static_cache = isinstance(past_key_values, StaticCache)
901
- using_sliding_window_cache = isinstance(
902
- past_key_values, SlidingWindowCache)
903
-
904
- # When output attentions is True, sdpa implementation's forward method calls the eager implementation's forward
905
- if (
906
- self.config._attn_implementation == "sdpa"
907
- and not (using_static_cache or using_sliding_window_cache)
908
- and not output_attentions
909
- ):
910
- if AttentionMaskConverter._ignore_causal_mask_sdpa(
911
- attention_mask,
912
- inputs_embeds=input_tensor,
913
- past_key_values_length=past_seen_tokens,
914
- sliding_window=self.config.sliding_window,
915
- is_training=self.training,
916
- ):
917
- return None
918
-
919
- dtype = input_tensor.dtype
920
- min_dtype = torch.finfo(dtype).min
921
- sequence_length = input_tensor.shape[1]
922
- # SlidingWindowCache or StaticCache
923
- if using_sliding_window_cache or using_static_cache:
924
- target_length = past_key_values.get_max_cache_shape()
925
- # DynamicCache or no cache
926
- else:
927
- target_length = (
928
- attention_mask.shape[-1]
929
- if isinstance(attention_mask, torch.Tensor)
930
- else past_seen_tokens + sequence_length + 1
931
- )
932
-
933
- # In case the provided `attention` mask is 2D, we generate a causal mask here (4D).
934
- causal_mask = self._prepare_4d_causal_attention_mask_with_cache_position(
935
- attention_mask,
936
- sequence_length=sequence_length,
937
- target_length=target_length,
938
- dtype=dtype,
939
- cache_position=cache_position,
940
- batch_size=input_tensor.shape[0],
941
- config=self.config,
942
- past_key_values=past_key_values,
943
- )
944
-
945
- if (
946
- self.config._attn_implementation == "sdpa"
947
- and attention_mask is not None
948
- and attention_mask.device.type in ["cuda", "xpu", "npu"]
949
- and not output_attentions
950
- ):
951
- # Attend to all tokens in fully masked rows in the causal_mask, for example the relevant first rows when
952
- # using left padding. This is required by F.scaled_dot_product_attention memory-efficient attention path.
953
- # Details: https://github.com/pytorch/pytorch/issues/110213
954
- causal_mask = AttentionMaskConverter._unmask_unattended(
955
- causal_mask, min_dtype)
956
-
957
- return causal_mask
958
-
959
- @staticmethod
960
- def _prepare_4d_causal_attention_mask_with_cache_position(
961
- attention_mask: torch.Tensor,
962
- sequence_length: int,
963
- target_length: int,
964
- dtype: torch.dtype,
965
- cache_position: torch.Tensor,
966
- batch_size: int,
967
- config: SDARConfig,
968
- past_key_values: Cache,
969
- ):
970
- """
971
- Creates a causal 4D mask of shape `(batch_size, 1, query_length, key_value_length)` from a 2D mask of shape
972
- `(batch_size, key_value_length)`, or if the input `attention_mask` is already 4D, do nothing.
973
-
974
- Args:
975
- attention_mask (`torch.Tensor`):
976
- 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)`.
977
- sequence_length (`int`):
978
- The sequence length being processed.
979
- target_length (`int`):
980
- 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.
981
- dtype (`torch.dtype`):
982
- The dtype to use for the 4D attention mask.
983
- cache_position (`torch.Tensor`):
984
- Indices depicting the position of the input sequence tokens in the sequence.
985
- batch_size (`torch.Tensor`):
986
- Batch size.
987
- config (`SDARConfig`):
988
- The model's configuration class
989
- past_key_values (`Cache`):
990
- The cache class that is being used currently to generate
991
- """
992
- if attention_mask is not None and attention_mask.dim() == 4:
993
- # In this case we assume that the mask comes already in inverted form and requires no inversion or slicing.
994
- causal_mask = attention_mask
995
- else:
996
- min_dtype = torch.finfo(dtype).min
997
- causal_mask = torch.full(
998
- (sequence_length, target_length), fill_value=min_dtype, dtype=dtype, device=cache_position.device
999
- )
1000
- diagonal_attend_mask = torch.arange(target_length, device=cache_position.device) > cache_position.reshape(
1001
- -1, 1
1002
- )
1003
- text_config = config.get_text_config()
1004
- if getattr(text_config, "use_sliding_window", True) and text_config.sliding_window is not None:
1005
- # if we have sliding window, we should not attend to tokens beyond sliding window length, so we mask them out also
1006
- # the check is needed to verify is current checkpoint was trained with sliding window or not
1007
- if not isinstance(past_key_values, SlidingWindowCache) or sequence_length > target_length:
1008
- sliding_attend_mask = torch.arange(target_length, device=cache_position.device) <= (
1009
- cache_position.reshape(-1, 1) -
1010
- text_config.sliding_window
1011
- )
1012
- diagonal_attend_mask.bitwise_or_(sliding_attend_mask)
1013
- causal_mask *= diagonal_attend_mask
1014
- causal_mask = causal_mask[None, None,
1015
- :, :].expand(batch_size, 1, -1, -1)
1016
- if attention_mask is not None:
1017
- causal_mask = causal_mask.clone() # copy to contiguous memory for in-place edit
1018
- if attention_mask.shape[-1] > target_length:
1019
- attention_mask = attention_mask[:, :target_length]
1020
- mask_length = attention_mask.shape[-1]
1021
- padding_mask = causal_mask[:, :, :, :mask_length] + attention_mask[:, None, None, :].to(
1022
- causal_mask.device
1023
- )
1024
- padding_mask = padding_mask == 0
1025
- causal_mask[:, :, :, :mask_length] = causal_mask[:, :, :, :mask_length].masked_fill(
1026
- padding_mask, min_dtype
1027
- )
1028
- return causal_mask
1029
-
1030
-
1031
- class KwargsForCausalLM(FlashAttentionKwargs, LossKwargs):
1032
- ...
1033
-
1034
-
1035
- @auto_docstring
1036
- class SDARForCausalLM(SDARPreTrainedModel, GenerationMixin):
1037
- _tied_weights_keys = ["lm_head.weight"]
1038
- _tp_plan = {"lm_head": "colwise_rep"}
1039
- _pp_plan = {"lm_head": (["hidden_states"], ["logits"])}
1040
-
1041
- def __init__(self, config):
1042
- super().__init__(config)
1043
- self.model = SDARModel(config)
1044
- self.vocab_size = config.vocab_size
1045
- self.lm_head = nn.Linear(
1046
- config.hidden_size, config.vocab_size, bias=False)
1047
-
1048
- # Initialize weights and apply final processing
1049
- self.post_init()
1050
-
1051
- def get_input_embeddings(self):
1052
- return self.model.embed_tokens
1053
-
1054
- def set_input_embeddings(self, value):
1055
- self.model.embed_tokens = value
1056
-
1057
- def get_output_embeddings(self):
1058
- return self.lm_head
1059
-
1060
- def set_output_embeddings(self, new_embeddings):
1061
- self.lm_head = new_embeddings
1062
-
1063
- def set_decoder(self, decoder):
1064
- self.model = decoder
1065
-
1066
- def get_decoder(self):
1067
- return self.model
1068
-
1069
- def prepare_for_bd_training(self, inputs_ids, position_ids, prompt_mask):
1070
- bsz, seq_len = inputs_ids.shape
1071
- num_tokens = calculate_token_nums(position_ids) # List[torch.Tensor]
1072
- noisy_inputs_ids, logits_to_keep_half, p_mask = forward_add_noise_packed(
1073
- inputs_ids=inputs_ids,
1074
- num_tokens_list=num_tokens,
1075
- prompt_mask=prompt_mask,
1076
- mask_id=self.config.mask_token_id,
1077
- )
1078
- router_noisy_part_list = []
1079
- for i in range(bsz):
1080
- cur_router_noisy_part = (torch.arange(num_tokens[i].shape[0] *2) % 2 == 0).to(inputs_ids.device)
1081
- cur_router_noisy_part = cur_router_noisy_part.repeat_interleave(num_tokens[i].repeat_interleave(2))
1082
- router_noisy_part_list.append(cur_router_noisy_part)
1083
- router_noisy_part = torch.stack(router_noisy_part_list, dim=0)
1084
-
1085
- # concated inputs_ids: (bzs, seq_len x 2)
1086
- concat_inputs_ids = inputs_ids.repeat(1, 2)
1087
- # concated logits_to_keep: (bsz, seq_len x 2)
1088
- logits_to_keep = torch.zeros(
1089
- bsz, 2 * seq_len, dtype=torch.bool, device=inputs_ids.device)
1090
- # concated position_ids: (bsz, seq_len x 2)
1091
- concat_position_ids = torch.zeros(
1092
- bsz, 2 * seq_len, dtype=position_ids.dtype, device=position_ids.device)
1093
- for i in range(bsz):
1094
- concat_inputs_ids[i][router_noisy_part[i]] = noisy_inputs_ids[i]
1095
- concat_inputs_ids[i][~router_noisy_part[i]] = inputs_ids[i]
1096
-
1097
- logits_to_keep[i][router_noisy_part[i]] = logits_to_keep_half[i]
1098
-
1099
- concat_position_ids[i][router_noisy_part[i]] = position_ids[i]
1100
- concat_position_ids[i][~router_noisy_part[i]] = position_ids[i]
1101
-
1102
- # create flex_attention mask
1103
- attention_mask = block_attn_mask(num_tokens, self.config.block_size, inputs_ids.device)
1104
- flex_attention_mask_3d = create_block_mask(
1105
- lambda b, h, q_idx, kv_idx: attention_mask[b, q_idx, kv_idx],
1106
- B=attention_mask.size(0), H=None,
1107
- Q_LEN=attention_mask.size(1), KV_LEN=attention_mask.size(2),
1108
- )
1109
-
1110
- return concat_inputs_ids, concat_position_ids, flex_attention_mask_3d, logits_to_keep_half, logits_to_keep, p_mask
1111
-
1112
- @can_return_tuple
1113
- @auto_docstring
1114
- def forward(
1115
- self,
1116
- input_ids: Optional[torch.LongTensor] = None,
1117
- attention_mask: Optional[torch.Tensor] = None,
1118
- position_ids: Optional[torch.LongTensor] = None,
1119
- past_key_values: Optional[Cache] = None,
1120
- inputs_embeds: Optional[torch.FloatTensor] = None,
1121
- labels: Optional[torch.LongTensor] = None,
1122
- use_cache: Optional[bool] = None,
1123
- output_attentions: Optional[bool] = None,
1124
- output_hidden_states: Optional[bool] = None,
1125
- cache_position: Optional[torch.LongTensor] = None,
1126
- logits_to_keep: Union[int, torch.Tensor] = 0,
1127
- **kwargs: Unpack[KwargsForCausalLM],
1128
- ) -> CausalLMOutputWithPast:
1129
- r"""
1130
- labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1131
- Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
1132
- config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
1133
- (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
1134
-
1135
- Example:
1136
-
1137
- ```python
1138
- >>> from transformers import AutoTokenizer, SDARForCausalLM
1139
-
1140
- >>> model = SDARForCausalLM.from_pretrained("DiffuOpen/SDAR-1.7B-Chat")
1141
- >>> tokenizer = AutoTokenizer.from_pretrained("DiffuOpen/SDAR-1.7B-Chat")
1142
-
1143
- >>> prompt = "Hey, are you conscious? Can you talk to me?"
1144
- >>> inputs = tokenizer(prompt, return_tensors="pt")
1145
-
1146
- >>> # Generate
1147
- >>> generate_ids = model.generate(inputs.input_ids, max_length=30)
1148
- >>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
1149
- "Hey, are you conscious? Can you talk to me?\nI'm not conscious, but I can talk to you."
1150
- ```"""
1151
- output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
1152
- output_hidden_states = (
1153
- output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
1154
- )
1155
- if self.training:
1156
- assert inputs_embeds is None, "only support input_ids during training"
1157
- prompt_mask = (labels == -100) if labels is not None else None
1158
- position_ids = modify_padded_position_ids_2d(position_ids)
1159
- 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)
1160
- outputs = self.model(
1161
- input_ids=concat_inputs_ids,
1162
- attention_mask=flex_attention_mask_3d,
1163
- position_ids=concat_position_ids,
1164
- output_attentions=output_attentions,
1165
- output_hidden_states=output_hidden_states,
1166
- return_dict=True,
1167
- cache_position=cache_position,
1168
- **kwargs,
1169
- )
1170
- hidden_states = outputs.last_hidden_state
1171
- hidden_states = hidden_states[logits_to_keep].contiguous()
1172
- assert labels is not None, "Labels must be provided for training."
1173
- answer_len = (labels != -100).sum()
1174
- loss_fct = FusedLinearDiffusionCrossEntropyLoss(reduction='sum')
1175
- loss = loss_fct( # it will return (sum_loss, unreduced_loss)
1176
- # conduct `view(-1, V)` inside the function
1177
- x=hidden_states,
1178
- target=labels[logits_to_keep_half].contiguous(),
1179
- weight=self.lm_head.weight,
1180
- bias=self.lm_head.bias,
1181
- p_mask=p_mask,
1182
- )
1183
- loss = loss / answer_len
1184
- logits = None
1185
- else:
1186
- # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
1187
- outputs: BaseModelOutputWithPast = self.model(
1188
- input_ids=input_ids,
1189
- attention_mask=attention_mask,
1190
- position_ids=position_ids,
1191
- past_key_values=past_key_values,
1192
- inputs_embeds=inputs_embeds,
1193
- use_cache=use_cache,
1194
- output_attentions=output_attentions,
1195
- output_hidden_states=output_hidden_states,
1196
- cache_position=cache_position,
1197
- **kwargs,
1198
- )
1199
-
1200
- hidden_states = outputs.last_hidden_state
1201
- # Only compute necessary logits, and do not upcast them to float if we are not computing the loss
1202
- slice_indices = slice(-logits_to_keep,
1203
- None) if isinstance(logits_to_keep, int) else logits_to_keep
1204
- hidden_states = hidden_states[:, slice_indices, :].contiguous()
1205
- fuse_linear_and_cross_entropy = self.config.fuse_cross_entropy and self.training
1206
- if fuse_linear_and_cross_entropy:
1207
- # When using fused_linear_ce_loss, we do not compute the whole logits on HBM
1208
- logits = None
1209
- else:
1210
- logits = self.lm_head(hidden_states)
1211
-
1212
- loss = None
1213
- if labels is not None:
1214
- # FusedLinearCrossEntropyLoss will be implemented by monkey patch when training
1215
- # We don't use it when inferencing
1216
- loss_fct = nn.CrossEntropyLoss() # nn.CE
1217
- loss = loss_fct(
1218
- logits.view(-1, self.config.vocab_size), labels.view(-1))
1219
-
1220
- return CausalLMOutputWithPast(
1221
- loss=loss,
1222
- logits=logits,
1223
- past_key_values=outputs.past_key_values,
1224
- hidden_states=outputs.hidden_states,
1225
- attentions=outputs.attentions,
1226
- )
1227
-
1228
-
1229
- __all__ = [
1230
- "SDARForCausalLM",
1231
- "SDARModel",
1232
- "SDARPreTrainedModel",
1233
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/special_tokens_map.json DELETED
@@ -1,39 +0,0 @@
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": "<|im_end|>",
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/tokenization_qwen2.py DELETED
@@ -1,342 +0,0 @@
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"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/tokenizer.json DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4
3
- size 11422654
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/tokenizer_config.json DELETED
@@ -1,256 +0,0 @@
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": "<|im_end|>",
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/train_results.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "effective_tokens_per_sec": 16342.776477265266,
3
- "epoch": 3.9988184324537217,
4
- "total_flos": 4.3565600076592054e+19,
5
- "train_loss": 1.895302517482642,
6
- "train_runtime": 61070.1581,
7
- "train_samples_per_second": 2.661,
8
- "train_steps_per_second": 0.042
9
- }
 
 
 
 
 
 
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/trainer_log.jsonl DELETED
The diff for this file is too large to render. See raw diff
 
Qwen3.4B-Math-R1-CoT-SFT/trainer_state.json DELETED
@@ -1,3592 +0,0 @@
1
- {
2
- "best_global_step": null,
3
- "best_metric": null,
4
- "best_model_checkpoint": null,
5
- "epoch": 3.9988184324537217,
6
- "eval_steps": 500,
7
- "global_step": 2539,
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.007877116975187082,
14
- "grad_norm": 3399.454833984375,
15
- "learning_rate": 1.5748031496062992e-06,
16
- "loss": 131.9922,
17
- "step": 5
18
- },
19
- {
20
- "epoch": 0.015754233950374164,
21
- "grad_norm": 1452.986572265625,
22
- "learning_rate": 3.5433070866141735e-06,
23
- "loss": 88.8359,
24
- "step": 10
25
- },
26
- {
27
- "epoch": 0.023631350925561245,
28
- "grad_norm": 534.6153564453125,
29
- "learning_rate": 5.511811023622048e-06,
30
- "loss": 48.5337,
31
- "step": 15
32
- },
33
- {
34
- "epoch": 0.03150846790074833,
35
- "grad_norm": 281.75048828125,
36
- "learning_rate": 7.4803149606299226e-06,
37
- "loss": 35.3826,
38
- "step": 20
39
- },
40
- {
41
- "epoch": 0.03938558487593541,
42
- "grad_norm": 87.65968322753906,
43
- "learning_rate": 9.448818897637795e-06,
44
- "loss": 27.0295,
45
- "step": 25
46
- },
47
- {
48
- "epoch": 0.04726270185112249,
49
- "grad_norm": 65.45500183105469,
50
- "learning_rate": 1.141732283464567e-05,
51
- "loss": 23.913,
52
- "step": 30
53
- },
54
- {
55
- "epoch": 0.05513981882630957,
56
- "grad_norm": 65.12550354003906,
57
- "learning_rate": 1.3385826771653545e-05,
58
- "loss": 20.433,
59
- "step": 35
60
- },
61
- {
62
- "epoch": 0.06301693580149666,
63
- "grad_norm": 20.998428344726562,
64
- "learning_rate": 1.535433070866142e-05,
65
- "loss": 18.3731,
66
- "step": 40
67
- },
68
- {
69
- "epoch": 0.07089405277668373,
70
- "grad_norm": 29.879304885864258,
71
- "learning_rate": 1.732283464566929e-05,
72
- "loss": 16.9914,
73
- "step": 45
74
- },
75
- {
76
- "epoch": 0.07877116975187082,
77
- "grad_norm": 22.706512451171875,
78
- "learning_rate": 1.9291338582677166e-05,
79
- "loss": 15.2466,
80
- "step": 50
81
- },
82
- {
83
- "epoch": 0.08664828672705789,
84
- "grad_norm": 18.713308334350586,
85
- "learning_rate": 2.125984251968504e-05,
86
- "loss": 13.814,
87
- "step": 55
88
- },
89
- {
90
- "epoch": 0.09452540370224498,
91
- "grad_norm": 29.742462158203125,
92
- "learning_rate": 2.3228346456692916e-05,
93
- "loss": 14.2114,
94
- "step": 60
95
- },
96
- {
97
- "epoch": 0.10240252067743207,
98
- "grad_norm": 29.92841339111328,
99
- "learning_rate": 2.5196850393700788e-05,
100
- "loss": 14.0749,
101
- "step": 65
102
- },
103
- {
104
- "epoch": 0.11027963765261914,
105
- "grad_norm": 17.866037368774414,
106
- "learning_rate": 2.7165354330708666e-05,
107
- "loss": 13.3448,
108
- "step": 70
109
- },
110
- {
111
- "epoch": 0.11815675462780623,
112
- "grad_norm": 26.47714614868164,
113
- "learning_rate": 2.9133858267716534e-05,
114
- "loss": 13.2347,
115
- "step": 75
116
- },
117
- {
118
- "epoch": 0.1260338716029933,
119
- "grad_norm": 22.94607162475586,
120
- "learning_rate": 3.110236220472441e-05,
121
- "loss": 12.4648,
122
- "step": 80
123
- },
124
- {
125
- "epoch": 0.13391098857818037,
126
- "grad_norm": 14.325417518615723,
127
- "learning_rate": 3.3070866141732284e-05,
128
- "loss": 12.8074,
129
- "step": 85
130
- },
131
- {
132
- "epoch": 0.14178810555336746,
133
- "grad_norm": 14.305035591125488,
134
- "learning_rate": 3.5039370078740156e-05,
135
- "loss": 12.1508,
136
- "step": 90
137
- },
138
- {
139
- "epoch": 0.14966522252855455,
140
- "grad_norm": 14.955709457397461,
141
- "learning_rate": 3.7007874015748034e-05,
142
- "loss": 12.5528,
143
- "step": 95
144
- },
145
- {
146
- "epoch": 0.15754233950374164,
147
- "grad_norm": 14.336165428161621,
148
- "learning_rate": 3.8976377952755905e-05,
149
- "loss": 11.6424,
150
- "step": 100
151
- },
152
- {
153
- "epoch": 0.16541945647892872,
154
- "grad_norm": 14.17673110961914,
155
- "learning_rate": 4.0944881889763784e-05,
156
- "loss": 12.1279,
157
- "step": 105
158
- },
159
- {
160
- "epoch": 0.17329657345411578,
161
- "grad_norm": 12.128265380859375,
162
- "learning_rate": 4.2913385826771655e-05,
163
- "loss": 11.7178,
164
- "step": 110
165
- },
166
- {
167
- "epoch": 0.18117369042930287,
168
- "grad_norm": 13.574759483337402,
169
- "learning_rate": 4.488188976377953e-05,
170
- "loss": 11.9381,
171
- "step": 115
172
- },
173
- {
174
- "epoch": 0.18905080740448996,
175
- "grad_norm": 11.064770698547363,
176
- "learning_rate": 4.6850393700787405e-05,
177
- "loss": 11.1822,
178
- "step": 120
179
- },
180
- {
181
- "epoch": 0.19692792437967704,
182
- "grad_norm": 13.90650463104248,
183
- "learning_rate": 4.881889763779528e-05,
184
- "loss": 12.0308,
185
- "step": 125
186
- },
187
- {
188
- "epoch": 0.20480504135486413,
189
- "grad_norm": 12.934874534606934,
190
- "learning_rate": 4.999991524704281e-05,
191
- "loss": 11.8371,
192
- "step": 130
193
- },
194
- {
195
- "epoch": 0.2126821583300512,
196
- "grad_norm": 11.595288276672363,
197
- "learning_rate": 4.999896178287378e-05,
198
- "loss": 11.3976,
199
- "step": 135
200
- },
201
- {
202
- "epoch": 0.22055927530523828,
203
- "grad_norm": 10.271947860717773,
204
- "learning_rate": 4.999694895387824e-05,
205
- "loss": 11.6096,
206
- "step": 140
207
- },
208
- {
209
- "epoch": 0.22843639228042537,
210
- "grad_norm": 12.979105949401855,
211
- "learning_rate": 4.999387684535255e-05,
212
- "loss": 11.5108,
213
- "step": 145
214
- },
215
- {
216
- "epoch": 0.23631350925561245,
217
- "grad_norm": 12.064156532287598,
218
- "learning_rate": 4.998974558748146e-05,
219
- "loss": 11.7928,
220
- "step": 150
221
- },
222
- {
223
- "epoch": 0.24419062623079954,
224
- "grad_norm": 12.464822769165039,
225
- "learning_rate": 4.9984555355332604e-05,
226
- "loss": 11.2361,
227
- "step": 155
228
- },
229
- {
230
- "epoch": 0.2520677432059866,
231
- "grad_norm": 11.160205841064453,
232
- "learning_rate": 4.997830636884911e-05,
233
- "loss": 11.118,
234
- "step": 160
235
- },
236
- {
237
- "epoch": 0.2599448601811737,
238
- "grad_norm": 10.261472702026367,
239
- "learning_rate": 4.997099889284021e-05,
240
- "loss": 11.6838,
241
- "step": 165
242
- },
243
- {
244
- "epoch": 0.26782197715636075,
245
- "grad_norm": 9.86904525756836,
246
- "learning_rate": 4.996263323697011e-05,
247
- "loss": 11.4614,
248
- "step": 170
249
- },
250
- {
251
- "epoch": 0.27569909413154786,
252
- "grad_norm": 10.730037689208984,
253
- "learning_rate": 4.9953209755744784e-05,
254
- "loss": 11.69,
255
- "step": 175
256
- },
257
- {
258
- "epoch": 0.2835762111067349,
259
- "grad_norm": 10.000442504882812,
260
- "learning_rate": 4.9942728848496995e-05,
261
- "loss": 11.3298,
262
- "step": 180
263
- },
264
- {
265
- "epoch": 0.29145332808192204,
266
- "grad_norm": 9.375894546508789,
267
- "learning_rate": 4.993119095936937e-05,
268
- "loss": 11.5506,
269
- "step": 185
270
- },
271
- {
272
- "epoch": 0.2993304450571091,
273
- "grad_norm": 11.61759090423584,
274
- "learning_rate": 4.991859657729557e-05,
275
- "loss": 11.0027,
276
- "step": 190
277
- },
278
- {
279
- "epoch": 0.30720756203229616,
280
- "grad_norm": 8.72737979888916,
281
- "learning_rate": 4.9904946235979574e-05,
282
- "loss": 11.1883,
283
- "step": 195
284
- },
285
- {
286
- "epoch": 0.31508467900748327,
287
- "grad_norm": 8.50748348236084,
288
- "learning_rate": 4.9890240513873064e-05,
289
- "loss": 11.0641,
290
- "step": 200
291
- },
292
- {
293
- "epoch": 0.32296179598267033,
294
- "grad_norm": 8.511228561401367,
295
- "learning_rate": 4.9874480034150915e-05,
296
- "loss": 11.1942,
297
- "step": 205
298
- },
299
- {
300
- "epoch": 0.33083891295785745,
301
- "grad_norm": 9.39171028137207,
302
- "learning_rate": 4.985766546468477e-05,
303
- "loss": 10.6584,
304
- "step": 210
305
- },
306
- {
307
- "epoch": 0.3387160299330445,
308
- "grad_norm": 7.405202865600586,
309
- "learning_rate": 4.983979751801475e-05,
310
- "loss": 11.1103,
311
- "step": 215
312
- },
313
- {
314
- "epoch": 0.34659314690823156,
315
- "grad_norm": 7.648876667022705,
316
- "learning_rate": 4.982087695131928e-05,
317
- "loss": 11.0276,
318
- "step": 220
319
- },
320
- {
321
- "epoch": 0.3544702638834187,
322
- "grad_norm": 7.407284259796143,
323
- "learning_rate": 4.9800904566382984e-05,
324
- "loss": 9.9736,
325
- "step": 225
326
- },
327
- {
328
- "epoch": 0.36234738085860574,
329
- "grad_norm": 7.161754608154297,
330
- "learning_rate": 4.9779881209562675e-05,
331
- "loss": 10.8461,
332
- "step": 230
333
- },
334
- {
335
- "epoch": 0.37022449783379285,
336
- "grad_norm": 9.168039321899414,
337
- "learning_rate": 4.975780777175154e-05,
338
- "loss": 10.7467,
339
- "step": 235
340
- },
341
- {
342
- "epoch": 0.3781016148089799,
343
- "grad_norm": 8.102660179138184,
344
- "learning_rate": 4.9734685188341376e-05,
345
- "loss": 10.8515,
346
- "step": 240
347
- },
348
- {
349
- "epoch": 0.385978731784167,
350
- "grad_norm": 8.496058464050293,
351
- "learning_rate": 4.971051443918294e-05,
352
- "loss": 10.1448,
353
- "step": 245
354
- },
355
- {
356
- "epoch": 0.3938558487593541,
357
- "grad_norm": 8.0912446975708,
358
- "learning_rate": 4.9685296548544424e-05,
359
- "loss": 10.299,
360
- "step": 250
361
- },
362
- {
363
- "epoch": 0.40173296573454115,
364
- "grad_norm": 8.432981491088867,
365
- "learning_rate": 4.965903258506806e-05,
366
- "loss": 10.3602,
367
- "step": 255
368
- },
369
- {
370
- "epoch": 0.40961008270972826,
371
- "grad_norm": 7.998964786529541,
372
- "learning_rate": 4.9631723661724836e-05,
373
- "loss": 10.3991,
374
- "step": 260
375
- },
376
- {
377
- "epoch": 0.4174871996849153,
378
- "grad_norm": 7.924742698669434,
379
- "learning_rate": 4.9603370935767324e-05,
380
- "loss": 10.7044,
381
- "step": 265
382
- },
383
- {
384
- "epoch": 0.4253643166601024,
385
- "grad_norm": 7.88558292388916,
386
- "learning_rate": 4.957397560868064e-05,
387
- "loss": 10.2436,
388
- "step": 270
389
- },
390
- {
391
- "epoch": 0.4332414336352895,
392
- "grad_norm": 7.450520038604736,
393
- "learning_rate": 4.954353892613154e-05,
394
- "loss": 10.2202,
395
- "step": 275
396
- },
397
- {
398
- "epoch": 0.44111855061047656,
399
- "grad_norm": 8.56113052368164,
400
- "learning_rate": 4.951206217791564e-05,
401
- "loss": 10.4133,
402
- "step": 280
403
- },
404
- {
405
- "epoch": 0.44899566758566367,
406
- "grad_norm": 6.7272491455078125,
407
- "learning_rate": 4.94795466979027e-05,
408
- "loss": 10.1886,
409
- "step": 285
410
- },
411
- {
412
- "epoch": 0.45687278456085073,
413
- "grad_norm": 8.858597755432129,
414
- "learning_rate": 4.94459938639802e-05,
415
- "loss": 10.2836,
416
- "step": 290
417
- },
418
- {
419
- "epoch": 0.4647499015360378,
420
- "grad_norm": 7.176908493041992,
421
- "learning_rate": 4.941140509799487e-05,
422
- "loss": 10.657,
423
- "step": 295
424
- },
425
- {
426
- "epoch": 0.4726270185112249,
427
- "grad_norm": 6.454217433929443,
428
- "learning_rate": 4.937578186569244e-05,
429
- "loss": 9.67,
430
- "step": 300
431
- },
432
- {
433
- "epoch": 0.48050413548641197,
434
- "grad_norm": 8.159943580627441,
435
- "learning_rate": 4.933912567665561e-05,
436
- "loss": 10.7037,
437
- "step": 305
438
- },
439
- {
440
- "epoch": 0.4883812524615991,
441
- "grad_norm": 7.20767879486084,
442
- "learning_rate": 4.930143808423995e-05,
443
- "loss": 9.7757,
444
- "step": 310
445
- },
446
- {
447
- "epoch": 0.49625836943678614,
448
- "grad_norm": 8.055448532104492,
449
- "learning_rate": 4.926272068550819e-05,
450
- "loss": 10.9187,
451
- "step": 315
452
- },
453
- {
454
- "epoch": 0.5041354864119733,
455
- "grad_norm": 7.440671443939209,
456
- "learning_rate": 4.922297512116248e-05,
457
- "loss": 10.756,
458
- "step": 320
459
- },
460
- {
461
- "epoch": 0.5120126033871603,
462
- "grad_norm": 7.851231098175049,
463
- "learning_rate": 4.9182203075474884e-05,
464
- "loss": 9.9799,
465
- "step": 325
466
- },
467
- {
468
- "epoch": 0.5198897203623474,
469
- "grad_norm": 7.782782077789307,
470
- "learning_rate": 4.914040627621599e-05,
471
- "loss": 10.0362,
472
- "step": 330
473
- },
474
- {
475
- "epoch": 0.5277668373375345,
476
- "grad_norm": 7.82265043258667,
477
- "learning_rate": 4.909758649458172e-05,
478
- "loss": 10.2922,
479
- "step": 335
480
- },
481
- {
482
- "epoch": 0.5356439543127215,
483
- "grad_norm": 7.081122875213623,
484
- "learning_rate": 4.905374554511825e-05,
485
- "loss": 9.93,
486
- "step": 340
487
- },
488
- {
489
- "epoch": 0.5435210712879086,
490
- "grad_norm": 7.180002212524414,
491
- "learning_rate": 4.9008885285645134e-05,
492
- "loss": 10.1384,
493
- "step": 345
494
- },
495
- {
496
- "epoch": 0.5513981882630957,
497
- "grad_norm": 8.38278579711914,
498
- "learning_rate": 4.8963007617176535e-05,
499
- "loss": 10.1262,
500
- "step": 350
501
- },
502
- {
503
- "epoch": 0.5592753052382828,
504
- "grad_norm": 7.965811729431152,
505
- "learning_rate": 4.8916114483840746e-05,
506
- "loss": 10.2287,
507
- "step": 355
508
- },
509
- {
510
- "epoch": 0.5671524222134698,
511
- "grad_norm": 6.411648750305176,
512
- "learning_rate": 4.886820787279773e-05,
513
- "loss": 9.9416,
514
- "step": 360
515
- },
516
- {
517
- "epoch": 0.575029539188657,
518
- "grad_norm": 6.27194356918335,
519
- "learning_rate": 4.8819289814154935e-05,
520
- "loss": 9.9728,
521
- "step": 365
522
- },
523
- {
524
- "epoch": 0.5829066561638441,
525
- "grad_norm": 5.867300987243652,
526
- "learning_rate": 4.876936238088127e-05,
527
- "loss": 10.0274,
528
- "step": 370
529
- },
530
- {
531
- "epoch": 0.5907837731390311,
532
- "grad_norm": 6.166661739349365,
533
- "learning_rate": 4.871842768871928e-05,
534
- "loss": 10.2888,
535
- "step": 375
536
- },
537
- {
538
- "epoch": 0.5986608901142182,
539
- "grad_norm": 6.584941387176514,
540
- "learning_rate": 4.866648789609545e-05,
541
- "loss": 9.8767,
542
- "step": 380
543
- },
544
- {
545
- "epoch": 0.6065380070894053,
546
- "grad_norm": 6.197508811950684,
547
- "learning_rate": 4.8613545204028764e-05,
548
- "loss": 10.2098,
549
- "step": 385
550
- },
551
- {
552
- "epoch": 0.6144151240645923,
553
- "grad_norm": 7.481927394866943,
554
- "learning_rate": 4.855960185603742e-05,
555
- "loss": 9.8902,
556
- "step": 390
557
- },
558
- {
559
- "epoch": 0.6222922410397794,
560
- "grad_norm": 7.165607452392578,
561
- "learning_rate": 4.850466013804377e-05,
562
- "loss": 10.2372,
563
- "step": 395
564
- },
565
- {
566
- "epoch": 0.6301693580149665,
567
- "grad_norm": 6.94336462020874,
568
- "learning_rate": 4.844872237827745e-05,
569
- "loss": 9.9813,
570
- "step": 400
571
- },
572
- {
573
- "epoch": 0.6380464749901537,
574
- "grad_norm": 6.348086833953857,
575
- "learning_rate": 4.8391790947176696e-05,
576
- "loss": 10.0216,
577
- "step": 405
578
- },
579
- {
580
- "epoch": 0.6459235919653407,
581
- "grad_norm": 6.404892444610596,
582
- "learning_rate": 4.833386825728794e-05,
583
- "loss": 10.108,
584
- "step": 410
585
- },
586
- {
587
- "epoch": 0.6538007089405278,
588
- "grad_norm": 7.904120445251465,
589
- "learning_rate": 4.8274956763163506e-05,
590
- "loss": 10.0952,
591
- "step": 415
592
- },
593
- {
594
- "epoch": 0.6616778259157149,
595
- "grad_norm": 6.545925617218018,
596
- "learning_rate": 4.821505896125769e-05,
597
- "loss": 9.8825,
598
- "step": 420
599
- },
600
- {
601
- "epoch": 0.6695549428909019,
602
- "grad_norm": 6.014336109161377,
603
- "learning_rate": 4.815417738982085e-05,
604
- "loss": 10.0608,
605
- "step": 425
606
- },
607
- {
608
- "epoch": 0.677432059866089,
609
- "grad_norm": 7.037391185760498,
610
- "learning_rate": 4.809231462879196e-05,
611
- "loss": 9.6694,
612
- "step": 430
613
- },
614
- {
615
- "epoch": 0.6853091768412761,
616
- "grad_norm": 6.266141414642334,
617
- "learning_rate": 4.802947329968921e-05,
618
- "loss": 9.5179,
619
- "step": 435
620
- },
621
- {
622
- "epoch": 0.6931862938164631,
623
- "grad_norm": 6.4194111824035645,
624
- "learning_rate": 4.7965656065498944e-05,
625
- "loss": 9.9608,
626
- "step": 440
627
- },
628
- {
629
- "epoch": 0.7010634107916502,
630
- "grad_norm": 6.709506511688232,
631
- "learning_rate": 4.7900865630562786e-05,
632
- "loss": 9.8622,
633
- "step": 445
634
- },
635
- {
636
- "epoch": 0.7089405277668374,
637
- "grad_norm": 5.767233848571777,
638
- "learning_rate": 4.783510474046308e-05,
639
- "loss": 9.3161,
640
- "step": 450
641
- },
642
- {
643
- "epoch": 0.7168176447420245,
644
- "grad_norm": 5.416118621826172,
645
- "learning_rate": 4.77683761819065e-05,
646
- "loss": 9.719,
647
- "step": 455
648
- },
649
- {
650
- "epoch": 0.7246947617172115,
651
- "grad_norm": 6.180813789367676,
652
- "learning_rate": 4.7700682782606015e-05,
653
- "loss": 9.9941,
654
- "step": 460
655
- },
656
- {
657
- "epoch": 0.7325718786923986,
658
- "grad_norm": 5.783968448638916,
659
- "learning_rate": 4.763202741116098e-05,
660
- "loss": 10.4704,
661
- "step": 465
662
- },
663
- {
664
- "epoch": 0.7404489956675857,
665
- "grad_norm": 5.99013614654541,
666
- "learning_rate": 4.756241297693566e-05,
667
- "loss": 9.3854,
668
- "step": 470
669
- },
670
- {
671
- "epoch": 0.7483261126427727,
672
- "grad_norm": 6.445564270019531,
673
- "learning_rate": 4.749184242993587e-05,
674
- "loss": 9.835,
675
- "step": 475
676
- },
677
- {
678
- "epoch": 0.7562032296179598,
679
- "grad_norm": 5.977458477020264,
680
- "learning_rate": 4.742031876068402e-05,
681
- "loss": 10.2198,
682
- "step": 480
683
- },
684
- {
685
- "epoch": 0.7640803465931469,
686
- "grad_norm": 7.140058517456055,
687
- "learning_rate": 4.734784500009237e-05,
688
- "loss": 9.456,
689
- "step": 485
690
- },
691
- {
692
- "epoch": 0.771957463568334,
693
- "grad_norm": 6.452182769775391,
694
- "learning_rate": 4.727442421933456e-05,
695
- "loss": 9.904,
696
- "step": 490
697
- },
698
- {
699
- "epoch": 0.7798345805435211,
700
- "grad_norm": 5.870535373687744,
701
- "learning_rate": 4.720005952971551e-05,
702
- "loss": 9.9197,
703
- "step": 495
704
- },
705
- {
706
- "epoch": 0.7877116975187082,
707
- "grad_norm": 6.265655040740967,
708
- "learning_rate": 4.7124754082539546e-05,
709
- "loss": 9.8827,
710
- "step": 500
711
- },
712
- {
713
- "epoch": 0.7955888144938952,
714
- "grad_norm": 6.607460975646973,
715
- "learning_rate": 4.704851106897689e-05,
716
- "loss": 9.6845,
717
- "step": 505
718
- },
719
- {
720
- "epoch": 0.8034659314690823,
721
- "grad_norm": 7.221487045288086,
722
- "learning_rate": 4.6971333719928354e-05,
723
- "loss": 9.9776,
724
- "step": 510
725
- },
726
- {
727
- "epoch": 0.8113430484442694,
728
- "grad_norm": 6.316247463226318,
729
- "learning_rate": 4.6893225305888556e-05,
730
- "loss": 9.2224,
731
- "step": 515
732
- },
733
- {
734
- "epoch": 0.8192201654194565,
735
- "grad_norm": 5.804502010345459,
736
- "learning_rate": 4.68141891368072e-05,
737
- "loss": 9.8942,
738
- "step": 520
739
- },
740
- {
741
- "epoch": 0.8270972823946435,
742
- "grad_norm": 6.048508644104004,
743
- "learning_rate": 4.6734228561948864e-05,
744
- "loss": 9.9273,
745
- "step": 525
746
- },
747
- {
748
- "epoch": 0.8349743993698306,
749
- "grad_norm": 5.967385768890381,
750
- "learning_rate": 4.6653346969751096e-05,
751
- "loss": 9.8039,
752
- "step": 530
753
- },
754
- {
755
- "epoch": 0.8428515163450178,
756
- "grad_norm": 5.828855514526367,
757
- "learning_rate": 4.65715477876808e-05,
758
- "loss": 9.5876,
759
- "step": 535
760
- },
761
- {
762
- "epoch": 0.8507286333202048,
763
- "grad_norm": 6.0214314460754395,
764
- "learning_rate": 4.6488834482088965e-05,
765
- "loss": 9.478,
766
- "step": 540
767
- },
768
- {
769
- "epoch": 0.8586057502953919,
770
- "grad_norm": 6.222189903259277,
771
- "learning_rate": 4.640521055806383e-05,
772
- "loss": 9.6082,
773
- "step": 545
774
- },
775
- {
776
- "epoch": 0.866482867270579,
777
- "grad_norm": 6.3668437004089355,
778
- "learning_rate": 4.632067955928231e-05,
779
- "loss": 9.515,
780
- "step": 550
781
- },
782
- {
783
- "epoch": 0.874359984245766,
784
- "grad_norm": 6.134618282318115,
785
- "learning_rate": 4.6235245067859825e-05,
786
- "loss": 9.7517,
787
- "step": 555
788
- },
789
- {
790
- "epoch": 0.8822371012209531,
791
- "grad_norm": 6.289186000823975,
792
- "learning_rate": 4.614891070419855e-05,
793
- "loss": 9.7513,
794
- "step": 560
795
- },
796
- {
797
- "epoch": 0.8901142181961402,
798
- "grad_norm": 6.570099830627441,
799
- "learning_rate": 4.606168012683394e-05,
800
- "loss": 9.5023,
801
- "step": 565
802
- },
803
- {
804
- "epoch": 0.8979913351713273,
805
- "grad_norm": 6.501761436462402,
806
- "learning_rate": 4.5973557032279726e-05,
807
- "loss": 9.7911,
808
- "step": 570
809
- },
810
- {
811
- "epoch": 0.9058684521465143,
812
- "grad_norm": 6.731903553009033,
813
- "learning_rate": 4.588454515487125e-05,
814
- "loss": 9.2721,
815
- "step": 575
816
- },
817
- {
818
- "epoch": 0.9137455691217015,
819
- "grad_norm": 6.2406086921691895,
820
- "learning_rate": 4.5794648266607254e-05,
821
- "loss": 9.2431,
822
- "step": 580
823
- },
824
- {
825
- "epoch": 0.9216226860968886,
826
- "grad_norm": 8.897172927856445,
827
- "learning_rate": 4.570387017699e-05,
828
- "loss": 9.4321,
829
- "step": 585
830
- },
831
- {
832
- "epoch": 0.9294998030720756,
833
- "grad_norm": 6.036581039428711,
834
- "learning_rate": 4.561221473286384e-05,
835
- "loss": 10.3099,
836
- "step": 590
837
- },
838
- {
839
- "epoch": 0.9373769200472627,
840
- "grad_norm": 5.789550304412842,
841
- "learning_rate": 4.551968581825222e-05,
842
- "loss": 10.217,
843
- "step": 595
844
- },
845
- {
846
- "epoch": 0.9452540370224498,
847
- "grad_norm": 6.0984110832214355,
848
- "learning_rate": 4.5426287354193095e-05,
849
- "loss": 9.667,
850
- "step": 600
851
- },
852
- {
853
- "epoch": 0.9531311539976368,
854
- "grad_norm": 6.172824382781982,
855
- "learning_rate": 4.533202329857271e-05,
856
- "loss": 9.7751,
857
- "step": 605
858
- },
859
- {
860
- "epoch": 0.9610082709728239,
861
- "grad_norm": 6.124137878417969,
862
- "learning_rate": 4.523689764595797e-05,
863
- "loss": 9.4172,
864
- "step": 610
865
- },
866
- {
867
- "epoch": 0.968885387948011,
868
- "grad_norm": 5.909232139587402,
869
- "learning_rate": 4.5140914427427094e-05,
870
- "loss": 9.2955,
871
- "step": 615
872
- },
873
- {
874
- "epoch": 0.9767625049231982,
875
- "grad_norm": 5.878952503204346,
876
- "learning_rate": 4.504407771039883e-05,
877
- "loss": 9.4788,
878
- "step": 620
879
- },
880
- {
881
- "epoch": 0.9846396218983852,
882
- "grad_norm": 7.975442886352539,
883
- "learning_rate": 4.494639159846006e-05,
884
- "loss": 9.15,
885
- "step": 625
886
- },
887
- {
888
- "epoch": 0.9925167388735723,
889
- "grad_norm": 6.191237449645996,
890
- "learning_rate": 4.484786023119194e-05,
891
- "loss": 10.031,
892
- "step": 630
893
- },
894
- {
895
- "epoch": 1.0,
896
- "grad_norm": 5.575296401977539,
897
- "learning_rate": 4.474848778399446e-05,
898
- "loss": 9.1086,
899
- "step": 635
900
- },
901
- {
902
- "epoch": 1.007877116975187,
903
- "grad_norm": 5.996377944946289,
904
- "learning_rate": 4.464827846790952e-05,
905
- "loss": 9.3717,
906
- "step": 640
907
- },
908
- {
909
- "epoch": 1.0157542339503742,
910
- "grad_norm": 5.924043655395508,
911
- "learning_rate": 4.454723652944246e-05,
912
- "loss": 9.4512,
913
- "step": 645
914
- },
915
- {
916
- "epoch": 1.0236313509255612,
917
- "grad_norm": 6.695152282714844,
918
- "learning_rate": 4.4445366250382106e-05,
919
- "loss": 8.4621,
920
- "step": 650
921
- },
922
- {
923
- "epoch": 1.0315084679007482,
924
- "grad_norm": 7.838866233825684,
925
- "learning_rate": 4.434267194761936e-05,
926
- "loss": 9.3423,
927
- "step": 655
928
- },
929
- {
930
- "epoch": 1.0393855848759355,
931
- "grad_norm": 5.655851364135742,
932
- "learning_rate": 4.423915797296425e-05,
933
- "loss": 9.2772,
934
- "step": 660
935
- },
936
- {
937
- "epoch": 1.0472627018511225,
938
- "grad_norm": 6.232006072998047,
939
- "learning_rate": 4.413482871296148e-05,
940
- "loss": 9.1979,
941
- "step": 665
942
- },
943
- {
944
- "epoch": 1.0551398188263095,
945
- "grad_norm": 5.975604057312012,
946
- "learning_rate": 4.402968858870459e-05,
947
- "loss": 9.4245,
948
- "step": 670
949
- },
950
- {
951
- "epoch": 1.0630169358014967,
952
- "grad_norm": 8.961718559265137,
953
- "learning_rate": 4.39237420556486e-05,
954
- "loss": 9.2747,
955
- "step": 675
956
- },
957
- {
958
- "epoch": 1.0708940527766837,
959
- "grad_norm": 6.198498249053955,
960
- "learning_rate": 4.381699360342116e-05,
961
- "loss": 9.1819,
962
- "step": 680
963
- },
964
- {
965
- "epoch": 1.078771169751871,
966
- "grad_norm": 5.1888861656188965,
967
- "learning_rate": 4.370944775563239e-05,
968
- "loss": 8.2554,
969
- "step": 685
970
- },
971
- {
972
- "epoch": 1.086648286727058,
973
- "grad_norm": 5.546014308929443,
974
- "learning_rate": 4.360110906968305e-05,
975
- "loss": 9.2945,
976
- "step": 690
977
- },
978
- {
979
- "epoch": 1.094525403702245,
980
- "grad_norm": 5.926428318023682,
981
- "learning_rate": 4.3491982136571554e-05,
982
- "loss": 9.384,
983
- "step": 695
984
- },
985
- {
986
- "epoch": 1.1024025206774322,
987
- "grad_norm": 6.317972660064697,
988
- "learning_rate": 4.3382071580699314e-05,
989
- "loss": 8.7085,
990
- "step": 700
991
- },
992
- {
993
- "epoch": 1.1102796376526192,
994
- "grad_norm": 5.735546588897705,
995
- "learning_rate": 4.327138205967484e-05,
996
- "loss": 9.1479,
997
- "step": 705
998
- },
999
- {
1000
- "epoch": 1.1181567546278062,
1001
- "grad_norm": 5.673744201660156,
1002
- "learning_rate": 4.3159918264116334e-05,
1003
- "loss": 9.5043,
1004
- "step": 710
1005
- },
1006
- {
1007
- "epoch": 1.1260338716029934,
1008
- "grad_norm": 5.20525598526001,
1009
- "learning_rate": 4.3047684917452936e-05,
1010
- "loss": 9.1163,
1011
- "step": 715
1012
- },
1013
- {
1014
- "epoch": 1.1339109885781804,
1015
- "grad_norm": 6.533771514892578,
1016
- "learning_rate": 4.293468677572454e-05,
1017
- "loss": 8.9555,
1018
- "step": 720
1019
- },
1020
- {
1021
- "epoch": 1.1417881055533674,
1022
- "grad_norm": 5.279290676116943,
1023
- "learning_rate": 4.282092862738029e-05,
1024
- "loss": 8.6573,
1025
- "step": 725
1026
- },
1027
- {
1028
- "epoch": 1.1496652225285546,
1029
- "grad_norm": 5.301630020141602,
1030
- "learning_rate": 4.270641529307562e-05,
1031
- "loss": 8.9388,
1032
- "step": 730
1033
- },
1034
- {
1035
- "epoch": 1.1575423395037416,
1036
- "grad_norm": 7.306978225708008,
1037
- "learning_rate": 4.2591151625467986e-05,
1038
- "loss": 9.1701,
1039
- "step": 735
1040
- },
1041
- {
1042
- "epoch": 1.1654194564789286,
1043
- "grad_norm": 5.707004070281982,
1044
- "learning_rate": 4.2475142509011254e-05,
1045
- "loss": 9.3798,
1046
- "step": 740
1047
- },
1048
- {
1049
- "epoch": 1.1732965734541159,
1050
- "grad_norm": 7.129739284515381,
1051
- "learning_rate": 4.235839285974868e-05,
1052
- "loss": 9.1854,
1053
- "step": 745
1054
- },
1055
- {
1056
- "epoch": 1.1811736904293029,
1057
- "grad_norm": 9.110360145568848,
1058
- "learning_rate": 4.2240907625104606e-05,
1059
- "loss": 8.9261,
1060
- "step": 750
1061
- },
1062
- {
1063
- "epoch": 1.1890508074044899,
1064
- "grad_norm": 6.3835554122924805,
1065
- "learning_rate": 4.2122691783674786e-05,
1066
- "loss": 8.9869,
1067
- "step": 755
1068
- },
1069
- {
1070
- "epoch": 1.196927924379677,
1071
- "grad_norm": 5.634960651397705,
1072
- "learning_rate": 4.200375034501543e-05,
1073
- "loss": 8.6859,
1074
- "step": 760
1075
- },
1076
- {
1077
- "epoch": 1.204805041354864,
1078
- "grad_norm": 5.98690938949585,
1079
- "learning_rate": 4.188408834943093e-05,
1080
- "loss": 8.9667,
1081
- "step": 765
1082
- },
1083
- {
1084
- "epoch": 1.212682158330051,
1085
- "grad_norm": 5.745028972625732,
1086
- "learning_rate": 4.176371086776023e-05,
1087
- "loss": 8.3641,
1088
- "step": 770
1089
- },
1090
- {
1091
- "epoch": 1.2205592753052383,
1092
- "grad_norm": 5.545426845550537,
1093
- "learning_rate": 4.1642623001161976e-05,
1094
- "loss": 9.2566,
1095
- "step": 775
1096
- },
1097
- {
1098
- "epoch": 1.2284363922804253,
1099
- "grad_norm": 6.151079177856445,
1100
- "learning_rate": 4.152082988089834e-05,
1101
- "loss": 9.1436,
1102
- "step": 780
1103
- },
1104
- {
1105
- "epoch": 1.2363135092556123,
1106
- "grad_norm": 5.903685092926025,
1107
- "learning_rate": 4.139833666811756e-05,
1108
- "loss": 9.0897,
1109
- "step": 785
1110
- },
1111
- {
1112
- "epoch": 1.2441906262307996,
1113
- "grad_norm": 5.456060886383057,
1114
- "learning_rate": 4.127514855363524e-05,
1115
- "loss": 9.2121,
1116
- "step": 790
1117
- },
1118
- {
1119
- "epoch": 1.2520677432059866,
1120
- "grad_norm": 5.680197238922119,
1121
- "learning_rate": 4.1151270757714405e-05,
1122
- "loss": 9.1453,
1123
- "step": 795
1124
- },
1125
- {
1126
- "epoch": 1.2599448601811738,
1127
- "grad_norm": 6.367788791656494,
1128
- "learning_rate": 4.102670852984425e-05,
1129
- "loss": 9.0336,
1130
- "step": 800
1131
- },
1132
- {
1133
- "epoch": 1.2678219771563608,
1134
- "grad_norm": 5.573480606079102,
1135
- "learning_rate": 4.090146714851769e-05,
1136
- "loss": 8.6367,
1137
- "step": 805
1138
- },
1139
- {
1140
- "epoch": 1.2756990941315478,
1141
- "grad_norm": 5.5287861824035645,
1142
- "learning_rate": 4.077555192100772e-05,
1143
- "loss": 8.8872,
1144
- "step": 810
1145
- },
1146
- {
1147
- "epoch": 1.2835762111067348,
1148
- "grad_norm": 5.406901836395264,
1149
- "learning_rate": 4.0648968183142424e-05,
1150
- "loss": 8.9955,
1151
- "step": 815
1152
- },
1153
- {
1154
- "epoch": 1.291453328081922,
1155
- "grad_norm": 5.834075927734375,
1156
- "learning_rate": 4.052172129907897e-05,
1157
- "loss": 8.9981,
1158
- "step": 820
1159
- },
1160
- {
1161
- "epoch": 1.299330445057109,
1162
- "grad_norm": 6.222182273864746,
1163
- "learning_rate": 4.039381666107621e-05,
1164
- "loss": 9.2987,
1165
- "step": 825
1166
- },
1167
- {
1168
- "epoch": 1.3072075620322963,
1169
- "grad_norm": 5.359075546264648,
1170
- "learning_rate": 4.026525968926624e-05,
1171
- "loss": 8.97,
1172
- "step": 830
1173
- },
1174
- {
1175
- "epoch": 1.3150846790074833,
1176
- "grad_norm": 7.37460994720459,
1177
- "learning_rate": 4.013605583142464e-05,
1178
- "loss": 8.8287,
1179
- "step": 835
1180
- },
1181
- {
1182
- "epoch": 1.3229617959826703,
1183
- "grad_norm": 7.033757209777832,
1184
- "learning_rate": 4.000621056273971e-05,
1185
- "loss": 8.9608,
1186
- "step": 840
1187
- },
1188
- {
1189
- "epoch": 1.3308389129578575,
1190
- "grad_norm": 5.98358154296875,
1191
- "learning_rate": 3.987572938558035e-05,
1192
- "loss": 8.7479,
1193
- "step": 845
1194
- },
1195
- {
1196
- "epoch": 1.3387160299330445,
1197
- "grad_norm": 8.184402465820312,
1198
- "learning_rate": 3.974461782926299e-05,
1199
- "loss": 8.6626,
1200
- "step": 850
1201
- },
1202
- {
1203
- "epoch": 1.3465931469082315,
1204
- "grad_norm": 9.955259323120117,
1205
- "learning_rate": 3.96128814498172e-05,
1206
- "loss": 8.926,
1207
- "step": 855
1208
- },
1209
- {
1210
- "epoch": 1.3544702638834187,
1211
- "grad_norm": 6.086458683013916,
1212
- "learning_rate": 3.9480525829750295e-05,
1213
- "loss": 8.6291,
1214
- "step": 860
1215
- },
1216
- {
1217
- "epoch": 1.3623473808586057,
1218
- "grad_norm": 6.604151725769043,
1219
- "learning_rate": 3.9347556577810724e-05,
1220
- "loss": 8.8916,
1221
- "step": 865
1222
- },
1223
- {
1224
- "epoch": 1.3702244978337927,
1225
- "grad_norm": 6.385220050811768,
1226
- "learning_rate": 3.921397932875044e-05,
1227
- "loss": 8.6173,
1228
- "step": 870
1229
- },
1230
- {
1231
- "epoch": 1.37810161480898,
1232
- "grad_norm": 5.808775424957275,
1233
- "learning_rate": 3.9079799743086076e-05,
1234
- "loss": 8.8478,
1235
- "step": 875
1236
- },
1237
- {
1238
- "epoch": 1.385978731784167,
1239
- "grad_norm": 5.057977676391602,
1240
- "learning_rate": 3.8945023506859125e-05,
1241
- "loss": 8.8043,
1242
- "step": 880
1243
- },
1244
- {
1245
- "epoch": 1.3938558487593542,
1246
- "grad_norm": 5.664560794830322,
1247
- "learning_rate": 3.880965633139493e-05,
1248
- "loss": 8.517,
1249
- "step": 885
1250
- },
1251
- {
1252
- "epoch": 1.4017329657345412,
1253
- "grad_norm": 6.176719665527344,
1254
- "learning_rate": 3.867370395306068e-05,
1255
- "loss": 9.4023,
1256
- "step": 890
1257
- },
1258
- {
1259
- "epoch": 1.4096100827097282,
1260
- "grad_norm": 5.604133605957031,
1261
- "learning_rate": 3.8537172133022334e-05,
1262
- "loss": 8.819,
1263
- "step": 895
1264
- },
1265
- {
1266
- "epoch": 1.4174871996849152,
1267
- "grad_norm": 6.113736152648926,
1268
- "learning_rate": 3.840006665700049e-05,
1269
- "loss": 8.5058,
1270
- "step": 900
1271
- },
1272
- {
1273
- "epoch": 1.4253643166601024,
1274
- "grad_norm": 5.689216136932373,
1275
- "learning_rate": 3.8262393335025175e-05,
1276
- "loss": 9.0603,
1277
- "step": 905
1278
- },
1279
- {
1280
- "epoch": 1.4332414336352894,
1281
- "grad_norm": 5.811161994934082,
1282
- "learning_rate": 3.812415800118968e-05,
1283
- "loss": 8.7633,
1284
- "step": 910
1285
- },
1286
- {
1287
- "epoch": 1.4411185506104767,
1288
- "grad_norm": 6.930866241455078,
1289
- "learning_rate": 3.7985366513403275e-05,
1290
- "loss": 8.8962,
1291
- "step": 915
1292
- },
1293
- {
1294
- "epoch": 1.4489956675856637,
1295
- "grad_norm": 4.998627662658691,
1296
- "learning_rate": 3.784602475314303e-05,
1297
- "loss": 8.8133,
1298
- "step": 920
1299
- },
1300
- {
1301
- "epoch": 1.4568727845608507,
1302
- "grad_norm": 5.640780925750732,
1303
- "learning_rate": 3.7706138625204565e-05,
1304
- "loss": 8.5275,
1305
- "step": 925
1306
- },
1307
- {
1308
- "epoch": 1.4647499015360377,
1309
- "grad_norm": 6.085617542266846,
1310
- "learning_rate": 3.756571405745178e-05,
1311
- "loss": 8.2861,
1312
- "step": 930
1313
- },
1314
- {
1315
- "epoch": 1.472627018511225,
1316
- "grad_norm": 6.3180108070373535,
1317
- "learning_rate": 3.7424757000565734e-05,
1318
- "loss": 8.8205,
1319
- "step": 935
1320
- },
1321
- {
1322
- "epoch": 1.480504135486412,
1323
- "grad_norm": 7.119158744812012,
1324
- "learning_rate": 3.7283273427792407e-05,
1325
- "loss": 8.8586,
1326
- "step": 940
1327
- },
1328
- {
1329
- "epoch": 1.4883812524615991,
1330
- "grad_norm": 7.279252529144287,
1331
- "learning_rate": 3.714126933468959e-05,
1332
- "loss": 8.2839,
1333
- "step": 945
1334
- },
1335
- {
1336
- "epoch": 1.4962583694367861,
1337
- "grad_norm": 5.607680320739746,
1338
- "learning_rate": 3.6998750738872876e-05,
1339
- "loss": 9.2545,
1340
- "step": 950
1341
- },
1342
- {
1343
- "epoch": 1.5041354864119731,
1344
- "grad_norm": 5.1762590408325195,
1345
- "learning_rate": 3.6855723679760545e-05,
1346
- "loss": 9.3281,
1347
- "step": 955
1348
- },
1349
- {
1350
- "epoch": 1.5120126033871601,
1351
- "grad_norm": 5.414069652557373,
1352
- "learning_rate": 3.671219421831775e-05,
1353
- "loss": 8.5181,
1354
- "step": 960
1355
- },
1356
- {
1357
- "epoch": 1.5198897203623474,
1358
- "grad_norm": 6.324887275695801,
1359
- "learning_rate": 3.656816843679959e-05,
1360
- "loss": 9.1248,
1361
- "step": 965
1362
- },
1363
- {
1364
- "epoch": 1.5277668373375346,
1365
- "grad_norm": 6.40478515625,
1366
- "learning_rate": 3.64236524384934e-05,
1367
- "loss": 9.0107,
1368
- "step": 970
1369
- },
1370
- {
1371
- "epoch": 1.5356439543127216,
1372
- "grad_norm": 6.342474937438965,
1373
- "learning_rate": 3.627865234746014e-05,
1374
- "loss": 8.8478,
1375
- "step": 975
1376
- },
1377
- {
1378
- "epoch": 1.5435210712879086,
1379
- "grad_norm": 5.396797180175781,
1380
- "learning_rate": 3.6133174308274826e-05,
1381
- "loss": 8.8895,
1382
- "step": 980
1383
- },
1384
- {
1385
- "epoch": 1.5513981882630956,
1386
- "grad_norm": 5.2031378746032715,
1387
- "learning_rate": 3.598722448576619e-05,
1388
- "loss": 8.6624,
1389
- "step": 985
1390
- },
1391
- {
1392
- "epoch": 1.5592753052382828,
1393
- "grad_norm": 6.283775329589844,
1394
- "learning_rate": 3.584080906475542e-05,
1395
- "loss": 8.7416,
1396
- "step": 990
1397
- },
1398
- {
1399
- "epoch": 1.5671524222134698,
1400
- "grad_norm": 5.148292064666748,
1401
- "learning_rate": 3.569393424979405e-05,
1402
- "loss": 8.5302,
1403
- "step": 995
1404
- },
1405
- {
1406
- "epoch": 1.575029539188657,
1407
- "grad_norm": 5.293840408325195,
1408
- "learning_rate": 3.554660626490109e-05,
1409
- "loss": 8.4594,
1410
- "step": 1000
1411
- },
1412
- {
1413
- "epoch": 1.582906656163844,
1414
- "grad_norm": 4.885067462921143,
1415
- "learning_rate": 3.53988313532992e-05,
1416
- "loss": 8.5849,
1417
- "step": 1005
1418
- },
1419
- {
1420
- "epoch": 1.590783773139031,
1421
- "grad_norm": 5.12977933883667,
1422
- "learning_rate": 3.52506157771502e-05,
1423
- "loss": 8.2942,
1424
- "step": 1010
1425
- },
1426
- {
1427
- "epoch": 1.598660890114218,
1428
- "grad_norm": 6.016343593597412,
1429
- "learning_rate": 3.510196581728963e-05,
1430
- "loss": 8.5103,
1431
- "step": 1015
1432
- },
1433
- {
1434
- "epoch": 1.6065380070894053,
1435
- "grad_norm": 6.179079055786133,
1436
- "learning_rate": 3.495288777296067e-05,
1437
- "loss": 8.3985,
1438
- "step": 1020
1439
- },
1440
- {
1441
- "epoch": 1.6144151240645923,
1442
- "grad_norm": 6.393824100494385,
1443
- "learning_rate": 3.480338796154712e-05,
1444
- "loss": 8.5286,
1445
- "step": 1025
1446
- },
1447
- {
1448
- "epoch": 1.6222922410397795,
1449
- "grad_norm": 6.632625102996826,
1450
- "learning_rate": 3.4653472718305745e-05,
1451
- "loss": 8.713,
1452
- "step": 1030
1453
- },
1454
- {
1455
- "epoch": 1.6301693580149665,
1456
- "grad_norm": 5.532236576080322,
1457
- "learning_rate": 3.450314839609781e-05,
1458
- "loss": 8.6,
1459
- "step": 1035
1460
- },
1461
- {
1462
- "epoch": 1.6380464749901535,
1463
- "grad_norm": 5.10947322845459,
1464
- "learning_rate": 3.435242136511984e-05,
1465
- "loss": 8.7229,
1466
- "step": 1040
1467
- },
1468
- {
1469
- "epoch": 1.6459235919653405,
1470
- "grad_norm": 6.765851020812988,
1471
- "learning_rate": 3.420129801263367e-05,
1472
- "loss": 8.7038,
1473
- "step": 1045
1474
- },
1475
- {
1476
- "epoch": 1.6538007089405278,
1477
- "grad_norm": 6.051114082336426,
1478
- "learning_rate": 3.404978474269583e-05,
1479
- "loss": 8.9874,
1480
- "step": 1050
1481
- },
1482
- {
1483
- "epoch": 1.661677825915715,
1484
- "grad_norm": 5.545468807220459,
1485
- "learning_rate": 3.389788797588611e-05,
1486
- "loss": 8.7562,
1487
- "step": 1055
1488
- },
1489
- {
1490
- "epoch": 1.669554942890902,
1491
- "grad_norm": 5.190369129180908,
1492
- "learning_rate": 3.374561414903552e-05,
1493
- "loss": 8.7141,
1494
- "step": 1060
1495
- },
1496
- {
1497
- "epoch": 1.677432059866089,
1498
- "grad_norm": 5.89268684387207,
1499
- "learning_rate": 3.3592969714953464e-05,
1500
- "loss": 8.5692,
1501
- "step": 1065
1502
- },
1503
- {
1504
- "epoch": 1.685309176841276,
1505
- "grad_norm": 5.843109130859375,
1506
- "learning_rate": 3.343996114215436e-05,
1507
- "loss": 8.7083,
1508
- "step": 1070
1509
- },
1510
- {
1511
- "epoch": 1.693186293816463,
1512
- "grad_norm": 7.01223087310791,
1513
- "learning_rate": 3.328659491458348e-05,
1514
- "loss": 8.9503,
1515
- "step": 1075
1516
- },
1517
- {
1518
- "epoch": 1.7010634107916502,
1519
- "grad_norm": 5.1653666496276855,
1520
- "learning_rate": 3.31328775313422e-05,
1521
- "loss": 8.6678,
1522
- "step": 1080
1523
- },
1524
- {
1525
- "epoch": 1.7089405277668375,
1526
- "grad_norm": 4.834114074707031,
1527
- "learning_rate": 3.297881550641261e-05,
1528
- "loss": 9.2416,
1529
- "step": 1085
1530
- },
1531
- {
1532
- "epoch": 1.7168176447420245,
1533
- "grad_norm": 5.249499320983887,
1534
- "learning_rate": 3.282441536838144e-05,
1535
- "loss": 8.4502,
1536
- "step": 1090
1537
- },
1538
- {
1539
- "epoch": 1.7246947617172115,
1540
- "grad_norm": 5.539346694946289,
1541
- "learning_rate": 3.266968366016342e-05,
1542
- "loss": 8.7632,
1543
- "step": 1095
1544
- },
1545
- {
1546
- "epoch": 1.7325718786923985,
1547
- "grad_norm": 5.473989963531494,
1548
- "learning_rate": 3.251462693872403e-05,
1549
- "loss": 8.6672,
1550
- "step": 1100
1551
- },
1552
- {
1553
- "epoch": 1.7404489956675857,
1554
- "grad_norm": 5.088748455047607,
1555
- "learning_rate": 3.2359251774801616e-05,
1556
- "loss": 8.3875,
1557
- "step": 1105
1558
- },
1559
- {
1560
- "epoch": 1.7483261126427727,
1561
- "grad_norm": 5.558929920196533,
1562
- "learning_rate": 3.2203564752628956e-05,
1563
- "loss": 8.9813,
1564
- "step": 1110
1565
- },
1566
- {
1567
- "epoch": 1.75620322961796,
1568
- "grad_norm": 5.3655548095703125,
1569
- "learning_rate": 3.204757246965424e-05,
1570
- "loss": 8.9908,
1571
- "step": 1115
1572
- },
1573
- {
1574
- "epoch": 1.764080346593147,
1575
- "grad_norm": 6.439647197723389,
1576
- "learning_rate": 3.18912815362615e-05,
1577
- "loss": 8.1854,
1578
- "step": 1120
1579
- },
1580
- {
1581
- "epoch": 1.771957463568334,
1582
- "grad_norm": 5.290548324584961,
1583
- "learning_rate": 3.173469857549048e-05,
1584
- "loss": 8.9399,
1585
- "step": 1125
1586
- },
1587
- {
1588
- "epoch": 1.779834580543521,
1589
- "grad_norm": 5.242992401123047,
1590
- "learning_rate": 3.157783022275599e-05,
1591
- "loss": 8.6978,
1592
- "step": 1130
1593
- },
1594
- {
1595
- "epoch": 1.7877116975187082,
1596
- "grad_norm": 5.243824481964111,
1597
- "learning_rate": 3.14206831255667e-05,
1598
- "loss": 8.5899,
1599
- "step": 1135
1600
- },
1601
- {
1602
- "epoch": 1.7955888144938952,
1603
- "grad_norm": 6.161407947540283,
1604
- "learning_rate": 3.126326394324346e-05,
1605
- "loss": 8.4425,
1606
- "step": 1140
1607
- },
1608
- {
1609
- "epoch": 1.8034659314690824,
1610
- "grad_norm": 5.396100997924805,
1611
- "learning_rate": 3.110557934663708e-05,
1612
- "loss": 8.4716,
1613
- "step": 1145
1614
- },
1615
- {
1616
- "epoch": 1.8113430484442694,
1617
- "grad_norm": 5.102015972137451,
1618
- "learning_rate": 3.09476360178457e-05,
1619
- "loss": 8.396,
1620
- "step": 1150
1621
- },
1622
- {
1623
- "epoch": 1.8192201654194564,
1624
- "grad_norm": 5.385177135467529,
1625
- "learning_rate": 3.078944064993152e-05,
1626
- "loss": 9.0414,
1627
- "step": 1155
1628
- },
1629
- {
1630
- "epoch": 1.8270972823946434,
1631
- "grad_norm": 5.5736165046691895,
1632
- "learning_rate": 3.063099994663731e-05,
1633
- "loss": 8.5122,
1634
- "step": 1160
1635
- },
1636
- {
1637
- "epoch": 1.8349743993698306,
1638
- "grad_norm": 5.4414286613464355,
1639
- "learning_rate": 3.0472320622102207e-05,
1640
- "loss": 8.3838,
1641
- "step": 1165
1642
- },
1643
- {
1644
- "epoch": 1.8428515163450179,
1645
- "grad_norm": 5.483443737030029,
1646
- "learning_rate": 3.0313409400577264e-05,
1647
- "loss": 8.0776,
1648
- "step": 1170
1649
- },
1650
- {
1651
- "epoch": 1.8507286333202049,
1652
- "grad_norm": 5.481230735778809,
1653
- "learning_rate": 3.0154273016140504e-05,
1654
- "loss": 8.5493,
1655
- "step": 1175
1656
- },
1657
- {
1658
- "epoch": 1.8586057502953919,
1659
- "grad_norm": 5.8650312423706055,
1660
- "learning_rate": 2.999491821241148e-05,
1661
- "loss": 8.9861,
1662
- "step": 1180
1663
- },
1664
- {
1665
- "epoch": 1.8664828672705789,
1666
- "grad_norm": 5.712615013122559,
1667
- "learning_rate": 2.9835351742265622e-05,
1668
- "loss": 8.5673,
1669
- "step": 1185
1670
- },
1671
- {
1672
- "epoch": 1.8743599842457659,
1673
- "grad_norm": 5.285681247711182,
1674
- "learning_rate": 2.967558036754796e-05,
1675
- "loss": 8.4617,
1676
- "step": 1190
1677
- },
1678
- {
1679
- "epoch": 1.8822371012209531,
1680
- "grad_norm": 5.035665035247803,
1681
- "learning_rate": 2.9515610858786657e-05,
1682
- "loss": 8.1492,
1683
- "step": 1195
1684
- },
1685
- {
1686
- "epoch": 1.8901142181961403,
1687
- "grad_norm": 5.165551662445068,
1688
- "learning_rate": 2.935544999490607e-05,
1689
- "loss": 8.599,
1690
- "step": 1200
1691
- },
1692
- {
1693
- "epoch": 1.8979913351713273,
1694
- "grad_norm": 5.6296610832214355,
1695
- "learning_rate": 2.9195104562939474e-05,
1696
- "loss": 8.6841,
1697
- "step": 1205
1698
- },
1699
- {
1700
- "epoch": 1.9058684521465143,
1701
- "grad_norm": 5.5025634765625,
1702
- "learning_rate": 2.90345813577415e-05,
1703
- "loss": 8.4796,
1704
- "step": 1210
1705
- },
1706
- {
1707
- "epoch": 1.9137455691217014,
1708
- "grad_norm": 5.420698642730713,
1709
- "learning_rate": 2.8873887181700127e-05,
1710
- "loss": 8.134,
1711
- "step": 1215
1712
- },
1713
- {
1714
- "epoch": 1.9216226860968886,
1715
- "grad_norm": 5.495443344116211,
1716
- "learning_rate": 2.8713028844448464e-05,
1717
- "loss": 8.4425,
1718
- "step": 1220
1719
- },
1720
- {
1721
- "epoch": 1.9294998030720756,
1722
- "grad_norm": 5.478509902954102,
1723
- "learning_rate": 2.8552013162576186e-05,
1724
- "loss": 8.2366,
1725
- "step": 1225
1726
- },
1727
- {
1728
- "epoch": 1.9373769200472628,
1729
- "grad_norm": 5.962779521942139,
1730
- "learning_rate": 2.8390846959340638e-05,
1731
- "loss": 8.4159,
1732
- "step": 1230
1733
- },
1734
- {
1735
- "epoch": 1.9452540370224498,
1736
- "grad_norm": 7.839330673217773,
1737
- "learning_rate": 2.8229537064377735e-05,
1738
- "loss": 8.2683,
1739
- "step": 1235
1740
- },
1741
- {
1742
- "epoch": 1.9531311539976368,
1743
- "grad_norm": 5.109673023223877,
1744
- "learning_rate": 2.806809031341251e-05,
1745
- "loss": 8.6595,
1746
- "step": 1240
1747
- },
1748
- {
1749
- "epoch": 1.9610082709728238,
1750
- "grad_norm": 5.204682350158691,
1751
- "learning_rate": 2.790651354796945e-05,
1752
- "loss": 8.6676,
1753
- "step": 1245
1754
- },
1755
- {
1756
- "epoch": 1.968885387948011,
1757
- "grad_norm": 7.151166915893555,
1758
- "learning_rate": 2.7744813615082588e-05,
1759
- "loss": 8.2718,
1760
- "step": 1250
1761
- },
1762
- {
1763
- "epoch": 1.9767625049231983,
1764
- "grad_norm": 5.639292240142822,
1765
- "learning_rate": 2.7582997367005337e-05,
1766
- "loss": 8.4982,
1767
- "step": 1255
1768
- },
1769
- {
1770
- "epoch": 1.9846396218983853,
1771
- "grad_norm": 7.254332065582275,
1772
- "learning_rate": 2.742107166092015e-05,
1773
- "loss": 8.3822,
1774
- "step": 1260
1775
- },
1776
- {
1777
- "epoch": 1.9925167388735723,
1778
- "grad_norm": 5.9872307777404785,
1779
- "learning_rate": 2.7259043358647863e-05,
1780
- "loss": 8.5006,
1781
- "step": 1265
1782
- },
1783
- {
1784
- "epoch": 2.0015754233950376,
1785
- "grad_norm": 4.944819450378418,
1786
- "learning_rate": 2.709691932635701e-05,
1787
- "loss": 9.5234,
1788
- "step": 1270
1789
- },
1790
- {
1791
- "epoch": 2.0094525403702246,
1792
- "grad_norm": 4.903031349182129,
1793
- "learning_rate": 2.6934706434272794e-05,
1794
- "loss": 8.1337,
1795
- "step": 1275
1796
- },
1797
- {
1798
- "epoch": 2.0173296573454116,
1799
- "grad_norm": 5.022507667541504,
1800
- "learning_rate": 2.6772411556385966e-05,
1801
- "loss": 8.5159,
1802
- "step": 1280
1803
- },
1804
- {
1805
- "epoch": 2.0252067743205986,
1806
- "grad_norm": 5.7532525062561035,
1807
- "learning_rate": 2.6610041570161563e-05,
1808
- "loss": 7.8905,
1809
- "step": 1285
1810
- },
1811
- {
1812
- "epoch": 2.0330838912957856,
1813
- "grad_norm": 5.3462653160095215,
1814
- "learning_rate": 2.6447603356247396e-05,
1815
- "loss": 8.5373,
1816
- "step": 1290
1817
- },
1818
- {
1819
- "epoch": 2.0409610082709726,
1820
- "grad_norm": 5.146194934844971,
1821
- "learning_rate": 2.628510379818256e-05,
1822
- "loss": 8.375,
1823
- "step": 1295
1824
- },
1825
- {
1826
- "epoch": 2.04883812524616,
1827
- "grad_norm": 4.806943893432617,
1828
- "learning_rate": 2.6122549782105666e-05,
1829
- "loss": 8.4479,
1830
- "step": 1300
1831
- },
1832
- {
1833
- "epoch": 2.056715242221347,
1834
- "grad_norm": 6.281928062438965,
1835
- "learning_rate": 2.5959948196463058e-05,
1836
- "loss": 8.1086,
1837
- "step": 1305
1838
- },
1839
- {
1840
- "epoch": 2.064592359196534,
1841
- "grad_norm": 5.9106550216674805,
1842
- "learning_rate": 2.5797305931716924e-05,
1843
- "loss": 8.3172,
1844
- "step": 1310
1845
- },
1846
- {
1847
- "epoch": 2.072469476171721,
1848
- "grad_norm": 5.928641319274902,
1849
- "learning_rate": 2.5634629880053256e-05,
1850
- "loss": 8.3275,
1851
- "step": 1315
1852
- },
1853
- {
1854
- "epoch": 2.080346593146908,
1855
- "grad_norm": 5.428690433502197,
1856
- "learning_rate": 2.5471926935089835e-05,
1857
- "loss": 8.5239,
1858
- "step": 1320
1859
- },
1860
- {
1861
- "epoch": 2.0882237101220955,
1862
- "grad_norm": 5.30228853225708,
1863
- "learning_rate": 2.5309203991584073e-05,
1864
- "loss": 8.3246,
1865
- "step": 1325
1866
- },
1867
- {
1868
- "epoch": 2.0961008270972825,
1869
- "grad_norm": 5.126616477966309,
1870
- "learning_rate": 2.514646794514085e-05,
1871
- "loss": 7.8035,
1872
- "step": 1330
1873
- },
1874
- {
1875
- "epoch": 2.1039779440724695,
1876
- "grad_norm": 5.645951747894287,
1877
- "learning_rate": 2.4983725691920294e-05,
1878
- "loss": 8.3698,
1879
- "step": 1335
1880
- },
1881
- {
1882
- "epoch": 2.1118550610476565,
1883
- "grad_norm": 5.491515636444092,
1884
- "learning_rate": 2.482098412834556e-05,
1885
- "loss": 7.826,
1886
- "step": 1340
1887
- },
1888
- {
1889
- "epoch": 2.1197321780228435,
1890
- "grad_norm": 5.176724910736084,
1891
- "learning_rate": 2.4658250150810578e-05,
1892
- "loss": 8.0034,
1893
- "step": 1345
1894
- },
1895
- {
1896
- "epoch": 2.1276092949980305,
1897
- "grad_norm": 4.87959098815918,
1898
- "learning_rate": 2.449553065538781e-05,
1899
- "loss": 8.2813,
1900
- "step": 1350
1901
- },
1902
- {
1903
- "epoch": 2.135486411973218,
1904
- "grad_norm": 5.171248435974121,
1905
- "learning_rate": 2.4332832537536e-05,
1906
- "loss": 8.4077,
1907
- "step": 1355
1908
- },
1909
- {
1910
- "epoch": 2.143363528948405,
1911
- "grad_norm": 5.680236339569092,
1912
- "learning_rate": 2.4170162691808034e-05,
1913
- "loss": 8.2604,
1914
- "step": 1360
1915
- },
1916
- {
1917
- "epoch": 2.151240645923592,
1918
- "grad_norm": 5.374014854431152,
1919
- "learning_rate": 2.4007528011558683e-05,
1920
- "loss": 8.0889,
1921
- "step": 1365
1922
- },
1923
- {
1924
- "epoch": 2.159117762898779,
1925
- "grad_norm": 5.249903678894043,
1926
- "learning_rate": 2.3844935388652545e-05,
1927
- "loss": 8.3831,
1928
- "step": 1370
1929
- },
1930
- {
1931
- "epoch": 2.166994879873966,
1932
- "grad_norm": 5.103092670440674,
1933
- "learning_rate": 2.3682391713171998e-05,
1934
- "loss": 8.314,
1935
- "step": 1375
1936
- },
1937
- {
1938
- "epoch": 2.174871996849153,
1939
- "grad_norm": 5.576798915863037,
1940
- "learning_rate": 2.351990387312519e-05,
1941
- "loss": 7.9968,
1942
- "step": 1380
1943
- },
1944
- {
1945
- "epoch": 2.1827491138243404,
1946
- "grad_norm": 5.228267192840576,
1947
- "learning_rate": 2.3357478754154173e-05,
1948
- "loss": 8.3819,
1949
- "step": 1385
1950
- },
1951
- {
1952
- "epoch": 2.1906262307995275,
1953
- "grad_norm": 4.981462478637695,
1954
- "learning_rate": 2.3195123239243098e-05,
1955
- "loss": 8.5833,
1956
- "step": 1390
1957
- },
1958
- {
1959
- "epoch": 2.1985033477747145,
1960
- "grad_norm": 5.161903381347656,
1961
- "learning_rate": 2.303284420842658e-05,
1962
- "loss": 8.0129,
1963
- "step": 1395
1964
- },
1965
- {
1966
- "epoch": 2.2063804647499015,
1967
- "grad_norm": 5.56730842590332,
1968
- "learning_rate": 2.2870648538498085e-05,
1969
- "loss": 8.2146,
1970
- "step": 1400
1971
- },
1972
- {
1973
- "epoch": 2.2142575817250885,
1974
- "grad_norm": 5.310222625732422,
1975
- "learning_rate": 2.2708543102718542e-05,
1976
- "loss": 8.3771,
1977
- "step": 1405
1978
- },
1979
- {
1980
- "epoch": 2.222134698700276,
1981
- "grad_norm": 5.077228546142578,
1982
- "learning_rate": 2.254653477052514e-05,
1983
- "loss": 8.0806,
1984
- "step": 1410
1985
- },
1986
- {
1987
- "epoch": 2.230011815675463,
1988
- "grad_norm": 5.488475322723389,
1989
- "learning_rate": 2.238463040724011e-05,
1990
- "loss": 7.9597,
1991
- "step": 1415
1992
- },
1993
- {
1994
- "epoch": 2.23788893265065,
1995
- "grad_norm": 4.879157543182373,
1996
- "learning_rate": 2.2222836873779888e-05,
1997
- "loss": 8.1727,
1998
- "step": 1420
1999
- },
2000
- {
2001
- "epoch": 2.245766049625837,
2002
- "grad_norm": 5.107478618621826,
2003
- "learning_rate": 2.2061161026364353e-05,
2004
- "loss": 8.0123,
2005
- "step": 1425
2006
- },
2007
- {
2008
- "epoch": 2.253643166601024,
2009
- "grad_norm": 5.371547222137451,
2010
- "learning_rate": 2.1899609716226263e-05,
2011
- "loss": 8.2489,
2012
- "step": 1430
2013
- },
2014
- {
2015
- "epoch": 2.261520283576211,
2016
- "grad_norm": 5.334740161895752,
2017
- "learning_rate": 2.173818978932095e-05,
2018
- "loss": 8.536,
2019
- "step": 1435
2020
- },
2021
- {
2022
- "epoch": 2.2693974005513984,
2023
- "grad_norm": 5.4585394859313965,
2024
- "learning_rate": 2.1576908086036195e-05,
2025
- "loss": 8.2132,
2026
- "step": 1440
2027
- },
2028
- {
2029
- "epoch": 2.2772745175265854,
2030
- "grad_norm": 6.0415449142456055,
2031
- "learning_rate": 2.1415771440902384e-05,
2032
- "loss": 7.9417,
2033
- "step": 1445
2034
- },
2035
- {
2036
- "epoch": 2.2851516345017724,
2037
- "grad_norm": 5.975248336791992,
2038
- "learning_rate": 2.1254786682302847e-05,
2039
- "loss": 8.2411,
2040
- "step": 1450
2041
- },
2042
- {
2043
- "epoch": 2.2930287514769594,
2044
- "grad_norm": 5.171903133392334,
2045
- "learning_rate": 2.1093960632184513e-05,
2046
- "loss": 8.4717,
2047
- "step": 1455
2048
- },
2049
- {
2050
- "epoch": 2.3009058684521464,
2051
- "grad_norm": 5.419390678405762,
2052
- "learning_rate": 2.0933300105768867e-05,
2053
- "loss": 7.9774,
2054
- "step": 1460
2055
- },
2056
- {
2057
- "epoch": 2.3087829854273334,
2058
- "grad_norm": 5.009170055389404,
2059
- "learning_rate": 2.0772811911263048e-05,
2060
- "loss": 7.9232,
2061
- "step": 1465
2062
- },
2063
- {
2064
- "epoch": 2.316660102402521,
2065
- "grad_norm": 5.920315265655518,
2066
- "learning_rate": 2.0612502849571425e-05,
2067
- "loss": 8.3842,
2068
- "step": 1470
2069
- },
2070
- {
2071
- "epoch": 2.324537219377708,
2072
- "grad_norm": 5.717631816864014,
2073
- "learning_rate": 2.0452379714007375e-05,
2074
- "loss": 8.3991,
2075
- "step": 1475
2076
- },
2077
- {
2078
- "epoch": 2.332414336352895,
2079
- "grad_norm": 6.118537425994873,
2080
- "learning_rate": 2.0292449290005395e-05,
2081
- "loss": 8.1187,
2082
- "step": 1480
2083
- },
2084
- {
2085
- "epoch": 2.340291453328082,
2086
- "grad_norm": 4.826847076416016,
2087
- "learning_rate": 2.013271835483357e-05,
2088
- "loss": 7.8728,
2089
- "step": 1485
2090
- },
2091
- {
2092
- "epoch": 2.348168570303269,
2093
- "grad_norm": 5.45656681060791,
2094
- "learning_rate": 1.9973193677306377e-05,
2095
- "loss": 8.1391,
2096
- "step": 1490
2097
- },
2098
- {
2099
- "epoch": 2.3560456872784563,
2100
- "grad_norm": 5.478461265563965,
2101
- "learning_rate": 1.9813882017497848e-05,
2102
- "loss": 8.1173,
2103
- "step": 1495
2104
- },
2105
- {
2106
- "epoch": 2.3639228042536433,
2107
- "grad_norm": 6.264642715454102,
2108
- "learning_rate": 1.9654790126455103e-05,
2109
- "loss": 8.1301,
2110
- "step": 1500
2111
- },
2112
- {
2113
- "epoch": 2.3717999212288303,
2114
- "grad_norm": 5.903857231140137,
2115
- "learning_rate": 1.949592474591224e-05,
2116
- "loss": 7.9252,
2117
- "step": 1505
2118
- },
2119
- {
2120
- "epoch": 2.3796770382040173,
2121
- "grad_norm": 4.8199896812438965,
2122
- "learning_rate": 1.9337292608004715e-05,
2123
- "loss": 8.3755,
2124
- "step": 1510
2125
- },
2126
- {
2127
- "epoch": 2.3875541551792043,
2128
- "grad_norm": 4.588783264160156,
2129
- "learning_rate": 1.917890043498397e-05,
2130
- "loss": 8.1026,
2131
- "step": 1515
2132
- },
2133
- {
2134
- "epoch": 2.3954312721543913,
2135
- "grad_norm": 5.213608741760254,
2136
- "learning_rate": 1.9020754938932624e-05,
2137
- "loss": 8.1211,
2138
- "step": 1520
2139
- },
2140
- {
2141
- "epoch": 2.4033083891295783,
2142
- "grad_norm": 5.581782817840576,
2143
- "learning_rate": 1.8862862821480025e-05,
2144
- "loss": 7.7893,
2145
- "step": 1525
2146
- },
2147
- {
2148
- "epoch": 2.411185506104766,
2149
- "grad_norm": 5.054122447967529,
2150
- "learning_rate": 1.8705230773518267e-05,
2151
- "loss": 8.1924,
2152
- "step": 1530
2153
- },
2154
- {
2155
- "epoch": 2.419062623079953,
2156
- "grad_norm": 4.978759288787842,
2157
- "learning_rate": 1.854786547491864e-05,
2158
- "loss": 8.1678,
2159
- "step": 1535
2160
- },
2161
- {
2162
- "epoch": 2.42693974005514,
2163
- "grad_norm": 5.0260329246521,
2164
- "learning_rate": 1.8390773594248568e-05,
2165
- "loss": 8.1418,
2166
- "step": 1540
2167
- },
2168
- {
2169
- "epoch": 2.434816857030327,
2170
- "grad_norm": 5.8550262451171875,
2171
- "learning_rate": 1.823396178848903e-05,
2172
- "loss": 8.2088,
2173
- "step": 1545
2174
- },
2175
- {
2176
- "epoch": 2.442693974005514,
2177
- "grad_norm": 6.323260307312012,
2178
- "learning_rate": 1.8077436702752448e-05,
2179
- "loss": 7.9444,
2180
- "step": 1550
2181
- },
2182
- {
2183
- "epoch": 2.4505710909807012,
2184
- "grad_norm": 5.396198272705078,
2185
- "learning_rate": 1.7921204970001065e-05,
2186
- "loss": 7.8484,
2187
- "step": 1555
2188
- },
2189
- {
2190
- "epoch": 2.4584482079558883,
2191
- "grad_norm": 5.220623970031738,
2192
- "learning_rate": 1.776527321076596e-05,
2193
- "loss": 8.1014,
2194
- "step": 1560
2195
- },
2196
- {
2197
- "epoch": 2.4663253249310753,
2198
- "grad_norm": 16.552457809448242,
2199
- "learning_rate": 1.7609648032866362e-05,
2200
- "loss": 8.2018,
2201
- "step": 1565
2202
- },
2203
- {
2204
- "epoch": 2.4742024419062623,
2205
- "grad_norm": 5.957991600036621,
2206
- "learning_rate": 1.7454336031129743e-05,
2207
- "loss": 7.8216,
2208
- "step": 1570
2209
- },
2210
- {
2211
- "epoch": 2.4820795588814493,
2212
- "grad_norm": 5.393924713134766,
2213
- "learning_rate": 1.729934378711228e-05,
2214
- "loss": 8.3398,
2215
- "step": 1575
2216
- },
2217
- {
2218
- "epoch": 2.4899566758566367,
2219
- "grad_norm": 4.859684944152832,
2220
- "learning_rate": 1.7144677868820026e-05,
2221
- "loss": 8.6844,
2222
- "step": 1580
2223
- },
2224
- {
2225
- "epoch": 2.4978337928318237,
2226
- "grad_norm": 5.323124885559082,
2227
- "learning_rate": 1.6990344830430498e-05,
2228
- "loss": 8.0736,
2229
- "step": 1585
2230
- },
2231
- {
2232
- "epoch": 2.5057109098070107,
2233
- "grad_norm": 8.831464767456055,
2234
- "learning_rate": 1.6836351212014996e-05,
2235
- "loss": 8.1686,
2236
- "step": 1590
2237
- },
2238
- {
2239
- "epoch": 2.51201260338716,
2240
- "grad_norm": 5.187417507171631,
2241
- "learning_rate": 1.6682703539261442e-05,
2242
- "loss": 7.6429,
2243
- "step": 1595
2244
- },
2245
- {
2246
- "epoch": 2.5198897203623476,
2247
- "grad_norm": 6.1180500984191895,
2248
- "learning_rate": 1.652940832319785e-05,
2249
- "loss": 7.9255,
2250
- "step": 1600
2251
- },
2252
- {
2253
- "epoch": 2.5277668373375346,
2254
- "grad_norm": 8.949240684509277,
2255
- "learning_rate": 1.6376472059916354e-05,
2256
- "loss": 8.0755,
2257
- "step": 1605
2258
- },
2259
- {
2260
- "epoch": 2.5356439543127216,
2261
- "grad_norm": 4.905629634857178,
2262
- "learning_rate": 1.6223901230298062e-05,
2263
- "loss": 7.8017,
2264
- "step": 1610
2265
- },
2266
- {
2267
- "epoch": 2.5435210712879086,
2268
- "grad_norm": 5.435753345489502,
2269
- "learning_rate": 1.6071702299738268e-05,
2270
- "loss": 7.7271,
2271
- "step": 1615
2272
- },
2273
- {
2274
- "epoch": 2.5513981882630956,
2275
- "grad_norm": 5.005056858062744,
2276
- "learning_rate": 1.5919881717872564e-05,
2277
- "loss": 8.3681,
2278
- "step": 1620
2279
- },
2280
- {
2281
- "epoch": 2.559275305238283,
2282
- "grad_norm": 5.524580001831055,
2283
- "learning_rate": 1.5768445918303505e-05,
2284
- "loss": 7.6268,
2285
- "step": 1625
2286
- },
2287
- {
2288
- "epoch": 2.5671524222134696,
2289
- "grad_norm": 5.758496284484863,
2290
- "learning_rate": 1.5617401318327985e-05,
2291
- "loss": 7.8986,
2292
- "step": 1630
2293
- },
2294
- {
2295
- "epoch": 2.575029539188657,
2296
- "grad_norm": 5.624476909637451,
2297
- "learning_rate": 1.546675431866526e-05,
2298
- "loss": 7.437,
2299
- "step": 1635
2300
- },
2301
- {
2302
- "epoch": 2.582906656163844,
2303
- "grad_norm": 4.7457594871521,
2304
- "learning_rate": 1.5316511303185755e-05,
2305
- "loss": 8.1143,
2306
- "step": 1640
2307
- },
2308
- {
2309
- "epoch": 2.590783773139031,
2310
- "grad_norm": 5.465321063995361,
2311
- "learning_rate": 1.5166678638640521e-05,
2312
- "loss": 7.4633,
2313
- "step": 1645
2314
- },
2315
- {
2316
- "epoch": 2.598660890114218,
2317
- "grad_norm": 5.189293384552002,
2318
- "learning_rate": 1.5017262674391428e-05,
2319
- "loss": 7.7685,
2320
- "step": 1650
2321
- },
2322
- {
2323
- "epoch": 2.606538007089405,
2324
- "grad_norm": 5.231342792510986,
2325
- "learning_rate": 1.486826974214209e-05,
2326
- "loss": 7.6534,
2327
- "step": 1655
2328
- },
2329
- {
2330
- "epoch": 2.6144151240645925,
2331
- "grad_norm": 5.773874282836914,
2332
- "learning_rate": 1.4719706155669587e-05,
2333
- "loss": 7.7808,
2334
- "step": 1660
2335
- },
2336
- {
2337
- "epoch": 2.6222922410397795,
2338
- "grad_norm": 5.353034019470215,
2339
- "learning_rate": 1.4571578210556896e-05,
2340
- "loss": 7.7763,
2341
- "step": 1665
2342
- },
2343
- {
2344
- "epoch": 2.6301693580149665,
2345
- "grad_norm": 5.128270149230957,
2346
- "learning_rate": 1.4423892183926092e-05,
2347
- "loss": 7.8019,
2348
- "step": 1670
2349
- },
2350
- {
2351
- "epoch": 2.6380464749901535,
2352
- "grad_norm": 5.596746444702148,
2353
- "learning_rate": 1.4276654334172332e-05,
2354
- "loss": 7.3829,
2355
- "step": 1675
2356
- },
2357
- {
2358
- "epoch": 2.6459235919653405,
2359
- "grad_norm": 4.946563720703125,
2360
- "learning_rate": 1.4129870900698739e-05,
2361
- "loss": 8.053,
2362
- "step": 1680
2363
- },
2364
- {
2365
- "epoch": 2.653800708940528,
2366
- "grad_norm": 5.08951473236084,
2367
- "learning_rate": 1.3983548103651861e-05,
2368
- "loss": 7.9546,
2369
- "step": 1685
2370
- },
2371
- {
2372
- "epoch": 2.661677825915715,
2373
- "grad_norm": 6.104579925537109,
2374
- "learning_rate": 1.3837692143658182e-05,
2375
- "loss": 7.8367,
2376
- "step": 1690
2377
- },
2378
- {
2379
- "epoch": 2.669554942890902,
2380
- "grad_norm": 5.49988317489624,
2381
- "learning_rate": 1.369230920156134e-05,
2382
- "loss": 7.8629,
2383
- "step": 1695
2384
- },
2385
- {
2386
- "epoch": 2.677432059866089,
2387
- "grad_norm": 5.227181434631348,
2388
- "learning_rate": 1.3547405438160205e-05,
2389
- "loss": 8.1967,
2390
- "step": 1700
2391
- },
2392
- {
2393
- "epoch": 2.685309176841276,
2394
- "grad_norm": 6.716334819793701,
2395
- "learning_rate": 1.340298699394777e-05,
2396
- "loss": 7.4787,
2397
- "step": 1705
2398
- },
2399
- {
2400
- "epoch": 2.693186293816463,
2401
- "grad_norm": 5.50681209564209,
2402
- "learning_rate": 1.3259059988851e-05,
2403
- "loss": 7.2509,
2404
- "step": 1710
2405
- },
2406
- {
2407
- "epoch": 2.70106341079165,
2408
- "grad_norm": 4.969735145568848,
2409
- "learning_rate": 1.3115630521971468e-05,
2410
- "loss": 7.8345,
2411
- "step": 1715
2412
- },
2413
- {
2414
- "epoch": 2.7089405277668375,
2415
- "grad_norm": 5.385042190551758,
2416
- "learning_rate": 1.2972704671326863e-05,
2417
- "loss": 7.6157,
2418
- "step": 1720
2419
- },
2420
- {
2421
- "epoch": 2.7168176447420245,
2422
- "grad_norm": 5.288397789001465,
2423
- "learning_rate": 1.2830288493593451e-05,
2424
- "loss": 7.6661,
2425
- "step": 1725
2426
- },
2427
- {
2428
- "epoch": 2.7246947617172115,
2429
- "grad_norm": 5.0901994705200195,
2430
- "learning_rate": 1.2688388023849482e-05,
2431
- "loss": 7.8334,
2432
- "step": 1730
2433
- },
2434
- {
2435
- "epoch": 2.7325718786923985,
2436
- "grad_norm": 5.180675983428955,
2437
- "learning_rate": 1.2547009275319313e-05,
2438
- "loss": 7.3121,
2439
- "step": 1735
2440
- },
2441
- {
2442
- "epoch": 2.7404489956675855,
2443
- "grad_norm": 7.612630367279053,
2444
- "learning_rate": 1.2406158239118677e-05,
2445
- "loss": 7.5115,
2446
- "step": 1740
2447
- },
2448
- {
2449
- "epoch": 2.748326112642773,
2450
- "grad_norm": 9.157015800476074,
2451
- "learning_rate": 1.2265840884000792e-05,
2452
- "loss": 7.7749,
2453
- "step": 1745
2454
- },
2455
- {
2456
- "epoch": 2.75620322961796,
2457
- "grad_norm": 5.494700908660889,
2458
- "learning_rate": 1.2126063156103437e-05,
2459
- "loss": 7.8249,
2460
- "step": 1750
2461
- },
2462
- {
2463
- "epoch": 2.764080346593147,
2464
- "grad_norm": 4.8552985191345215,
2465
- "learning_rate": 1.1986830978696908e-05,
2466
- "loss": 7.3518,
2467
- "step": 1755
2468
- },
2469
- {
2470
- "epoch": 2.771957463568334,
2471
- "grad_norm": 5.416152477264404,
2472
- "learning_rate": 1.1848150251933102e-05,
2473
- "loss": 7.7477,
2474
- "step": 1760
2475
- },
2476
- {
2477
- "epoch": 2.779834580543521,
2478
- "grad_norm": 4.609814643859863,
2479
- "learning_rate": 1.1710026852595446e-05,
2480
- "loss": 7.7182,
2481
- "step": 1765
2482
- },
2483
- {
2484
- "epoch": 2.7877116975187084,
2485
- "grad_norm": 4.770631790161133,
2486
- "learning_rate": 1.157246663384984e-05,
2487
- "loss": 7.5309,
2488
- "step": 1770
2489
- },
2490
- {
2491
- "epoch": 2.795588814493895,
2492
- "grad_norm": 5.455694675445557,
2493
- "learning_rate": 1.1435475424996644e-05,
2494
- "loss": 7.4731,
2495
- "step": 1775
2496
- },
2497
- {
2498
- "epoch": 2.8034659314690824,
2499
- "grad_norm": 5.270656585693359,
2500
- "learning_rate": 1.1299059031223706e-05,
2501
- "loss": 7.6206,
2502
- "step": 1780
2503
- },
2504
- {
2505
- "epoch": 2.8113430484442694,
2506
- "grad_norm": 4.653499126434326,
2507
- "learning_rate": 1.1163223233360243e-05,
2508
- "loss": 7.9029,
2509
- "step": 1785
2510
- },
2511
- {
2512
- "epoch": 2.8192201654194564,
2513
- "grad_norm": 5.981932163238525,
2514
- "learning_rate": 1.1027973787631956e-05,
2515
- "loss": 7.6331,
2516
- "step": 1790
2517
- },
2518
- {
2519
- "epoch": 2.8270972823946434,
2520
- "grad_norm": 6.355517864227295,
2521
- "learning_rate": 1.0893316425417097e-05,
2522
- "loss": 7.6632,
2523
- "step": 1795
2524
- },
2525
- {
2526
- "epoch": 2.8349743993698304,
2527
- "grad_norm": 7.381013870239258,
2528
- "learning_rate": 1.0759256853003578e-05,
2529
- "loss": 7.5561,
2530
- "step": 1800
2531
- },
2532
- {
2533
- "epoch": 2.842851516345018,
2534
- "grad_norm": 6.400808811187744,
2535
- "learning_rate": 1.062580075134712e-05,
2536
- "loss": 7.1496,
2537
- "step": 1805
2538
- },
2539
- {
2540
- "epoch": 2.850728633320205,
2541
- "grad_norm": 6.144219875335693,
2542
- "learning_rate": 1.0492953775830603e-05,
2543
- "loss": 7.6644,
2544
- "step": 1810
2545
- },
2546
- {
2547
- "epoch": 2.858605750295392,
2548
- "grad_norm": 4.925227642059326,
2549
- "learning_rate": 1.0360721556024348e-05,
2550
- "loss": 7.9462,
2551
- "step": 1815
2552
- },
2553
- {
2554
- "epoch": 2.866482867270579,
2555
- "grad_norm": 6.179694175720215,
2556
- "learning_rate": 1.0229109695447553e-05,
2557
- "loss": 7.6671,
2558
- "step": 1820
2559
- },
2560
- {
2561
- "epoch": 2.874359984245766,
2562
- "grad_norm": 5.008157730102539,
2563
- "learning_rate": 1.0098123771330853e-05,
2564
- "loss": 7.9779,
2565
- "step": 1825
2566
- },
2567
- {
2568
- "epoch": 2.8822371012209533,
2569
- "grad_norm": 5.26678466796875,
2570
- "learning_rate": 9.967769334380029e-06,
2571
- "loss": 7.4016,
2572
- "step": 1830
2573
- },
2574
- {
2575
- "epoch": 2.8901142181961403,
2576
- "grad_norm": 5.3563151359558105,
2577
- "learning_rate": 9.83805190854068e-06,
2578
- "loss": 7.6818,
2579
- "step": 1835
2580
- },
2581
- {
2582
- "epoch": 2.8979913351713273,
2583
- "grad_norm": 4.609752178192139,
2584
- "learning_rate": 9.708976990764212e-06,
2585
- "loss": 7.826,
2586
- "step": 1840
2587
- },
2588
- {
2589
- "epoch": 2.9058684521465143,
2590
- "grad_norm": 4.820992946624756,
2591
- "learning_rate": 9.580550050774906e-06,
2592
- "loss": 7.7669,
2593
- "step": 1845
2594
- },
2595
- {
2596
- "epoch": 2.9137455691217014,
2597
- "grad_norm": 5.011669635772705,
2598
- "learning_rate": 9.452776530838096e-06,
2599
- "loss": 7.8166,
2600
- "step": 1850
2601
- },
2602
- {
2603
- "epoch": 2.921622686096889,
2604
- "grad_norm": 5.413022041320801,
2605
- "learning_rate": 9.325661845529533e-06,
2606
- "loss": 7.3276,
2607
- "step": 1855
2608
- },
2609
- {
2610
- "epoch": 2.9294998030720754,
2611
- "grad_norm": 5.638709545135498,
2612
- "learning_rate": 9.199211381505993e-06,
2613
- "loss": 7.6476,
2614
- "step": 1860
2615
- },
2616
- {
2617
- "epoch": 2.937376920047263,
2618
- "grad_norm": 6.355219841003418,
2619
- "learning_rate": 9.073430497276969e-06,
2620
- "loss": 7.5497,
2621
- "step": 1865
2622
- },
2623
- {
2624
- "epoch": 2.94525403702245,
2625
- "grad_norm": 4.824697494506836,
2626
- "learning_rate": 8.94832452297759e-06,
2627
- "loss": 7.4419,
2628
- "step": 1870
2629
- },
2630
- {
2631
- "epoch": 2.953131153997637,
2632
- "grad_norm": 10.201951026916504,
2633
- "learning_rate": 8.823898760142759e-06,
2634
- "loss": 7.8972,
2635
- "step": 1875
2636
- },
2637
- {
2638
- "epoch": 2.961008270972824,
2639
- "grad_norm": 5.421176433563232,
2640
- "learning_rate": 8.700158481482543e-06,
2641
- "loss": 7.5122,
2642
- "step": 1880
2643
- },
2644
- {
2645
- "epoch": 2.968885387948011,
2646
- "grad_norm": 4.769680500030518,
2647
- "learning_rate": 8.577108930658636e-06,
2648
- "loss": 7.4867,
2649
- "step": 1885
2650
- },
2651
- {
2652
- "epoch": 2.9767625049231983,
2653
- "grad_norm": 4.7165727615356445,
2654
- "learning_rate": 8.454755322062228e-06,
2655
- "loss": 7.9242,
2656
- "step": 1890
2657
- },
2658
- {
2659
- "epoch": 2.9846396218983853,
2660
- "grad_norm": 6.179513931274414,
2661
- "learning_rate": 8.333102840593015e-06,
2662
- "loss": 7.585,
2663
- "step": 1895
2664
- },
2665
- {
2666
- "epoch": 2.9925167388735723,
2667
- "grad_norm": 5.120509624481201,
2668
- "learning_rate": 8.212156641439495e-06,
2669
- "loss": 7.6742,
2670
- "step": 1900
2671
- },
2672
- {
2673
- "epoch": 3.0015754233950376,
2674
- "grad_norm": 5.389956951141357,
2675
- "learning_rate": 8.091921849860466e-06,
2676
- "loss": 8.6246,
2677
- "step": 1905
2678
- },
2679
- {
2680
- "epoch": 3.007877116975187,
2681
- "grad_norm": 5.342672348022461,
2682
- "learning_rate": 7.972403560967895e-06,
2683
- "loss": 8.6445,
2684
- "step": 1910
2685
- },
2686
- {
2687
- "epoch": 3.015754233950374,
2688
- "grad_norm": 5.166170597076416,
2689
- "learning_rate": 7.853606839510976e-06,
2690
- "loss": 8.1686,
2691
- "step": 1915
2692
- },
2693
- {
2694
- "epoch": 3.0236313509255615,
2695
- "grad_norm": 4.708956241607666,
2696
- "learning_rate": 7.735536719661495e-06,
2697
- "loss": 8.1996,
2698
- "step": 1920
2699
- },
2700
- {
2701
- "epoch": 3.0315084679007485,
2702
- "grad_norm": 5.225474834442139,
2703
- "learning_rate": 7.618198204800509e-06,
2704
- "loss": 8.5347,
2705
- "step": 1925
2706
- },
2707
- {
2708
- "epoch": 3.0393855848759355,
2709
- "grad_norm": 4.633377552032471,
2710
- "learning_rate": 7.5015962673063375e-06,
2711
- "loss": 8.4879,
2712
- "step": 1930
2713
- },
2714
- {
2715
- "epoch": 3.0472627018511225,
2716
- "grad_norm": 6.010617256164551,
2717
- "learning_rate": 7.3857358483438385e-06,
2718
- "loss": 8.3143,
2719
- "step": 1935
2720
- },
2721
- {
2722
- "epoch": 3.0551398188263095,
2723
- "grad_norm": 5.735445022583008,
2724
- "learning_rate": 7.270621857655002e-06,
2725
- "loss": 8.2262,
2726
- "step": 1940
2727
- },
2728
- {
2729
- "epoch": 3.0630169358014965,
2730
- "grad_norm": 5.311731815338135,
2731
- "learning_rate": 7.156259173350926e-06,
2732
- "loss": 8.3875,
2733
- "step": 1945
2734
- },
2735
- {
2736
- "epoch": 3.070894052776684,
2737
- "grad_norm": 4.930365562438965,
2738
- "learning_rate": 7.042652641705083e-06,
2739
- "loss": 8.2483,
2740
- "step": 1950
2741
- },
2742
- {
2743
- "epoch": 3.078771169751871,
2744
- "grad_norm": 4.509944915771484,
2745
- "learning_rate": 6.9298070769479476e-06,
2746
- "loss": 8.1581,
2747
- "step": 1955
2748
- },
2749
- {
2750
- "epoch": 3.086648286727058,
2751
- "grad_norm": 6.027124404907227,
2752
- "learning_rate": 6.817727261062973e-06,
2753
- "loss": 8.4293,
2754
- "step": 1960
2755
- },
2756
- {
2757
- "epoch": 3.094525403702245,
2758
- "grad_norm": 4.761337757110596,
2759
- "learning_rate": 6.706417943584023e-06,
2760
- "loss": 8.0434,
2761
- "step": 1965
2762
- },
2763
- {
2764
- "epoch": 3.102402520677432,
2765
- "grad_norm": 4.544243335723877,
2766
- "learning_rate": 6.5958838413940016e-06,
2767
- "loss": 8.3465,
2768
- "step": 1970
2769
- },
2770
- {
2771
- "epoch": 3.110279637652619,
2772
- "grad_norm": 4.9786882400512695,
2773
- "learning_rate": 6.486129638525021e-06,
2774
- "loss": 8.0994,
2775
- "step": 1975
2776
- },
2777
- {
2778
- "epoch": 3.1181567546278064,
2779
- "grad_norm": 5.5463972091674805,
2780
- "learning_rate": 6.377159985959921e-06,
2781
- "loss": 7.9211,
2782
- "step": 1980
2783
- },
2784
- {
2785
- "epoch": 3.1260338716029934,
2786
- "grad_norm": 4.427308082580566,
2787
- "learning_rate": 6.2689795014351595e-06,
2788
- "loss": 8.2482,
2789
- "step": 1985
2790
- },
2791
- {
2792
- "epoch": 3.1339109885781804,
2793
- "grad_norm": 4.5052642822265625,
2794
- "learning_rate": 6.161592769245114e-06,
2795
- "loss": 8.1749,
2796
- "step": 1990
2797
- },
2798
- {
2799
- "epoch": 3.1417881055533674,
2800
- "grad_norm": 5.253861904144287,
2801
- "learning_rate": 6.055004340047849e-06,
2802
- "loss": 8.2287,
2803
- "step": 1995
2804
- },
2805
- {
2806
- "epoch": 3.1496652225285544,
2807
- "grad_norm": 8.412028312683105,
2808
- "learning_rate": 5.949218730672259e-06,
2809
- "loss": 7.489,
2810
- "step": 2000
2811
- },
2812
- {
2813
- "epoch": 3.157542339503742,
2814
- "grad_norm": 6.002096652984619,
2815
- "learning_rate": 5.844240423926659e-06,
2816
- "loss": 7.7578,
2817
- "step": 2005
2818
- },
2819
- {
2820
- "epoch": 3.165419456478929,
2821
- "grad_norm": 5.330885410308838,
2822
- "learning_rate": 5.740073868408799e-06,
2823
- "loss": 7.6986,
2824
- "step": 2010
2825
- },
2826
- {
2827
- "epoch": 3.173296573454116,
2828
- "grad_norm": 6.712745666503906,
2829
- "learning_rate": 5.636723478317429e-06,
2830
- "loss": 7.765,
2831
- "step": 2015
2832
- },
2833
- {
2834
- "epoch": 3.181173690429303,
2835
- "grad_norm": 5.10537052154541,
2836
- "learning_rate": 5.5341936332651336e-06,
2837
- "loss": 7.9934,
2838
- "step": 2020
2839
- },
2840
- {
2841
- "epoch": 3.18905080740449,
2842
- "grad_norm": 5.30924129486084,
2843
- "learning_rate": 5.432488678092807e-06,
2844
- "loss": 7.8984,
2845
- "step": 2025
2846
- },
2847
- {
2848
- "epoch": 3.196927924379677,
2849
- "grad_norm": 6.369449138641357,
2850
- "learning_rate": 5.331612922685522e-06,
2851
- "loss": 7.7312,
2852
- "step": 2030
2853
- },
2854
- {
2855
- "epoch": 3.2048050413548643,
2856
- "grad_norm": 4.61285924911499,
2857
- "learning_rate": 5.231570641789899e-06,
2858
- "loss": 7.9155,
2859
- "step": 2035
2860
- },
2861
- {
2862
- "epoch": 3.2126821583300513,
2863
- "grad_norm": 4.817512512207031,
2864
- "learning_rate": 5.13236607483292e-06,
2865
- "loss": 7.6799,
2866
- "step": 2040
2867
- },
2868
- {
2869
- "epoch": 3.2205592753052383,
2870
- "grad_norm": 5.9151082038879395,
2871
- "learning_rate": 5.034003425742334e-06,
2872
- "loss": 8.2068,
2873
- "step": 2045
2874
- },
2875
- {
2876
- "epoch": 3.2284363922804253,
2877
- "grad_norm": 4.645730972290039,
2878
- "learning_rate": 4.9364868627684775e-06,
2879
- "loss": 7.9157,
2880
- "step": 2050
2881
- },
2882
- {
2883
- "epoch": 3.2363135092556123,
2884
- "grad_norm": 4.885422706604004,
2885
- "learning_rate": 4.839820518307628e-06,
2886
- "loss": 7.7623,
2887
- "step": 2055
2888
- },
2889
- {
2890
- "epoch": 3.2441906262307993,
2891
- "grad_norm": 5.870239734649658,
2892
- "learning_rate": 4.7440084887269035e-06,
2893
- "loss": 8.0045,
2894
- "step": 2060
2895
- },
2896
- {
2897
- "epoch": 3.252067743205987,
2898
- "grad_norm": 4.6275153160095215,
2899
- "learning_rate": 4.649054834190686e-06,
2900
- "loss": 8.0402,
2901
- "step": 2065
2902
- },
2903
- {
2904
- "epoch": 3.259944860181174,
2905
- "grad_norm": 5.3590779304504395,
2906
- "learning_rate": 4.554963578488561e-06,
2907
- "loss": 7.8615,
2908
- "step": 2070
2909
- },
2910
- {
2911
- "epoch": 3.267821977156361,
2912
- "grad_norm": 4.911188125610352,
2913
- "learning_rate": 4.461738708864768e-06,
2914
- "loss": 7.8886,
2915
- "step": 2075
2916
- },
2917
- {
2918
- "epoch": 3.275699094131548,
2919
- "grad_norm": 5.0650954246521,
2920
- "learning_rate": 4.369384175849287e-06,
2921
- "loss": 8.1302,
2922
- "step": 2080
2923
- },
2924
- {
2925
- "epoch": 3.283576211106735,
2926
- "grad_norm": 5.238993167877197,
2927
- "learning_rate": 4.277903893090407e-06,
2928
- "loss": 7.5243,
2929
- "step": 2085
2930
- },
2931
- {
2932
- "epoch": 3.2914533280819223,
2933
- "grad_norm": 4.651856899261475,
2934
- "learning_rate": 4.187301737188859e-06,
2935
- "loss": 7.3692,
2936
- "step": 2090
2937
- },
2938
- {
2939
- "epoch": 3.2993304450571093,
2940
- "grad_norm": 4.900179386138916,
2941
- "learning_rate": 4.0975815475335855e-06,
2942
- "loss": 7.0708,
2943
- "step": 2095
2944
- },
2945
- {
2946
- "epoch": 3.3072075620322963,
2947
- "grad_norm": 7.008111953735352,
2948
- "learning_rate": 4.0087471261390094e-06,
2949
- "loss": 7.5399,
2950
- "step": 2100
2951
- },
2952
- {
2953
- "epoch": 3.3150846790074833,
2954
- "grad_norm": 4.802496910095215,
2955
- "learning_rate": 3.920802237483912e-06,
2956
- "loss": 7.7337,
2957
- "step": 2105
2958
- },
2959
- {
2960
- "epoch": 3.3229617959826703,
2961
- "grad_norm": 5.664666175842285,
2962
- "learning_rate": 3.833750608351924e-06,
2963
- "loss": 7.3805,
2964
- "step": 2110
2965
- },
2966
- {
2967
- "epoch": 3.3308389129578573,
2968
- "grad_norm": 5.779867649078369,
2969
- "learning_rate": 3.747595927673611e-06,
2970
- "loss": 7.4321,
2971
- "step": 2115
2972
- },
2973
- {
2974
- "epoch": 3.3387160299330443,
2975
- "grad_norm": 4.908834457397461,
2976
- "learning_rate": 3.6623418463701293e-06,
2977
- "loss": 7.8338,
2978
- "step": 2120
2979
- },
2980
- {
2981
- "epoch": 3.3465931469082317,
2982
- "grad_norm": 5.189285755157471,
2983
- "learning_rate": 3.5779919771985025e-06,
2984
- "loss": 7.2317,
2985
- "step": 2125
2986
- },
2987
- {
2988
- "epoch": 3.3544702638834187,
2989
- "grad_norm": 4.881292819976807,
2990
- "learning_rate": 3.494549894598556e-06,
2991
- "loss": 7.1418,
2992
- "step": 2130
2993
- },
2994
- {
2995
- "epoch": 3.3623473808586057,
2996
- "grad_norm": 4.643113613128662,
2997
- "learning_rate": 3.4120191345414415e-06,
2998
- "loss": 7.9551,
2999
- "step": 2135
3000
- },
3001
- {
3002
- "epoch": 3.3702244978337927,
3003
- "grad_norm": 6.662186622619629,
3004
- "learning_rate": 3.3304031943797527e-06,
3005
- "loss": 7.9614,
3006
- "step": 2140
3007
- },
3008
- {
3009
- "epoch": 3.3781016148089797,
3010
- "grad_norm": 4.886229038238525,
3011
- "learning_rate": 3.249705532699379e-06,
3012
- "loss": 7.7298,
3013
- "step": 2145
3014
- },
3015
- {
3016
- "epoch": 3.385978731784167,
3017
- "grad_norm": 6.290960788726807,
3018
- "learning_rate": 3.169929569172919e-06,
3019
- "loss": 7.4452,
3020
- "step": 2150
3021
- },
3022
- {
3023
- "epoch": 3.393855848759354,
3024
- "grad_norm": 5.830533981323242,
3025
- "learning_rate": 3.0910786844147473e-06,
3026
- "loss": 7.6276,
3027
- "step": 2155
3028
- },
3029
- {
3030
- "epoch": 3.401732965734541,
3031
- "grad_norm": 4.647792339324951,
3032
- "learning_rate": 3.013156219837776e-06,
3033
- "loss": 7.7677,
3034
- "step": 2160
3035
- },
3036
- {
3037
- "epoch": 3.409610082709728,
3038
- "grad_norm": 4.803062915802002,
3039
- "learning_rate": 2.936165477511868e-06,
3040
- "loss": 7.9931,
3041
- "step": 2165
3042
- },
3043
- {
3044
- "epoch": 3.417487199684915,
3045
- "grad_norm": 5.041831970214844,
3046
- "learning_rate": 2.8601097200238987e-06,
3047
- "loss": 7.7018,
3048
- "step": 2170
3049
- },
3050
- {
3051
- "epoch": 3.425364316660102,
3052
- "grad_norm": 5.187193393707275,
3053
- "learning_rate": 2.7849921703394732e-06,
3054
- "loss": 7.4835,
3055
- "step": 2175
3056
- },
3057
- {
3058
- "epoch": 3.4332414336352897,
3059
- "grad_norm": 5.092511177062988,
3060
- "learning_rate": 2.7108160116663893e-06,
3061
- "loss": 7.4102,
3062
- "step": 2180
3063
- },
3064
- {
3065
- "epoch": 3.4411185506104767,
3066
- "grad_norm": 4.9641594886779785,
3067
- "learning_rate": 2.637584387319733e-06,
3068
- "loss": 8.2661,
3069
- "step": 2185
3070
- },
3071
- {
3072
- "epoch": 3.4489956675856637,
3073
- "grad_norm": 4.644840240478516,
3074
- "learning_rate": 2.565300400588647e-06,
3075
- "loss": 7.5782,
3076
- "step": 2190
3077
- },
3078
- {
3079
- "epoch": 3.4568727845608507,
3080
- "grad_norm": 4.720969200134277,
3081
- "learning_rate": 2.4939671146048727e-06,
3082
- "loss": 7.7751,
3083
- "step": 2195
3084
- },
3085
- {
3086
- "epoch": 3.4647499015360377,
3087
- "grad_norm": 4.5188889503479,
3088
- "learning_rate": 2.4235875522128997e-06,
3089
- "loss": 7.6633,
3090
- "step": 2200
3091
- },
3092
- {
3093
- "epoch": 3.4726270185112247,
3094
- "grad_norm": 4.929895877838135,
3095
- "learning_rate": 2.3541646958419094e-06,
3096
- "loss": 8.0803,
3097
- "step": 2205
3098
- },
3099
- {
3100
- "epoch": 3.480504135486412,
3101
- "grad_norm": 4.896505832672119,
3102
- "learning_rate": 2.2857014873793577e-06,
3103
- "loss": 7.508,
3104
- "step": 2210
3105
- },
3106
- {
3107
- "epoch": 3.488381252461599,
3108
- "grad_norm": 5.505984783172607,
3109
- "learning_rate": 2.218200828046324e-06,
3110
- "loss": 7.1282,
3111
- "step": 2215
3112
- },
3113
- {
3114
- "epoch": 3.496258369436786,
3115
- "grad_norm": 5.277995586395264,
3116
- "learning_rate": 2.151665578274581e-06,
3117
- "loss": 7.9669,
3118
- "step": 2220
3119
- },
3120
- {
3121
- "epoch": 3.504135486411973,
3122
- "grad_norm": 7.832403182983398,
3123
- "learning_rate": 2.0860985575853366e-06,
3124
- "loss": 8.0894,
3125
- "step": 2225
3126
- },
3127
- {
3128
- "epoch": 3.51201260338716,
3129
- "grad_norm": 5.209780216217041,
3130
- "learning_rate": 2.021502544469808e-06,
3131
- "loss": 7.4866,
3132
- "step": 2230
3133
- },
3134
- {
3135
- "epoch": 3.5198897203623476,
3136
- "grad_norm": 5.2757697105407715,
3137
- "learning_rate": 1.9578802762714427e-06,
3138
- "loss": 7.7545,
3139
- "step": 2235
3140
- },
3141
- {
3142
- "epoch": 3.5277668373375346,
3143
- "grad_norm": 4.831712245941162,
3144
- "learning_rate": 1.8952344490699243e-06,
3145
- "loss": 7.9045,
3146
- "step": 2240
3147
- },
3148
- {
3149
- "epoch": 3.5356439543127216,
3150
- "grad_norm": 4.441675662994385,
3151
- "learning_rate": 1.833567717566939e-06,
3152
- "loss": 7.379,
3153
- "step": 2245
3154
- },
3155
- {
3156
- "epoch": 3.5435210712879086,
3157
- "grad_norm": 5.417379856109619,
3158
- "learning_rate": 1.7728826949736598e-06,
3159
- "loss": 7.6097,
3160
- "step": 2250
3161
- },
3162
- {
3163
- "epoch": 3.5513981882630956,
3164
- "grad_norm": 4.504559516906738,
3165
- "learning_rate": 1.7131819529000226e-06,
3166
- "loss": 7.2856,
3167
- "step": 2255
3168
- },
3169
- {
3170
- "epoch": 3.559275305238283,
3171
- "grad_norm": 4.984797954559326,
3172
- "learning_rate": 1.6544680212457337e-06,
3173
- "loss": 7.194,
3174
- "step": 2260
3175
- },
3176
- {
3177
- "epoch": 3.5671524222134696,
3178
- "grad_norm": 4.818814754486084,
3179
- "learning_rate": 1.5967433880930889e-06,
3180
- "loss": 7.051,
3181
- "step": 2265
3182
- },
3183
- {
3184
- "epoch": 3.575029539188657,
3185
- "grad_norm": 4.872919082641602,
3186
- "learning_rate": 1.540010499601513e-06,
3187
- "loss": 7.1664,
3188
- "step": 2270
3189
- },
3190
- {
3191
- "epoch": 3.582906656163844,
3192
- "grad_norm": 6.4378862380981445,
3193
- "learning_rate": 1.4842717599039047e-06,
3194
- "loss": 7.3849,
3195
- "step": 2275
3196
- },
3197
- {
3198
- "epoch": 3.590783773139031,
3199
- "grad_norm": 5.795922756195068,
3200
- "learning_rate": 1.4295295310047668e-06,
3201
- "loss": 7.4473,
3202
- "step": 2280
3203
- },
3204
- {
3205
- "epoch": 3.598660890114218,
3206
- "grad_norm": 4.69597053527832,
3207
- "learning_rate": 1.375786132680118e-06,
3208
- "loss": 7.3833,
3209
- "step": 2285
3210
- },
3211
- {
3212
- "epoch": 3.606538007089405,
3213
- "grad_norm": 5.1728901863098145,
3214
- "learning_rate": 1.3230438423791625e-06,
3215
- "loss": 7.0266,
3216
- "step": 2290
3217
- },
3218
- {
3219
- "epoch": 3.6144151240645925,
3220
- "grad_norm": 4.9159440994262695,
3221
- "learning_rate": 1.2713048951278144e-06,
3222
- "loss": 7.3836,
3223
- "step": 2295
3224
- },
3225
- {
3226
- "epoch": 3.6222922410397795,
3227
- "grad_norm": 5.896880149841309,
3228
- "learning_rate": 1.2205714834339521e-06,
3229
- "loss": 7.517,
3230
- "step": 2300
3231
- },
3232
- {
3233
- "epoch": 3.6301693580149665,
3234
- "grad_norm": 4.930107593536377,
3235
- "learning_rate": 1.1708457571945386e-06,
3236
- "loss": 7.6201,
3237
- "step": 2305
3238
- },
3239
- {
3240
- "epoch": 3.6380464749901535,
3241
- "grad_norm": 4.929466724395752,
3242
- "learning_rate": 1.1221298236044953e-06,
3243
- "loss": 7.285,
3244
- "step": 2310
3245
- },
3246
- {
3247
- "epoch": 3.6459235919653405,
3248
- "grad_norm": 5.38197135925293,
3249
- "learning_rate": 1.0744257470674147e-06,
3250
- "loss": 7.2539,
3251
- "step": 2315
3252
- },
3253
- {
3254
- "epoch": 3.653800708940528,
3255
- "grad_norm": 5.5960469245910645,
3256
- "learning_rate": 1.0277355491080804e-06,
3257
- "loss": 7.4543,
3258
- "step": 2320
3259
- },
3260
- {
3261
- "epoch": 3.661677825915715,
3262
- "grad_norm": 5.1494245529174805,
3263
- "learning_rate": 9.820612082867969e-07,
3264
- "loss": 7.4204,
3265
- "step": 2325
3266
- },
3267
- {
3268
- "epoch": 3.669554942890902,
3269
- "grad_norm": 5.0791015625,
3270
- "learning_rate": 9.374046601155539e-07,
3271
- "loss": 7.2228,
3272
- "step": 2330
3273
- },
3274
- {
3275
- "epoch": 3.677432059866089,
3276
- "grad_norm": 4.948309421539307,
3277
- "learning_rate": 8.937677969759861e-07,
3278
- "loss": 7.5265,
3279
- "step": 2335
3280
- },
3281
- {
3282
- "epoch": 3.685309176841276,
3283
- "grad_norm": 5.31011438369751,
3284
- "learning_rate": 8.511524680392096e-07,
3285
- "loss": 7.5065,
3286
- "step": 2340
3287
- },
3288
- {
3289
- "epoch": 3.693186293816463,
3290
- "grad_norm": 4.728499889373779,
3291
- "learning_rate": 8.09560479187449e-07,
3292
- "loss": 7.6349,
3293
- "step": 2345
3294
- },
3295
- {
3296
- "epoch": 3.70106341079165,
3297
- "grad_norm": 4.810965538024902,
3298
- "learning_rate": 7.689935929374892e-07,
3299
- "loss": 7.2619,
3300
- "step": 2350
3301
- },
3302
- {
3303
- "epoch": 3.7089405277668375,
3304
- "grad_norm": 5.238432884216309,
3305
- "learning_rate": 7.294535283660281e-07,
3306
- "loss": 7.1741,
3307
- "step": 2355
3308
- },
3309
- {
3310
- "epoch": 3.7168176447420245,
3311
- "grad_norm": 4.824338436126709,
3312
- "learning_rate": 6.909419610367896e-07,
3313
- "loss": 7.5995,
3314
- "step": 2360
3315
- },
3316
- {
3317
- "epoch": 3.7246947617172115,
3318
- "grad_norm": 5.660040855407715,
3319
- "learning_rate": 6.534605229295415e-07,
3320
- "loss": 7.513,
3321
- "step": 2365
3322
- },
3323
- {
3324
- "epoch": 3.7325718786923985,
3325
- "grad_norm": 5.301452159881592,
3326
- "learning_rate": 6.170108023709348e-07,
3327
- "loss": 7.3567,
3328
- "step": 2370
3329
- },
3330
- {
3331
- "epoch": 3.7404489956675855,
3332
- "grad_norm": 5.379169940948486,
3333
- "learning_rate": 5.815943439671901e-07,
3334
- "loss": 6.9589,
3335
- "step": 2375
3336
- },
3337
- {
3338
- "epoch": 3.748326112642773,
3339
- "grad_norm": 5.965606212615967,
3340
- "learning_rate": 5.472126485386475e-07,
3341
- "loss": 7.6638,
3342
- "step": 2380
3343
- },
3344
- {
3345
- "epoch": 3.75620322961796,
3346
- "grad_norm": 4.746719837188721,
3347
- "learning_rate": 5.138671730561623e-07,
3348
- "loss": 7.3243,
3349
- "step": 2385
3350
- },
3351
- {
3352
- "epoch": 3.764080346593147,
3353
- "grad_norm": 4.829946994781494,
3354
- "learning_rate": 4.815593305793703e-07,
3355
- "loss": 7.6804,
3356
- "step": 2390
3357
- },
3358
- {
3359
- "epoch": 3.771957463568334,
3360
- "grad_norm": 6.1915669441223145,
3361
- "learning_rate": 4.502904901968141e-07,
3362
- "loss": 7.2188,
3363
- "step": 2395
3364
- },
3365
- {
3366
- "epoch": 3.779834580543521,
3367
- "grad_norm": 4.6367998123168945,
3368
- "learning_rate": 4.200619769679004e-07,
3369
- "loss": 6.9212,
3370
- "step": 2400
3371
- },
3372
- {
3373
- "epoch": 3.7877116975187084,
3374
- "grad_norm": 5.0970611572265625,
3375
- "learning_rate": 3.908750718667753e-07,
3376
- "loss": 7.3765,
3377
- "step": 2405
3378
- },
3379
- {
3380
- "epoch": 3.795588814493895,
3381
- "grad_norm": 5.42421817779541,
3382
- "learning_rate": 3.6273101172802914e-07,
3383
- "loss": 7.402,
3384
- "step": 2410
3385
- },
3386
- {
3387
- "epoch": 3.8034659314690824,
3388
- "grad_norm": 5.175075054168701,
3389
- "learning_rate": 3.3563098919428827e-07,
3390
- "loss": 7.053,
3391
- "step": 2415
3392
- },
3393
- {
3394
- "epoch": 3.8113430484442694,
3395
- "grad_norm": 4.7831854820251465,
3396
- "learning_rate": 3.095761526656693e-07,
3397
- "loss": 7.9933,
3398
- "step": 2420
3399
- },
3400
- {
3401
- "epoch": 3.8192201654194564,
3402
- "grad_norm": 6.312967300415039,
3403
- "learning_rate": 2.8456760625111823e-07,
3404
- "loss": 7.4616,
3405
- "step": 2425
3406
- },
3407
- {
3408
- "epoch": 3.8270972823946434,
3409
- "grad_norm": 5.104128360748291,
3410
- "learning_rate": 2.6060640972162543e-07,
3411
- "loss": 7.5123,
3412
- "step": 2430
3413
- },
3414
- {
3415
- "epoch": 3.8349743993698304,
3416
- "grad_norm": 5.383700847625732,
3417
- "learning_rate": 2.3769357846531171e-07,
3418
- "loss": 6.8885,
3419
- "step": 2435
3420
- },
3421
- {
3422
- "epoch": 3.842851516345018,
3423
- "grad_norm": 4.860473155975342,
3424
- "learning_rate": 2.1583008344439603e-07,
3425
- "loss": 7.0768,
3426
- "step": 2440
3427
- },
3428
- {
3429
- "epoch": 3.850728633320205,
3430
- "grad_norm": 5.095125675201416,
3431
- "learning_rate": 1.9501685115406176e-07,
3432
- "loss": 7.6519,
3433
- "step": 2445
3434
- },
3435
- {
3436
- "epoch": 3.858605750295392,
3437
- "grad_norm": 5.066483497619629,
3438
- "learning_rate": 1.7525476358318526e-07,
3439
- "loss": 7.3912,
3440
- "step": 2450
3441
- },
3442
- {
3443
- "epoch": 3.866482867270579,
3444
- "grad_norm": 6.104281425476074,
3445
- "learning_rate": 1.5654465817696584e-07,
3446
- "loss": 6.9311,
3447
- "step": 2455
3448
- },
3449
- {
3450
- "epoch": 3.874359984245766,
3451
- "grad_norm": 4.735925674438477,
3452
- "learning_rate": 1.3888732780142632e-07,
3453
- "loss": 7.2688,
3454
- "step": 2460
3455
- },
3456
- {
3457
- "epoch": 3.8822371012209533,
3458
- "grad_norm": 4.991415500640869,
3459
- "learning_rate": 1.2228352070983719e-07,
3460
- "loss": 6.8569,
3461
- "step": 2465
3462
- },
3463
- {
3464
- "epoch": 3.8901142181961403,
3465
- "grad_norm": 5.310063362121582,
3466
- "learning_rate": 1.0673394051098074e-07,
3467
- "loss": 7.4524,
3468
- "step": 2470
3469
- },
3470
- {
3471
- "epoch": 3.8979913351713273,
3472
- "grad_norm": 6.486708641052246,
3473
- "learning_rate": 9.223924613935842e-08,
3474
- "loss": 7.5994,
3475
- "step": 2475
3476
- },
3477
- {
3478
- "epoch": 3.9058684521465143,
3479
- "grad_norm": 4.825411319732666,
3480
- "learning_rate": 7.880005182725469e-08,
3481
- "loss": 7.0521,
3482
- "step": 2480
3483
- },
3484
- {
3485
- "epoch": 3.9137455691217014,
3486
- "grad_norm": 4.599216461181641,
3487
- "learning_rate": 6.641692707870795e-08,
3488
- "loss": 7.1754,
3489
- "step": 2485
3490
- },
3491
- {
3492
- "epoch": 3.921622686096889,
3493
- "grad_norm": 4.610249042510986,
3494
- "learning_rate": 5.509039664538251e-08,
3495
- "loss": 7.6455,
3496
- "step": 2490
3497
- },
3498
- {
3499
- "epoch": 3.9294998030720754,
3500
- "grad_norm": 5.008790016174316,
3501
- "learning_rate": 4.482094050433372e-08,
3502
- "loss": 7.7298,
3503
- "step": 2495
3504
- },
3505
- {
3506
- "epoch": 3.937376920047263,
3507
- "grad_norm": 5.213418006896973,
3508
- "learning_rate": 3.5608993837651924e-08,
3509
- "loss": 7.2896,
3510
- "step": 2500
3511
- },
3512
- {
3513
- "epoch": 3.94525403702245,
3514
- "grad_norm": 4.882436275482178,
3515
- "learning_rate": 2.745494701404394e-08,
3516
- "loss": 7.3404,
3517
- "step": 2505
3518
- },
3519
- {
3520
- "epoch": 3.953131153997637,
3521
- "grad_norm": 4.545849800109863,
3522
- "learning_rate": 2.0359145572276804e-08,
3523
- "loss": 7.5327,
3524
- "step": 2510
3525
- },
3526
- {
3527
- "epoch": 3.961008270972824,
3528
- "grad_norm": 5.91042423248291,
3529
- "learning_rate": 1.4321890206533961e-08,
3530
- "loss": 7.468,
3531
- "step": 2515
3532
- },
3533
- {
3534
- "epoch": 3.968885387948011,
3535
- "grad_norm": 5.8342766761779785,
3536
- "learning_rate": 9.34343675368099e-09,
3537
- "loss": 7.6057,
3538
- "step": 2520
3539
- },
3540
- {
3541
- "epoch": 3.9767625049231983,
3542
- "grad_norm": 5.667447566986084,
3543
- "learning_rate": 5.423996182415958e-09,
3544
- "loss": 7.2114,
3545
- "step": 2525
3546
- },
3547
- {
3548
- "epoch": 3.9846396218983853,
3549
- "grad_norm": 5.622943878173828,
3550
- "learning_rate": 2.5637345843348982e-09,
3551
- "loss": 7.2359,
3552
- "step": 2530
3553
- },
3554
- {
3555
- "epoch": 3.9925167388735723,
3556
- "grad_norm": 4.587869644165039,
3557
- "learning_rate": 7.627731668985449e-10,
3558
- "loss": 7.1989,
3559
- "step": 2535
3560
- },
3561
- {
3562
- "epoch": 3.9988184324537217,
3563
- "step": 2539,
3564
- "total_flos": 4.3565600076592054e+19,
3565
- "train_loss": 1.895302517482642,
3566
- "train_runtime": 61070.1581,
3567
- "train_samples_per_second": 2.661,
3568
- "train_steps_per_second": 0.042
3569
- }
3570
- ],
3571
- "logging_steps": 5,
3572
- "max_steps": 2540,
3573
- "num_input_tokens_seen": 0,
3574
- "num_train_epochs": 4,
3575
- "save_steps": 159,
3576
- "stateful_callbacks": {
3577
- "TrainerControl": {
3578
- "args": {
3579
- "should_epoch_stop": false,
3580
- "should_evaluate": false,
3581
- "should_log": false,
3582
- "should_save": true,
3583
- "should_training_stop": false
3584
- },
3585
- "attributes": {}
3586
- }
3587
- },
3588
- "total_flos": 4.3565600076592054e+19,
3589
- "train_batch_size": 2,
3590
- "trial_name": null,
3591
- "trial_params": null
3592
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/training_args.bin DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:46943a038bbd8afe345ee35cc3e2d8972bcd53d59b88da7fd7b677b1c4414324
3
- size 7825
 
 
 
 
Qwen3.4B-Math-R1-CoT-SFT/training_loss.png DELETED
Binary file (30 kB)
 
Qwen3.4B-Math-R1-CoT-SFT/vocab.json DELETED
The diff for this file is too large to render. See raw diff