satyanshu404
commited on
Commit
•
e319cfe
1
Parent(s):
55fafa0
Model save
Browse files- README.md +55 -0
- all_results.json +13 -0
- configuration_phi3.py +227 -0
- eval_results.json +8 -0
- generation_config.json +11 -0
- model-00001-of-00002.safetensors +1 -1
- model-00002-of-00002.safetensors +1 -1
- modeling_phi3.py +1563 -0
- tokenizer_config.json +1 -1
- train_results.json +8 -0
- trainer_state.json +3192 -0
README.md
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- trl
|
4 |
+
- sft
|
5 |
+
- generated_from_trainer
|
6 |
+
model-index:
|
7 |
+
- name: Phi-3-mini-4k-instruct-full-finetuned-v01
|
8 |
+
results: []
|
9 |
+
---
|
10 |
+
|
11 |
+
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
12 |
+
should probably proofread and complete it, then remove this comment. -->
|
13 |
+
|
14 |
+
# Phi-3-mini-4k-instruct-full-finetuned-v01
|
15 |
+
|
16 |
+
This model was trained from scratch on an unknown dataset.
|
17 |
+
It achieves the following results on the evaluation set:
|
18 |
+
- Loss: 0.4590
|
19 |
+
|
20 |
+
## Model description
|
21 |
+
|
22 |
+
More information needed
|
23 |
+
|
24 |
+
## Intended uses & limitations
|
25 |
+
|
26 |
+
More information needed
|
27 |
+
|
28 |
+
## Training and evaluation data
|
29 |
+
|
30 |
+
More information needed
|
31 |
+
|
32 |
+
## Training procedure
|
33 |
+
|
34 |
+
### Training hyperparameters
|
35 |
+
|
36 |
+
The following hyperparameters were used during training:
|
37 |
+
- learning_rate: 3e-05
|
38 |
+
- train_batch_size: 2
|
39 |
+
- eval_batch_size: 2
|
40 |
+
- seed: 0
|
41 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
42 |
+
- lr_scheduler_type: cosine
|
43 |
+
- lr_scheduler_warmup_ratio: 0.2
|
44 |
+
- num_epochs: 1
|
45 |
+
|
46 |
+
### Training results
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
### Framework versions
|
51 |
+
|
52 |
+
- Transformers 4.43.3
|
53 |
+
- Pytorch 2.2.2+cu121
|
54 |
+
- Datasets 2.20.0
|
55 |
+
- Tokenizers 0.19.1
|
all_results.json
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"epoch": 1.0,
|
3 |
+
"eval_loss": 0.4590456783771515,
|
4 |
+
"eval_runtime": 233.2276,
|
5 |
+
"eval_samples": 558,
|
6 |
+
"eval_samples_per_second": 2.393,
|
7 |
+
"eval_steps_per_second": 1.196,
|
8 |
+
"total_flos": 5.485972481640161e+17,
|
9 |
+
"train_loss": 0.4824531834622566,
|
10 |
+
"train_runtime": 26326.043,
|
11 |
+
"train_samples_per_second": 0.685,
|
12 |
+
"train_steps_per_second": 0.342
|
13 |
+
}
|
configuration_phi3.py
ADDED
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2024 Microsoft 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 |
+
|
16 |
+
""" Phi-3 model configuration"""
|
17 |
+
|
18 |
+
|
19 |
+
from transformers.configuration_utils import PretrainedConfig
|
20 |
+
from transformers.utils import logging
|
21 |
+
|
22 |
+
|
23 |
+
logger = logging.get_logger(__name__)
|
24 |
+
|
25 |
+
PHI3_PRETRAINED_CONFIG_ARCHIVE_MAP = {
|
26 |
+
"microsoft/Phi-3-mini-4k-instruct": "https://huggingface.co/microsoft/Phi-3-mini-4k-instruct/resolve/main/config.json",
|
27 |
+
"microsoft/Phi-3-mini-128k-instruct": "https://huggingface.co/microsoft/Phi-3-mini-128k-instruct/resolve/main/config.json",
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
class Phi3Config(PretrainedConfig):
|
32 |
+
r"""
|
33 |
+
This is the configuration class to store the configuration of a [`Phi3Model`]. It is used to instantiate a Phi-3
|
34 |
+
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
|
35 |
+
defaults will yield a similar configuration to that of the
|
36 |
+
[microsoft/Phi-3-mini-4k-instruct](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct).
|
37 |
+
|
38 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
39 |
+
documentation from [`PretrainedConfig`] for more information.
|
40 |
+
|
41 |
+
Args:
|
42 |
+
vocab_size (`int`, *optional*, defaults to 32064):
|
43 |
+
Vocabulary size of the Phi-3 model. Defines the number of different tokens that can be represented by the
|
44 |
+
`inputs_ids` passed when calling [`Phi3Model`].
|
45 |
+
hidden_size (`int`, *optional*, defaults to 3072):
|
46 |
+
Dimension of the hidden representations.
|
47 |
+
intermediate_size (`int`, *optional*, defaults to 8192):
|
48 |
+
Dimension of the MLP representations.
|
49 |
+
num_hidden_layers (`int`, *optional*, defaults to 32):
|
50 |
+
Number of hidden layers in the Transformer decoder.
|
51 |
+
num_attention_heads (`int`, *optional*, defaults to 32):
|
52 |
+
Number of attention heads for each attention layer in the Transformer decoder.
|
53 |
+
num_key_value_heads (`int`, *optional*):
|
54 |
+
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
|
55 |
+
`num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
|
56 |
+
`num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
|
57 |
+
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
|
58 |
+
by meanpooling all the original heads within that group. For more details checkout [this
|
59 |
+
paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
|
60 |
+
`num_attention_heads`.
|
61 |
+
resid_pdrop (`float`, *optional*, defaults to 0.0):
|
62 |
+
Dropout probability for mlp outputs.
|
63 |
+
embd_pdrop (`int`, *optional*, defaults to 0.0):
|
64 |
+
The dropout ratio for the embeddings.
|
65 |
+
attention_dropout (`float`, *optional*, defaults to 0.0):
|
66 |
+
The dropout ratio after computing the attention scores.
|
67 |
+
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
68 |
+
The non-linear activation function (function or string) in the decoder.
|
69 |
+
max_position_embeddings (`int`, *optional*, defaults to 4096):
|
70 |
+
The maximum sequence length that this model might ever be used with.
|
71 |
+
original_max_position_embeddings (`int`, *optional*, defaults to 4096):
|
72 |
+
The maximum sequence length that this model was trained with. This is used to determine the size of the
|
73 |
+
original RoPE embeddings when using long scaling.
|
74 |
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
75 |
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
76 |
+
rms_norm_eps (`float`, *optional*, defaults to 1e-05):
|
77 |
+
The epsilon value used for the RMSNorm.
|
78 |
+
use_cache (`bool`, *optional*, defaults to `True`):
|
79 |
+
Whether or not the model should return the last key/values attentions (not used by all models). Only
|
80 |
+
relevant if `config.is_decoder=True`. Whether to tie weight embeddings or not.
|
81 |
+
tie_word_embeddings (`bool`, *optional*, defaults to `False`):
|
82 |
+
Whether to tie weight embeddings
|
83 |
+
rope_theta (`float`, *optional*, defaults to 10000.0):
|
84 |
+
The base period of the RoPE embeddings.
|
85 |
+
rope_scaling (`dict`, *optional*):
|
86 |
+
The scaling strategy for the RoPE embeddings. If `None`, no scaling is applied. If a dictionary, it must
|
87 |
+
contain the following keys: `type`, `short_factor` and `long_factor`. The `type` must be `longrope` and
|
88 |
+
the `short_factor` and `long_factor` must be lists of numbers with the same length as the hidden size
|
89 |
+
divided by the number of attention heads divided by 2.
|
90 |
+
bos_token_id (`int`, *optional*, defaults to 1):
|
91 |
+
The id of the "beginning-of-sequence" token.
|
92 |
+
eos_token_id (`int`, *optional*, defaults to 32000):
|
93 |
+
The id of the "end-of-sequence" token.
|
94 |
+
pad_token_id (`int`, *optional*, defaults to 32000):
|
95 |
+
The id of the padding token.
|
96 |
+
sliding_window (`int`, *optional*):
|
97 |
+
Sliding window attention window size. If `None`, no sliding window is applied.
|
98 |
+
|
99 |
+
Example:
|
100 |
+
|
101 |
+
```python
|
102 |
+
>>> from transformers import Phi3Model, Phi3Config
|
103 |
+
|
104 |
+
>>> # Initializing a Phi-3 style configuration
|
105 |
+
>>> configuration = Phi3Config.from_pretrained("microsoft/Phi-3-mini-4k-instruct")
|
106 |
+
|
107 |
+
>>> # Initializing a model from the configuration
|
108 |
+
>>> model = Phi3Model(configuration)
|
109 |
+
|
110 |
+
>>> # Accessing the model configuration
|
111 |
+
>>> configuration = model.config
|
112 |
+
```"""
|
113 |
+
|
114 |
+
model_type = "phi3"
|
115 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
116 |
+
|
117 |
+
def __init__(
|
118 |
+
self,
|
119 |
+
vocab_size=32064,
|
120 |
+
hidden_size=3072,
|
121 |
+
intermediate_size=8192,
|
122 |
+
num_hidden_layers=32,
|
123 |
+
num_attention_heads=32,
|
124 |
+
num_key_value_heads=None,
|
125 |
+
resid_pdrop=0.0,
|
126 |
+
embd_pdrop=0.0,
|
127 |
+
attention_dropout=0.0,
|
128 |
+
hidden_act="silu",
|
129 |
+
max_position_embeddings=4096,
|
130 |
+
original_max_position_embeddings=4096,
|
131 |
+
initializer_range=0.02,
|
132 |
+
rms_norm_eps=1e-5,
|
133 |
+
use_cache=True,
|
134 |
+
tie_word_embeddings=False,
|
135 |
+
rope_theta=10000.0,
|
136 |
+
rope_scaling=None,
|
137 |
+
bos_token_id=1,
|
138 |
+
eos_token_id=32000,
|
139 |
+
pad_token_id=32000,
|
140 |
+
sliding_window=None,
|
141 |
+
**kwargs,
|
142 |
+
):
|
143 |
+
self.vocab_size = vocab_size
|
144 |
+
self.hidden_size = hidden_size
|
145 |
+
self.intermediate_size = intermediate_size
|
146 |
+
self.num_hidden_layers = num_hidden_layers
|
147 |
+
self.num_attention_heads = num_attention_heads
|
148 |
+
|
149 |
+
if num_key_value_heads is None:
|
150 |
+
num_key_value_heads = num_attention_heads
|
151 |
+
|
152 |
+
self.num_key_value_heads = num_key_value_heads
|
153 |
+
self.resid_pdrop = resid_pdrop
|
154 |
+
self.embd_pdrop = embd_pdrop
|
155 |
+
self.attention_dropout = attention_dropout
|
156 |
+
self.hidden_act = hidden_act
|
157 |
+
self.max_position_embeddings = max_position_embeddings
|
158 |
+
self.original_max_position_embeddings = original_max_position_embeddings
|
159 |
+
self.initializer_range = initializer_range
|
160 |
+
self.rms_norm_eps = rms_norm_eps
|
161 |
+
self.use_cache = use_cache
|
162 |
+
self.rope_theta = rope_theta
|
163 |
+
self.rope_scaling = rope_scaling
|
164 |
+
self._rope_scaling_adjustment()
|
165 |
+
self._rope_scaling_validation()
|
166 |
+
self.sliding_window = sliding_window
|
167 |
+
|
168 |
+
super().__init__(
|
169 |
+
bos_token_id=bos_token_id,
|
170 |
+
eos_token_id=eos_token_id,
|
171 |
+
pad_token_id=pad_token_id,
|
172 |
+
tie_word_embeddings=tie_word_embeddings,
|
173 |
+
**kwargs,
|
174 |
+
)
|
175 |
+
|
176 |
+
def _rope_scaling_adjustment(self):
|
177 |
+
"""
|
178 |
+
Adjust the `type` of the `rope_scaling` configuration for backward compatibility.
|
179 |
+
"""
|
180 |
+
if self.rope_scaling is None:
|
181 |
+
return
|
182 |
+
|
183 |
+
rope_scaling_type = self.rope_scaling.get("type", None)
|
184 |
+
|
185 |
+
# For backward compatibility if previous version used "su" or "yarn"
|
186 |
+
if rope_scaling_type is not None and rope_scaling_type in ["su", "yarn"]:
|
187 |
+
self.rope_scaling["type"] = "longrope"
|
188 |
+
|
189 |
+
def _rope_scaling_validation(self):
|
190 |
+
"""
|
191 |
+
Validate the `rope_scaling` configuration.
|
192 |
+
"""
|
193 |
+
if self.rope_scaling is None:
|
194 |
+
return
|
195 |
+
|
196 |
+
if not isinstance(self.rope_scaling, dict) or len(self.rope_scaling) != 3:
|
197 |
+
raise ValueError(
|
198 |
+
"`rope_scaling` must be a dictionary with three fields, `type`, `short_factor` and `long_factor`, "
|
199 |
+
f"got {self.rope_scaling}"
|
200 |
+
)
|
201 |
+
rope_scaling_type = self.rope_scaling.get("type", None)
|
202 |
+
rope_scaling_short_factor = self.rope_scaling.get("short_factor", None)
|
203 |
+
rope_scaling_long_factor = self.rope_scaling.get("long_factor", None)
|
204 |
+
if rope_scaling_type is None or rope_scaling_type not in ["longrope"]:
|
205 |
+
raise ValueError(f"`rope_scaling`'s type field must be one of ['longrope'], got {rope_scaling_type}")
|
206 |
+
if not (
|
207 |
+
isinstance(rope_scaling_short_factor, list)
|
208 |
+
and all(isinstance(x, (int, float)) for x in rope_scaling_short_factor)
|
209 |
+
):
|
210 |
+
raise ValueError(
|
211 |
+
f"`rope_scaling`'s short_factor field must be a list of numbers, got {rope_scaling_short_factor}"
|
212 |
+
)
|
213 |
+
if not len(rope_scaling_short_factor) == self.hidden_size // self.num_attention_heads // 2:
|
214 |
+
raise ValueError(
|
215 |
+
f"`rope_scaling`'s short_factor field must have length {self.hidden_size // self.num_attention_heads // 2}, got {len(rope_scaling_short_factor)}"
|
216 |
+
)
|
217 |
+
if not (
|
218 |
+
isinstance(rope_scaling_long_factor, list)
|
219 |
+
and all(isinstance(x, (int, float)) for x in rope_scaling_long_factor)
|
220 |
+
):
|
221 |
+
raise ValueError(
|
222 |
+
f"`rope_scaling`'s long_factor field must be a list of numbers, got {rope_scaling_long_factor}"
|
223 |
+
)
|
224 |
+
if not len(rope_scaling_long_factor) == self.hidden_size // self.num_attention_heads // 2:
|
225 |
+
raise ValueError(
|
226 |
+
f"`rope_scaling`'s long_factor field must have length {self.hidden_size // self.num_attention_heads // 2}, got {len(rope_scaling_long_factor)}"
|
227 |
+
)
|
eval_results.json
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"epoch": 1.0,
|
3 |
+
"eval_loss": 0.4590456783771515,
|
4 |
+
"eval_runtime": 233.2276,
|
5 |
+
"eval_samples": 558,
|
6 |
+
"eval_samples_per_second": 2.393,
|
7 |
+
"eval_steps_per_second": 1.196
|
8 |
+
}
|
generation_config.json
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 1,
|
4 |
+
"eos_token_id": [
|
5 |
+
32000,
|
6 |
+
32001,
|
7 |
+
32007
|
8 |
+
],
|
9 |
+
"pad_token_id": 32000,
|
10 |
+
"transformers_version": "4.43.3"
|
11 |
+
}
|
model-00001-of-00002.safetensors
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 4972489328
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ab568a422e189be32ef82332bac5922fa40d18cf1acde2ed49a039938bf304be
|
3 |
size 4972489328
|
model-00002-of-00002.safetensors
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 2669692552
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:afd166e96177532d652009e1487f4abd1d47898d57be8bcdaea86e2a155cb388
|
3 |
size 2669692552
|
modeling_phi3.py
ADD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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2024 Microsoft 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 |
+
|
16 |
+
""" PyTorch Phi-3 model."""
|
17 |
+
|
18 |
+
import inspect
|
19 |
+
import math
|
20 |
+
import warnings
|
21 |
+
from typing import List, Optional, Tuple, Union
|
22 |
+
|
23 |
+
import torch
|
24 |
+
import torch.nn.functional as F
|
25 |
+
import torch.utils.checkpoint
|
26 |
+
from torch import nn
|
27 |
+
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
|
28 |
+
|
29 |
+
from transformers.activations import ACT2FN
|
30 |
+
from transformers.cache_utils import Cache, DynamicCache
|
31 |
+
from transformers.modeling_attn_mask_utils import _prepare_4d_causal_attention_mask
|
32 |
+
from transformers.modeling_outputs import (
|
33 |
+
BaseModelOutputWithPast,
|
34 |
+
CausalLMOutputWithPast,
|
35 |
+
SequenceClassifierOutputWithPast,
|
36 |
+
TokenClassifierOutput,
|
37 |
+
)
|
38 |
+
from transformers.modeling_utils import PreTrainedModel
|
39 |
+
from transformers.utils import (
|
40 |
+
add_code_sample_docstrings,
|
41 |
+
add_start_docstrings,
|
42 |
+
add_start_docstrings_to_model_forward,
|
43 |
+
is_flash_attn_2_available,
|
44 |
+
is_flash_attn_greater_or_equal_2_10,
|
45 |
+
logging,
|
46 |
+
replace_return_docstrings,
|
47 |
+
)
|
48 |
+
from .configuration_phi3 import Phi3Config
|
49 |
+
|
50 |
+
|
51 |
+
logger = logging.get_logger(__name__)
|
52 |
+
|
53 |
+
# Transformers scans dependencies in the modeling file, causing issues on conditional loading. The regex only ignores try/catch blocks, but not if statements
|
54 |
+
# if is_flash_attn_2_available():
|
55 |
+
_flash_supports_window_size = False
|
56 |
+
try:
|
57 |
+
from flash_attn import flash_attn_func, flash_attn_varlen_func
|
58 |
+
from flash_attn.bert_padding import index_first_axis, pad_input, unpad_input # noqa
|
59 |
+
|
60 |
+
_flash_supports_window_size = "window_size" in list(inspect.signature(flash_attn_func).parameters)
|
61 |
+
except ImportError as error:
|
62 |
+
logger.warning(
|
63 |
+
f"`flash-attention` package not found, consider installing for better performance: {error}."
|
64 |
+
)
|
65 |
+
if not _flash_supports_window_size:
|
66 |
+
logger.warning(
|
67 |
+
"Current `flash-attention` does not support `window_size`. Either upgrade or use `attn_implementation='eager'`."
|
68 |
+
)
|
69 |
+
|
70 |
+
_CHECKPOINT_FOR_DOC = "microsoft/Phi-3-mini-4k-instruct"
|
71 |
+
_CONFIG_FOR_DOC = "Phi3Config"
|
72 |
+
|
73 |
+
PHI3_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
74 |
+
"microsoft/Phi-3-mini-4k-instruct",
|
75 |
+
"microsoft/Phi-3-mini-128k-instruct",
|
76 |
+
# See all Phi-3 models at https://huggingface.co/models?filter=Phi-3
|
77 |
+
]
|
78 |
+
|
79 |
+
|
80 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaRMSNorm with Llama->Phi3
|
81 |
+
class Phi3RMSNorm(nn.Module):
|
82 |
+
def __init__(self, hidden_size, eps=1e-6):
|
83 |
+
"""
|
84 |
+
Phi3RMSNorm is equivalent to T5LayerNorm
|
85 |
+
"""
|
86 |
+
super().__init__()
|
87 |
+
self.weight = nn.Parameter(torch.ones(hidden_size))
|
88 |
+
self.variance_epsilon = eps
|
89 |
+
|
90 |
+
def forward(self, hidden_states):
|
91 |
+
input_dtype = hidden_states.dtype
|
92 |
+
hidden_states = hidden_states.to(torch.float32)
|
93 |
+
variance = hidden_states.pow(2).mean(-1, keepdim=True)
|
94 |
+
hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
|
95 |
+
return self.weight * hidden_states.to(input_dtype)
|
96 |
+
|
97 |
+
|
98 |
+
# Copied from transformers.models.llama.modeling_llama._get_unpad_data
|
99 |
+
def _get_unpad_data(attention_mask):
|
100 |
+
seqlens_in_batch = attention_mask.sum(dim=-1, dtype=torch.int32)
|
101 |
+
indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()
|
102 |
+
max_seqlen_in_batch = seqlens_in_batch.max().item()
|
103 |
+
cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.int32), (1, 0))
|
104 |
+
return (
|
105 |
+
indices,
|
106 |
+
cu_seqlens,
|
107 |
+
max_seqlen_in_batch,
|
108 |
+
)
|
109 |
+
|
110 |
+
|
111 |
+
# Copied from transformers.models.gemma.modeling_gemma.GemmaRotaryEmbedding with gemma->phi3, Gemma->Phi3
|
112 |
+
class Phi3RotaryEmbedding(nn.Module):
|
113 |
+
def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None):
|
114 |
+
super().__init__()
|
115 |
+
|
116 |
+
self.dim = dim
|
117 |
+
self.max_position_embeddings = max_position_embeddings
|
118 |
+
self.base = base
|
119 |
+
self.register_buffer("inv_freq", None, persistent=False)
|
120 |
+
|
121 |
+
@torch.no_grad()
|
122 |
+
def forward(self, x, position_ids, seq_len=None):
|
123 |
+
# x: [bs, num_attention_heads, seq_len, head_size]
|
124 |
+
if self.inv_freq is None:
|
125 |
+
self.inv_freq = 1.0 / (
|
126 |
+
self.base ** (torch.arange(0, self.dim, 2, dtype=torch.int64, device=x.device).float() / self.dim)
|
127 |
+
)
|
128 |
+
inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1)
|
129 |
+
position_ids_expanded = position_ids[:, None, :].float()
|
130 |
+
# Force float32 since bfloat16 loses precision on long contexts
|
131 |
+
# See https://github.com/huggingface/transformers/pull/29285
|
132 |
+
device_type = x.device.type
|
133 |
+
device_type = device_type if isinstance(device_type, str) and device_type != "mps" else "cpu"
|
134 |
+
with torch.autocast(device_type=device_type, enabled=False):
|
135 |
+
freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
|
136 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
137 |
+
cos = emb.cos()
|
138 |
+
sin = emb.sin()
|
139 |
+
return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
|
140 |
+
|
141 |
+
|
142 |
+
class Phi3LongRoPEScaledRotaryEmbedding(Phi3RotaryEmbedding):
|
143 |
+
def __init__(self, dim, config, device=None):
|
144 |
+
super().__init__(dim, config.max_position_embeddings, config.rope_theta, device)
|
145 |
+
|
146 |
+
self.short_factor = config.rope_scaling["short_factor"]
|
147 |
+
self.long_factor = config.rope_scaling["long_factor"]
|
148 |
+
self.original_max_position_embeddings = config.original_max_position_embeddings
|
149 |
+
|
150 |
+
@torch.no_grad()
|
151 |
+
def forward(self, x, position_ids, seq_len=None):
|
152 |
+
seq_len = torch.max(position_ids) + 1
|
153 |
+
if seq_len > self.original_max_position_embeddings:
|
154 |
+
ext_factors = torch.tensor(self.long_factor, dtype=torch.float32, device=x.device)
|
155 |
+
else:
|
156 |
+
ext_factors = torch.tensor(self.short_factor, dtype=torch.float32, device=x.device)
|
157 |
+
|
158 |
+
inv_freq_shape = torch.arange(0, self.dim, 2, dtype=torch.int64, device=x.device).float() / self.dim
|
159 |
+
self.inv_freq = 1.0 / (ext_factors * self.base**inv_freq_shape)
|
160 |
+
|
161 |
+
inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1)
|
162 |
+
position_ids_expanded = position_ids[:, None, :].float()
|
163 |
+
|
164 |
+
# Force float32 since bfloat16 loses precision on long contexts
|
165 |
+
# See https://github.com/huggingface/transformers/pull/29285
|
166 |
+
device_type = x.device.type
|
167 |
+
device_type = device_type if isinstance(device_type, str) and device_type != "mps" else "cpu"
|
168 |
+
with torch.autocast(device_type=device_type, enabled=False):
|
169 |
+
freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
|
170 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
171 |
+
|
172 |
+
scale = self.max_position_embeddings / self.original_max_position_embeddings
|
173 |
+
if scale <= 1.0:
|
174 |
+
scaling_factor = 1.0
|
175 |
+
else:
|
176 |
+
scaling_factor = math.sqrt(1 + math.log(scale) / math.log(self.original_max_position_embeddings))
|
177 |
+
|
178 |
+
cos = emb.cos() * scaling_factor
|
179 |
+
sin = emb.sin() * scaling_factor
|
180 |
+
return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
|
181 |
+
|
182 |
+
|
183 |
+
# Copied from transformers.models.llama.modeling_llama.rotate_half
|
184 |
+
def rotate_half(x):
|
185 |
+
"""Rotates half the hidden dims of the input."""
|
186 |
+
x1 = x[..., : x.shape[-1] // 2]
|
187 |
+
x2 = x[..., x.shape[-1] // 2 :]
|
188 |
+
return torch.cat((-x2, x1), dim=-1)
|
189 |
+
|
190 |
+
|
191 |
+
# Copied from transformers.models.llama.modeling_llama.apply_rotary_pos_emb
|
192 |
+
def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_dim=1):
|
193 |
+
"""Applies Rotary Position Embedding to the query and key tensors.
|
194 |
+
|
195 |
+
Args:
|
196 |
+
q (`torch.Tensor`): The query tensor.
|
197 |
+
k (`torch.Tensor`): The key tensor.
|
198 |
+
cos (`torch.Tensor`): The cosine part of the rotary embedding.
|
199 |
+
sin (`torch.Tensor`): The sine part of the rotary embedding.
|
200 |
+
position_ids (`torch.Tensor`, *optional*):
|
201 |
+
Deprecated and unused.
|
202 |
+
unsqueeze_dim (`int`, *optional*, defaults to 1):
|
203 |
+
The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
|
204 |
+
sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
|
205 |
+
that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
|
206 |
+
k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
|
207 |
+
cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
|
208 |
+
the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
|
209 |
+
Returns:
|
210 |
+
`tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
|
211 |
+
"""
|
212 |
+
cos = cos.unsqueeze(unsqueeze_dim)
|
213 |
+
sin = sin.unsqueeze(unsqueeze_dim)
|
214 |
+
q_embed = (q * cos) + (rotate_half(q) * sin)
|
215 |
+
k_embed = (k * cos) + (rotate_half(k) * sin)
|
216 |
+
return q_embed, k_embed
|
217 |
+
|
218 |
+
|
219 |
+
class Phi3MLP(nn.Module):
|
220 |
+
def __init__(self, config):
|
221 |
+
super().__init__()
|
222 |
+
|
223 |
+
self.config = config
|
224 |
+
self.gate_up_proj = nn.Linear(config.hidden_size, 2 * config.intermediate_size, bias=False)
|
225 |
+
self.down_proj = nn.Linear(config.intermediate_size, config.hidden_size, bias=False)
|
226 |
+
|
227 |
+
self.activation_fn = ACT2FN[config.hidden_act]
|
228 |
+
|
229 |
+
def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor:
|
230 |
+
up_states = self.gate_up_proj(hidden_states)
|
231 |
+
|
232 |
+
gate, up_states = up_states.chunk(2, dim=-1)
|
233 |
+
up_states = up_states * self.activation_fn(gate)
|
234 |
+
|
235 |
+
return self.down_proj(up_states)
|
236 |
+
|
237 |
+
|
238 |
+
# Copied from transformers.models.llama.modeling_llama.repeat_kv with llama->phi
|
239 |
+
def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
|
240 |
+
"""
|
241 |
+
This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
|
242 |
+
num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
|
243 |
+
"""
|
244 |
+
batch, num_key_value_heads, slen, head_dim = hidden_states.shape
|
245 |
+
if n_rep == 1:
|
246 |
+
return hidden_states
|
247 |
+
hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
|
248 |
+
return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
|
249 |
+
|
250 |
+
|
251 |
+
class Phi3Attention(nn.Module):
|
252 |
+
"""Multi-headed attention from 'Attention Is All You Need' paper"""
|
253 |
+
|
254 |
+
def __init__(self, config: Phi3Config, layer_idx: Optional[int] = None):
|
255 |
+
super().__init__()
|
256 |
+
self.config = config
|
257 |
+
self.layer_idx = layer_idx
|
258 |
+
if layer_idx is None:
|
259 |
+
logger.warning_once(
|
260 |
+
f"Instantiating {self.__class__.__name__} without passing a `layer_idx` is not recommended and will "
|
261 |
+
"lead to errors during the forward call if caching is used. Please make sure to provide a `layer_idx` "
|
262 |
+
"when creating this class."
|
263 |
+
)
|
264 |
+
|
265 |
+
self.attention_dropout = config.attention_dropout
|
266 |
+
self.hidden_size = config.hidden_size
|
267 |
+
self.num_heads = config.num_attention_heads
|
268 |
+
self.head_dim = self.hidden_size // self.num_heads
|
269 |
+
self.num_key_value_heads = config.num_key_value_heads
|
270 |
+
self.num_key_value_groups = self.num_heads // self.num_key_value_heads
|
271 |
+
self.max_position_embeddings = config.max_position_embeddings
|
272 |
+
self.original_max_position_embeddings = config.original_max_position_embeddings
|
273 |
+
self.rope_theta = config.rope_theta
|
274 |
+
self.rope_scaling = config.rope_scaling
|
275 |
+
self.is_causal = True
|
276 |
+
|
277 |
+
if (self.head_dim * self.num_heads) != self.hidden_size:
|
278 |
+
raise ValueError(
|
279 |
+
f"hidden_size must be divisible by num_heads (got `hidden_size`: {self.hidden_size}"
|
280 |
+
f" and `num_heads`: {self.num_heads})."
|
281 |
+
)
|
282 |
+
|
283 |
+
op_size = self.num_heads * self.head_dim + 2 * (self.num_key_value_heads * self.head_dim)
|
284 |
+
self.o_proj = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=False)
|
285 |
+
self.qkv_proj = nn.Linear(self.hidden_size, op_size, bias=False)
|
286 |
+
self._init_rope()
|
287 |
+
|
288 |
+
def _init_rope(self):
|
289 |
+
if self.rope_scaling is None:
|
290 |
+
self.rotary_emb = Phi3RotaryEmbedding(
|
291 |
+
self.head_dim,
|
292 |
+
max_position_embeddings=self.max_position_embeddings,
|
293 |
+
base=self.rope_theta,
|
294 |
+
)
|
295 |
+
else:
|
296 |
+
scaling_type = self.config.rope_scaling["type"]
|
297 |
+
if scaling_type == "longrope":
|
298 |
+
self.rotary_emb = Phi3LongRoPEScaledRotaryEmbedding(self.head_dim, self.config)
|
299 |
+
else:
|
300 |
+
raise ValueError(f"Unknown RoPE scaling type {scaling_type}")
|
301 |
+
|
302 |
+
def forward(
|
303 |
+
self,
|
304 |
+
hidden_states: torch.Tensor,
|
305 |
+
attention_mask: Optional[torch.Tensor] = None,
|
306 |
+
position_ids: Optional[torch.LongTensor] = None,
|
307 |
+
past_key_value: Optional[Cache] = None,
|
308 |
+
output_attentions: bool = False,
|
309 |
+
use_cache: bool = False,
|
310 |
+
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
311 |
+
logger.warning_once("You are not running the flash-attention implementation, expect numerical differences.")
|
312 |
+
|
313 |
+
bsz, q_len, _ = hidden_states.size()
|
314 |
+
|
315 |
+
qkv = self.qkv_proj(hidden_states)
|
316 |
+
query_pos = self.num_heads * self.head_dim
|
317 |
+
query_states = qkv[..., :query_pos]
|
318 |
+
key_states = qkv[..., query_pos : query_pos + self.num_key_value_heads * self.head_dim]
|
319 |
+
value_states = qkv[..., query_pos + self.num_key_value_heads * self.head_dim :]
|
320 |
+
|
321 |
+
query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
|
322 |
+
key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
|
323 |
+
value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
|
324 |
+
|
325 |
+
kv_seq_len = key_states.shape[-2]
|
326 |
+
if past_key_value is not None:
|
327 |
+
if self.layer_idx is None:
|
328 |
+
raise ValueError(
|
329 |
+
f"The cache structure has changed since version v4.36. If you are using {self.__class__.__name__} "
|
330 |
+
"for auto-regressive decoding with k/v caching, please make sure to initialize the attention class "
|
331 |
+
"with a layer index."
|
332 |
+
)
|
333 |
+
kv_seq_len += past_key_value.get_usable_length(kv_seq_len, self.layer_idx)
|
334 |
+
cos, sin = self.rotary_emb(value_states, position_ids, seq_len=kv_seq_len)
|
335 |
+
|
336 |
+
query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
|
337 |
+
|
338 |
+
if past_key_value is not None:
|
339 |
+
cache_kwargs = {"sin": sin, "cos": cos} # Specific to RoPE models
|
340 |
+
key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
|
341 |
+
|
342 |
+
# repeat k/v heads if n_kv_heads < n_heads
|
343 |
+
key_states = repeat_kv(key_states, self.num_key_value_groups)
|
344 |
+
value_states = repeat_kv(value_states, self.num_key_value_groups)
|
345 |
+
|
346 |
+
attn_weights = torch.matmul(query_states, key_states.transpose(2, 3)) / math.sqrt(self.head_dim)
|
347 |
+
|
348 |
+
if attn_weights.size() != (bsz, self.num_heads, q_len, kv_seq_len):
|
349 |
+
raise ValueError(
|
350 |
+
f"Attention weights should be of size {(bsz, self.num_heads, q_len, kv_seq_len)}, but is"
|
351 |
+
f" {attn_weights.size()}"
|
352 |
+
)
|
353 |
+
|
354 |
+
if attention_mask is not None:
|
355 |
+
if attention_mask.size() != (bsz, 1, q_len, kv_seq_len):
|
356 |
+
raise ValueError(
|
357 |
+
f"Attention mask should be of size {(bsz, 1, q_len, kv_seq_len)}, but is {attention_mask.size()}"
|
358 |
+
)
|
359 |
+
attn_weights = attn_weights + attention_mask
|
360 |
+
|
361 |
+
# upcast attention to fp32
|
362 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(value_states.dtype)
|
363 |
+
attn_weights = nn.functional.dropout(attn_weights, p=self.attention_dropout, training=self.training)
|
364 |
+
|
365 |
+
attn_output = torch.matmul(attn_weights, value_states)
|
366 |
+
|
367 |
+
if attn_output.size() != (bsz, self.num_heads, q_len, self.head_dim):
|
368 |
+
raise ValueError(
|
369 |
+
f"`attn_output` should be of size {(bsz, self.num_heads, q_len, self.head_dim)}, but is"
|
370 |
+
f" {attn_output.size()}"
|
371 |
+
)
|
372 |
+
|
373 |
+
attn_output = attn_output.transpose(1, 2).contiguous()
|
374 |
+
attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
|
375 |
+
|
376 |
+
attn_output = self.o_proj(attn_output)
|
377 |
+
|
378 |
+
if not output_attentions:
|
379 |
+
attn_weights = None
|
380 |
+
|
381 |
+
return attn_output, attn_weights, past_key_value
|
382 |
+
|
383 |
+
|
384 |
+
class Phi3FlashAttention2(Phi3Attention):
|
385 |
+
"""
|
386 |
+
Phi-3 flash attention module. This module inherits from `Phi3Attention` as the weights of the module stays
|
387 |
+
untouched. The only required change would be on the forward pass where it needs to correctly call the public API of
|
388 |
+
flash attention and deal with padding tokens in case the input contains any of them.
|
389 |
+
"""
|
390 |
+
|
391 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaFlashAttention2.__init__
|
392 |
+
def __init__(self, *args, **kwargs):
|
393 |
+
super().__init__(*args, **kwargs)
|
394 |
+
|
395 |
+
# TODO: Should be removed once Flash Attention for RoCm is bumped to 2.1.
|
396 |
+
# flash_attn<2.1 generates top-left aligned causal mask, while what is needed here is bottom-right alignement, that was made default for flash_attn>=2.1. This attribute is used to handle this difference. Reference: https://github.com/Dao-AILab/flash-attention/releases/tag/v2.1.0.
|
397 |
+
# Beware that with flash_attn<2.1, using q_seqlen != k_seqlen (except for the case q_seqlen == 1) produces a wrong mask (top-left).
|
398 |
+
self._flash_attn_uses_top_left_mask = not is_flash_attn_greater_or_equal_2_10()
|
399 |
+
|
400 |
+
def forward(
|
401 |
+
self,
|
402 |
+
hidden_states: torch.Tensor,
|
403 |
+
attention_mask: Optional[torch.LongTensor] = None,
|
404 |
+
position_ids: Optional[torch.LongTensor] = None,
|
405 |
+
past_key_value: Optional[Cache] = None,
|
406 |
+
output_attentions: bool = False,
|
407 |
+
use_cache: bool = False,
|
408 |
+
**kwargs,
|
409 |
+
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
410 |
+
# Phi3FlashAttention2 attention does not support output_attentions
|
411 |
+
|
412 |
+
if not _flash_supports_window_size:
|
413 |
+
logger.warning_once(
|
414 |
+
"The current flash attention version does not support sliding window attention. Please use `attn_implementation='eager'` or upgrade flash-attn library."
|
415 |
+
)
|
416 |
+
raise ValueError("The current flash attention version does not support sliding window attention.")
|
417 |
+
|
418 |
+
output_attentions = False
|
419 |
+
|
420 |
+
if "padding_mask" in kwargs:
|
421 |
+
warnings.warn(
|
422 |
+
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
423 |
+
)
|
424 |
+
|
425 |
+
# overwrite attention_mask with padding_mask
|
426 |
+
attention_mask = kwargs.pop("padding_mask")
|
427 |
+
|
428 |
+
bsz, q_len, _ = hidden_states.size()
|
429 |
+
|
430 |
+
qkv = self.qkv_proj(hidden_states)
|
431 |
+
query_pos = self.num_heads * self.head_dim
|
432 |
+
query_states = qkv[..., :query_pos]
|
433 |
+
key_states = qkv[..., query_pos : query_pos + self.num_key_value_heads * self.head_dim]
|
434 |
+
value_states = qkv[..., query_pos + self.num_key_value_heads * self.head_dim :]
|
435 |
+
|
436 |
+
# Flash attention requires the input to have the shape
|
437 |
+
# batch_size x seq_length x head_dim x hidden_dim
|
438 |
+
# therefore we just need to keep the original shape
|
439 |
+
query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
|
440 |
+
key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
|
441 |
+
value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
|
442 |
+
|
443 |
+
kv_seq_len = key_states.shape[-2]
|
444 |
+
if past_key_value is not None:
|
445 |
+
if self.layer_idx is None:
|
446 |
+
raise ValueError(
|
447 |
+
f"The cache structure has changed since version v4.36. If you are using {self.__class__.__name__} "
|
448 |
+
"for auto-regressive decoding with k/v caching, please make sure to initialize the attention class "
|
449 |
+
"with a layer index."
|
450 |
+
)
|
451 |
+
kv_seq_len += past_key_value.get_usable_length(kv_seq_len, self.layer_idx)
|
452 |
+
|
453 |
+
# Because the input can be padded, the absolute sequence length depends on the max position id.
|
454 |
+
rotary_seq_len = max(kv_seq_len, position_ids[:, -1].max().item()) + 1
|
455 |
+
cos, sin = self.rotary_emb(value_states, position_ids, seq_len=rotary_seq_len)
|
456 |
+
|
457 |
+
query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
|
458 |
+
|
459 |
+
use_sliding_windows = (
|
460 |
+
_flash_supports_window_size
|
461 |
+
and getattr(self.config, "sliding_window", None) is not None
|
462 |
+
and kv_seq_len > self.config.sliding_window
|
463 |
+
)
|
464 |
+
|
465 |
+
if past_key_value is not None:
|
466 |
+
# Activate slicing cache only if the config has a value `sliding_windows` attribute
|
467 |
+
cache_has_contents = past_key_value.get_seq_length(self.layer_idx) > 0
|
468 |
+
if (
|
469 |
+
getattr(self.config, "sliding_window", None) is not None
|
470 |
+
and kv_seq_len > self.config.sliding_window
|
471 |
+
and cache_has_contents
|
472 |
+
):
|
473 |
+
slicing_tokens = 1 - self.config.sliding_window
|
474 |
+
|
475 |
+
past_key = past_key_value[self.layer_idx][0]
|
476 |
+
past_value = past_key_value[self.layer_idx][1]
|
477 |
+
|
478 |
+
past_key = past_key[:, :, slicing_tokens:, :].contiguous()
|
479 |
+
past_value = past_value[:, :, slicing_tokens:, :].contiguous()
|
480 |
+
|
481 |
+
if past_key.shape[-2] != self.config.sliding_window - 1:
|
482 |
+
raise ValueError(
|
483 |
+
f"past key must have a shape of (`batch_size, num_heads, self.config.sliding_window-1, head_dim`), got"
|
484 |
+
f" {past_key.shape}"
|
485 |
+
)
|
486 |
+
|
487 |
+
if attention_mask is not None:
|
488 |
+
attention_mask = attention_mask[:, slicing_tokens:]
|
489 |
+
attention_mask = torch.cat([attention_mask, torch.ones_like(attention_mask[:, -1:])], dim=-1)
|
490 |
+
|
491 |
+
cache_kwargs = {"sin": sin, "cos": cos} # Specific to RoPE models
|
492 |
+
key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
|
493 |
+
|
494 |
+
# repeat k/v heads if n_kv_heads < n_heads
|
495 |
+
key_states = repeat_kv(key_states, self.num_key_value_groups)
|
496 |
+
value_states = repeat_kv(value_states, self.num_key_value_groups)
|
497 |
+
|
498 |
+
attn_dropout = self.attention_dropout if self.training else 0.0
|
499 |
+
|
500 |
+
# In PEFT, usually we cast the layer norms in float32 for training stability reasons
|
501 |
+
# therefore the input hidden states gets silently casted in float32. Hence, we need
|
502 |
+
# cast them back in the correct dtype just to be sure everything works as expected.
|
503 |
+
# This might slowdown training & inference so it is recommended to not cast the LayerNorms
|
504 |
+
# in fp32.
|
505 |
+
|
506 |
+
if query_states.dtype == torch.float32:
|
507 |
+
if torch.is_autocast_enabled():
|
508 |
+
target_dtype = torch.get_autocast_gpu_dtype()
|
509 |
+
# Handle the case where the model is quantized
|
510 |
+
elif hasattr(self.config, "_pre_quantization_dtype"):
|
511 |
+
target_dtype = self.config._pre_quantization_dtype
|
512 |
+
else:
|
513 |
+
target_dtype = self.qkv_proj.weight.dtype
|
514 |
+
|
515 |
+
logger.warning_once(
|
516 |
+
f"The input hidden states seems to be silently casted in float32, this might be related to"
|
517 |
+
f" the fact you have upcasted embedding or layer norm layers in float32. We will cast back the input in"
|
518 |
+
f" {target_dtype}."
|
519 |
+
)
|
520 |
+
|
521 |
+
query_states = query_states.to(target_dtype)
|
522 |
+
key_states = key_states.to(target_dtype)
|
523 |
+
value_states = value_states.to(target_dtype)
|
524 |
+
|
525 |
+
# Reashape to the expected shape for Flash Attention
|
526 |
+
query_states = query_states.transpose(1, 2)
|
527 |
+
key_states = key_states.transpose(1, 2)
|
528 |
+
value_states = value_states.transpose(1, 2)
|
529 |
+
|
530 |
+
attn_output = self._flash_attention_forward(
|
531 |
+
query_states,
|
532 |
+
key_states,
|
533 |
+
value_states,
|
534 |
+
attention_mask,
|
535 |
+
q_len,
|
536 |
+
dropout=attn_dropout,
|
537 |
+
use_sliding_windows=use_sliding_windows,
|
538 |
+
)
|
539 |
+
|
540 |
+
attn_output = attn_output.reshape(bsz, q_len, self.hidden_size).contiguous()
|
541 |
+
attn_output = self.o_proj(attn_output)
|
542 |
+
|
543 |
+
if not output_attentions:
|
544 |
+
attn_weights = None
|
545 |
+
|
546 |
+
return attn_output, attn_weights, past_key_value
|
547 |
+
|
548 |
+
# Copied from transformers.models.mistral.modeling_mistral.MistralFlashAttention2._flash_attention_forward
|
549 |
+
def _flash_attention_forward(
|
550 |
+
self,
|
551 |
+
query_states,
|
552 |
+
key_states,
|
553 |
+
value_states,
|
554 |
+
attention_mask,
|
555 |
+
query_length,
|
556 |
+
dropout=0.0,
|
557 |
+
softmax_scale=None,
|
558 |
+
use_sliding_windows=False,
|
559 |
+
):
|
560 |
+
"""
|
561 |
+
Calls the forward method of Flash Attention - if the input hidden states contain at least one padding token
|
562 |
+
first unpad the input, then computes the attention scores and pad the final attention scores.
|
563 |
+
|
564 |
+
Args:
|
565 |
+
query_states (`torch.Tensor`):
|
566 |
+
Input query states to be passed to Flash Attention API
|
567 |
+
key_states (`torch.Tensor`):
|
568 |
+
Input key states to be passed to Flash Attention API
|
569 |
+
value_states (`torch.Tensor`):
|
570 |
+
Input value states to be passed to Flash Attention API
|
571 |
+
attention_mask (`torch.Tensor`):
|
572 |
+
The padding mask - corresponds to a tensor of size `(batch_size, seq_len)` where 0 stands for the
|
573 |
+
position of padding tokens and 1 for the position of non-padding tokens.
|
574 |
+
dropout (`float`):
|
575 |
+
Attention dropout
|
576 |
+
softmax_scale (`float`, *optional*):
|
577 |
+
The scaling of QK^T before applying softmax. Default to 1 / sqrt(head_dim)
|
578 |
+
use_sliding_windows (`bool`, *optional*):
|
579 |
+
Whether to activate sliding window attention.
|
580 |
+
"""
|
581 |
+
if not self._flash_attn_uses_top_left_mask:
|
582 |
+
causal = self.is_causal
|
583 |
+
else:
|
584 |
+
# TODO: Remove the `query_length != 1` check once Flash Attention for RoCm is bumped to 2.1. For details, please see the comment in LlamaFlashAttention2 __init__.
|
585 |
+
causal = self.is_causal and query_length != 1
|
586 |
+
|
587 |
+
# Contains at least one padding token in the sequence
|
588 |
+
if attention_mask is not None:
|
589 |
+
batch_size = query_states.shape[0]
|
590 |
+
query_states, key_states, value_states, indices_q, cu_seq_lens, max_seq_lens = self._upad_input(
|
591 |
+
query_states, key_states, value_states, attention_mask, query_length
|
592 |
+
)
|
593 |
+
|
594 |
+
cu_seqlens_q, cu_seqlens_k = cu_seq_lens
|
595 |
+
max_seqlen_in_batch_q, max_seqlen_in_batch_k = max_seq_lens
|
596 |
+
|
597 |
+
if not use_sliding_windows:
|
598 |
+
attn_output_unpad = flash_attn_varlen_func(
|
599 |
+
query_states,
|
600 |
+
key_states,
|
601 |
+
value_states,
|
602 |
+
cu_seqlens_q=cu_seqlens_q,
|
603 |
+
cu_seqlens_k=cu_seqlens_k,
|
604 |
+
max_seqlen_q=max_seqlen_in_batch_q,
|
605 |
+
max_seqlen_k=max_seqlen_in_batch_k,
|
606 |
+
dropout_p=dropout,
|
607 |
+
softmax_scale=softmax_scale,
|
608 |
+
causal=causal,
|
609 |
+
)
|
610 |
+
else:
|
611 |
+
attn_output_unpad = flash_attn_varlen_func(
|
612 |
+
query_states,
|
613 |
+
key_states,
|
614 |
+
value_states,
|
615 |
+
cu_seqlens_q=cu_seqlens_q,
|
616 |
+
cu_seqlens_k=cu_seqlens_k,
|
617 |
+
max_seqlen_q=max_seqlen_in_batch_q,
|
618 |
+
max_seqlen_k=max_seqlen_in_batch_k,
|
619 |
+
dropout_p=dropout,
|
620 |
+
softmax_scale=softmax_scale,
|
621 |
+
causal=causal,
|
622 |
+
window_size=(self.config.sliding_window, self.config.sliding_window),
|
623 |
+
)
|
624 |
+
|
625 |
+
attn_output = pad_input(attn_output_unpad, indices_q, batch_size, query_length)
|
626 |
+
else:
|
627 |
+
if not use_sliding_windows:
|
628 |
+
attn_output = flash_attn_func(
|
629 |
+
query_states,
|
630 |
+
key_states,
|
631 |
+
value_states,
|
632 |
+
dropout,
|
633 |
+
softmax_scale=softmax_scale,
|
634 |
+
causal=causal,
|
635 |
+
)
|
636 |
+
else:
|
637 |
+
attn_output = flash_attn_func(
|
638 |
+
query_states,
|
639 |
+
key_states,
|
640 |
+
value_states,
|
641 |
+
dropout,
|
642 |
+
softmax_scale=softmax_scale,
|
643 |
+
causal=causal,
|
644 |
+
window_size=(self.config.sliding_window, self.config.sliding_window),
|
645 |
+
)
|
646 |
+
|
647 |
+
return attn_output
|
648 |
+
|
649 |
+
# Copied from transformers.models.mistral.modeling_mistral.MistralFlashAttention2._upad_input
|
650 |
+
def _upad_input(self, query_layer, key_layer, value_layer, attention_mask, query_length):
|
651 |
+
batch_size, kv_seq_len, num_heads, head_dim = key_layer.shape
|
652 |
+
|
653 |
+
# On the first iteration we need to properly re-create the padding mask
|
654 |
+
# by slicing it on the proper place
|
655 |
+
if kv_seq_len != attention_mask.shape[-1]:
|
656 |
+
attention_mask_num_tokens = attention_mask.shape[-1]
|
657 |
+
attention_mask = attention_mask[:, attention_mask_num_tokens - kv_seq_len :]
|
658 |
+
|
659 |
+
indices_k, cu_seqlens_k, max_seqlen_in_batch_k = _get_unpad_data(attention_mask)
|
660 |
+
|
661 |
+
key_layer = index_first_axis(key_layer.reshape(batch_size * kv_seq_len, num_heads, head_dim), indices_k)
|
662 |
+
value_layer = index_first_axis(value_layer.reshape(batch_size * kv_seq_len, num_heads, head_dim), indices_k)
|
663 |
+
|
664 |
+
if query_length == kv_seq_len:
|
665 |
+
query_layer = index_first_axis(
|
666 |
+
query_layer.reshape(batch_size * kv_seq_len, num_heads, head_dim), indices_k
|
667 |
+
)
|
668 |
+
cu_seqlens_q = cu_seqlens_k
|
669 |
+
max_seqlen_in_batch_q = max_seqlen_in_batch_k
|
670 |
+
indices_q = indices_k
|
671 |
+
elif query_length == 1:
|
672 |
+
max_seqlen_in_batch_q = 1
|
673 |
+
cu_seqlens_q = torch.arange(
|
674 |
+
batch_size + 1, dtype=torch.int32, device=query_layer.device
|
675 |
+
) # There is a memcpy here, that is very bad.
|
676 |
+
indices_q = cu_seqlens_q[:-1]
|
677 |
+
query_layer = query_layer.squeeze(1)
|
678 |
+
else:
|
679 |
+
# The -q_len: slice assumes left padding.
|
680 |
+
attention_mask = attention_mask[:, -query_length:]
|
681 |
+
query_layer, indices_q, cu_seqlens_q, max_seqlen_in_batch_q = unpad_input(query_layer, attention_mask)
|
682 |
+
|
683 |
+
return (
|
684 |
+
query_layer,
|
685 |
+
key_layer,
|
686 |
+
value_layer,
|
687 |
+
indices_q,
|
688 |
+
(cu_seqlens_q, cu_seqlens_k),
|
689 |
+
(max_seqlen_in_batch_q, max_seqlen_in_batch_k),
|
690 |
+
)
|
691 |
+
|
692 |
+
|
693 |
+
# copied from transformers.models.llama.modeling_llama.LlamaSdpaAttention with Llama->Phi3
|
694 |
+
# TODO @Arthur no longer copied from LLama after static cache
|
695 |
+
class Phi3SdpaAttention(Phi3Attention):
|
696 |
+
"""
|
697 |
+
Phi3 attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
|
698 |
+
`Phi3Attention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to
|
699 |
+
SDPA API.
|
700 |
+
"""
|
701 |
+
|
702 |
+
# Adapted from Phi3Attention.forward
|
703 |
+
def forward(
|
704 |
+
self,
|
705 |
+
hidden_states: torch.Tensor,
|
706 |
+
attention_mask: Optional[torch.Tensor] = None,
|
707 |
+
position_ids: Optional[torch.LongTensor] = None,
|
708 |
+
past_key_value: Optional[Cache] = None,
|
709 |
+
output_attentions: bool = False,
|
710 |
+
use_cache: bool = False,
|
711 |
+
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
712 |
+
if output_attentions:
|
713 |
+
# TODO: Improve this warning with e.g. `model.config.attn_implementation = "manual"` once this is implemented.
|
714 |
+
logger.warning_once(
|
715 |
+
"Phi3Model is using Phi3SdpaAttention, but `torch.nn.functional.scaled_dot_product_attention` does not support `output_attentions=True`. Falling back to the manual attention implementation, "
|
716 |
+
'but specifying the manual implementation will be required from Transformers version v5.0.0 onwards. This warning can be removed using the argument `attn_implementation="eager"` when loading the model.'
|
717 |
+
)
|
718 |
+
return super().forward(
|
719 |
+
hidden_states=hidden_states,
|
720 |
+
attention_mask=attention_mask,
|
721 |
+
position_ids=position_ids,
|
722 |
+
past_key_value=past_key_value,
|
723 |
+
output_attentions=output_attentions,
|
724 |
+
use_cache=use_cache,
|
725 |
+
)
|
726 |
+
|
727 |
+
bsz, q_len, _ = hidden_states.size()
|
728 |
+
|
729 |
+
qkv = self.qkv_proj(hidden_states)
|
730 |
+
query_pos = self.num_heads * self.head_dim
|
731 |
+
query_states = qkv[..., :query_pos]
|
732 |
+
key_states = qkv[..., query_pos : query_pos + self.num_key_value_heads * self.head_dim]
|
733 |
+
value_states = qkv[..., query_pos + self.num_key_value_heads * self.head_dim :]
|
734 |
+
|
735 |
+
query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
|
736 |
+
key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
|
737 |
+
value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
|
738 |
+
|
739 |
+
kv_seq_len = key_states.shape[-2]
|
740 |
+
if past_key_value is not None:
|
741 |
+
kv_seq_len += past_key_value.get_usable_length(kv_seq_len, self.layer_idx)
|
742 |
+
cos, sin = self.rotary_emb(value_states, position_ids, seq_len=kv_seq_len)
|
743 |
+
|
744 |
+
query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
|
745 |
+
|
746 |
+
if past_key_value is not None:
|
747 |
+
cache_kwargs = {"sin": sin, "cos": cos} # Specific to RoPE models
|
748 |
+
key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
|
749 |
+
|
750 |
+
key_states = repeat_kv(key_states, self.num_key_value_groups)
|
751 |
+
value_states = repeat_kv(value_states, self.num_key_value_groups)
|
752 |
+
|
753 |
+
if attention_mask is not None:
|
754 |
+
if attention_mask.size() != (bsz, 1, q_len, kv_seq_len):
|
755 |
+
raise ValueError(
|
756 |
+
f"Attention mask should be of size {(bsz, 1, q_len, kv_seq_len)}, but is {attention_mask.size()}"
|
757 |
+
)
|
758 |
+
|
759 |
+
# SDPA with memory-efficient backend is currently (torch==2.1.2) bugged with non-contiguous inputs with custom attn_mask,
|
760 |
+
# Reference: https://github.com/pytorch/pytorch/issues/112577.
|
761 |
+
if query_states.device.type == "cuda" and attention_mask is not None:
|
762 |
+
query_states = query_states.contiguous()
|
763 |
+
key_states = key_states.contiguous()
|
764 |
+
value_states = value_states.contiguous()
|
765 |
+
|
766 |
+
attn_output = torch.nn.functional.scaled_dot_product_attention(
|
767 |
+
query_states,
|
768 |
+
key_states,
|
769 |
+
value_states,
|
770 |
+
attn_mask=attention_mask,
|
771 |
+
dropout_p=self.attention_dropout if self.training else 0.0,
|
772 |
+
# The q_len > 1 is necessary to match with AttentionMaskConverter.to_causal_4d that does not create a causal mask in case q_len == 1.
|
773 |
+
is_causal=self.is_causal and attention_mask is None and q_len > 1,
|
774 |
+
)
|
775 |
+
|
776 |
+
attn_output = attn_output.transpose(1, 2).contiguous()
|
777 |
+
attn_output = attn_output.view(bsz, q_len, self.hidden_size)
|
778 |
+
|
779 |
+
attn_output = self.o_proj(attn_output)
|
780 |
+
|
781 |
+
return attn_output, None, past_key_value
|
782 |
+
|
783 |
+
|
784 |
+
PHI3_ATTENTION_CLASSES = {
|
785 |
+
"eager": Phi3Attention,
|
786 |
+
"flash_attention_2": Phi3FlashAttention2,
|
787 |
+
"sdpa": Phi3SdpaAttention,
|
788 |
+
}
|
789 |
+
|
790 |
+
|
791 |
+
class Phi3DecoderLayer(nn.Module):
|
792 |
+
def __init__(self, config: Phi3Config, layer_idx: int):
|
793 |
+
super().__init__()
|
794 |
+
|
795 |
+
self.config = config
|
796 |
+
self.self_attn = PHI3_ATTENTION_CLASSES[config._attn_implementation](config, layer_idx=layer_idx)
|
797 |
+
|
798 |
+
self.mlp = Phi3MLP(config)
|
799 |
+
self.input_layernorm = Phi3RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
800 |
+
|
801 |
+
self.resid_attn_dropout = nn.Dropout(config.resid_pdrop)
|
802 |
+
self.resid_mlp_dropout = nn.Dropout(config.resid_pdrop)
|
803 |
+
self.post_attention_layernorm = Phi3RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
804 |
+
|
805 |
+
def forward(
|
806 |
+
self,
|
807 |
+
hidden_states: torch.Tensor,
|
808 |
+
attention_mask: Optional[torch.Tensor] = None,
|
809 |
+
position_ids: Optional[torch.LongTensor] = None,
|
810 |
+
past_key_value: Optional[Tuple[torch.Tensor]] = None,
|
811 |
+
output_attentions: Optional[bool] = False,
|
812 |
+
use_cache: Optional[bool] = False,
|
813 |
+
**kwargs,
|
814 |
+
) -> Tuple[torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]]:
|
815 |
+
if "padding_mask" in kwargs:
|
816 |
+
warnings.warn(
|
817 |
+
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
818 |
+
)
|
819 |
+
"""
|
820 |
+
Args:
|
821 |
+
hidden_states (`torch.FloatTensor`):
|
822 |
+
input to the layer of shape `(batch, seq_len, embed_dim)`
|
823 |
+
attention_mask (`torch.FloatTensor`, *optional*): attention mask of size
|
824 |
+
`(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values.
|
825 |
+
position_ids (`torch.LongTensor` of shape `({0})`, *optional*):
|
826 |
+
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range
|
827 |
+
`[0, config.n_positions - 1]`. [What are position IDs?](../glossary#position-ids)
|
828 |
+
output_attentions (`bool`, *optional*):
|
829 |
+
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
830 |
+
returned tensors for more detail.
|
831 |
+
use_cache (`bool`, *optional*):
|
832 |
+
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding
|
833 |
+
(see `past_key_values`).
|
834 |
+
past_key_value (`Tuple(torch.FloatTensor)`, *optional*): cached past key and value projection states
|
835 |
+
"""
|
836 |
+
|
837 |
+
residual = hidden_states
|
838 |
+
|
839 |
+
hidden_states = self.input_layernorm(hidden_states)
|
840 |
+
|
841 |
+
# Self Attention
|
842 |
+
attn_outputs, self_attn_weights, present_key_value = self.self_attn(
|
843 |
+
hidden_states=hidden_states,
|
844 |
+
attention_mask=attention_mask,
|
845 |
+
position_ids=position_ids,
|
846 |
+
past_key_value=past_key_value,
|
847 |
+
output_attentions=output_attentions,
|
848 |
+
use_cache=use_cache,
|
849 |
+
)
|
850 |
+
|
851 |
+
hidden_states = residual + self.resid_attn_dropout(attn_outputs)
|
852 |
+
|
853 |
+
residual = hidden_states
|
854 |
+
hidden_states = self.post_attention_layernorm(hidden_states)
|
855 |
+
hidden_states = self.mlp(hidden_states)
|
856 |
+
hidden_states = residual + self.resid_mlp_dropout(hidden_states)
|
857 |
+
|
858 |
+
outputs = (hidden_states,)
|
859 |
+
|
860 |
+
if output_attentions:
|
861 |
+
outputs += (self_attn_weights,)
|
862 |
+
|
863 |
+
if use_cache:
|
864 |
+
outputs += (present_key_value,)
|
865 |
+
|
866 |
+
return outputs
|
867 |
+
|
868 |
+
|
869 |
+
PHI3_START_DOCSTRING = r"""
|
870 |
+
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
|
871 |
+
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
|
872 |
+
etc.)
|
873 |
+
|
874 |
+
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
|
875 |
+
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
|
876 |
+
and behavior.
|
877 |
+
|
878 |
+
Parameters:
|
879 |
+
config ([`Phi3Config`]):
|
880 |
+
Model configuration class with all the parameters of the model. Initializing with a config file does not
|
881 |
+
load the weights associated with the model, only the configuration. Check out the
|
882 |
+
[`~PreTrainedModel.from_pretrained`] method to load the model weights.
|
883 |
+
"""
|
884 |
+
|
885 |
+
|
886 |
+
@add_start_docstrings(
|
887 |
+
"The bare Phi-3 model outputting raw hidden-states without any specific head on top.",
|
888 |
+
PHI3_START_DOCSTRING,
|
889 |
+
)
|
890 |
+
class Phi3PreTrainedModel(PreTrainedModel):
|
891 |
+
config_class = Phi3Config
|
892 |
+
base_model_prefix = "model"
|
893 |
+
supports_gradient_checkpointing = True
|
894 |
+
_no_split_modules = ["Phi3DecoderLayer"]
|
895 |
+
_skip_keys_device_placement = "past_key_values"
|
896 |
+
_supports_flash_attn_2 = True
|
897 |
+
_supports_sdpa = False
|
898 |
+
_supports_cache_class = True
|
899 |
+
|
900 |
+
_version = "0.0.5"
|
901 |
+
|
902 |
+
def _init_weights(self, module):
|
903 |
+
std = self.config.initializer_range
|
904 |
+
if isinstance(module, nn.Linear):
|
905 |
+
module.weight.data.normal_(mean=0.0, std=std)
|
906 |
+
if module.bias is not None:
|
907 |
+
module.bias.data.zero_()
|
908 |
+
elif isinstance(module, nn.Embedding):
|
909 |
+
module.weight.data.normal_(mean=0.0, std=std)
|
910 |
+
if module.padding_idx is not None:
|
911 |
+
module.weight.data[module.padding_idx].zero_()
|
912 |
+
|
913 |
+
|
914 |
+
PHI3_INPUTS_DOCSTRING = r"""
|
915 |
+
Args:
|
916 |
+
input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
|
917 |
+
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
|
918 |
+
it.
|
919 |
+
|
920 |
+
Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
|
921 |
+
[`PreTrainedTokenizer.__call__`] for details.
|
922 |
+
|
923 |
+
[What are input IDs?](../glossary#input-ids)
|
924 |
+
attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
|
925 |
+
Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
|
926 |
+
|
927 |
+
- 1 for tokens that are **not masked**,
|
928 |
+
- 0 for tokens that are **masked**.
|
929 |
+
|
930 |
+
[What are attention masks?](../glossary#attention-mask)
|
931 |
+
|
932 |
+
Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
|
933 |
+
[`PreTrainedTokenizer.__call__`] for details.
|
934 |
+
|
935 |
+
If `past_key_values` is used, optionally only the last `input_ids` have to be input (see
|
936 |
+
`past_key_values`).
|
937 |
+
|
938 |
+
If you want to change padding behavior, you should read [`modeling_opt._prepare_decoder_attention_mask`]
|
939 |
+
and modify to your needs. See diagram 1 in [the paper](https://arxiv.org/abs/1910.13461) for more
|
940 |
+
information on the default strategy.
|
941 |
+
|
942 |
+
- 1 indicates the head is **not masked**,
|
943 |
+
- 0 indicates the head is **masked**.
|
944 |
+
position_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
945 |
+
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
|
946 |
+
config.n_positions - 1]`.
|
947 |
+
|
948 |
+
[What are position IDs?](../glossary#position-ids)
|
949 |
+
past_key_values (`Cache` or `tuple(tuple(torch.FloatTensor))`, *optional*):
|
950 |
+
Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
|
951 |
+
blocks) that can be used to speed up sequential decoding. This typically consists in the `past_key_values`
|
952 |
+
returned by the model at a previous stage of decoding, when `use_cache=True` or `config.use_cache=True`.
|
953 |
+
|
954 |
+
Two formats are allowed:
|
955 |
+
- a [`~cache_utils.Cache`] instance;
|
956 |
+
- Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of
|
957 |
+
shape `(batch_size, num_heads, sequence_length, embed_size_per_head)`). This is also known as the legacy
|
958 |
+
cache format.
|
959 |
+
|
960 |
+
The model will output the same cache format that is fed as input. If no `past_key_values` are passed, the
|
961 |
+
legacy cache format will be returned.
|
962 |
+
|
963 |
+
If `past_key_values` are used, the user can optionally input only the last `input_ids` (those that don't
|
964 |
+
have their past key value states given to this model) of shape `(batch_size, 1)` instead of all `input_ids`
|
965 |
+
of shape `(batch_size, sequence_length)`.
|
966 |
+
inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
|
967 |
+
Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
|
968 |
+
is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
|
969 |
+
model's internal embedding lookup matrix.
|
970 |
+
use_cache (`bool`, *optional*):
|
971 |
+
If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
|
972 |
+
`past_key_values`).
|
973 |
+
output_attentions (`bool`, *optional*):
|
974 |
+
Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
|
975 |
+
tensors for more detail.
|
976 |
+
output_hidden_states (`bool`, *optional*):
|
977 |
+
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
978 |
+
more detail.
|
979 |
+
return_dict (`bool`, *optional*):
|
980 |
+
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
981 |
+
"""
|
982 |
+
|
983 |
+
|
984 |
+
@add_start_docstrings(
|
985 |
+
"The bare Phi-3 model outputting raw hidden-states without any specific head on top.",
|
986 |
+
PHI3_START_DOCSTRING,
|
987 |
+
)
|
988 |
+
class Phi3Model(Phi3PreTrainedModel):
|
989 |
+
"""
|
990 |
+
Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`Phi3DecoderLayer`]
|
991 |
+
|
992 |
+
Args:
|
993 |
+
config: Phi3Config
|
994 |
+
"""
|
995 |
+
|
996 |
+
def __init__(self, config: Phi3Config):
|
997 |
+
super().__init__(config)
|
998 |
+
self.padding_idx = config.pad_token_id
|
999 |
+
self.vocab_size = config.vocab_size
|
1000 |
+
|
1001 |
+
self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
|
1002 |
+
self.embed_dropout = nn.Dropout(config.embd_pdrop)
|
1003 |
+
self.layers = nn.ModuleList(
|
1004 |
+
[Phi3DecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
|
1005 |
+
)
|
1006 |
+
self._attn_implementation = config._attn_implementation
|
1007 |
+
self.norm = Phi3RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
1008 |
+
|
1009 |
+
self.gradient_checkpointing = False
|
1010 |
+
# Initialize weights and apply final processing
|
1011 |
+
self.post_init()
|
1012 |
+
|
1013 |
+
def get_input_embeddings(self):
|
1014 |
+
return self.embed_tokens
|
1015 |
+
|
1016 |
+
def set_input_embeddings(self, value):
|
1017 |
+
self.embed_tokens = value
|
1018 |
+
|
1019 |
+
@add_start_docstrings_to_model_forward(PHI3_INPUTS_DOCSTRING)
|
1020 |
+
def forward(
|
1021 |
+
self,
|
1022 |
+
input_ids: torch.LongTensor = None,
|
1023 |
+
attention_mask: Optional[torch.Tensor] = None,
|
1024 |
+
position_ids: Optional[torch.LongTensor] = None,
|
1025 |
+
past_key_values: Optional[List[torch.FloatTensor]] = None,
|
1026 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
1027 |
+
use_cache: Optional[bool] = None,
|
1028 |
+
output_attentions: Optional[bool] = None,
|
1029 |
+
output_hidden_states: Optional[bool] = None,
|
1030 |
+
return_dict: Optional[bool] = None,
|
1031 |
+
) -> Union[Tuple, BaseModelOutputWithPast]:
|
1032 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
1033 |
+
output_hidden_states = (
|
1034 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
1035 |
+
)
|
1036 |
+
use_cache = use_cache if use_cache is not None else self.config.use_cache
|
1037 |
+
|
1038 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
1039 |
+
|
1040 |
+
# retrieve input_ids and inputs_embeds
|
1041 |
+
if input_ids is not None and inputs_embeds is not None:
|
1042 |
+
raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
|
1043 |
+
elif input_ids is not None:
|
1044 |
+
batch_size, seq_length = input_ids.shape[:2]
|
1045 |
+
elif inputs_embeds is not None:
|
1046 |
+
batch_size, seq_length = inputs_embeds.shape[:2]
|
1047 |
+
else:
|
1048 |
+
raise ValueError("You have to specify either input_ids or inputs_embeds")
|
1049 |
+
|
1050 |
+
past_key_values_length = 0
|
1051 |
+
|
1052 |
+
if self.gradient_checkpointing and self.training:
|
1053 |
+
if use_cache:
|
1054 |
+
logger.warning_once(
|
1055 |
+
"`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
|
1056 |
+
)
|
1057 |
+
use_cache = False
|
1058 |
+
|
1059 |
+
if use_cache:
|
1060 |
+
use_legacy_cache = not isinstance(past_key_values, Cache)
|
1061 |
+
if use_legacy_cache:
|
1062 |
+
past_key_values = DynamicCache.from_legacy_cache(past_key_values)
|
1063 |
+
past_key_values_length = past_key_values.get_usable_length(seq_length)
|
1064 |
+
|
1065 |
+
if position_ids is None:
|
1066 |
+
device = input_ids.device if input_ids is not None else inputs_embeds.device
|
1067 |
+
position_ids = torch.arange(
|
1068 |
+
past_key_values_length, seq_length + past_key_values_length, dtype=torch.long, device=device
|
1069 |
+
)
|
1070 |
+
position_ids = position_ids.unsqueeze(0).view(-1, seq_length)
|
1071 |
+
else:
|
1072 |
+
position_ids = position_ids.view(-1, seq_length).long()
|
1073 |
+
|
1074 |
+
if inputs_embeds is None:
|
1075 |
+
inputs_embeds = self.embed_tokens(input_ids)
|
1076 |
+
|
1077 |
+
if attention_mask is not None and self._attn_implementation == "flash_attention_2" and use_cache:
|
1078 |
+
is_padding_right = attention_mask[:, -1].sum().item() != batch_size
|
1079 |
+
if is_padding_right:
|
1080 |
+
raise ValueError(
|
1081 |
+
"You are attempting to perform batched generation with padding_side='right'"
|
1082 |
+
" this may lead to unexpected behaviour for Flash Attention version of Phi3. Make sure to "
|
1083 |
+
" call `tokenizer.padding_side = 'left'` before tokenizing the input. "
|
1084 |
+
)
|
1085 |
+
|
1086 |
+
if self._attn_implementation == "flash_attention_2":
|
1087 |
+
# 2d mask is passed through the layers
|
1088 |
+
attention_mask = attention_mask if (attention_mask is not None and 0 in attention_mask) else None
|
1089 |
+
else:
|
1090 |
+
# 4d mask is passed through the layers
|
1091 |
+
attention_mask = _prepare_4d_causal_attention_mask(
|
1092 |
+
attention_mask,
|
1093 |
+
(batch_size, seq_length),
|
1094 |
+
inputs_embeds,
|
1095 |
+
past_key_values_length,
|
1096 |
+
sliding_window=self.config.sliding_window,
|
1097 |
+
)
|
1098 |
+
|
1099 |
+
hidden_states = inputs_embeds
|
1100 |
+
|
1101 |
+
# decoder layers
|
1102 |
+
all_hidden_states = () if output_hidden_states else None
|
1103 |
+
all_self_attns = () if output_attentions else None
|
1104 |
+
next_decoder_cache = None
|
1105 |
+
|
1106 |
+
for decoder_layer in self.layers:
|
1107 |
+
if output_hidden_states:
|
1108 |
+
all_hidden_states += (hidden_states,)
|
1109 |
+
|
1110 |
+
if self.gradient_checkpointing and self.training:
|
1111 |
+
layer_outputs = self._gradient_checkpointing_func(
|
1112 |
+
decoder_layer.__call__,
|
1113 |
+
hidden_states,
|
1114 |
+
attention_mask,
|
1115 |
+
position_ids,
|
1116 |
+
past_key_values,
|
1117 |
+
output_attentions,
|
1118 |
+
use_cache,
|
1119 |
+
)
|
1120 |
+
else:
|
1121 |
+
layer_outputs = decoder_layer(
|
1122 |
+
hidden_states,
|
1123 |
+
attention_mask=attention_mask,
|
1124 |
+
position_ids=position_ids,
|
1125 |
+
past_key_value=past_key_values,
|
1126 |
+
output_attentions=output_attentions,
|
1127 |
+
use_cache=use_cache,
|
1128 |
+
)
|
1129 |
+
|
1130 |
+
hidden_states = layer_outputs[0]
|
1131 |
+
|
1132 |
+
if use_cache:
|
1133 |
+
next_decoder_cache = layer_outputs[2 if output_attentions else 1]
|
1134 |
+
|
1135 |
+
if output_attentions:
|
1136 |
+
all_self_attns += (layer_outputs[1],)
|
1137 |
+
|
1138 |
+
hidden_states = self.norm(hidden_states)
|
1139 |
+
|
1140 |
+
# add hidden states from the last decoder layer
|
1141 |
+
if output_hidden_states:
|
1142 |
+
all_hidden_states += (hidden_states,)
|
1143 |
+
|
1144 |
+
next_cache = None
|
1145 |
+
if use_cache:
|
1146 |
+
next_cache = next_decoder_cache.to_legacy_cache() if use_legacy_cache else next_decoder_cache
|
1147 |
+
if not return_dict:
|
1148 |
+
return tuple(v for v in [hidden_states, next_cache, all_hidden_states, all_self_attns] if v is not None)
|
1149 |
+
return BaseModelOutputWithPast(
|
1150 |
+
last_hidden_state=hidden_states,
|
1151 |
+
past_key_values=next_cache,
|
1152 |
+
hidden_states=all_hidden_states,
|
1153 |
+
attentions=all_self_attns,
|
1154 |
+
)
|
1155 |
+
|
1156 |
+
|
1157 |
+
class Phi3ForCausalLM(Phi3PreTrainedModel):
|
1158 |
+
_tied_weights_keys = ["lm_head.weight"]
|
1159 |
+
|
1160 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM.__init__ with Llama->Phi3
|
1161 |
+
def __init__(self, config):
|
1162 |
+
super().__init__(config)
|
1163 |
+
self.model = Phi3Model(config)
|
1164 |
+
self.vocab_size = config.vocab_size
|
1165 |
+
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
1166 |
+
|
1167 |
+
# Initialize weights and apply final processing
|
1168 |
+
self.post_init()
|
1169 |
+
|
1170 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM.get_input_embeddings
|
1171 |
+
def get_input_embeddings(self):
|
1172 |
+
return self.model.embed_tokens
|
1173 |
+
|
1174 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM.set_input_embeddings
|
1175 |
+
def set_input_embeddings(self, value):
|
1176 |
+
self.model.embed_tokens = value
|
1177 |
+
|
1178 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM.get_output_embeddings
|
1179 |
+
def get_output_embeddings(self):
|
1180 |
+
return self.lm_head
|
1181 |
+
|
1182 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM.set_output_embeddings
|
1183 |
+
def set_output_embeddings(self, new_embeddings):
|
1184 |
+
self.lm_head = new_embeddings
|
1185 |
+
|
1186 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM.set_decoder
|
1187 |
+
def set_decoder(self, decoder):
|
1188 |
+
self.model = decoder
|
1189 |
+
|
1190 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM.get_decoder
|
1191 |
+
def get_decoder(self):
|
1192 |
+
return self.model
|
1193 |
+
|
1194 |
+
# Ignore copy
|
1195 |
+
@add_start_docstrings_to_model_forward(PHI3_INPUTS_DOCSTRING)
|
1196 |
+
@replace_return_docstrings(output_type=CausalLMOutputWithPast, config_class=_CONFIG_FOR_DOC)
|
1197 |
+
def forward(
|
1198 |
+
self,
|
1199 |
+
input_ids: torch.LongTensor = None,
|
1200 |
+
attention_mask: Optional[torch.Tensor] = None,
|
1201 |
+
position_ids: Optional[torch.LongTensor] = None,
|
1202 |
+
past_key_values: Optional[List[torch.FloatTensor]] = None,
|
1203 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
1204 |
+
labels: Optional[torch.LongTensor] = None,
|
1205 |
+
use_cache: Optional[bool] = None,
|
1206 |
+
output_attentions: Optional[bool] = None,
|
1207 |
+
output_hidden_states: Optional[bool] = None,
|
1208 |
+
return_dict: Optional[bool] = None,
|
1209 |
+
) -> Union[Tuple, CausalLMOutputWithPast]:
|
1210 |
+
r"""
|
1211 |
+
Args:
|
1212 |
+
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
1213 |
+
Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
|
1214 |
+
config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
|
1215 |
+
(masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
|
1216 |
+
|
1217 |
+
Returns:
|
1218 |
+
|
1219 |
+
Example:
|
1220 |
+
|
1221 |
+
```python
|
1222 |
+
>>> from transformers import AutoTokenizer, Phi3ForCausalLM
|
1223 |
+
|
1224 |
+
>>> model = Phi3ForCausalLM.from_pretrained("microsoft/phi-3-mini-4k-instruct")
|
1225 |
+
>>> tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-3-mini-4k-instruct")
|
1226 |
+
|
1227 |
+
>>> prompt = "This is an example script ."
|
1228 |
+
>>> inputs = tokenizer(prompt, return_tensors="pt")
|
1229 |
+
|
1230 |
+
>>> # Generate
|
1231 |
+
>>> generate_ids = model.generate(inputs.input_ids, max_length=30)
|
1232 |
+
>>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
1233 |
+
'This is an example script .\n Certainly! Below is a sample script that demonstrates a simple task, such as calculating the sum'
|
1234 |
+
```"""
|
1235 |
+
|
1236 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
1237 |
+
output_hidden_states = (
|
1238 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
1239 |
+
)
|
1240 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
1241 |
+
|
1242 |
+
# decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
|
1243 |
+
outputs = self.model(
|
1244 |
+
input_ids=input_ids,
|
1245 |
+
attention_mask=attention_mask,
|
1246 |
+
position_ids=position_ids,
|
1247 |
+
past_key_values=past_key_values,
|
1248 |
+
inputs_embeds=inputs_embeds,
|
1249 |
+
use_cache=use_cache,
|
1250 |
+
output_attentions=output_attentions,
|
1251 |
+
output_hidden_states=output_hidden_states,
|
1252 |
+
return_dict=return_dict,
|
1253 |
+
)
|
1254 |
+
|
1255 |
+
hidden_states = outputs[0]
|
1256 |
+
logits = self.lm_head(hidden_states)
|
1257 |
+
logits = logits.float()
|
1258 |
+
|
1259 |
+
loss = None
|
1260 |
+
if labels is not None:
|
1261 |
+
# Shift so that tokens < n predict n
|
1262 |
+
shift_logits = logits[..., :-1, :].contiguous()
|
1263 |
+
shift_labels = labels[..., 1:].contiguous()
|
1264 |
+
# Flatten the tokens
|
1265 |
+
loss_fct = CrossEntropyLoss()
|
1266 |
+
shift_logits = shift_logits.view(-1, self.config.vocab_size)
|
1267 |
+
shift_labels = shift_labels.view(-1)
|
1268 |
+
# Enable model parallelism
|
1269 |
+
shift_labels = shift_labels.to(shift_logits.device)
|
1270 |
+
loss = loss_fct(shift_logits, shift_labels)
|
1271 |
+
|
1272 |
+
if not return_dict:
|
1273 |
+
output = (logits,) + outputs[1:]
|
1274 |
+
return (loss,) + output if loss is not None else output
|
1275 |
+
|
1276 |
+
return CausalLMOutputWithPast(
|
1277 |
+
loss=loss,
|
1278 |
+
logits=logits,
|
1279 |
+
past_key_values=outputs.past_key_values,
|
1280 |
+
hidden_states=outputs.hidden_states,
|
1281 |
+
attentions=outputs.attentions,
|
1282 |
+
)
|
1283 |
+
|
1284 |
+
# Copied from transformers.models.persimmon.modeling_persimmon.PersimmonForCausalLM.prepare_inputs_for_generation
|
1285 |
+
def prepare_inputs_for_generation(
|
1286 |
+
self, input_ids, past_key_values=None, attention_mask=None, inputs_embeds=None, **kwargs
|
1287 |
+
):
|
1288 |
+
if past_key_values is not None:
|
1289 |
+
if isinstance(past_key_values, Cache):
|
1290 |
+
cache_length = past_key_values.get_seq_length()
|
1291 |
+
past_length = past_key_values.seen_tokens
|
1292 |
+
max_cache_length = past_key_values.get_max_length()
|
1293 |
+
else:
|
1294 |
+
cache_length = past_length = past_key_values[0][0].shape[2]
|
1295 |
+
max_cache_length = None
|
1296 |
+
|
1297 |
+
# Keep only the unprocessed tokens:
|
1298 |
+
# 1 - If the length of the attention_mask exceeds the length of input_ids, then we are in a setting where
|
1299 |
+
# some of the inputs are exclusively passed as part of the cache (e.g. when passing input_embeds as
|
1300 |
+
# input)
|
1301 |
+
if attention_mask is not None and attention_mask.shape[1] > input_ids.shape[1]:
|
1302 |
+
input_ids = input_ids[:, -(attention_mask.shape[1] - past_length) :]
|
1303 |
+
# 2 - If the past_length is smaller than input_ids', then input_ids holds all input tokens. We can discard
|
1304 |
+
# input_ids based on the past_length.
|
1305 |
+
elif past_length < input_ids.shape[1]:
|
1306 |
+
input_ids = input_ids[:, past_length:]
|
1307 |
+
# 3 - Otherwise (past_length >= input_ids.shape[1]), let's assume input_ids only has unprocessed tokens.
|
1308 |
+
|
1309 |
+
# If we are about to go beyond the maximum cache length, we need to crop the input attention mask.
|
1310 |
+
if (
|
1311 |
+
max_cache_length is not None
|
1312 |
+
and attention_mask is not None
|
1313 |
+
and cache_length + input_ids.shape[1] > max_cache_length
|
1314 |
+
):
|
1315 |
+
attention_mask = attention_mask[:, -max_cache_length:]
|
1316 |
+
|
1317 |
+
position_ids = kwargs.get("position_ids", None)
|
1318 |
+
if attention_mask is not None and position_ids is None:
|
1319 |
+
# create position_ids on the fly for batch generation
|
1320 |
+
position_ids = attention_mask.long().cumsum(-1) - 1
|
1321 |
+
position_ids.masked_fill_(attention_mask == 0, 1)
|
1322 |
+
if past_key_values:
|
1323 |
+
position_ids = position_ids[:, -input_ids.shape[1] :]
|
1324 |
+
|
1325 |
+
# if `inputs_embeds` are passed, we only want to use them in the 1st generation step
|
1326 |
+
if inputs_embeds is not None and past_key_values is None:
|
1327 |
+
model_inputs = {"inputs_embeds": inputs_embeds}
|
1328 |
+
else:
|
1329 |
+
model_inputs = {"input_ids": input_ids}
|
1330 |
+
|
1331 |
+
model_inputs.update(
|
1332 |
+
{
|
1333 |
+
"position_ids": position_ids,
|
1334 |
+
"past_key_values": past_key_values,
|
1335 |
+
"use_cache": kwargs.get("use_cache"),
|
1336 |
+
"attention_mask": attention_mask,
|
1337 |
+
}
|
1338 |
+
)
|
1339 |
+
return model_inputs
|
1340 |
+
|
1341 |
+
@staticmethod
|
1342 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaForCausalLM._reorder_cache
|
1343 |
+
def _reorder_cache(past_key_values, beam_idx):
|
1344 |
+
reordered_past = ()
|
1345 |
+
for layer_past in past_key_values:
|
1346 |
+
reordered_past += (
|
1347 |
+
tuple(past_state.index_select(0, beam_idx.to(past_state.device)) for past_state in layer_past),
|
1348 |
+
)
|
1349 |
+
return reordered_past
|
1350 |
+
|
1351 |
+
|
1352 |
+
@add_start_docstrings(
|
1353 |
+
"""
|
1354 |
+
The [`Phi3Model`] with a sequence classification head on top (linear layer).
|
1355 |
+
|
1356 |
+
[`Phi3ForSequenceClassification`] uses the last token in order to do the classification, as other causal models
|
1357 |
+
(e.g. GPT-2) do.
|
1358 |
+
|
1359 |
+
Since it does classification on the last token, it requires to know the position of the last token. If a
|
1360 |
+
`pad_token_id` is defined in the configuration, it finds the last token that is not a padding token in each row. If
|
1361 |
+
no `pad_token_id` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
|
1362 |
+
padding tokens when `inputs_embeds` are passed instead of `input_ids`, it does the same (take the last value in
|
1363 |
+
each row of the batch).
|
1364 |
+
""",
|
1365 |
+
PHI3_START_DOCSTRING,
|
1366 |
+
)
|
1367 |
+
# Copied from transformers.models.llama.modeling_llama.LlamaForSequenceClassification with Llama->Phi3, LLAMA->PHI3, self.transformer->self.model, transformer_outputs->model_outputs
|
1368 |
+
class Phi3ForSequenceClassification(Phi3PreTrainedModel):
|
1369 |
+
def __init__(self, config):
|
1370 |
+
super().__init__(config)
|
1371 |
+
self.num_labels = config.num_labels
|
1372 |
+
self.model = Phi3Model(config)
|
1373 |
+
self.score = nn.Linear(config.hidden_size, self.num_labels, bias=False)
|
1374 |
+
|
1375 |
+
# Initialize weights and apply final processing
|
1376 |
+
self.post_init()
|
1377 |
+
|
1378 |
+
def get_input_embeddings(self):
|
1379 |
+
return self.model.embed_tokens
|
1380 |
+
|
1381 |
+
def set_input_embeddings(self, value):
|
1382 |
+
self.model.embed_tokens = value
|
1383 |
+
|
1384 |
+
@add_start_docstrings_to_model_forward(PHI3_INPUTS_DOCSTRING)
|
1385 |
+
def forward(
|
1386 |
+
self,
|
1387 |
+
input_ids: torch.LongTensor = None,
|
1388 |
+
attention_mask: Optional[torch.Tensor] = None,
|
1389 |
+
position_ids: Optional[torch.LongTensor] = None,
|
1390 |
+
past_key_values: Optional[List[torch.FloatTensor]] = None,
|
1391 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
1392 |
+
labels: Optional[torch.LongTensor] = None,
|
1393 |
+
use_cache: Optional[bool] = None,
|
1394 |
+
output_attentions: Optional[bool] = None,
|
1395 |
+
output_hidden_states: Optional[bool] = None,
|
1396 |
+
return_dict: Optional[bool] = None,
|
1397 |
+
) -> Union[Tuple, SequenceClassifierOutputWithPast]:
|
1398 |
+
r"""
|
1399 |
+
labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
|
1400 |
+
Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
|
1401 |
+
config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
|
1402 |
+
`config.num_labels > 1` a classification loss is computed (Cross-Entropy).
|
1403 |
+
"""
|
1404 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
1405 |
+
|
1406 |
+
model_outputs = self.model(
|
1407 |
+
input_ids,
|
1408 |
+
attention_mask=attention_mask,
|
1409 |
+
position_ids=position_ids,
|
1410 |
+
past_key_values=past_key_values,
|
1411 |
+
inputs_embeds=inputs_embeds,
|
1412 |
+
use_cache=use_cache,
|
1413 |
+
output_attentions=output_attentions,
|
1414 |
+
output_hidden_states=output_hidden_states,
|
1415 |
+
return_dict=return_dict,
|
1416 |
+
)
|
1417 |
+
hidden_states = model_outputs[0]
|
1418 |
+
logits = self.score(hidden_states)
|
1419 |
+
|
1420 |
+
if input_ids is not None:
|
1421 |
+
batch_size = input_ids.shape[0]
|
1422 |
+
else:
|
1423 |
+
batch_size = inputs_embeds.shape[0]
|
1424 |
+
|
1425 |
+
if self.config.pad_token_id is None and batch_size != 1:
|
1426 |
+
raise ValueError("Cannot handle batch sizes > 1 if no padding token is defined.")
|
1427 |
+
if self.config.pad_token_id is None:
|
1428 |
+
sequence_lengths = -1
|
1429 |
+
else:
|
1430 |
+
if input_ids is not None:
|
1431 |
+
# if no pad token found, use modulo instead of reverse indexing for ONNX compatibility
|
1432 |
+
sequence_lengths = torch.eq(input_ids, self.config.pad_token_id).int().argmax(-1) - 1
|
1433 |
+
sequence_lengths = sequence_lengths % input_ids.shape[-1]
|
1434 |
+
sequence_lengths = sequence_lengths.to(logits.device)
|
1435 |
+
else:
|
1436 |
+
sequence_lengths = -1
|
1437 |
+
|
1438 |
+
pooled_logits = logits[torch.arange(batch_size, device=logits.device), sequence_lengths]
|
1439 |
+
|
1440 |
+
loss = None
|
1441 |
+
if labels is not None:
|
1442 |
+
labels = labels.to(logits.device)
|
1443 |
+
if self.config.problem_type is None:
|
1444 |
+
if self.num_labels == 1:
|
1445 |
+
self.config.problem_type = "regression"
|
1446 |
+
elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
|
1447 |
+
self.config.problem_type = "single_label_classification"
|
1448 |
+
else:
|
1449 |
+
self.config.problem_type = "multi_label_classification"
|
1450 |
+
|
1451 |
+
if self.config.problem_type == "regression":
|
1452 |
+
loss_fct = MSELoss()
|
1453 |
+
if self.num_labels == 1:
|
1454 |
+
loss = loss_fct(pooled_logits.squeeze(), labels.squeeze())
|
1455 |
+
else:
|
1456 |
+
loss = loss_fct(pooled_logits, labels)
|
1457 |
+
elif self.config.problem_type == "single_label_classification":
|
1458 |
+
loss_fct = CrossEntropyLoss()
|
1459 |
+
loss = loss_fct(pooled_logits.view(-1, self.num_labels), labels.view(-1))
|
1460 |
+
elif self.config.problem_type == "multi_label_classification":
|
1461 |
+
loss_fct = BCEWithLogitsLoss()
|
1462 |
+
loss = loss_fct(pooled_logits, labels)
|
1463 |
+
if not return_dict:
|
1464 |
+
output = (pooled_logits,) + model_outputs[1:]
|
1465 |
+
return ((loss,) + output) if loss is not None else output
|
1466 |
+
|
1467 |
+
return SequenceClassifierOutputWithPast(
|
1468 |
+
loss=loss,
|
1469 |
+
logits=pooled_logits,
|
1470 |
+
past_key_values=model_outputs.past_key_values,
|
1471 |
+
hidden_states=model_outputs.hidden_states,
|
1472 |
+
attentions=model_outputs.attentions,
|
1473 |
+
)
|
1474 |
+
|
1475 |
+
|
1476 |
+
@add_start_docstrings(
|
1477 |
+
"""
|
1478 |
+
[`Phi3Model`] with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for
|
1479 |
+
Named-Entity-Recognition (NER) tasks.
|
1480 |
+
""",
|
1481 |
+
PHI3_START_DOCSTRING,
|
1482 |
+
)
|
1483 |
+
# Copied from transformers.models.mpt.modeling_mpt.MptForTokenClassification with Mpt->Phi3,MPT->PHI3,self.transformer->self.model,transformer_outputs->model_outputs
|
1484 |
+
class Phi3ForTokenClassification(Phi3PreTrainedModel):
|
1485 |
+
def __init__(self, config: Phi3Config):
|
1486 |
+
super().__init__(config)
|
1487 |
+
self.num_labels = config.num_labels
|
1488 |
+
|
1489 |
+
self.model = Phi3Model(config)
|
1490 |
+
if hasattr(config, "classifier_dropout") and config.classifier_dropout is not None:
|
1491 |
+
classifier_dropout = config.classifier_dropout
|
1492 |
+
elif hasattr(config, "hidden_dropout") and config.hidden_dropout is not None:
|
1493 |
+
classifier_dropout = config.hidden_dropout
|
1494 |
+
else:
|
1495 |
+
classifier_dropout = 0.1
|
1496 |
+
self.dropout = nn.Dropout(classifier_dropout)
|
1497 |
+
self.classifier = nn.Linear(config.hidden_size, config.num_labels)
|
1498 |
+
|
1499 |
+
# Initialize weights and apply final processing
|
1500 |
+
self.post_init()
|
1501 |
+
|
1502 |
+
@add_start_docstrings_to_model_forward(PHI3_INPUTS_DOCSTRING)
|
1503 |
+
@add_code_sample_docstrings(
|
1504 |
+
checkpoint=_CHECKPOINT_FOR_DOC,
|
1505 |
+
output_type=TokenClassifierOutput,
|
1506 |
+
config_class=_CONFIG_FOR_DOC,
|
1507 |
+
)
|
1508 |
+
def forward(
|
1509 |
+
self,
|
1510 |
+
input_ids: Optional[torch.LongTensor] = None,
|
1511 |
+
past_key_values: Optional[Tuple[Tuple[torch.Tensor, torch.Tensor], ...]] = None,
|
1512 |
+
attention_mask: Optional[torch.Tensor] = None,
|
1513 |
+
inputs_embeds: Optional[torch.Tensor] = None,
|
1514 |
+
labels: Optional[torch.Tensor] = None,
|
1515 |
+
use_cache: Optional[bool] = None,
|
1516 |
+
output_attentions: Optional[bool] = None,
|
1517 |
+
output_hidden_states: Optional[bool] = None,
|
1518 |
+
return_dict: Optional[bool] = None,
|
1519 |
+
**deprecated_arguments,
|
1520 |
+
) -> Union[Tuple[torch.Tensor], TokenClassifierOutput]:
|
1521 |
+
r"""
|
1522 |
+
labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
|
1523 |
+
Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
|
1524 |
+
config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
|
1525 |
+
`config.num_labels > 1` a classification loss is computed (Cross-Entropy).
|
1526 |
+
"""
|
1527 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
1528 |
+
|
1529 |
+
model_outputs = self.model(
|
1530 |
+
input_ids,
|
1531 |
+
past_key_values=past_key_values,
|
1532 |
+
attention_mask=attention_mask,
|
1533 |
+
inputs_embeds=inputs_embeds,
|
1534 |
+
use_cache=use_cache,
|
1535 |
+
output_attentions=output_attentions,
|
1536 |
+
output_hidden_states=output_hidden_states,
|
1537 |
+
return_dict=return_dict,
|
1538 |
+
)
|
1539 |
+
|
1540 |
+
hidden_states = model_outputs[0]
|
1541 |
+
hidden_states = self.dropout(hidden_states)
|
1542 |
+
logits = self.classifier(hidden_states)
|
1543 |
+
|
1544 |
+
loss = None
|
1545 |
+
if labels is not None:
|
1546 |
+
# move labels to correct device to enable model parallelism
|
1547 |
+
labels = labels.to(logits.device)
|
1548 |
+
batch_size, seq_length = labels.shape
|
1549 |
+
loss_fct = CrossEntropyLoss()
|
1550 |
+
loss = loss_fct(
|
1551 |
+
logits.view(batch_size * seq_length, self.num_labels), labels.view(batch_size * seq_length)
|
1552 |
+
)
|
1553 |
+
|
1554 |
+
if not return_dict:
|
1555 |
+
output = (logits,) + model_outputs[2:]
|
1556 |
+
return ((loss,) + output) if loss is not None else output
|
1557 |
+
|
1558 |
+
return TokenClassifierOutput(
|
1559 |
+
loss=loss,
|
1560 |
+
logits=logits,
|
1561 |
+
hidden_states=model_outputs.hidden_states,
|
1562 |
+
attentions=model_outputs.attentions,
|
1563 |
+
)
|
tokenizer_config.json
CHANGED
@@ -123,7 +123,7 @@
|
|
123 |
"legacy": false,
|
124 |
"model_max_length": 4096,
|
125 |
"pad_token": "<unk>",
|
126 |
-
"padding_side": "
|
127 |
"sp_model_kwargs": {},
|
128 |
"tokenizer_class": "LlamaTokenizer",
|
129 |
"unk_token": "<unk>",
|
|
|
123 |
"legacy": false,
|
124 |
"model_max_length": 4096,
|
125 |
"pad_token": "<unk>",
|
126 |
+
"padding_side": "left",
|
127 |
"sp_model_kwargs": {},
|
128 |
"tokenizer_class": "LlamaTokenizer",
|
129 |
"unk_token": "<unk>",
|
train_results.json
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"epoch": 1.0,
|
3 |
+
"total_flos": 5.485972481640161e+17,
|
4 |
+
"train_loss": 0.4824531834622566,
|
5 |
+
"train_runtime": 26326.043,
|
6 |
+
"train_samples_per_second": 0.685,
|
7 |
+
"train_steps_per_second": 0.342
|
8 |
+
}
|
trainer_state.json
ADDED
@@ -0,0 +1,3192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"best_metric": null,
|
3 |
+
"best_model_checkpoint": null,
|
4 |
+
"epoch": 1.0,
|
5 |
+
"eval_steps": 500,
|
6 |
+
"global_step": 9013,
|
7 |
+
"is_hyper_param_search": false,
|
8 |
+
"is_local_process_zero": true,
|
9 |
+
"is_world_process_zero": true,
|
10 |
+
"log_history": [
|
11 |
+
{
|
12 |
+
"epoch": 0.0022190169754798626,
|
13 |
+
"grad_norm": 7.625,
|
14 |
+
"learning_rate": 3.3277870216306157e-07,
|
15 |
+
"loss": 1.2617,
|
16 |
+
"step": 20
|
17 |
+
},
|
18 |
+
{
|
19 |
+
"epoch": 0.004438033950959725,
|
20 |
+
"grad_norm": 5.5625,
|
21 |
+
"learning_rate": 6.655574043261231e-07,
|
22 |
+
"loss": 1.2121,
|
23 |
+
"step": 40
|
24 |
+
},
|
25 |
+
{
|
26 |
+
"epoch": 0.006657050926439588,
|
27 |
+
"grad_norm": 4.78125,
|
28 |
+
"learning_rate": 9.983361064891848e-07,
|
29 |
+
"loss": 1.2737,
|
30 |
+
"step": 60
|
31 |
+
},
|
32 |
+
{
|
33 |
+
"epoch": 0.00887606790191945,
|
34 |
+
"grad_norm": 5.46875,
|
35 |
+
"learning_rate": 1.3311148086522463e-06,
|
36 |
+
"loss": 1.1634,
|
37 |
+
"step": 80
|
38 |
+
},
|
39 |
+
{
|
40 |
+
"epoch": 0.011095084877399313,
|
41 |
+
"grad_norm": 6.46875,
|
42 |
+
"learning_rate": 1.6638935108153078e-06,
|
43 |
+
"loss": 1.1582,
|
44 |
+
"step": 100
|
45 |
+
},
|
46 |
+
{
|
47 |
+
"epoch": 0.013314101852879175,
|
48 |
+
"grad_norm": 6.09375,
|
49 |
+
"learning_rate": 1.9966722129783695e-06,
|
50 |
+
"loss": 1.1071,
|
51 |
+
"step": 120
|
52 |
+
},
|
53 |
+
{
|
54 |
+
"epoch": 0.015533118828359036,
|
55 |
+
"grad_norm": 5.5625,
|
56 |
+
"learning_rate": 2.329450915141431e-06,
|
57 |
+
"loss": 1.0944,
|
58 |
+
"step": 140
|
59 |
+
},
|
60 |
+
{
|
61 |
+
"epoch": 0.0177521358038389,
|
62 |
+
"grad_norm": 3.3125,
|
63 |
+
"learning_rate": 2.6622296173044925e-06,
|
64 |
+
"loss": 0.9622,
|
65 |
+
"step": 160
|
66 |
+
},
|
67 |
+
{
|
68 |
+
"epoch": 0.01997115277931876,
|
69 |
+
"grad_norm": 5.65625,
|
70 |
+
"learning_rate": 2.995008319467554e-06,
|
71 |
+
"loss": 0.7219,
|
72 |
+
"step": 180
|
73 |
+
},
|
74 |
+
{
|
75 |
+
"epoch": 0.022190169754798626,
|
76 |
+
"grad_norm": 3.234375,
|
77 |
+
"learning_rate": 3.3277870216306156e-06,
|
78 |
+
"loss": 0.6194,
|
79 |
+
"step": 200
|
80 |
+
},
|
81 |
+
{
|
82 |
+
"epoch": 0.024409186730278486,
|
83 |
+
"grad_norm": 3.359375,
|
84 |
+
"learning_rate": 3.6605657237936775e-06,
|
85 |
+
"loss": 0.5223,
|
86 |
+
"step": 220
|
87 |
+
},
|
88 |
+
{
|
89 |
+
"epoch": 0.02662820370575835,
|
90 |
+
"grad_norm": 2.234375,
|
91 |
+
"learning_rate": 3.993344425956739e-06,
|
92 |
+
"loss": 0.5673,
|
93 |
+
"step": 240
|
94 |
+
},
|
95 |
+
{
|
96 |
+
"epoch": 0.02884722068123821,
|
97 |
+
"grad_norm": 2.109375,
|
98 |
+
"learning_rate": 4.326123128119801e-06,
|
99 |
+
"loss": 0.5215,
|
100 |
+
"step": 260
|
101 |
+
},
|
102 |
+
{
|
103 |
+
"epoch": 0.031066237656718072,
|
104 |
+
"grad_norm": 2.765625,
|
105 |
+
"learning_rate": 4.658901830282862e-06,
|
106 |
+
"loss": 0.5166,
|
107 |
+
"step": 280
|
108 |
+
},
|
109 |
+
{
|
110 |
+
"epoch": 0.03328525463219793,
|
111 |
+
"grad_norm": 2.0625,
|
112 |
+
"learning_rate": 4.991680532445923e-06,
|
113 |
+
"loss": 0.5023,
|
114 |
+
"step": 300
|
115 |
+
},
|
116 |
+
{
|
117 |
+
"epoch": 0.0355042716076778,
|
118 |
+
"grad_norm": 2.0625,
|
119 |
+
"learning_rate": 5.324459234608985e-06,
|
120 |
+
"loss": 0.4611,
|
121 |
+
"step": 320
|
122 |
+
},
|
123 |
+
{
|
124 |
+
"epoch": 0.03772328858315766,
|
125 |
+
"grad_norm": 2.09375,
|
126 |
+
"learning_rate": 5.657237936772047e-06,
|
127 |
+
"loss": 0.5203,
|
128 |
+
"step": 340
|
129 |
+
},
|
130 |
+
{
|
131 |
+
"epoch": 0.03994230555863752,
|
132 |
+
"grad_norm": 2.34375,
|
133 |
+
"learning_rate": 5.990016638935108e-06,
|
134 |
+
"loss": 0.5498,
|
135 |
+
"step": 360
|
136 |
+
},
|
137 |
+
{
|
138 |
+
"epoch": 0.04216132253411738,
|
139 |
+
"grad_norm": 2.03125,
|
140 |
+
"learning_rate": 6.32279534109817e-06,
|
141 |
+
"loss": 0.5597,
|
142 |
+
"step": 380
|
143 |
+
},
|
144 |
+
{
|
145 |
+
"epoch": 0.04438033950959725,
|
146 |
+
"grad_norm": 2.453125,
|
147 |
+
"learning_rate": 6.655574043261231e-06,
|
148 |
+
"loss": 0.5133,
|
149 |
+
"step": 400
|
150 |
+
},
|
151 |
+
{
|
152 |
+
"epoch": 0.04659935648507711,
|
153 |
+
"grad_norm": 2.15625,
|
154 |
+
"learning_rate": 6.988352745424292e-06,
|
155 |
+
"loss": 0.4843,
|
156 |
+
"step": 420
|
157 |
+
},
|
158 |
+
{
|
159 |
+
"epoch": 0.04881837346055697,
|
160 |
+
"grad_norm": 2.265625,
|
161 |
+
"learning_rate": 7.321131447587355e-06,
|
162 |
+
"loss": 0.5358,
|
163 |
+
"step": 440
|
164 |
+
},
|
165 |
+
{
|
166 |
+
"epoch": 0.051037390436036834,
|
167 |
+
"grad_norm": 2.6875,
|
168 |
+
"learning_rate": 7.653910149750416e-06,
|
169 |
+
"loss": 0.3936,
|
170 |
+
"step": 460
|
171 |
+
},
|
172 |
+
{
|
173 |
+
"epoch": 0.0532564074115167,
|
174 |
+
"grad_norm": 2.125,
|
175 |
+
"learning_rate": 7.986688851913478e-06,
|
176 |
+
"loss": 0.5245,
|
177 |
+
"step": 480
|
178 |
+
},
|
179 |
+
{
|
180 |
+
"epoch": 0.05547542438699656,
|
181 |
+
"grad_norm": 2.796875,
|
182 |
+
"learning_rate": 8.319467554076538e-06,
|
183 |
+
"loss": 0.5094,
|
184 |
+
"step": 500
|
185 |
+
},
|
186 |
+
{
|
187 |
+
"epoch": 0.05769444136247642,
|
188 |
+
"grad_norm": 1.84375,
|
189 |
+
"learning_rate": 8.652246256239602e-06,
|
190 |
+
"loss": 0.4476,
|
191 |
+
"step": 520
|
192 |
+
},
|
193 |
+
{
|
194 |
+
"epoch": 0.059913458337956284,
|
195 |
+
"grad_norm": 2.09375,
|
196 |
+
"learning_rate": 8.985024958402662e-06,
|
197 |
+
"loss": 0.4836,
|
198 |
+
"step": 540
|
199 |
+
},
|
200 |
+
{
|
201 |
+
"epoch": 0.062132475313436145,
|
202 |
+
"grad_norm": 1.6328125,
|
203 |
+
"learning_rate": 9.317803660565724e-06,
|
204 |
+
"loss": 0.4805,
|
205 |
+
"step": 560
|
206 |
+
},
|
207 |
+
{
|
208 |
+
"epoch": 0.06435149228891601,
|
209 |
+
"grad_norm": 1.8828125,
|
210 |
+
"learning_rate": 9.650582362728786e-06,
|
211 |
+
"loss": 0.425,
|
212 |
+
"step": 580
|
213 |
+
},
|
214 |
+
{
|
215 |
+
"epoch": 0.06657050926439587,
|
216 |
+
"grad_norm": 2.6875,
|
217 |
+
"learning_rate": 9.983361064891846e-06,
|
218 |
+
"loss": 0.5223,
|
219 |
+
"step": 600
|
220 |
+
},
|
221 |
+
{
|
222 |
+
"epoch": 0.06878952623987573,
|
223 |
+
"grad_norm": 2.140625,
|
224 |
+
"learning_rate": 1.031613976705491e-05,
|
225 |
+
"loss": 0.5,
|
226 |
+
"step": 620
|
227 |
+
},
|
228 |
+
{
|
229 |
+
"epoch": 0.0710085432153556,
|
230 |
+
"grad_norm": 2.203125,
|
231 |
+
"learning_rate": 1.064891846921797e-05,
|
232 |
+
"loss": 0.5271,
|
233 |
+
"step": 640
|
234 |
+
},
|
235 |
+
{
|
236 |
+
"epoch": 0.07322756019083546,
|
237 |
+
"grad_norm": 1.9765625,
|
238 |
+
"learning_rate": 1.0981697171381032e-05,
|
239 |
+
"loss": 0.4981,
|
240 |
+
"step": 660
|
241 |
+
},
|
242 |
+
{
|
243 |
+
"epoch": 0.07544657716631532,
|
244 |
+
"grad_norm": 1.2421875,
|
245 |
+
"learning_rate": 1.1314475873544094e-05,
|
246 |
+
"loss": 0.5133,
|
247 |
+
"step": 680
|
248 |
+
},
|
249 |
+
{
|
250 |
+
"epoch": 0.07766559414179519,
|
251 |
+
"grad_norm": 2.515625,
|
252 |
+
"learning_rate": 1.1647254575707154e-05,
|
253 |
+
"loss": 0.4693,
|
254 |
+
"step": 700
|
255 |
+
},
|
256 |
+
{
|
257 |
+
"epoch": 0.07988461111727505,
|
258 |
+
"grad_norm": 2.03125,
|
259 |
+
"learning_rate": 1.1980033277870216e-05,
|
260 |
+
"loss": 0.4844,
|
261 |
+
"step": 720
|
262 |
+
},
|
263 |
+
{
|
264 |
+
"epoch": 0.08210362809275491,
|
265 |
+
"grad_norm": 1.578125,
|
266 |
+
"learning_rate": 1.2312811980033278e-05,
|
267 |
+
"loss": 0.4943,
|
268 |
+
"step": 740
|
269 |
+
},
|
270 |
+
{
|
271 |
+
"epoch": 0.08432264506823477,
|
272 |
+
"grad_norm": 2.75,
|
273 |
+
"learning_rate": 1.264559068219634e-05,
|
274 |
+
"loss": 0.5,
|
275 |
+
"step": 760
|
276 |
+
},
|
277 |
+
{
|
278 |
+
"epoch": 0.08654166204371463,
|
279 |
+
"grad_norm": 1.46875,
|
280 |
+
"learning_rate": 1.2978369384359402e-05,
|
281 |
+
"loss": 0.4318,
|
282 |
+
"step": 780
|
283 |
+
},
|
284 |
+
{
|
285 |
+
"epoch": 0.0887606790191945,
|
286 |
+
"grad_norm": 2.484375,
|
287 |
+
"learning_rate": 1.3311148086522462e-05,
|
288 |
+
"loss": 0.4745,
|
289 |
+
"step": 800
|
290 |
+
},
|
291 |
+
{
|
292 |
+
"epoch": 0.09097969599467436,
|
293 |
+
"grad_norm": 2.28125,
|
294 |
+
"learning_rate": 1.3643926788685524e-05,
|
295 |
+
"loss": 0.5459,
|
296 |
+
"step": 820
|
297 |
+
},
|
298 |
+
{
|
299 |
+
"epoch": 0.09319871297015422,
|
300 |
+
"grad_norm": 2.078125,
|
301 |
+
"learning_rate": 1.3976705490848584e-05,
|
302 |
+
"loss": 0.5021,
|
303 |
+
"step": 840
|
304 |
+
},
|
305 |
+
{
|
306 |
+
"epoch": 0.09541772994563408,
|
307 |
+
"grad_norm": 0.97265625,
|
308 |
+
"learning_rate": 1.4309484193011648e-05,
|
309 |
+
"loss": 0.4271,
|
310 |
+
"step": 860
|
311 |
+
},
|
312 |
+
{
|
313 |
+
"epoch": 0.09763674692111395,
|
314 |
+
"grad_norm": 1.828125,
|
315 |
+
"learning_rate": 1.464226289517471e-05,
|
316 |
+
"loss": 0.4924,
|
317 |
+
"step": 880
|
318 |
+
},
|
319 |
+
{
|
320 |
+
"epoch": 0.09985576389659381,
|
321 |
+
"grad_norm": 2.25,
|
322 |
+
"learning_rate": 1.497504159733777e-05,
|
323 |
+
"loss": 0.514,
|
324 |
+
"step": 900
|
325 |
+
},
|
326 |
+
{
|
327 |
+
"epoch": 0.10207478087207367,
|
328 |
+
"grad_norm": 1.578125,
|
329 |
+
"learning_rate": 1.5307820299500832e-05,
|
330 |
+
"loss": 0.4569,
|
331 |
+
"step": 920
|
332 |
+
},
|
333 |
+
{
|
334 |
+
"epoch": 0.10429379784755353,
|
335 |
+
"grad_norm": 1.4140625,
|
336 |
+
"learning_rate": 1.5640599001663892e-05,
|
337 |
+
"loss": 0.4751,
|
338 |
+
"step": 940
|
339 |
+
},
|
340 |
+
{
|
341 |
+
"epoch": 0.1065128148230334,
|
342 |
+
"grad_norm": 2.1875,
|
343 |
+
"learning_rate": 1.5973377703826956e-05,
|
344 |
+
"loss": 0.4719,
|
345 |
+
"step": 960
|
346 |
+
},
|
347 |
+
{
|
348 |
+
"epoch": 0.10873183179851326,
|
349 |
+
"grad_norm": 1.921875,
|
350 |
+
"learning_rate": 1.6306156405990016e-05,
|
351 |
+
"loss": 0.4455,
|
352 |
+
"step": 980
|
353 |
+
},
|
354 |
+
{
|
355 |
+
"epoch": 0.11095084877399312,
|
356 |
+
"grad_norm": 1.7421875,
|
357 |
+
"learning_rate": 1.6638935108153077e-05,
|
358 |
+
"loss": 0.5068,
|
359 |
+
"step": 1000
|
360 |
+
},
|
361 |
+
{
|
362 |
+
"epoch": 0.11316986574947298,
|
363 |
+
"grad_norm": 1.96875,
|
364 |
+
"learning_rate": 1.697171381031614e-05,
|
365 |
+
"loss": 0.5076,
|
366 |
+
"step": 1020
|
367 |
+
},
|
368 |
+
{
|
369 |
+
"epoch": 0.11538888272495285,
|
370 |
+
"grad_norm": 2.0625,
|
371 |
+
"learning_rate": 1.7304492512479204e-05,
|
372 |
+
"loss": 0.449,
|
373 |
+
"step": 1040
|
374 |
+
},
|
375 |
+
{
|
376 |
+
"epoch": 0.11760789970043271,
|
377 |
+
"grad_norm": 2.859375,
|
378 |
+
"learning_rate": 1.7637271214642264e-05,
|
379 |
+
"loss": 0.4298,
|
380 |
+
"step": 1060
|
381 |
+
},
|
382 |
+
{
|
383 |
+
"epoch": 0.11982691667591257,
|
384 |
+
"grad_norm": 2.0625,
|
385 |
+
"learning_rate": 1.7970049916805324e-05,
|
386 |
+
"loss": 0.5298,
|
387 |
+
"step": 1080
|
388 |
+
},
|
389 |
+
{
|
390 |
+
"epoch": 0.12204593365139244,
|
391 |
+
"grad_norm": 1.90625,
|
392 |
+
"learning_rate": 1.8302828618968388e-05,
|
393 |
+
"loss": 0.5398,
|
394 |
+
"step": 1100
|
395 |
+
},
|
396 |
+
{
|
397 |
+
"epoch": 0.12426495062687229,
|
398 |
+
"grad_norm": 1.40625,
|
399 |
+
"learning_rate": 1.8635607321131448e-05,
|
400 |
+
"loss": 0.5533,
|
401 |
+
"step": 1120
|
402 |
+
},
|
403 |
+
{
|
404 |
+
"epoch": 0.12648396760235217,
|
405 |
+
"grad_norm": 2.21875,
|
406 |
+
"learning_rate": 1.896838602329451e-05,
|
407 |
+
"loss": 0.422,
|
408 |
+
"step": 1140
|
409 |
+
},
|
410 |
+
{
|
411 |
+
"epoch": 0.12870298457783202,
|
412 |
+
"grad_norm": 1.96875,
|
413 |
+
"learning_rate": 1.9301164725457572e-05,
|
414 |
+
"loss": 0.4807,
|
415 |
+
"step": 1160
|
416 |
+
},
|
417 |
+
{
|
418 |
+
"epoch": 0.13092200155331188,
|
419 |
+
"grad_norm": 1.484375,
|
420 |
+
"learning_rate": 1.9633943427620632e-05,
|
421 |
+
"loss": 0.5209,
|
422 |
+
"step": 1180
|
423 |
+
},
|
424 |
+
{
|
425 |
+
"epoch": 0.13314101852879173,
|
426 |
+
"grad_norm": 1.9765625,
|
427 |
+
"learning_rate": 1.9966722129783693e-05,
|
428 |
+
"loss": 0.4522,
|
429 |
+
"step": 1200
|
430 |
+
},
|
431 |
+
{
|
432 |
+
"epoch": 0.13536003550427161,
|
433 |
+
"grad_norm": 1.3828125,
|
434 |
+
"learning_rate": 2.0299500831946756e-05,
|
435 |
+
"loss": 0.4684,
|
436 |
+
"step": 1220
|
437 |
+
},
|
438 |
+
{
|
439 |
+
"epoch": 0.13757905247975147,
|
440 |
+
"grad_norm": 1.59375,
|
441 |
+
"learning_rate": 2.063227953410982e-05,
|
442 |
+
"loss": 0.3982,
|
443 |
+
"step": 1240
|
444 |
+
},
|
445 |
+
{
|
446 |
+
"epoch": 0.13979806945523132,
|
447 |
+
"grad_norm": 1.7734375,
|
448 |
+
"learning_rate": 2.096505823627288e-05,
|
449 |
+
"loss": 0.5518,
|
450 |
+
"step": 1260
|
451 |
+
},
|
452 |
+
{
|
453 |
+
"epoch": 0.1420170864307112,
|
454 |
+
"grad_norm": 1.6875,
|
455 |
+
"learning_rate": 2.129783693843594e-05,
|
456 |
+
"loss": 0.5107,
|
457 |
+
"step": 1280
|
458 |
+
},
|
459 |
+
{
|
460 |
+
"epoch": 0.14423610340619106,
|
461 |
+
"grad_norm": 1.453125,
|
462 |
+
"learning_rate": 2.1630615640599004e-05,
|
463 |
+
"loss": 0.4422,
|
464 |
+
"step": 1300
|
465 |
+
},
|
466 |
+
{
|
467 |
+
"epoch": 0.1464551203816709,
|
468 |
+
"grad_norm": 2.015625,
|
469 |
+
"learning_rate": 2.1963394342762064e-05,
|
470 |
+
"loss": 0.5578,
|
471 |
+
"step": 1320
|
472 |
+
},
|
473 |
+
{
|
474 |
+
"epoch": 0.1486741373571508,
|
475 |
+
"grad_norm": 1.4921875,
|
476 |
+
"learning_rate": 2.2296173044925124e-05,
|
477 |
+
"loss": 0.4516,
|
478 |
+
"step": 1340
|
479 |
+
},
|
480 |
+
{
|
481 |
+
"epoch": 0.15089315433263065,
|
482 |
+
"grad_norm": 2.15625,
|
483 |
+
"learning_rate": 2.2628951747088188e-05,
|
484 |
+
"loss": 0.3979,
|
485 |
+
"step": 1360
|
486 |
+
},
|
487 |
+
{
|
488 |
+
"epoch": 0.1531121713081105,
|
489 |
+
"grad_norm": 1.4140625,
|
490 |
+
"learning_rate": 2.296173044925125e-05,
|
491 |
+
"loss": 0.4895,
|
492 |
+
"step": 1380
|
493 |
+
},
|
494 |
+
{
|
495 |
+
"epoch": 0.15533118828359038,
|
496 |
+
"grad_norm": 1.453125,
|
497 |
+
"learning_rate": 2.329450915141431e-05,
|
498 |
+
"loss": 0.4505,
|
499 |
+
"step": 1400
|
500 |
+
},
|
501 |
+
{
|
502 |
+
"epoch": 0.15755020525907024,
|
503 |
+
"grad_norm": 2.265625,
|
504 |
+
"learning_rate": 2.3627287853577372e-05,
|
505 |
+
"loss": 0.5008,
|
506 |
+
"step": 1420
|
507 |
+
},
|
508 |
+
{
|
509 |
+
"epoch": 0.1597692222345501,
|
510 |
+
"grad_norm": 1.5390625,
|
511 |
+
"learning_rate": 2.3960066555740432e-05,
|
512 |
+
"loss": 0.523,
|
513 |
+
"step": 1440
|
514 |
+
},
|
515 |
+
{
|
516 |
+
"epoch": 0.16198823921002994,
|
517 |
+
"grad_norm": 1.5546875,
|
518 |
+
"learning_rate": 2.4292845257903493e-05,
|
519 |
+
"loss": 0.4813,
|
520 |
+
"step": 1460
|
521 |
+
},
|
522 |
+
{
|
523 |
+
"epoch": 0.16420725618550983,
|
524 |
+
"grad_norm": 1.46875,
|
525 |
+
"learning_rate": 2.4625623960066556e-05,
|
526 |
+
"loss": 0.4995,
|
527 |
+
"step": 1480
|
528 |
+
},
|
529 |
+
{
|
530 |
+
"epoch": 0.16642627316098968,
|
531 |
+
"grad_norm": 1.8359375,
|
532 |
+
"learning_rate": 2.495840266222962e-05,
|
533 |
+
"loss": 0.474,
|
534 |
+
"step": 1500
|
535 |
+
},
|
536 |
+
{
|
537 |
+
"epoch": 0.16864529013646953,
|
538 |
+
"grad_norm": 1.6328125,
|
539 |
+
"learning_rate": 2.529118136439268e-05,
|
540 |
+
"loss": 0.4201,
|
541 |
+
"step": 1520
|
542 |
+
},
|
543 |
+
{
|
544 |
+
"epoch": 0.17086430711194942,
|
545 |
+
"grad_norm": 2.15625,
|
546 |
+
"learning_rate": 2.562396006655574e-05,
|
547 |
+
"loss": 0.5332,
|
548 |
+
"step": 1540
|
549 |
+
},
|
550 |
+
{
|
551 |
+
"epoch": 0.17308332408742927,
|
552 |
+
"grad_norm": 2.53125,
|
553 |
+
"learning_rate": 2.5956738768718804e-05,
|
554 |
+
"loss": 0.5105,
|
555 |
+
"step": 1560
|
556 |
+
},
|
557 |
+
{
|
558 |
+
"epoch": 0.17530234106290912,
|
559 |
+
"grad_norm": 1.734375,
|
560 |
+
"learning_rate": 2.6289517470881864e-05,
|
561 |
+
"loss": 0.4679,
|
562 |
+
"step": 1580
|
563 |
+
},
|
564 |
+
{
|
565 |
+
"epoch": 0.177521358038389,
|
566 |
+
"grad_norm": 1.4453125,
|
567 |
+
"learning_rate": 2.6622296173044925e-05,
|
568 |
+
"loss": 0.4276,
|
569 |
+
"step": 1600
|
570 |
+
},
|
571 |
+
{
|
572 |
+
"epoch": 0.17974037501386886,
|
573 |
+
"grad_norm": 1.9609375,
|
574 |
+
"learning_rate": 2.6955074875207988e-05,
|
575 |
+
"loss": 0.4462,
|
576 |
+
"step": 1620
|
577 |
+
},
|
578 |
+
{
|
579 |
+
"epoch": 0.1819593919893487,
|
580 |
+
"grad_norm": 1.734375,
|
581 |
+
"learning_rate": 2.728785357737105e-05,
|
582 |
+
"loss": 0.4534,
|
583 |
+
"step": 1640
|
584 |
+
},
|
585 |
+
{
|
586 |
+
"epoch": 0.1841784089648286,
|
587 |
+
"grad_norm": 1.5703125,
|
588 |
+
"learning_rate": 2.762063227953411e-05,
|
589 |
+
"loss": 0.4699,
|
590 |
+
"step": 1660
|
591 |
+
},
|
592 |
+
{
|
593 |
+
"epoch": 0.18639742594030845,
|
594 |
+
"grad_norm": 1.828125,
|
595 |
+
"learning_rate": 2.795341098169717e-05,
|
596 |
+
"loss": 0.483,
|
597 |
+
"step": 1680
|
598 |
+
},
|
599 |
+
{
|
600 |
+
"epoch": 0.1886164429157883,
|
601 |
+
"grad_norm": 2.765625,
|
602 |
+
"learning_rate": 2.8286189683860236e-05,
|
603 |
+
"loss": 0.4776,
|
604 |
+
"step": 1700
|
605 |
+
},
|
606 |
+
{
|
607 |
+
"epoch": 0.19083545989126816,
|
608 |
+
"grad_norm": 2.0,
|
609 |
+
"learning_rate": 2.8618968386023296e-05,
|
610 |
+
"loss": 0.4361,
|
611 |
+
"step": 1720
|
612 |
+
},
|
613 |
+
{
|
614 |
+
"epoch": 0.19305447686674804,
|
615 |
+
"grad_norm": 1.640625,
|
616 |
+
"learning_rate": 2.8951747088186356e-05,
|
617 |
+
"loss": 0.4566,
|
618 |
+
"step": 1740
|
619 |
+
},
|
620 |
+
{
|
621 |
+
"epoch": 0.1952734938422279,
|
622 |
+
"grad_norm": 1.640625,
|
623 |
+
"learning_rate": 2.928452579034942e-05,
|
624 |
+
"loss": 0.4609,
|
625 |
+
"step": 1760
|
626 |
+
},
|
627 |
+
{
|
628 |
+
"epoch": 0.19749251081770774,
|
629 |
+
"grad_norm": 1.9140625,
|
630 |
+
"learning_rate": 2.961730449251248e-05,
|
631 |
+
"loss": 0.5019,
|
632 |
+
"step": 1780
|
633 |
+
},
|
634 |
+
{
|
635 |
+
"epoch": 0.19971152779318763,
|
636 |
+
"grad_norm": 2.125,
|
637 |
+
"learning_rate": 2.995008319467554e-05,
|
638 |
+
"loss": 0.4844,
|
639 |
+
"step": 1800
|
640 |
+
},
|
641 |
+
{
|
642 |
+
"epoch": 0.20193054476866748,
|
643 |
+
"grad_norm": 2.015625,
|
644 |
+
"learning_rate": 2.999958848436878e-05,
|
645 |
+
"loss": 0.4974,
|
646 |
+
"step": 1820
|
647 |
+
},
|
648 |
+
{
|
649 |
+
"epoch": 0.20414956174414733,
|
650 |
+
"grad_norm": 1.828125,
|
651 |
+
"learning_rate": 2.9998050673796383e-05,
|
652 |
+
"loss": 0.4591,
|
653 |
+
"step": 1840
|
654 |
+
},
|
655 |
+
{
|
656 |
+
"epoch": 0.20636857871962722,
|
657 |
+
"grad_norm": 1.8671875,
|
658 |
+
"learning_rate": 2.999537386964595e-05,
|
659 |
+
"loss": 0.4319,
|
660 |
+
"step": 1860
|
661 |
+
},
|
662 |
+
{
|
663 |
+
"epoch": 0.20858759569510707,
|
664 |
+
"grad_norm": 1.953125,
|
665 |
+
"learning_rate": 2.9991558275201416e-05,
|
666 |
+
"loss": 0.4425,
|
667 |
+
"step": 1880
|
668 |
+
},
|
669 |
+
{
|
670 |
+
"epoch": 0.21080661267058692,
|
671 |
+
"grad_norm": 1.703125,
|
672 |
+
"learning_rate": 2.998660418022961e-05,
|
673 |
+
"loss": 0.4729,
|
674 |
+
"step": 1900
|
675 |
+
},
|
676 |
+
{
|
677 |
+
"epoch": 0.2130256296460668,
|
678 |
+
"grad_norm": 1.6484375,
|
679 |
+
"learning_rate": 2.9980511960958247e-05,
|
680 |
+
"loss": 0.4049,
|
681 |
+
"step": 1920
|
682 |
+
},
|
683 |
+
{
|
684 |
+
"epoch": 0.21524464662154666,
|
685 |
+
"grad_norm": 1.671875,
|
686 |
+
"learning_rate": 2.9973282080047365e-05,
|
687 |
+
"loss": 0.4646,
|
688 |
+
"step": 1940
|
689 |
+
},
|
690 |
+
{
|
691 |
+
"epoch": 0.2174636635970265,
|
692 |
+
"grad_norm": 1.6875,
|
693 |
+
"learning_rate": 2.996491508655417e-05,
|
694 |
+
"loss": 0.4725,
|
695 |
+
"step": 1960
|
696 |
+
},
|
697 |
+
{
|
698 |
+
"epoch": 0.21968268057250637,
|
699 |
+
"grad_norm": 1.953125,
|
700 |
+
"learning_rate": 2.995541161589137e-05,
|
701 |
+
"loss": 0.4448,
|
702 |
+
"step": 1980
|
703 |
+
},
|
704 |
+
{
|
705 |
+
"epoch": 0.22190169754798625,
|
706 |
+
"grad_norm": 1.3046875,
|
707 |
+
"learning_rate": 2.994477238977889e-05,
|
708 |
+
"loss": 0.4673,
|
709 |
+
"step": 2000
|
710 |
+
},
|
711 |
+
{
|
712 |
+
"epoch": 0.2241207145234661,
|
713 |
+
"grad_norm": 1.71875,
|
714 |
+
"learning_rate": 2.9932998216189077e-05,
|
715 |
+
"loss": 0.423,
|
716 |
+
"step": 2020
|
717 |
+
},
|
718 |
+
{
|
719 |
+
"epoch": 0.22633973149894596,
|
720 |
+
"grad_norm": 1.703125,
|
721 |
+
"learning_rate": 2.992008998928534e-05,
|
722 |
+
"loss": 0.4803,
|
723 |
+
"step": 2040
|
724 |
+
},
|
725 |
+
{
|
726 |
+
"epoch": 0.22855874847442584,
|
727 |
+
"grad_norm": 1.4296875,
|
728 |
+
"learning_rate": 2.990604868935424e-05,
|
729 |
+
"loss": 0.4604,
|
730 |
+
"step": 2060
|
731 |
+
},
|
732 |
+
{
|
733 |
+
"epoch": 0.2307777654499057,
|
734 |
+
"grad_norm": 1.890625,
|
735 |
+
"learning_rate": 2.989087538273105e-05,
|
736 |
+
"loss": 0.5155,
|
737 |
+
"step": 2080
|
738 |
+
},
|
739 |
+
{
|
740 |
+
"epoch": 0.23299678242538555,
|
741 |
+
"grad_norm": 1.7421875,
|
742 |
+
"learning_rate": 2.9874571221718776e-05,
|
743 |
+
"loss": 0.5122,
|
744 |
+
"step": 2100
|
745 |
+
},
|
746 |
+
{
|
747 |
+
"epoch": 0.23521579940086543,
|
748 |
+
"grad_norm": 1.765625,
|
749 |
+
"learning_rate": 2.985713744450063e-05,
|
750 |
+
"loss": 0.4475,
|
751 |
+
"step": 2120
|
752 |
+
},
|
753 |
+
{
|
754 |
+
"epoch": 0.23743481637634528,
|
755 |
+
"grad_norm": 2.15625,
|
756 |
+
"learning_rate": 2.9838575375046034e-05,
|
757 |
+
"loss": 0.4281,
|
758 |
+
"step": 2140
|
759 |
+
},
|
760 |
+
{
|
761 |
+
"epoch": 0.23965383335182514,
|
762 |
+
"grad_norm": 1.9296875,
|
763 |
+
"learning_rate": 2.9818886423010024e-05,
|
764 |
+
"loss": 0.4383,
|
765 |
+
"step": 2160
|
766 |
+
},
|
767 |
+
{
|
768 |
+
"epoch": 0.24187285032730502,
|
769 |
+
"grad_norm": 1.7421875,
|
770 |
+
"learning_rate": 2.979807208362625e-05,
|
771 |
+
"loss": 0.449,
|
772 |
+
"step": 2180
|
773 |
+
},
|
774 |
+
{
|
775 |
+
"epoch": 0.24409186730278487,
|
776 |
+
"grad_norm": 1.4453125,
|
777 |
+
"learning_rate": 2.9776133937593395e-05,
|
778 |
+
"loss": 0.5002,
|
779 |
+
"step": 2200
|
780 |
+
},
|
781 |
+
{
|
782 |
+
"epoch": 0.24631088427826472,
|
783 |
+
"grad_norm": 1.6484375,
|
784 |
+
"learning_rate": 2.9753073650955128e-05,
|
785 |
+
"loss": 0.4667,
|
786 |
+
"step": 2220
|
787 |
+
},
|
788 |
+
{
|
789 |
+
"epoch": 0.24852990125374458,
|
790 |
+
"grad_norm": 2.203125,
|
791 |
+
"learning_rate": 2.9728892974973592e-05,
|
792 |
+
"loss": 0.4431,
|
793 |
+
"step": 2240
|
794 |
+
},
|
795 |
+
{
|
796 |
+
"epoch": 0.25074891822922446,
|
797 |
+
"grad_norm": 1.78125,
|
798 |
+
"learning_rate": 2.970359374599641e-05,
|
799 |
+
"loss": 0.4684,
|
800 |
+
"step": 2260
|
801 |
+
},
|
802 |
+
{
|
803 |
+
"epoch": 0.25296793520470434,
|
804 |
+
"grad_norm": 2.15625,
|
805 |
+
"learning_rate": 2.967717788531722e-05,
|
806 |
+
"loss": 0.4599,
|
807 |
+
"step": 2280
|
808 |
+
},
|
809 |
+
{
|
810 |
+
"epoch": 0.25518695218018417,
|
811 |
+
"grad_norm": 1.4453125,
|
812 |
+
"learning_rate": 2.9649647399029764e-05,
|
813 |
+
"loss": 0.5047,
|
814 |
+
"step": 2300
|
815 |
+
},
|
816 |
+
{
|
817 |
+
"epoch": 0.25740596915566405,
|
818 |
+
"grad_norm": 2.265625,
|
819 |
+
"learning_rate": 2.9621004377875558e-05,
|
820 |
+
"loss": 0.4824,
|
821 |
+
"step": 2320
|
822 |
+
},
|
823 |
+
{
|
824 |
+
"epoch": 0.2596249861311439,
|
825 |
+
"grad_norm": 1.3515625,
|
826 |
+
"learning_rate": 2.959125099708509e-05,
|
827 |
+
"loss": 0.4928,
|
828 |
+
"step": 2340
|
829 |
+
},
|
830 |
+
{
|
831 |
+
"epoch": 0.26184400310662376,
|
832 |
+
"grad_norm": 1.5703125,
|
833 |
+
"learning_rate": 2.9560389516212638e-05,
|
834 |
+
"loss": 0.5386,
|
835 |
+
"step": 2360
|
836 |
+
},
|
837 |
+
{
|
838 |
+
"epoch": 0.26406302008210364,
|
839 |
+
"grad_norm": 0.96875,
|
840 |
+
"learning_rate": 2.9528422278964687e-05,
|
841 |
+
"loss": 0.4092,
|
842 |
+
"step": 2380
|
843 |
+
},
|
844 |
+
{
|
845 |
+
"epoch": 0.26628203705758346,
|
846 |
+
"grad_norm": 1.5703125,
|
847 |
+
"learning_rate": 2.949535171302192e-05,
|
848 |
+
"loss": 0.4929,
|
849 |
+
"step": 2400
|
850 |
+
},
|
851 |
+
{
|
852 |
+
"epoch": 0.26850105403306335,
|
853 |
+
"grad_norm": 1.5859375,
|
854 |
+
"learning_rate": 2.9461180329854867e-05,
|
855 |
+
"loss": 0.4893,
|
856 |
+
"step": 2420
|
857 |
+
},
|
858 |
+
{
|
859 |
+
"epoch": 0.27072007100854323,
|
860 |
+
"grad_norm": 1.890625,
|
861 |
+
"learning_rate": 2.9425910724533165e-05,
|
862 |
+
"loss": 0.4554,
|
863 |
+
"step": 2440
|
864 |
+
},
|
865 |
+
{
|
866 |
+
"epoch": 0.27293908798402305,
|
867 |
+
"grad_norm": 1.65625,
|
868 |
+
"learning_rate": 2.9389545575528496e-05,
|
869 |
+
"loss": 0.4702,
|
870 |
+
"step": 2460
|
871 |
+
},
|
872 |
+
{
|
873 |
+
"epoch": 0.27515810495950294,
|
874 |
+
"grad_norm": 1.375,
|
875 |
+
"learning_rate": 2.9352087644511162e-05,
|
876 |
+
"loss": 0.5056,
|
877 |
+
"step": 2480
|
878 |
+
},
|
879 |
+
{
|
880 |
+
"epoch": 0.2773771219349828,
|
881 |
+
"grad_norm": 2.859375,
|
882 |
+
"learning_rate": 2.9313539776140362e-05,
|
883 |
+
"loss": 0.428,
|
884 |
+
"step": 2500
|
885 |
+
},
|
886 |
+
{
|
887 |
+
"epoch": 0.27959613891046264,
|
888 |
+
"grad_norm": 1.7890625,
|
889 |
+
"learning_rate": 2.9273904897848174e-05,
|
890 |
+
"loss": 0.4827,
|
891 |
+
"step": 2520
|
892 |
+
},
|
893 |
+
{
|
894 |
+
"epoch": 0.2818151558859425,
|
895 |
+
"grad_norm": 1.359375,
|
896 |
+
"learning_rate": 2.9233186019617214e-05,
|
897 |
+
"loss": 0.5082,
|
898 |
+
"step": 2540
|
899 |
+
},
|
900 |
+
{
|
901 |
+
"epoch": 0.2840341728614224,
|
902 |
+
"grad_norm": 1.421875,
|
903 |
+
"learning_rate": 2.9191386233752062e-05,
|
904 |
+
"loss": 0.4803,
|
905 |
+
"step": 2560
|
906 |
+
},
|
907 |
+
{
|
908 |
+
"epoch": 0.28625318983690223,
|
909 |
+
"grad_norm": 1.859375,
|
910 |
+
"learning_rate": 2.9148508714644424e-05,
|
911 |
+
"loss": 0.5205,
|
912 |
+
"step": 2580
|
913 |
+
},
|
914 |
+
{
|
915 |
+
"epoch": 0.2884722068123821,
|
916 |
+
"grad_norm": 1.546875,
|
917 |
+
"learning_rate": 2.9104556718532054e-05,
|
918 |
+
"loss": 0.4965,
|
919 |
+
"step": 2600
|
920 |
+
},
|
921 |
+
{
|
922 |
+
"epoch": 0.290691223787862,
|
923 |
+
"grad_norm": 1.5078125,
|
924 |
+
"learning_rate": 2.9059533583251487e-05,
|
925 |
+
"loss": 0.4376,
|
926 |
+
"step": 2620
|
927 |
+
},
|
928 |
+
{
|
929 |
+
"epoch": 0.2929102407633418,
|
930 |
+
"grad_norm": 1.7578125,
|
931 |
+
"learning_rate": 2.9013442727984517e-05,
|
932 |
+
"loss": 0.4618,
|
933 |
+
"step": 2640
|
934 |
+
},
|
935 |
+
{
|
936 |
+
"epoch": 0.2951292577388217,
|
937 |
+
"grad_norm": 1.640625,
|
938 |
+
"learning_rate": 2.8966287652998562e-05,
|
939 |
+
"loss": 0.4943,
|
940 |
+
"step": 2660
|
941 |
+
},
|
942 |
+
{
|
943 |
+
"epoch": 0.2973482747143016,
|
944 |
+
"grad_norm": 1.703125,
|
945 |
+
"learning_rate": 2.891807193938085e-05,
|
946 |
+
"loss": 0.4582,
|
947 |
+
"step": 2680
|
948 |
+
},
|
949 |
+
{
|
950 |
+
"epoch": 0.2995672916897814,
|
951 |
+
"grad_norm": 1.6875,
|
952 |
+
"learning_rate": 2.8868799248766436e-05,
|
953 |
+
"loss": 0.5133,
|
954 |
+
"step": 2700
|
955 |
+
},
|
956 |
+
{
|
957 |
+
"epoch": 0.3017863086652613,
|
958 |
+
"grad_norm": 1.71875,
|
959 |
+
"learning_rate": 2.8818473323060143e-05,
|
960 |
+
"loss": 0.4628,
|
961 |
+
"step": 2720
|
962 |
+
},
|
963 |
+
{
|
964 |
+
"epoch": 0.3040053256407412,
|
965 |
+
"grad_norm": 1.609375,
|
966 |
+
"learning_rate": 2.87670979841524e-05,
|
967 |
+
"loss": 0.4408,
|
968 |
+
"step": 2740
|
969 |
+
},
|
970 |
+
{
|
971 |
+
"epoch": 0.306224342616221,
|
972 |
+
"grad_norm": 1.734375,
|
973 |
+
"learning_rate": 2.8714677133628963e-05,
|
974 |
+
"loss": 0.5004,
|
975 |
+
"step": 2760
|
976 |
+
},
|
977 |
+
{
|
978 |
+
"epoch": 0.3084433595917009,
|
979 |
+
"grad_norm": 1.6640625,
|
980 |
+
"learning_rate": 2.866121475247467e-05,
|
981 |
+
"loss": 0.4031,
|
982 |
+
"step": 2780
|
983 |
+
},
|
984 |
+
{
|
985 |
+
"epoch": 0.31066237656718076,
|
986 |
+
"grad_norm": 1.8046875,
|
987 |
+
"learning_rate": 2.8606714900771055e-05,
|
988 |
+
"loss": 0.5192,
|
989 |
+
"step": 2800
|
990 |
+
},
|
991 |
+
{
|
992 |
+
"epoch": 0.3128813935426606,
|
993 |
+
"grad_norm": 2.03125,
|
994 |
+
"learning_rate": 2.8551181717388066e-05,
|
995 |
+
"loss": 0.5397,
|
996 |
+
"step": 2820
|
997 |
+
},
|
998 |
+
{
|
999 |
+
"epoch": 0.3151004105181405,
|
1000 |
+
"grad_norm": 1.9609375,
|
1001 |
+
"learning_rate": 2.849461941966972e-05,
|
1002 |
+
"loss": 0.4446,
|
1003 |
+
"step": 2840
|
1004 |
+
},
|
1005 |
+
{
|
1006 |
+
"epoch": 0.3173194274936203,
|
1007 |
+
"grad_norm": 1.9296875,
|
1008 |
+
"learning_rate": 2.8437032303113823e-05,
|
1009 |
+
"loss": 0.4464,
|
1010 |
+
"step": 2860
|
1011 |
+
},
|
1012 |
+
{
|
1013 |
+
"epoch": 0.3195384444691002,
|
1014 |
+
"grad_norm": 1.734375,
|
1015 |
+
"learning_rate": 2.8378424741045773e-05,
|
1016 |
+
"loss": 0.526,
|
1017 |
+
"step": 2880
|
1018 |
+
},
|
1019 |
+
{
|
1020 |
+
"epoch": 0.32175746144458006,
|
1021 |
+
"grad_norm": 1.7265625,
|
1022 |
+
"learning_rate": 2.831880118428644e-05,
|
1023 |
+
"loss": 0.4087,
|
1024 |
+
"step": 2900
|
1025 |
+
},
|
1026 |
+
{
|
1027 |
+
"epoch": 0.3239764784200599,
|
1028 |
+
"grad_norm": 1.125,
|
1029 |
+
"learning_rate": 2.8258166160814135e-05,
|
1030 |
+
"loss": 0.4833,
|
1031 |
+
"step": 2920
|
1032 |
+
},
|
1033 |
+
{
|
1034 |
+
"epoch": 0.32619549539553977,
|
1035 |
+
"grad_norm": 1.34375,
|
1036 |
+
"learning_rate": 2.8196524275420758e-05,
|
1037 |
+
"loss": 0.4403,
|
1038 |
+
"step": 2940
|
1039 |
+
},
|
1040 |
+
{
|
1041 |
+
"epoch": 0.32841451237101965,
|
1042 |
+
"grad_norm": 1.7421875,
|
1043 |
+
"learning_rate": 2.813388020936211e-05,
|
1044 |
+
"loss": 0.4728,
|
1045 |
+
"step": 2960
|
1046 |
+
},
|
1047 |
+
{
|
1048 |
+
"epoch": 0.3306335293464995,
|
1049 |
+
"grad_norm": 1.0390625,
|
1050 |
+
"learning_rate": 2.8070238720002364e-05,
|
1051 |
+
"loss": 0.4389,
|
1052 |
+
"step": 2980
|
1053 |
+
},
|
1054 |
+
{
|
1055 |
+
"epoch": 0.33285254632197936,
|
1056 |
+
"grad_norm": 0.90625,
|
1057 |
+
"learning_rate": 2.800560464045278e-05,
|
1058 |
+
"loss": 0.482,
|
1059 |
+
"step": 3000
|
1060 |
+
},
|
1061 |
+
{
|
1062 |
+
"epoch": 0.33507156329745924,
|
1063 |
+
"grad_norm": 1.6796875,
|
1064 |
+
"learning_rate": 2.7939982879204686e-05,
|
1065 |
+
"loss": 0.4157,
|
1066 |
+
"step": 3020
|
1067 |
+
},
|
1068 |
+
{
|
1069 |
+
"epoch": 0.33729058027293907,
|
1070 |
+
"grad_norm": 1.9140625,
|
1071 |
+
"learning_rate": 2.787337841975668e-05,
|
1072 |
+
"loss": 0.4593,
|
1073 |
+
"step": 3040
|
1074 |
+
},
|
1075 |
+
{
|
1076 |
+
"epoch": 0.33950959724841895,
|
1077 |
+
"grad_norm": 1.2421875,
|
1078 |
+
"learning_rate": 2.78057963202362e-05,
|
1079 |
+
"loss": 0.4071,
|
1080 |
+
"step": 3060
|
1081 |
+
},
|
1082 |
+
{
|
1083 |
+
"epoch": 0.34172861422389883,
|
1084 |
+
"grad_norm": 1.671875,
|
1085 |
+
"learning_rate": 2.773724171301538e-05,
|
1086 |
+
"loss": 0.4307,
|
1087 |
+
"step": 3080
|
1088 |
+
},
|
1089 |
+
{
|
1090 |
+
"epoch": 0.34394763119937866,
|
1091 |
+
"grad_norm": 2.75,
|
1092 |
+
"learning_rate": 2.7667719804321285e-05,
|
1093 |
+
"loss": 0.5196,
|
1094 |
+
"step": 3100
|
1095 |
+
},
|
1096 |
+
{
|
1097 |
+
"epoch": 0.34616664817485854,
|
1098 |
+
"grad_norm": 1.71875,
|
1099 |
+
"learning_rate": 2.7597235873840544e-05,
|
1100 |
+
"loss": 0.4529,
|
1101 |
+
"step": 3120
|
1102 |
+
},
|
1103 |
+
{
|
1104 |
+
"epoch": 0.3483856651503384,
|
1105 |
+
"grad_norm": 1.453125,
|
1106 |
+
"learning_rate": 2.7525795274318386e-05,
|
1107 |
+
"loss": 0.5671,
|
1108 |
+
"step": 3140
|
1109 |
+
},
|
1110 |
+
{
|
1111 |
+
"epoch": 0.35060468212581825,
|
1112 |
+
"grad_norm": 1.6484375,
|
1113 |
+
"learning_rate": 2.745340343115213e-05,
|
1114 |
+
"loss": 0.506,
|
1115 |
+
"step": 3160
|
1116 |
+
},
|
1117 |
+
{
|
1118 |
+
"epoch": 0.3528236991012981,
|
1119 |
+
"grad_norm": 1.828125,
|
1120 |
+
"learning_rate": 2.7380065841979196e-05,
|
1121 |
+
"loss": 0.4834,
|
1122 |
+
"step": 3180
|
1123 |
+
},
|
1124 |
+
{
|
1125 |
+
"epoch": 0.355042716076778,
|
1126 |
+
"grad_norm": 1.9296875,
|
1127 |
+
"learning_rate": 2.7305788076259565e-05,
|
1128 |
+
"loss": 0.4635,
|
1129 |
+
"step": 3200
|
1130 |
+
},
|
1131 |
+
{
|
1132 |
+
"epoch": 0.35726173305225783,
|
1133 |
+
"grad_norm": 1.7109375,
|
1134 |
+
"learning_rate": 2.7230575774852843e-05,
|
1135 |
+
"loss": 0.4873,
|
1136 |
+
"step": 3220
|
1137 |
+
},
|
1138 |
+
{
|
1139 |
+
"epoch": 0.3594807500277377,
|
1140 |
+
"grad_norm": 1.578125,
|
1141 |
+
"learning_rate": 2.715443464958986e-05,
|
1142 |
+
"loss": 0.4133,
|
1143 |
+
"step": 3240
|
1144 |
+
},
|
1145 |
+
{
|
1146 |
+
"epoch": 0.3616997670032176,
|
1147 |
+
"grad_norm": 2.03125,
|
1148 |
+
"learning_rate": 2.707737048283891e-05,
|
1149 |
+
"loss": 0.4954,
|
1150 |
+
"step": 3260
|
1151 |
+
},
|
1152 |
+
{
|
1153 |
+
"epoch": 0.3639187839786974,
|
1154 |
+
"grad_norm": 1.3671875,
|
1155 |
+
"learning_rate": 2.699938912706663e-05,
|
1156 |
+
"loss": 0.4585,
|
1157 |
+
"step": 3280
|
1158 |
+
},
|
1159 |
+
{
|
1160 |
+
"epoch": 0.3661378009541773,
|
1161 |
+
"grad_norm": 1.921875,
|
1162 |
+
"learning_rate": 2.6920496504393507e-05,
|
1163 |
+
"loss": 0.5479,
|
1164 |
+
"step": 3300
|
1165 |
+
},
|
1166 |
+
{
|
1167 |
+
"epoch": 0.3683568179296572,
|
1168 |
+
"grad_norm": 2.515625,
|
1169 |
+
"learning_rate": 2.6840698606144197e-05,
|
1170 |
+
"loss": 0.4712,
|
1171 |
+
"step": 3320
|
1172 |
+
},
|
1173 |
+
{
|
1174 |
+
"epoch": 0.370575834905137,
|
1175 |
+
"grad_norm": 2.28125,
|
1176 |
+
"learning_rate": 2.6760001492392474e-05,
|
1177 |
+
"loss": 0.5046,
|
1178 |
+
"step": 3340
|
1179 |
+
},
|
1180 |
+
{
|
1181 |
+
"epoch": 0.3727948518806169,
|
1182 |
+
"grad_norm": 1.53125,
|
1183 |
+
"learning_rate": 2.6678411291501038e-05,
|
1184 |
+
"loss": 0.522,
|
1185 |
+
"step": 3360
|
1186 |
+
},
|
1187 |
+
{
|
1188 |
+
"epoch": 0.3750138688560967,
|
1189 |
+
"grad_norm": 1.6796875,
|
1190 |
+
"learning_rate": 2.6595934199656108e-05,
|
1191 |
+
"loss": 0.4852,
|
1192 |
+
"step": 3380
|
1193 |
+
},
|
1194 |
+
{
|
1195 |
+
"epoch": 0.3772328858315766,
|
1196 |
+
"grad_norm": 1.9140625,
|
1197 |
+
"learning_rate": 2.6512576480396862e-05,
|
1198 |
+
"loss": 0.4745,
|
1199 |
+
"step": 3400
|
1200 |
+
},
|
1201 |
+
{
|
1202 |
+
"epoch": 0.3794519028070565,
|
1203 |
+
"grad_norm": 1.71875,
|
1204 |
+
"learning_rate": 2.6428344464139756e-05,
|
1205 |
+
"loss": 0.4903,
|
1206 |
+
"step": 3420
|
1207 |
+
},
|
1208 |
+
{
|
1209 |
+
"epoch": 0.3816709197825363,
|
1210 |
+
"grad_norm": 1.625,
|
1211 |
+
"learning_rate": 2.6343244547697798e-05,
|
1212 |
+
"loss": 0.3906,
|
1213 |
+
"step": 3440
|
1214 |
+
},
|
1215 |
+
{
|
1216 |
+
"epoch": 0.3838899367580162,
|
1217 |
+
"grad_norm": 1.859375,
|
1218 |
+
"learning_rate": 2.6257283193794742e-05,
|
1219 |
+
"loss": 0.471,
|
1220 |
+
"step": 3460
|
1221 |
+
},
|
1222 |
+
{
|
1223 |
+
"epoch": 0.3861089537334961,
|
1224 |
+
"grad_norm": 1.90625,
|
1225 |
+
"learning_rate": 2.617046693057429e-05,
|
1226 |
+
"loss": 0.4878,
|
1227 |
+
"step": 3480
|
1228 |
+
},
|
1229 |
+
{
|
1230 |
+
"epoch": 0.3883279707089759,
|
1231 |
+
"grad_norm": 1.765625,
|
1232 |
+
"learning_rate": 2.6082802351104317e-05,
|
1233 |
+
"loss": 0.4718,
|
1234 |
+
"step": 3500
|
1235 |
+
},
|
1236 |
+
{
|
1237 |
+
"epoch": 0.3905469876844558,
|
1238 |
+
"grad_norm": 1.8828125,
|
1239 |
+
"learning_rate": 2.5994296112876222e-05,
|
1240 |
+
"loss": 0.4649,
|
1241 |
+
"step": 3520
|
1242 |
+
},
|
1243 |
+
{
|
1244 |
+
"epoch": 0.39276600465993566,
|
1245 |
+
"grad_norm": 1.2109375,
|
1246 |
+
"learning_rate": 2.5904954937299267e-05,
|
1247 |
+
"loss": 0.3973,
|
1248 |
+
"step": 3540
|
1249 |
+
},
|
1250 |
+
{
|
1251 |
+
"epoch": 0.3949850216354155,
|
1252 |
+
"grad_norm": 1.4609375,
|
1253 |
+
"learning_rate": 2.5814785609190197e-05,
|
1254 |
+
"loss": 0.4785,
|
1255 |
+
"step": 3560
|
1256 |
+
},
|
1257 |
+
{
|
1258 |
+
"epoch": 0.39720403861089537,
|
1259 |
+
"grad_norm": 2.171875,
|
1260 |
+
"learning_rate": 2.5723794976257947e-05,
|
1261 |
+
"loss": 0.4512,
|
1262 |
+
"step": 3580
|
1263 |
+
},
|
1264 |
+
{
|
1265 |
+
"epoch": 0.39942305558637525,
|
1266 |
+
"grad_norm": 1.7265625,
|
1267 |
+
"learning_rate": 2.5631989948583623e-05,
|
1268 |
+
"loss": 0.4931,
|
1269 |
+
"step": 3600
|
1270 |
+
},
|
1271 |
+
{
|
1272 |
+
"epoch": 0.4016420725618551,
|
1273 |
+
"grad_norm": 1.1796875,
|
1274 |
+
"learning_rate": 2.553937749809572e-05,
|
1275 |
+
"loss": 0.4183,
|
1276 |
+
"step": 3620
|
1277 |
+
},
|
1278 |
+
{
|
1279 |
+
"epoch": 0.40386108953733496,
|
1280 |
+
"grad_norm": 1.7890625,
|
1281 |
+
"learning_rate": 2.544596465804068e-05,
|
1282 |
+
"loss": 0.4321,
|
1283 |
+
"step": 3640
|
1284 |
+
},
|
1285 |
+
{
|
1286 |
+
"epoch": 0.40608010651281484,
|
1287 |
+
"grad_norm": 2.109375,
|
1288 |
+
"learning_rate": 2.5351758522448724e-05,
|
1289 |
+
"loss": 0.489,
|
1290 |
+
"step": 3660
|
1291 |
+
},
|
1292 |
+
{
|
1293 |
+
"epoch": 0.40829912348829467,
|
1294 |
+
"grad_norm": 2.03125,
|
1295 |
+
"learning_rate": 2.5256766245595166e-05,
|
1296 |
+
"loss": 0.4398,
|
1297 |
+
"step": 3680
|
1298 |
+
},
|
1299 |
+
{
|
1300 |
+
"epoch": 0.41051814046377455,
|
1301 |
+
"grad_norm": 1.6484375,
|
1302 |
+
"learning_rate": 2.516099504145703e-05,
|
1303 |
+
"loss": 0.4831,
|
1304 |
+
"step": 3700
|
1305 |
+
},
|
1306 |
+
{
|
1307 |
+
"epoch": 0.41273715743925443,
|
1308 |
+
"grad_norm": 1.90625,
|
1309 |
+
"learning_rate": 2.5064452183165283e-05,
|
1310 |
+
"loss": 0.4365,
|
1311 |
+
"step": 3720
|
1312 |
+
},
|
1313 |
+
{
|
1314 |
+
"epoch": 0.41495617441473426,
|
1315 |
+
"grad_norm": 1.359375,
|
1316 |
+
"learning_rate": 2.496714500245241e-05,
|
1317 |
+
"loss": 0.4309,
|
1318 |
+
"step": 3740
|
1319 |
+
},
|
1320 |
+
{
|
1321 |
+
"epoch": 0.41717519139021414,
|
1322 |
+
"grad_norm": 1.765625,
|
1323 |
+
"learning_rate": 2.4869080889095693e-05,
|
1324 |
+
"loss": 0.5378,
|
1325 |
+
"step": 3760
|
1326 |
+
},
|
1327 |
+
{
|
1328 |
+
"epoch": 0.419394208365694,
|
1329 |
+
"grad_norm": 1.75,
|
1330 |
+
"learning_rate": 2.477026729035595e-05,
|
1331 |
+
"loss": 0.4905,
|
1332 |
+
"step": 3780
|
1333 |
+
},
|
1334 |
+
{
|
1335 |
+
"epoch": 0.42161322534117385,
|
1336 |
+
"grad_norm": 1.859375,
|
1337 |
+
"learning_rate": 2.4670711710412026e-05,
|
1338 |
+
"loss": 0.4187,
|
1339 |
+
"step": 3800
|
1340 |
+
},
|
1341 |
+
{
|
1342 |
+
"epoch": 0.42383224231665373,
|
1343 |
+
"grad_norm": 1.9140625,
|
1344 |
+
"learning_rate": 2.457042170979086e-05,
|
1345 |
+
"loss": 0.4817,
|
1346 |
+
"step": 3820
|
1347 |
+
},
|
1348 |
+
{
|
1349 |
+
"epoch": 0.4260512592921336,
|
1350 |
+
"grad_norm": 1.6953125,
|
1351 |
+
"learning_rate": 2.4469404904793338e-05,
|
1352 |
+
"loss": 0.5108,
|
1353 |
+
"step": 3840
|
1354 |
+
},
|
1355 |
+
{
|
1356 |
+
"epoch": 0.42827027626761344,
|
1357 |
+
"grad_norm": 1.46875,
|
1358 |
+
"learning_rate": 2.4367668966915885e-05,
|
1359 |
+
"loss": 0.5112,
|
1360 |
+
"step": 3860
|
1361 |
+
},
|
1362 |
+
{
|
1363 |
+
"epoch": 0.4304892932430933,
|
1364 |
+
"grad_norm": 3.046875,
|
1365 |
+
"learning_rate": 2.4265221622267876e-05,
|
1366 |
+
"loss": 0.5353,
|
1367 |
+
"step": 3880
|
1368 |
+
},
|
1369 |
+
{
|
1370 |
+
"epoch": 0.43270831021857314,
|
1371 |
+
"grad_norm": 1.6640625,
|
1372 |
+
"learning_rate": 2.4162070650984893e-05,
|
1373 |
+
"loss": 0.4684,
|
1374 |
+
"step": 3900
|
1375 |
+
},
|
1376 |
+
{
|
1377 |
+
"epoch": 0.434927327194053,
|
1378 |
+
"grad_norm": 1.5078125,
|
1379 |
+
"learning_rate": 2.4058223886637872e-05,
|
1380 |
+
"loss": 0.4374,
|
1381 |
+
"step": 3920
|
1382 |
+
},
|
1383 |
+
{
|
1384 |
+
"epoch": 0.4371463441695329,
|
1385 |
+
"grad_norm": 1.6953125,
|
1386 |
+
"learning_rate": 2.3953689215638194e-05,
|
1387 |
+
"loss": 0.3753,
|
1388 |
+
"step": 3940
|
1389 |
+
},
|
1390 |
+
{
|
1391 |
+
"epoch": 0.43936536114501273,
|
1392 |
+
"grad_norm": 1.4921875,
|
1393 |
+
"learning_rate": 2.3848474576638807e-05,
|
1394 |
+
"loss": 0.4427,
|
1395 |
+
"step": 3960
|
1396 |
+
},
|
1397 |
+
{
|
1398 |
+
"epoch": 0.4415843781204926,
|
1399 |
+
"grad_norm": 1.25,
|
1400 |
+
"learning_rate": 2.3742587959931285e-05,
|
1401 |
+
"loss": 0.5074,
|
1402 |
+
"step": 3980
|
1403 |
+
},
|
1404 |
+
{
|
1405 |
+
"epoch": 0.4438033950959725,
|
1406 |
+
"grad_norm": 1.7265625,
|
1407 |
+
"learning_rate": 2.3636037406839076e-05,
|
1408 |
+
"loss": 0.4841,
|
1409 |
+
"step": 4000
|
1410 |
+
},
|
1411 |
+
{
|
1412 |
+
"epoch": 0.4460224120714523,
|
1413 |
+
"grad_norm": 1.8203125,
|
1414 |
+
"learning_rate": 2.3528831009106786e-05,
|
1415 |
+
"loss": 0.4643,
|
1416 |
+
"step": 4020
|
1417 |
+
},
|
1418 |
+
{
|
1419 |
+
"epoch": 0.4482414290469322,
|
1420 |
+
"grad_norm": 1.25,
|
1421 |
+
"learning_rate": 2.3420976908285687e-05,
|
1422 |
+
"loss": 0.4976,
|
1423 |
+
"step": 4040
|
1424 |
+
},
|
1425 |
+
{
|
1426 |
+
"epoch": 0.4504604460224121,
|
1427 |
+
"grad_norm": 1.828125,
|
1428 |
+
"learning_rate": 2.3312483295115424e-05,
|
1429 |
+
"loss": 0.5453,
|
1430 |
+
"step": 4060
|
1431 |
+
},
|
1432 |
+
{
|
1433 |
+
"epoch": 0.4526794629978919,
|
1434 |
+
"grad_norm": 2.921875,
|
1435 |
+
"learning_rate": 2.320335840890198e-05,
|
1436 |
+
"loss": 0.46,
|
1437 |
+
"step": 4080
|
1438 |
+
},
|
1439 |
+
{
|
1440 |
+
"epoch": 0.4548984799733718,
|
1441 |
+
"grad_norm": 2.03125,
|
1442 |
+
"learning_rate": 2.3093610536891965e-05,
|
1443 |
+
"loss": 0.5129,
|
1444 |
+
"step": 4100
|
1445 |
+
},
|
1446 |
+
{
|
1447 |
+
"epoch": 0.4571174969488517,
|
1448 |
+
"grad_norm": 1.4375,
|
1449 |
+
"learning_rate": 2.2983248013643253e-05,
|
1450 |
+
"loss": 0.4429,
|
1451 |
+
"step": 4120
|
1452 |
+
},
|
1453 |
+
{
|
1454 |
+
"epoch": 0.4593365139243315,
|
1455 |
+
"grad_norm": 2.03125,
|
1456 |
+
"learning_rate": 2.2872279220392054e-05,
|
1457 |
+
"loss": 0.4817,
|
1458 |
+
"step": 4140
|
1459 |
+
},
|
1460 |
+
{
|
1461 |
+
"epoch": 0.4615555308998114,
|
1462 |
+
"grad_norm": 1.8984375,
|
1463 |
+
"learning_rate": 2.2760712584416386e-05,
|
1464 |
+
"loss": 0.51,
|
1465 |
+
"step": 4160
|
1466 |
+
},
|
1467 |
+
{
|
1468 |
+
"epoch": 0.46377454787529127,
|
1469 |
+
"grad_norm": 1.2734375,
|
1470 |
+
"learning_rate": 2.2648556578396107e-05,
|
1471 |
+
"loss": 0.5001,
|
1472 |
+
"step": 4180
|
1473 |
+
},
|
1474 |
+
{
|
1475 |
+
"epoch": 0.4659935648507711,
|
1476 |
+
"grad_norm": 2.34375,
|
1477 |
+
"learning_rate": 2.2535819719769487e-05,
|
1478 |
+
"loss": 0.4739,
|
1479 |
+
"step": 4200
|
1480 |
+
},
|
1481 |
+
{
|
1482 |
+
"epoch": 0.468212581826251,
|
1483 |
+
"grad_norm": 1.484375,
|
1484 |
+
"learning_rate": 2.242251057008633e-05,
|
1485 |
+
"loss": 0.474,
|
1486 |
+
"step": 4220
|
1487 |
+
},
|
1488 |
+
{
|
1489 |
+
"epoch": 0.47043159880173085,
|
1490 |
+
"grad_norm": 1.7421875,
|
1491 |
+
"learning_rate": 2.2308637734357826e-05,
|
1492 |
+
"loss": 0.4622,
|
1493 |
+
"step": 4240
|
1494 |
+
},
|
1495 |
+
{
|
1496 |
+
"epoch": 0.4726506157772107,
|
1497 |
+
"grad_norm": 1.4296875,
|
1498 |
+
"learning_rate": 2.219420986040305e-05,
|
1499 |
+
"loss": 0.5075,
|
1500 |
+
"step": 4260
|
1501 |
+
},
|
1502 |
+
{
|
1503 |
+
"epoch": 0.47486963275269056,
|
1504 |
+
"grad_norm": 1.7734375,
|
1505 |
+
"learning_rate": 2.2079235638192203e-05,
|
1506 |
+
"loss": 0.4817,
|
1507 |
+
"step": 4280
|
1508 |
+
},
|
1509 |
+
{
|
1510 |
+
"epoch": 0.47708864972817044,
|
1511 |
+
"grad_norm": 1.3671875,
|
1512 |
+
"learning_rate": 2.1963723799186706e-05,
|
1513 |
+
"loss": 0.445,
|
1514 |
+
"step": 4300
|
1515 |
+
},
|
1516 |
+
{
|
1517 |
+
"epoch": 0.47930766670365027,
|
1518 |
+
"grad_norm": 1.6796875,
|
1519 |
+
"learning_rate": 2.184768311567608e-05,
|
1520 |
+
"loss": 0.475,
|
1521 |
+
"step": 4320
|
1522 |
+
},
|
1523 |
+
{
|
1524 |
+
"epoch": 0.48152668367913015,
|
1525 |
+
"grad_norm": 1.640625,
|
1526 |
+
"learning_rate": 2.1731122400111764e-05,
|
1527 |
+
"loss": 0.4418,
|
1528 |
+
"step": 4340
|
1529 |
+
},
|
1530 |
+
{
|
1531 |
+
"epoch": 0.48374570065461003,
|
1532 |
+
"grad_norm": 1.765625,
|
1533 |
+
"learning_rate": 2.161405050443789e-05,
|
1534 |
+
"loss": 0.4722,
|
1535 |
+
"step": 4360
|
1536 |
+
},
|
1537 |
+
{
|
1538 |
+
"epoch": 0.48596471763008986,
|
1539 |
+
"grad_norm": 1.75,
|
1540 |
+
"learning_rate": 2.1496476319419002e-05,
|
1541 |
+
"loss": 0.4814,
|
1542 |
+
"step": 4380
|
1543 |
+
},
|
1544 |
+
{
|
1545 |
+
"epoch": 0.48818373460556974,
|
1546 |
+
"grad_norm": 1.59375,
|
1547 |
+
"learning_rate": 2.137840877396491e-05,
|
1548 |
+
"loss": 0.5435,
|
1549 |
+
"step": 4400
|
1550 |
+
},
|
1551 |
+
{
|
1552 |
+
"epoch": 0.49040275158104957,
|
1553 |
+
"grad_norm": 1.734375,
|
1554 |
+
"learning_rate": 2.125985683445258e-05,
|
1555 |
+
"loss": 0.4521,
|
1556 |
+
"step": 4420
|
1557 |
+
},
|
1558 |
+
{
|
1559 |
+
"epoch": 0.49262176855652945,
|
1560 |
+
"grad_norm": 1.6640625,
|
1561 |
+
"learning_rate": 2.114082950404519e-05,
|
1562 |
+
"loss": 0.452,
|
1563 |
+
"step": 4440
|
1564 |
+
},
|
1565 |
+
{
|
1566 |
+
"epoch": 0.49484078553200933,
|
1567 |
+
"grad_norm": 1.2734375,
|
1568 |
+
"learning_rate": 2.1021335822008447e-05,
|
1569 |
+
"loss": 0.5176,
|
1570 |
+
"step": 4460
|
1571 |
+
},
|
1572 |
+
{
|
1573 |
+
"epoch": 0.49705980250748916,
|
1574 |
+
"grad_norm": 1.6328125,
|
1575 |
+
"learning_rate": 2.0901384863024078e-05,
|
1576 |
+
"loss": 0.4307,
|
1577 |
+
"step": 4480
|
1578 |
+
},
|
1579 |
+
{
|
1580 |
+
"epoch": 0.49927881948296904,
|
1581 |
+
"grad_norm": 1.6640625,
|
1582 |
+
"learning_rate": 2.0780985736500696e-05,
|
1583 |
+
"loss": 0.4856,
|
1584 |
+
"step": 4500
|
1585 |
+
},
|
1586 |
+
{
|
1587 |
+
"epoch": 0.5014978364584489,
|
1588 |
+
"grad_norm": 1.9609375,
|
1589 |
+
"learning_rate": 2.0660147585881994e-05,
|
1590 |
+
"loss": 0.4339,
|
1591 |
+
"step": 4520
|
1592 |
+
},
|
1593 |
+
{
|
1594 |
+
"epoch": 0.5037168534339288,
|
1595 |
+
"grad_norm": 2.046875,
|
1596 |
+
"learning_rate": 2.0538879587952382e-05,
|
1597 |
+
"loss": 0.4902,
|
1598 |
+
"step": 4540
|
1599 |
+
},
|
1600 |
+
{
|
1601 |
+
"epoch": 0.5059358704094087,
|
1602 |
+
"grad_norm": 1.8671875,
|
1603 |
+
"learning_rate": 2.0417190952140064e-05,
|
1604 |
+
"loss": 0.4343,
|
1605 |
+
"step": 4560
|
1606 |
+
},
|
1607 |
+
{
|
1608 |
+
"epoch": 0.5081548873848885,
|
1609 |
+
"grad_norm": 1.7265625,
|
1610 |
+
"learning_rate": 2.029509091981765e-05,
|
1611 |
+
"loss": 0.4416,
|
1612 |
+
"step": 4580
|
1613 |
+
},
|
1614 |
+
{
|
1615 |
+
"epoch": 0.5103739043603683,
|
1616 |
+
"grad_norm": 1.9375,
|
1617 |
+
"learning_rate": 2.0172588763600335e-05,
|
1618 |
+
"loss": 0.4802,
|
1619 |
+
"step": 4600
|
1620 |
+
},
|
1621 |
+
{
|
1622 |
+
"epoch": 0.5125929213358482,
|
1623 |
+
"grad_norm": 1.703125,
|
1624 |
+
"learning_rate": 2.0049693786641734e-05,
|
1625 |
+
"loss": 0.4794,
|
1626 |
+
"step": 4620
|
1627 |
+
},
|
1628 |
+
{
|
1629 |
+
"epoch": 0.5148119383113281,
|
1630 |
+
"grad_norm": 2.8125,
|
1631 |
+
"learning_rate": 1.9926415321927347e-05,
|
1632 |
+
"loss": 0.5092,
|
1633 |
+
"step": 4640
|
1634 |
+
},
|
1635 |
+
{
|
1636 |
+
"epoch": 0.517030955286808,
|
1637 |
+
"grad_norm": 1.3984375,
|
1638 |
+
"learning_rate": 1.980276273156581e-05,
|
1639 |
+
"loss": 0.4595,
|
1640 |
+
"step": 4660
|
1641 |
+
},
|
1642 |
+
{
|
1643 |
+
"epoch": 0.5192499722622878,
|
1644 |
+
"grad_norm": 1.484375,
|
1645 |
+
"learning_rate": 1.9678745406077886e-05,
|
1646 |
+
"loss": 0.452,
|
1647 |
+
"step": 4680
|
1648 |
+
},
|
1649 |
+
{
|
1650 |
+
"epoch": 0.5214689892377676,
|
1651 |
+
"grad_norm": 1.703125,
|
1652 |
+
"learning_rate": 1.9554372763683337e-05,
|
1653 |
+
"loss": 0.4528,
|
1654 |
+
"step": 4700
|
1655 |
+
},
|
1656 |
+
{
|
1657 |
+
"epoch": 0.5236880062132475,
|
1658 |
+
"grad_norm": 1.5,
|
1659 |
+
"learning_rate": 1.9429654249585684e-05,
|
1660 |
+
"loss": 0.4743,
|
1661 |
+
"step": 4720
|
1662 |
+
},
|
1663 |
+
{
|
1664 |
+
"epoch": 0.5259070231887274,
|
1665 |
+
"grad_norm": 1.5703125,
|
1666 |
+
"learning_rate": 1.9304599335254894e-05,
|
1667 |
+
"loss": 0.4476,
|
1668 |
+
"step": 4740
|
1669 |
+
},
|
1670 |
+
{
|
1671 |
+
"epoch": 0.5281260401642073,
|
1672 |
+
"grad_norm": 1.546875,
|
1673 |
+
"learning_rate": 1.9179217517708117e-05,
|
1674 |
+
"loss": 0.447,
|
1675 |
+
"step": 4760
|
1676 |
+
},
|
1677 |
+
{
|
1678 |
+
"epoch": 0.5303450571396872,
|
1679 |
+
"grad_norm": 1.625,
|
1680 |
+
"learning_rate": 1.9053518318788428e-05,
|
1681 |
+
"loss": 0.4606,
|
1682 |
+
"step": 4780
|
1683 |
+
},
|
1684 |
+
{
|
1685 |
+
"epoch": 0.5325640741151669,
|
1686 |
+
"grad_norm": 1.6875,
|
1687 |
+
"learning_rate": 1.8927511284441722e-05,
|
1688 |
+
"loss": 0.4561,
|
1689 |
+
"step": 4800
|
1690 |
+
},
|
1691 |
+
{
|
1692 |
+
"epoch": 0.5347830910906468,
|
1693 |
+
"grad_norm": 1.8359375,
|
1694 |
+
"learning_rate": 1.880120598399178e-05,
|
1695 |
+
"loss": 0.4522,
|
1696 |
+
"step": 4820
|
1697 |
+
},
|
1698 |
+
{
|
1699 |
+
"epoch": 0.5370021080661267,
|
1700 |
+
"grad_norm": 1.9921875,
|
1701 |
+
"learning_rate": 1.8674612009413536e-05,
|
1702 |
+
"loss": 0.4943,
|
1703 |
+
"step": 4840
|
1704 |
+
},
|
1705 |
+
{
|
1706 |
+
"epoch": 0.5392211250416066,
|
1707 |
+
"grad_norm": 1.703125,
|
1708 |
+
"learning_rate": 1.8547738974604623e-05,
|
1709 |
+
"loss": 0.5822,
|
1710 |
+
"step": 4860
|
1711 |
+
},
|
1712 |
+
{
|
1713 |
+
"epoch": 0.5414401420170865,
|
1714 |
+
"grad_norm": 1.7734375,
|
1715 |
+
"learning_rate": 1.842059651465531e-05,
|
1716 |
+
"loss": 0.4273,
|
1717 |
+
"step": 4880
|
1718 |
+
},
|
1719 |
+
{
|
1720 |
+
"epoch": 0.5436591589925663,
|
1721 |
+
"grad_norm": 1.6953125,
|
1722 |
+
"learning_rate": 1.829319428511673e-05,
|
1723 |
+
"loss": 0.4704,
|
1724 |
+
"step": 4900
|
1725 |
+
},
|
1726 |
+
{
|
1727 |
+
"epoch": 0.5458781759680461,
|
1728 |
+
"grad_norm": 1.671875,
|
1729 |
+
"learning_rate": 1.816554196126767e-05,
|
1730 |
+
"loss": 0.5452,
|
1731 |
+
"step": 4920
|
1732 |
+
},
|
1733 |
+
{
|
1734 |
+
"epoch": 0.548097192943526,
|
1735 |
+
"grad_norm": 1.8203125,
|
1736 |
+
"learning_rate": 1.803764923737974e-05,
|
1737 |
+
"loss": 0.436,
|
1738 |
+
"step": 4940
|
1739 |
+
},
|
1740 |
+
{
|
1741 |
+
"epoch": 0.5503162099190059,
|
1742 |
+
"grad_norm": 1.7578125,
|
1743 |
+
"learning_rate": 1.7909525825981214e-05,
|
1744 |
+
"loss": 0.4518,
|
1745 |
+
"step": 4960
|
1746 |
+
},
|
1747 |
+
{
|
1748 |
+
"epoch": 0.5525352268944858,
|
1749 |
+
"grad_norm": 2.03125,
|
1750 |
+
"learning_rate": 1.778118145711942e-05,
|
1751 |
+
"loss": 0.4138,
|
1752 |
+
"step": 4980
|
1753 |
+
},
|
1754 |
+
{
|
1755 |
+
"epoch": 0.5547542438699656,
|
1756 |
+
"grad_norm": 2.46875,
|
1757 |
+
"learning_rate": 1.7652625877621793e-05,
|
1758 |
+
"loss": 0.4332,
|
1759 |
+
"step": 5000
|
1760 |
+
},
|
1761 |
+
{
|
1762 |
+
"epoch": 0.5569732608454455,
|
1763 |
+
"grad_norm": 2.09375,
|
1764 |
+
"learning_rate": 1.7523868850355704e-05,
|
1765 |
+
"loss": 0.4842,
|
1766 |
+
"step": 5020
|
1767 |
+
},
|
1768 |
+
{
|
1769 |
+
"epoch": 0.5591922778209253,
|
1770 |
+
"grad_norm": 1.6328125,
|
1771 |
+
"learning_rate": 1.7394920153487022e-05,
|
1772 |
+
"loss": 0.4935,
|
1773 |
+
"step": 5040
|
1774 |
+
},
|
1775 |
+
{
|
1776 |
+
"epoch": 0.5614112947964052,
|
1777 |
+
"grad_norm": 1.6953125,
|
1778 |
+
"learning_rate": 1.7265789579737528e-05,
|
1779 |
+
"loss": 0.5129,
|
1780 |
+
"step": 5060
|
1781 |
+
},
|
1782 |
+
{
|
1783 |
+
"epoch": 0.563630311771885,
|
1784 |
+
"grad_norm": 1.65625,
|
1785 |
+
"learning_rate": 1.7136486935641256e-05,
|
1786 |
+
"loss": 0.4281,
|
1787 |
+
"step": 5080
|
1788 |
+
},
|
1789 |
+
{
|
1790 |
+
"epoch": 0.5658493287473649,
|
1791 |
+
"grad_norm": 2.015625,
|
1792 |
+
"learning_rate": 1.7007022040799726e-05,
|
1793 |
+
"loss": 0.4634,
|
1794 |
+
"step": 5100
|
1795 |
+
},
|
1796 |
+
{
|
1797 |
+
"epoch": 0.5680683457228448,
|
1798 |
+
"grad_norm": 2.15625,
|
1799 |
+
"learning_rate": 1.687740472713623e-05,
|
1800 |
+
"loss": 0.5225,
|
1801 |
+
"step": 5120
|
1802 |
+
},
|
1803 |
+
{
|
1804 |
+
"epoch": 0.5702873626983247,
|
1805 |
+
"grad_norm": 1.9921875,
|
1806 |
+
"learning_rate": 1.674764483814918e-05,
|
1807 |
+
"loss": 0.4838,
|
1808 |
+
"step": 5140
|
1809 |
+
},
|
1810 |
+
{
|
1811 |
+
"epoch": 0.5725063796738045,
|
1812 |
+
"grad_norm": 1.7421875,
|
1813 |
+
"learning_rate": 1.661775222816453e-05,
|
1814 |
+
"loss": 0.4291,
|
1815 |
+
"step": 5160
|
1816 |
+
},
|
1817 |
+
{
|
1818 |
+
"epoch": 0.5747253966492843,
|
1819 |
+
"grad_norm": 1.671875,
|
1820 |
+
"learning_rate": 1.648773676158747e-05,
|
1821 |
+
"loss": 0.3925,
|
1822 |
+
"step": 5180
|
1823 |
+
},
|
1824 |
+
{
|
1825 |
+
"epoch": 0.5769444136247642,
|
1826 |
+
"grad_norm": 1.734375,
|
1827 |
+
"learning_rate": 1.6357608312153223e-05,
|
1828 |
+
"loss": 0.4385,
|
1829 |
+
"step": 5200
|
1830 |
+
},
|
1831 |
+
{
|
1832 |
+
"epoch": 0.5791634306002441,
|
1833 |
+
"grad_norm": 1.71875,
|
1834 |
+
"learning_rate": 1.6227376762177272e-05,
|
1835 |
+
"loss": 0.4144,
|
1836 |
+
"step": 5220
|
1837 |
+
},
|
1838 |
+
{
|
1839 |
+
"epoch": 0.581382447575724,
|
1840 |
+
"grad_norm": 2.71875,
|
1841 |
+
"learning_rate": 1.6097052001804825e-05,
|
1842 |
+
"loss": 0.5116,
|
1843 |
+
"step": 5240
|
1844 |
+
},
|
1845 |
+
{
|
1846 |
+
"epoch": 0.5836014645512038,
|
1847 |
+
"grad_norm": 1.953125,
|
1848 |
+
"learning_rate": 1.5966643928259753e-05,
|
1849 |
+
"loss": 0.4869,
|
1850 |
+
"step": 5260
|
1851 |
+
},
|
1852 |
+
{
|
1853 |
+
"epoch": 0.5858204815266836,
|
1854 |
+
"grad_norm": 1.9140625,
|
1855 |
+
"learning_rate": 1.5836162445092963e-05,
|
1856 |
+
"loss": 0.4644,
|
1857 |
+
"step": 5280
|
1858 |
+
},
|
1859 |
+
{
|
1860 |
+
"epoch": 0.5880394985021635,
|
1861 |
+
"grad_norm": 1.8203125,
|
1862 |
+
"learning_rate": 1.5705617461430282e-05,
|
1863 |
+
"loss": 0.3844,
|
1864 |
+
"step": 5300
|
1865 |
+
},
|
1866 |
+
{
|
1867 |
+
"epoch": 0.5902585154776434,
|
1868 |
+
"grad_norm": 1.75,
|
1869 |
+
"learning_rate": 1.5575018891219944e-05,
|
1870 |
+
"loss": 0.4233,
|
1871 |
+
"step": 5320
|
1872 |
+
},
|
1873 |
+
{
|
1874 |
+
"epoch": 0.5924775324531233,
|
1875 |
+
"grad_norm": 1.140625,
|
1876 |
+
"learning_rate": 1.5444376652479706e-05,
|
1877 |
+
"loss": 0.5273,
|
1878 |
+
"step": 5340
|
1879 |
+
},
|
1880 |
+
{
|
1881 |
+
"epoch": 0.5946965494286032,
|
1882 |
+
"grad_norm": 1.921875,
|
1883 |
+
"learning_rate": 1.531370066654362e-05,
|
1884 |
+
"loss": 0.4783,
|
1885 |
+
"step": 5360
|
1886 |
+
},
|
1887 |
+
{
|
1888 |
+
"epoch": 0.5969155664040829,
|
1889 |
+
"grad_norm": 1.796875,
|
1890 |
+
"learning_rate": 1.5183000857308604e-05,
|
1891 |
+
"loss": 0.4747,
|
1892 |
+
"step": 5380
|
1893 |
+
},
|
1894 |
+
{
|
1895 |
+
"epoch": 0.5991345833795628,
|
1896 |
+
"grad_norm": 1.6484375,
|
1897 |
+
"learning_rate": 1.5052287150480774e-05,
|
1898 |
+
"loss": 0.4335,
|
1899 |
+
"step": 5400
|
1900 |
+
},
|
1901 |
+
{
|
1902 |
+
"epoch": 0.6013536003550427,
|
1903 |
+
"grad_norm": 1.75,
|
1904 |
+
"learning_rate": 1.4921569472821673e-05,
|
1905 |
+
"loss": 0.4489,
|
1906 |
+
"step": 5420
|
1907 |
+
},
|
1908 |
+
{
|
1909 |
+
"epoch": 0.6035726173305226,
|
1910 |
+
"grad_norm": 2.21875,
|
1911 |
+
"learning_rate": 1.4790857751394398e-05,
|
1912 |
+
"loss": 0.4495,
|
1913 |
+
"step": 5440
|
1914 |
+
},
|
1915 |
+
{
|
1916 |
+
"epoch": 0.6057916343060025,
|
1917 |
+
"grad_norm": 1.5703125,
|
1918 |
+
"learning_rate": 1.4660161912809718e-05,
|
1919 |
+
"loss": 0.4516,
|
1920 |
+
"step": 5460
|
1921 |
+
},
|
1922 |
+
{
|
1923 |
+
"epoch": 0.6080106512814824,
|
1924 |
+
"grad_norm": 1.4765625,
|
1925 |
+
"learning_rate": 1.4529491882472209e-05,
|
1926 |
+
"loss": 0.4418,
|
1927 |
+
"step": 5480
|
1928 |
+
},
|
1929 |
+
{
|
1930 |
+
"epoch": 0.6102296682569621,
|
1931 |
+
"grad_norm": 1.6015625,
|
1932 |
+
"learning_rate": 1.4398857583826501e-05,
|
1933 |
+
"loss": 0.4701,
|
1934 |
+
"step": 5500
|
1935 |
+
},
|
1936 |
+
{
|
1937 |
+
"epoch": 0.612448685232442,
|
1938 |
+
"grad_norm": 2.390625,
|
1939 |
+
"learning_rate": 1.4268268937603659e-05,
|
1940 |
+
"loss": 0.4957,
|
1941 |
+
"step": 5520
|
1942 |
+
},
|
1943 |
+
{
|
1944 |
+
"epoch": 0.6146677022079219,
|
1945 |
+
"grad_norm": 1.7421875,
|
1946 |
+
"learning_rate": 1.413773586106777e-05,
|
1947 |
+
"loss": 0.5176,
|
1948 |
+
"step": 5540
|
1949 |
+
},
|
1950 |
+
{
|
1951 |
+
"epoch": 0.6168867191834018,
|
1952 |
+
"grad_norm": 1.8125,
|
1953 |
+
"learning_rate": 1.400726826726282e-05,
|
1954 |
+
"loss": 0.4252,
|
1955 |
+
"step": 5560
|
1956 |
+
},
|
1957 |
+
{
|
1958 |
+
"epoch": 0.6191057361588816,
|
1959 |
+
"grad_norm": 1.4453125,
|
1960 |
+
"learning_rate": 1.3876876064259836e-05,
|
1961 |
+
"loss": 0.473,
|
1962 |
+
"step": 5580
|
1963 |
+
},
|
1964 |
+
{
|
1965 |
+
"epoch": 0.6213247531343615,
|
1966 |
+
"grad_norm": 1.6796875,
|
1967 |
+
"learning_rate": 1.3746569154404477e-05,
|
1968 |
+
"loss": 0.4589,
|
1969 |
+
"step": 5600
|
1970 |
+
},
|
1971 |
+
{
|
1972 |
+
"epoch": 0.6235437701098413,
|
1973 |
+
"grad_norm": 2.734375,
|
1974 |
+
"learning_rate": 1.3616357433564993e-05,
|
1975 |
+
"loss": 0.4083,
|
1976 |
+
"step": 5620
|
1977 |
+
},
|
1978 |
+
{
|
1979 |
+
"epoch": 0.6257627870853212,
|
1980 |
+
"grad_norm": 1.75,
|
1981 |
+
"learning_rate": 1.348625079038071e-05,
|
1982 |
+
"loss": 0.4638,
|
1983 |
+
"step": 5640
|
1984 |
+
},
|
1985 |
+
{
|
1986 |
+
"epoch": 0.6279818040608011,
|
1987 |
+
"grad_norm": 2.0625,
|
1988 |
+
"learning_rate": 1.335625910551108e-05,
|
1989 |
+
"loss": 0.4703,
|
1990 |
+
"step": 5660
|
1991 |
+
},
|
1992 |
+
{
|
1993 |
+
"epoch": 0.630200821036281,
|
1994 |
+
"grad_norm": 1.7109375,
|
1995 |
+
"learning_rate": 1.3226392250885288e-05,
|
1996 |
+
"loss": 0.4683,
|
1997 |
+
"step": 5680
|
1998 |
+
},
|
1999 |
+
{
|
2000 |
+
"epoch": 0.6324198380117608,
|
2001 |
+
"grad_norm": 1.2265625,
|
2002 |
+
"learning_rate": 1.3096660088952581e-05,
|
2003 |
+
"loss": 0.4641,
|
2004 |
+
"step": 5700
|
2005 |
+
},
|
2006 |
+
{
|
2007 |
+
"epoch": 0.6346388549872406,
|
2008 |
+
"grad_norm": 1.6953125,
|
2009 |
+
"learning_rate": 1.2967072471933255e-05,
|
2010 |
+
"loss": 0.4324,
|
2011 |
+
"step": 5720
|
2012 |
+
},
|
2013 |
+
{
|
2014 |
+
"epoch": 0.6368578719627205,
|
2015 |
+
"grad_norm": 1.6953125,
|
2016 |
+
"learning_rate": 1.283763924107046e-05,
|
2017 |
+
"loss": 0.5183,
|
2018 |
+
"step": 5740
|
2019 |
+
},
|
2020 |
+
{
|
2021 |
+
"epoch": 0.6390768889382004,
|
2022 |
+
"grad_norm": 1.4921875,
|
2023 |
+
"learning_rate": 1.2708370225882848e-05,
|
2024 |
+
"loss": 0.4178,
|
2025 |
+
"step": 5760
|
2026 |
+
},
|
2027 |
+
{
|
2028 |
+
"epoch": 0.6412959059136802,
|
2029 |
+
"grad_norm": 2.046875,
|
2030 |
+
"learning_rate": 1.2579275243418074e-05,
|
2031 |
+
"loss": 0.4503,
|
2032 |
+
"step": 5780
|
2033 |
+
},
|
2034 |
+
{
|
2035 |
+
"epoch": 0.6435149228891601,
|
2036 |
+
"grad_norm": 1.21875,
|
2037 |
+
"learning_rate": 1.245036409750725e-05,
|
2038 |
+
"loss": 0.4796,
|
2039 |
+
"step": 5800
|
2040 |
+
},
|
2041 |
+
{
|
2042 |
+
"epoch": 0.64573393986464,
|
2043 |
+
"grad_norm": 1.6015625,
|
2044 |
+
"learning_rate": 1.2321646578020452e-05,
|
2045 |
+
"loss": 0.4437,
|
2046 |
+
"step": 5820
|
2047 |
+
},
|
2048 |
+
{
|
2049 |
+
"epoch": 0.6479529568401198,
|
2050 |
+
"grad_norm": 2.09375,
|
2051 |
+
"learning_rate": 1.219313246012321e-05,
|
2052 |
+
"loss": 0.4504,
|
2053 |
+
"step": 5840
|
2054 |
+
},
|
2055 |
+
{
|
2056 |
+
"epoch": 0.6501719738155997,
|
2057 |
+
"grad_norm": 1.2265625,
|
2058 |
+
"learning_rate": 1.2064831503534185e-05,
|
2059 |
+
"loss": 0.5122,
|
2060 |
+
"step": 5860
|
2061 |
+
},
|
2062 |
+
{
|
2063 |
+
"epoch": 0.6523909907910795,
|
2064 |
+
"grad_norm": 1.7890625,
|
2065 |
+
"learning_rate": 1.1936753451783973e-05,
|
2066 |
+
"loss": 0.4294,
|
2067 |
+
"step": 5880
|
2068 |
+
},
|
2069 |
+
{
|
2070 |
+
"epoch": 0.6546100077665594,
|
2071 |
+
"grad_norm": 2.296875,
|
2072 |
+
"learning_rate": 1.1808908031475151e-05,
|
2073 |
+
"loss": 0.4895,
|
2074 |
+
"step": 5900
|
2075 |
+
},
|
2076 |
+
{
|
2077 |
+
"epoch": 0.6568290247420393,
|
2078 |
+
"grad_norm": 1.140625,
|
2079 |
+
"learning_rate": 1.1681304951543635e-05,
|
2080 |
+
"loss": 0.4824,
|
2081 |
+
"step": 5920
|
2082 |
+
},
|
2083 |
+
{
|
2084 |
+
"epoch": 0.6590480417175192,
|
2085 |
+
"grad_norm": 1.875,
|
2086 |
+
"learning_rate": 1.1553953902521321e-05,
|
2087 |
+
"loss": 0.525,
|
2088 |
+
"step": 5940
|
2089 |
+
},
|
2090 |
+
{
|
2091 |
+
"epoch": 0.661267058692999,
|
2092 |
+
"grad_norm": 1.8359375,
|
2093 |
+
"learning_rate": 1.1426864555800195e-05,
|
2094 |
+
"loss": 0.4289,
|
2095 |
+
"step": 5960
|
2096 |
+
},
|
2097 |
+
{
|
2098 |
+
"epoch": 0.6634860756684788,
|
2099 |
+
"grad_norm": 1.9375,
|
2100 |
+
"learning_rate": 1.1300046562897837e-05,
|
2101 |
+
"loss": 0.4695,
|
2102 |
+
"step": 5980
|
2103 |
+
},
|
2104 |
+
{
|
2105 |
+
"epoch": 0.6657050926439587,
|
2106 |
+
"grad_norm": 1.7109375,
|
2107 |
+
"learning_rate": 1.1173509554724461e-05,
|
2108 |
+
"loss": 0.465,
|
2109 |
+
"step": 6000
|
2110 |
+
},
|
2111 |
+
{
|
2112 |
+
"epoch": 0.6679241096194386,
|
2113 |
+
"grad_norm": 1.5625,
|
2114 |
+
"learning_rate": 1.104726314085153e-05,
|
2115 |
+
"loss": 0.4641,
|
2116 |
+
"step": 6020
|
2117 |
+
},
|
2118 |
+
{
|
2119 |
+
"epoch": 0.6701431265949185,
|
2120 |
+
"grad_norm": 1.84375,
|
2121 |
+
"learning_rate": 1.0921316908781965e-05,
|
2122 |
+
"loss": 0.4559,
|
2123 |
+
"step": 6040
|
2124 |
+
},
|
2125 |
+
{
|
2126 |
+
"epoch": 0.6723621435703984,
|
2127 |
+
"grad_norm": 1.4375,
|
2128 |
+
"learning_rate": 1.079568042322205e-05,
|
2129 |
+
"loss": 0.4938,
|
2130 |
+
"step": 6060
|
2131 |
+
},
|
2132 |
+
{
|
2133 |
+
"epoch": 0.6745811605458781,
|
2134 |
+
"grad_norm": 1.2734375,
|
2135 |
+
"learning_rate": 1.0670363225355054e-05,
|
2136 |
+
"loss": 0.4247,
|
2137 |
+
"step": 6080
|
2138 |
+
},
|
2139 |
+
{
|
2140 |
+
"epoch": 0.676800177521358,
|
2141 |
+
"grad_norm": 1.5390625,
|
2142 |
+
"learning_rate": 1.0545374832116658e-05,
|
2143 |
+
"loss": 0.4739,
|
2144 |
+
"step": 6100
|
2145 |
+
},
|
2146 |
+
{
|
2147 |
+
"epoch": 0.6790191944968379,
|
2148 |
+
"grad_norm": 1.640625,
|
2149 |
+
"learning_rate": 1.042072473547221e-05,
|
2150 |
+
"loss": 0.4923,
|
2151 |
+
"step": 6120
|
2152 |
+
},
|
2153 |
+
{
|
2154 |
+
"epoch": 0.6812382114723178,
|
2155 |
+
"grad_norm": 1.5,
|
2156 |
+
"learning_rate": 1.0296422401695867e-05,
|
2157 |
+
"loss": 0.5248,
|
2158 |
+
"step": 6140
|
2159 |
+
},
|
2160 |
+
{
|
2161 |
+
"epoch": 0.6834572284477977,
|
2162 |
+
"grad_norm": 1.5390625,
|
2163 |
+
"learning_rate": 1.017247727065172e-05,
|
2164 |
+
"loss": 0.4336,
|
2165 |
+
"step": 6160
|
2166 |
+
},
|
2167 |
+
{
|
2168 |
+
"epoch": 0.6856762454232775,
|
2169 |
+
"grad_norm": 1.7265625,
|
2170 |
+
"learning_rate": 1.0048898755076885e-05,
|
2171 |
+
"loss": 0.4915,
|
2172 |
+
"step": 6180
|
2173 |
+
},
|
2174 |
+
{
|
2175 |
+
"epoch": 0.6878952623987573,
|
2176 |
+
"grad_norm": 1.515625,
|
2177 |
+
"learning_rate": 9.925696239866679e-06,
|
2178 |
+
"loss": 0.4908,
|
2179 |
+
"step": 6200
|
2180 |
+
},
|
2181 |
+
{
|
2182 |
+
"epoch": 0.6901142793742372,
|
2183 |
+
"grad_norm": 1.4375,
|
2184 |
+
"learning_rate": 9.802879081361927e-06,
|
2185 |
+
"loss": 0.4512,
|
2186 |
+
"step": 6220
|
2187 |
+
},
|
2188 |
+
{
|
2189 |
+
"epoch": 0.6923332963497171,
|
2190 |
+
"grad_norm": 2.21875,
|
2191 |
+
"learning_rate": 9.680456606638376e-06,
|
2192 |
+
"loss": 0.4356,
|
2193 |
+
"step": 6240
|
2194 |
+
},
|
2195 |
+
{
|
2196 |
+
"epoch": 0.694552313325197,
|
2197 |
+
"grad_norm": 1.796875,
|
2198 |
+
"learning_rate": 9.558438112798397e-06,
|
2199 |
+
"loss": 0.4321,
|
2200 |
+
"step": 6260
|
2201 |
+
},
|
2202 |
+
{
|
2203 |
+
"epoch": 0.6967713303006768,
|
2204 |
+
"grad_norm": 1.421875,
|
2205 |
+
"learning_rate": 9.436832866264942e-06,
|
2206 |
+
"loss": 0.4288,
|
2207 |
+
"step": 6280
|
2208 |
+
},
|
2209 |
+
{
|
2210 |
+
"epoch": 0.6989903472761566,
|
2211 |
+
"grad_norm": 2.140625,
|
2212 |
+
"learning_rate": 9.3156501020778e-06,
|
2213 |
+
"loss": 0.4119,
|
2214 |
+
"step": 6300
|
2215 |
+
},
|
2216 |
+
{
|
2217 |
+
"epoch": 0.7012093642516365,
|
2218 |
+
"grad_norm": 1.7421875,
|
2219 |
+
"learning_rate": 9.194899023192295e-06,
|
2220 |
+
"loss": 0.4729,
|
2221 |
+
"step": 6320
|
2222 |
+
},
|
2223 |
+
{
|
2224 |
+
"epoch": 0.7034283812271164,
|
2225 |
+
"grad_norm": 2.03125,
|
2226 |
+
"learning_rate": 9.074588799780359e-06,
|
2227 |
+
"loss": 0.4438,
|
2228 |
+
"step": 6340
|
2229 |
+
},
|
2230 |
+
{
|
2231 |
+
"epoch": 0.7056473982025963,
|
2232 |
+
"grad_norm": 1.703125,
|
2233 |
+
"learning_rate": 8.95472856853414e-06,
|
2234 |
+
"loss": 0.4509,
|
2235 |
+
"step": 6360
|
2236 |
+
},
|
2237 |
+
{
|
2238 |
+
"epoch": 0.7078664151780761,
|
2239 |
+
"grad_norm": 1.453125,
|
2240 |
+
"learning_rate": 8.835327431972136e-06,
|
2241 |
+
"loss": 0.4812,
|
2242 |
+
"step": 6380
|
2243 |
+
},
|
2244 |
+
{
|
2245 |
+
"epoch": 0.710085432153556,
|
2246 |
+
"grad_norm": 1.4375,
|
2247 |
+
"learning_rate": 8.716394457747915e-06,
|
2248 |
+
"loss": 0.4796,
|
2249 |
+
"step": 6400
|
2250 |
+
},
|
2251 |
+
{
|
2252 |
+
"epoch": 0.7123044491290358,
|
2253 |
+
"grad_norm": 0.9375,
|
2254 |
+
"learning_rate": 8.597938677961505e-06,
|
2255 |
+
"loss": 0.4138,
|
2256 |
+
"step": 6420
|
2257 |
+
},
|
2258 |
+
{
|
2259 |
+
"epoch": 0.7145234661045157,
|
2260 |
+
"grad_norm": 1.71875,
|
2261 |
+
"learning_rate": 8.479969088473462e-06,
|
2262 |
+
"loss": 0.4161,
|
2263 |
+
"step": 6440
|
2264 |
+
},
|
2265 |
+
{
|
2266 |
+
"epoch": 0.7167424830799956,
|
2267 |
+
"grad_norm": 2.203125,
|
2268 |
+
"learning_rate": 8.362494648221697e-06,
|
2269 |
+
"loss": 0.4685,
|
2270 |
+
"step": 6460
|
2271 |
+
},
|
2272 |
+
{
|
2273 |
+
"epoch": 0.7189615000554754,
|
2274 |
+
"grad_norm": 1.6875,
|
2275 |
+
"learning_rate": 8.245524278541116e-06,
|
2276 |
+
"loss": 0.4476,
|
2277 |
+
"step": 6480
|
2278 |
+
},
|
2279 |
+
{
|
2280 |
+
"epoch": 0.7211805170309553,
|
2281 |
+
"grad_norm": 1.671875,
|
2282 |
+
"learning_rate": 8.129066862486115e-06,
|
2283 |
+
"loss": 0.5104,
|
2284 |
+
"step": 6500
|
2285 |
+
},
|
2286 |
+
{
|
2287 |
+
"epoch": 0.7233995340064352,
|
2288 |
+
"grad_norm": 1.5625,
|
2289 |
+
"learning_rate": 8.013131244155964e-06,
|
2290 |
+
"loss": 0.4467,
|
2291 |
+
"step": 6520
|
2292 |
+
},
|
2293 |
+
{
|
2294 |
+
"epoch": 0.725618550981915,
|
2295 |
+
"grad_norm": 2.234375,
|
2296 |
+
"learning_rate": 7.89772622802316e-06,
|
2297 |
+
"loss": 0.4317,
|
2298 |
+
"step": 6540
|
2299 |
+
},
|
2300 |
+
{
|
2301 |
+
"epoch": 0.7278375679573948,
|
2302 |
+
"grad_norm": 2.109375,
|
2303 |
+
"learning_rate": 7.782860578264806e-06,
|
2304 |
+
"loss": 0.4398,
|
2305 |
+
"step": 6560
|
2306 |
+
},
|
2307 |
+
{
|
2308 |
+
"epoch": 0.7300565849328747,
|
2309 |
+
"grad_norm": 1.6875,
|
2310 |
+
"learning_rate": 7.668543018097014e-06,
|
2311 |
+
"loss": 0.5054,
|
2312 |
+
"step": 6580
|
2313 |
+
},
|
2314 |
+
{
|
2315 |
+
"epoch": 0.7322756019083546,
|
2316 |
+
"grad_norm": 1.4453125,
|
2317 |
+
"learning_rate": 7.5547822291124715e-06,
|
2318 |
+
"loss": 0.4968,
|
2319 |
+
"step": 6600
|
2320 |
+
},
|
2321 |
+
{
|
2322 |
+
"epoch": 0.7344946188838345,
|
2323 |
+
"grad_norm": 1.5,
|
2324 |
+
"learning_rate": 7.441586850621102e-06,
|
2325 |
+
"loss": 0.4202,
|
2326 |
+
"step": 6620
|
2327 |
+
},
|
2328 |
+
{
|
2329 |
+
"epoch": 0.7367136358593144,
|
2330 |
+
"grad_norm": 1.765625,
|
2331 |
+
"learning_rate": 7.328965478993994e-06,
|
2332 |
+
"loss": 0.4447,
|
2333 |
+
"step": 6640
|
2334 |
+
},
|
2335 |
+
{
|
2336 |
+
"epoch": 0.7389326528347941,
|
2337 |
+
"grad_norm": 1.90625,
|
2338 |
+
"learning_rate": 7.2169266670105555e-06,
|
2339 |
+
"loss": 0.4869,
|
2340 |
+
"step": 6660
|
2341 |
+
},
|
2342 |
+
{
|
2343 |
+
"epoch": 0.741151669810274,
|
2344 |
+
"grad_norm": 1.3203125,
|
2345 |
+
"learning_rate": 7.105478923209001e-06,
|
2346 |
+
"loss": 0.4744,
|
2347 |
+
"step": 6680
|
2348 |
+
},
|
2349 |
+
{
|
2350 |
+
"epoch": 0.7433706867857539,
|
2351 |
+
"grad_norm": 0.76171875,
|
2352 |
+
"learning_rate": 6.994630711240201e-06,
|
2353 |
+
"loss": 0.4054,
|
2354 |
+
"step": 6700
|
2355 |
+
},
|
2356 |
+
{
|
2357 |
+
"epoch": 0.7455897037612338,
|
2358 |
+
"grad_norm": 1.9765625,
|
2359 |
+
"learning_rate": 6.884390449224898e-06,
|
2360 |
+
"loss": 0.4307,
|
2361 |
+
"step": 6720
|
2362 |
+
},
|
2363 |
+
{
|
2364 |
+
"epoch": 0.7478087207367137,
|
2365 |
+
"grad_norm": 1.921875,
|
2366 |
+
"learning_rate": 6.774766509114435e-06,
|
2367 |
+
"loss": 0.4728,
|
2368 |
+
"step": 6740
|
2369 |
+
},
|
2370 |
+
{
|
2371 |
+
"epoch": 0.7500277377121934,
|
2372 |
+
"grad_norm": 1.53125,
|
2373 |
+
"learning_rate": 6.66576721605496e-06,
|
2374 |
+
"loss": 0.4254,
|
2375 |
+
"step": 6760
|
2376 |
+
},
|
2377 |
+
{
|
2378 |
+
"epoch": 0.7522467546876733,
|
2379 |
+
"grad_norm": 1.78125,
|
2380 |
+
"learning_rate": 6.557400847755183e-06,
|
2381 |
+
"loss": 0.4508,
|
2382 |
+
"step": 6780
|
2383 |
+
},
|
2384 |
+
{
|
2385 |
+
"epoch": 0.7544657716631532,
|
2386 |
+
"grad_norm": 1.828125,
|
2387 |
+
"learning_rate": 6.449675633857772e-06,
|
2388 |
+
"loss": 0.4814,
|
2389 |
+
"step": 6800
|
2390 |
+
},
|
2391 |
+
{
|
2392 |
+
"epoch": 0.7566847886386331,
|
2393 |
+
"grad_norm": 1.578125,
|
2394 |
+
"learning_rate": 6.3425997553143315e-06,
|
2395 |
+
"loss": 0.459,
|
2396 |
+
"step": 6820
|
2397 |
+
},
|
2398 |
+
{
|
2399 |
+
"epoch": 0.758903805614113,
|
2400 |
+
"grad_norm": 1.7421875,
|
2401 |
+
"learning_rate": 6.236181343764144e-06,
|
2402 |
+
"loss": 0.464,
|
2403 |
+
"step": 6840
|
2404 |
+
},
|
2405 |
+
{
|
2406 |
+
"epoch": 0.7611228225895929,
|
2407 |
+
"grad_norm": 2.21875,
|
2408 |
+
"learning_rate": 6.130428480916626e-06,
|
2409 |
+
"loss": 0.4897,
|
2410 |
+
"step": 6860
|
2411 |
+
},
|
2412 |
+
{
|
2413 |
+
"epoch": 0.7633418395650726,
|
2414 |
+
"grad_norm": 1.5625,
|
2415 |
+
"learning_rate": 6.025349197937577e-06,
|
2416 |
+
"loss": 0.4614,
|
2417 |
+
"step": 6880
|
2418 |
+
},
|
2419 |
+
{
|
2420 |
+
"epoch": 0.7655608565405525,
|
2421 |
+
"grad_norm": 1.71875,
|
2422 |
+
"learning_rate": 5.920951474839266e-06,
|
2423 |
+
"loss": 0.444,
|
2424 |
+
"step": 6900
|
2425 |
+
},
|
2426 |
+
{
|
2427 |
+
"epoch": 0.7677798735160324,
|
2428 |
+
"grad_norm": 1.1640625,
|
2429 |
+
"learning_rate": 5.817243239874434e-06,
|
2430 |
+
"loss": 0.4649,
|
2431 |
+
"step": 6920
|
2432 |
+
},
|
2433 |
+
{
|
2434 |
+
"epoch": 0.7699988904915123,
|
2435 |
+
"grad_norm": 1.8046875,
|
2436 |
+
"learning_rate": 5.714232368934163e-06,
|
2437 |
+
"loss": 0.4758,
|
2438 |
+
"step": 6940
|
2439 |
+
},
|
2440 |
+
{
|
2441 |
+
"epoch": 0.7722179074669921,
|
2442 |
+
"grad_norm": 2.15625,
|
2443 |
+
"learning_rate": 5.611926684949779e-06,
|
2444 |
+
"loss": 0.4519,
|
2445 |
+
"step": 6960
|
2446 |
+
},
|
2447 |
+
{
|
2448 |
+
"epoch": 0.774436924442472,
|
2449 |
+
"grad_norm": 1.5234375,
|
2450 |
+
"learning_rate": 5.510333957298756e-06,
|
2451 |
+
"loss": 0.4729,
|
2452 |
+
"step": 6980
|
2453 |
+
},
|
2454 |
+
{
|
2455 |
+
"epoch": 0.7766559414179518,
|
2456 |
+
"grad_norm": 1.28125,
|
2457 |
+
"learning_rate": 5.409461901214679e-06,
|
2458 |
+
"loss": 0.4557,
|
2459 |
+
"step": 7000
|
2460 |
+
},
|
2461 |
+
{
|
2462 |
+
"epoch": 0.7788749583934317,
|
2463 |
+
"grad_norm": 1.2265625,
|
2464 |
+
"learning_rate": 5.3093181772013545e-06,
|
2465 |
+
"loss": 0.4433,
|
2466 |
+
"step": 7020
|
2467 |
+
},
|
2468 |
+
{
|
2469 |
+
"epoch": 0.7810939753689116,
|
2470 |
+
"grad_norm": 1.4375,
|
2471 |
+
"learning_rate": 5.209910390451007e-06,
|
2472 |
+
"loss": 0.4767,
|
2473 |
+
"step": 7040
|
2474 |
+
},
|
2475 |
+
{
|
2476 |
+
"epoch": 0.7833129923443914,
|
2477 |
+
"grad_norm": 2.140625,
|
2478 |
+
"learning_rate": 5.111246090266763e-06,
|
2479 |
+
"loss": 0.4422,
|
2480 |
+
"step": 7060
|
2481 |
+
},
|
2482 |
+
{
|
2483 |
+
"epoch": 0.7855320093198713,
|
2484 |
+
"grad_norm": 1.7265625,
|
2485 |
+
"learning_rate": 5.0133327694893035e-06,
|
2486 |
+
"loss": 0.4276,
|
2487 |
+
"step": 7080
|
2488 |
+
},
|
2489 |
+
{
|
2490 |
+
"epoch": 0.7877510262953512,
|
2491 |
+
"grad_norm": 1.5859375,
|
2492 |
+
"learning_rate": 4.916177863927856e-06,
|
2493 |
+
"loss": 0.482,
|
2494 |
+
"step": 7100
|
2495 |
+
},
|
2496 |
+
{
|
2497 |
+
"epoch": 0.789970043270831,
|
2498 |
+
"grad_norm": 1.71875,
|
2499 |
+
"learning_rate": 4.819788751795485e-06,
|
2500 |
+
"loss": 0.4817,
|
2501 |
+
"step": 7120
|
2502 |
+
},
|
2503 |
+
{
|
2504 |
+
"epoch": 0.7921890602463109,
|
2505 |
+
"grad_norm": 1.6484375,
|
2506 |
+
"learning_rate": 4.7241727531487925e-06,
|
2507 |
+
"loss": 0.4702,
|
2508 |
+
"step": 7140
|
2509 |
+
},
|
2510 |
+
{
|
2511 |
+
"epoch": 0.7944080772217907,
|
2512 |
+
"grad_norm": 1.9296875,
|
2513 |
+
"learning_rate": 4.629337129331983e-06,
|
2514 |
+
"loss": 0.4494,
|
2515 |
+
"step": 7160
|
2516 |
+
},
|
2517 |
+
{
|
2518 |
+
"epoch": 0.7966270941972706,
|
2519 |
+
"grad_norm": 1.9453125,
|
2520 |
+
"learning_rate": 4.535289082425438e-06,
|
2521 |
+
"loss": 0.4411,
|
2522 |
+
"step": 7180
|
2523 |
+
},
|
2524 |
+
{
|
2525 |
+
"epoch": 0.7988461111727505,
|
2526 |
+
"grad_norm": 2.015625,
|
2527 |
+
"learning_rate": 4.442035754698759e-06,
|
2528 |
+
"loss": 0.4671,
|
2529 |
+
"step": 7200
|
2530 |
+
},
|
2531 |
+
{
|
2532 |
+
"epoch": 0.8010651281482304,
|
2533 |
+
"grad_norm": 2.359375,
|
2534 |
+
"learning_rate": 4.349584228068369e-06,
|
2535 |
+
"loss": 0.4077,
|
2536 |
+
"step": 7220
|
2537 |
+
},
|
2538 |
+
{
|
2539 |
+
"epoch": 0.8032841451237102,
|
2540 |
+
"grad_norm": 1.3984375,
|
2541 |
+
"learning_rate": 4.257941523559703e-06,
|
2542 |
+
"loss": 0.5378,
|
2543 |
+
"step": 7240
|
2544 |
+
},
|
2545 |
+
{
|
2546 |
+
"epoch": 0.80550316209919,
|
2547 |
+
"grad_norm": 1.84375,
|
2548 |
+
"learning_rate": 4.167114600773983e-06,
|
2549 |
+
"loss": 0.4719,
|
2550 |
+
"step": 7260
|
2551 |
+
},
|
2552 |
+
{
|
2553 |
+
"epoch": 0.8077221790746699,
|
2554 |
+
"grad_norm": 1.140625,
|
2555 |
+
"learning_rate": 4.0771103573597125e-06,
|
2556 |
+
"loss": 0.4596,
|
2557 |
+
"step": 7280
|
2558 |
+
},
|
2559 |
+
{
|
2560 |
+
"epoch": 0.8099411960501498,
|
2561 |
+
"grad_norm": 1.5703125,
|
2562 |
+
"learning_rate": 3.987935628488841e-06,
|
2563 |
+
"loss": 0.4812,
|
2564 |
+
"step": 7300
|
2565 |
+
},
|
2566 |
+
{
|
2567 |
+
"epoch": 0.8121602130256297,
|
2568 |
+
"grad_norm": 1.65625,
|
2569 |
+
"learning_rate": 3.899597186337676e-06,
|
2570 |
+
"loss": 0.4636,
|
2571 |
+
"step": 7320
|
2572 |
+
},
|
2573 |
+
{
|
2574 |
+
"epoch": 0.8143792300011095,
|
2575 |
+
"grad_norm": 1.609375,
|
2576 |
+
"learning_rate": 3.812101739572605e-06,
|
2577 |
+
"loss": 0.4605,
|
2578 |
+
"step": 7340
|
2579 |
+
},
|
2580 |
+
{
|
2581 |
+
"epoch": 0.8165982469765893,
|
2582 |
+
"grad_norm": 2.09375,
|
2583 |
+
"learning_rate": 3.725455932840593e-06,
|
2584 |
+
"loss": 0.4368,
|
2585 |
+
"step": 7360
|
2586 |
+
},
|
2587 |
+
{
|
2588 |
+
"epoch": 0.8188172639520692,
|
2589 |
+
"grad_norm": 1.8125,
|
2590 |
+
"learning_rate": 3.6396663462645917e-06,
|
2591 |
+
"loss": 0.4686,
|
2592 |
+
"step": 7380
|
2593 |
+
},
|
2594 |
+
{
|
2595 |
+
"epoch": 0.8210362809275491,
|
2596 |
+
"grad_norm": 1.875,
|
2597 |
+
"learning_rate": 3.554739494943813e-06,
|
2598 |
+
"loss": 0.4701,
|
2599 |
+
"step": 7400
|
2600 |
+
},
|
2601 |
+
{
|
2602 |
+
"epoch": 0.823255297903029,
|
2603 |
+
"grad_norm": 1.8984375,
|
2604 |
+
"learning_rate": 3.470681828458962e-06,
|
2605 |
+
"loss": 0.4595,
|
2606 |
+
"step": 7420
|
2607 |
+
},
|
2608 |
+
{
|
2609 |
+
"epoch": 0.8254743148785089,
|
2610 |
+
"grad_norm": 1.328125,
|
2611 |
+
"learning_rate": 3.3874997303824416e-06,
|
2612 |
+
"loss": 0.4265,
|
2613 |
+
"step": 7440
|
2614 |
+
},
|
2615 |
+
{
|
2616 |
+
"epoch": 0.8276933318539886,
|
2617 |
+
"grad_norm": 1.5,
|
2618 |
+
"learning_rate": 3.305199517793557e-06,
|
2619 |
+
"loss": 0.4927,
|
2620 |
+
"step": 7460
|
2621 |
+
},
|
2622 |
+
{
|
2623 |
+
"epoch": 0.8299123488294685,
|
2624 |
+
"grad_norm": 1.7109375,
|
2625 |
+
"learning_rate": 3.2237874407987776e-06,
|
2626 |
+
"loss": 0.4211,
|
2627 |
+
"step": 7480
|
2628 |
+
},
|
2629 |
+
{
|
2630 |
+
"epoch": 0.8321313658049484,
|
2631 |
+
"grad_norm": 2.28125,
|
2632 |
+
"learning_rate": 3.1432696820570993e-06,
|
2633 |
+
"loss": 0.4771,
|
2634 |
+
"step": 7500
|
2635 |
+
},
|
2636 |
+
{
|
2637 |
+
"epoch": 0.8343503827804283,
|
2638 |
+
"grad_norm": 1.7109375,
|
2639 |
+
"learning_rate": 3.0636523563104985e-06,
|
2640 |
+
"loss": 0.4934,
|
2641 |
+
"step": 7520
|
2642 |
+
},
|
2643 |
+
{
|
2644 |
+
"epoch": 0.8365693997559082,
|
2645 |
+
"grad_norm": 1.6328125,
|
2646 |
+
"learning_rate": 2.9849415099195886e-06,
|
2647 |
+
"loss": 0.5184,
|
2648 |
+
"step": 7540
|
2649 |
+
},
|
2650 |
+
{
|
2651 |
+
"epoch": 0.838788416731388,
|
2652 |
+
"grad_norm": 1.234375,
|
2653 |
+
"learning_rate": 2.9071431204044123e-06,
|
2654 |
+
"loss": 0.4622,
|
2655 |
+
"step": 7560
|
2656 |
+
},
|
2657 |
+
{
|
2658 |
+
"epoch": 0.8410074337068678,
|
2659 |
+
"grad_norm": 1.6171875,
|
2660 |
+
"learning_rate": 2.8302630959905084e-06,
|
2661 |
+
"loss": 0.4491,
|
2662 |
+
"step": 7580
|
2663 |
+
},
|
2664 |
+
{
|
2665 |
+
"epoch": 0.8432264506823477,
|
2666 |
+
"grad_norm": 2.46875,
|
2667 |
+
"learning_rate": 2.7543072751602246e-06,
|
2668 |
+
"loss": 0.4093,
|
2669 |
+
"step": 7600
|
2670 |
+
},
|
2671 |
+
{
|
2672 |
+
"epoch": 0.8454454676578276,
|
2673 |
+
"grad_norm": 1.671875,
|
2674 |
+
"learning_rate": 2.6792814262093214e-06,
|
2675 |
+
"loss": 0.4312,
|
2676 |
+
"step": 7620
|
2677 |
+
},
|
2678 |
+
{
|
2679 |
+
"epoch": 0.8476644846333075,
|
2680 |
+
"grad_norm": 1.71875,
|
2681 |
+
"learning_rate": 2.605191246808912e-06,
|
2682 |
+
"loss": 0.455,
|
2683 |
+
"step": 7640
|
2684 |
+
},
|
2685 |
+
{
|
2686 |
+
"epoch": 0.8498835016087873,
|
2687 |
+
"grad_norm": 2.109375,
|
2688 |
+
"learning_rate": 2.5320423635727824e-06,
|
2689 |
+
"loss": 0.4839,
|
2690 |
+
"step": 7660
|
2691 |
+
},
|
2692 |
+
{
|
2693 |
+
"epoch": 0.8521025185842672,
|
2694 |
+
"grad_norm": 2.15625,
|
2695 |
+
"learning_rate": 2.45984033163006e-06,
|
2696 |
+
"loss": 0.5647,
|
2697 |
+
"step": 7680
|
2698 |
+
},
|
2699 |
+
{
|
2700 |
+
"epoch": 0.854321535559747,
|
2701 |
+
"grad_norm": 1.6484375,
|
2702 |
+
"learning_rate": 2.388590634203366e-06,
|
2703 |
+
"loss": 0.4108,
|
2704 |
+
"step": 7700
|
2705 |
+
},
|
2706 |
+
{
|
2707 |
+
"epoch": 0.8565405525352269,
|
2708 |
+
"grad_norm": 1.90625,
|
2709 |
+
"learning_rate": 2.3182986821923934e-06,
|
2710 |
+
"loss": 0.3933,
|
2711 |
+
"step": 7720
|
2712 |
+
},
|
2713 |
+
{
|
2714 |
+
"epoch": 0.8587595695107068,
|
2715 |
+
"grad_norm": 2.015625,
|
2716 |
+
"learning_rate": 2.2489698137629904e-06,
|
2717 |
+
"loss": 0.413,
|
2718 |
+
"step": 7740
|
2719 |
+
},
|
2720 |
+
{
|
2721 |
+
"epoch": 0.8609785864861866,
|
2722 |
+
"grad_norm": 2.140625,
|
2723 |
+
"learning_rate": 2.1806092939417732e-06,
|
2724 |
+
"loss": 0.516,
|
2725 |
+
"step": 7760
|
2726 |
+
},
|
2727 |
+
{
|
2728 |
+
"epoch": 0.8631976034616665,
|
2729 |
+
"grad_norm": 1.40625,
|
2730 |
+
"learning_rate": 2.1132223142162714e-06,
|
2731 |
+
"loss": 0.4403,
|
2732 |
+
"step": 7780
|
2733 |
+
},
|
2734 |
+
{
|
2735 |
+
"epoch": 0.8654166204371463,
|
2736 |
+
"grad_norm": 1.859375,
|
2737 |
+
"learning_rate": 2.046813992140679e-06,
|
2738 |
+
"loss": 0.4355,
|
2739 |
+
"step": 7800
|
2740 |
+
},
|
2741 |
+
{
|
2742 |
+
"epoch": 0.8676356374126262,
|
2743 |
+
"grad_norm": 1.4375,
|
2744 |
+
"learning_rate": 1.981389370947218e-06,
|
2745 |
+
"loss": 0.4744,
|
2746 |
+
"step": 7820
|
2747 |
+
},
|
2748 |
+
{
|
2749 |
+
"epoch": 0.869854654388106,
|
2750 |
+
"grad_norm": 2.359375,
|
2751 |
+
"learning_rate": 1.9169534191631243e-06,
|
2752 |
+
"loss": 0.4106,
|
2753 |
+
"step": 7840
|
2754 |
+
},
|
2755 |
+
{
|
2756 |
+
"epoch": 0.8720736713635859,
|
2757 |
+
"grad_norm": 2.046875,
|
2758 |
+
"learning_rate": 1.853511030233354e-06,
|
2759 |
+
"loss": 0.4519,
|
2760 |
+
"step": 7860
|
2761 |
+
},
|
2762 |
+
{
|
2763 |
+
"epoch": 0.8742926883390658,
|
2764 |
+
"grad_norm": 1.7421875,
|
2765 |
+
"learning_rate": 1.79106702214893e-06,
|
2766 |
+
"loss": 0.4568,
|
2767 |
+
"step": 7880
|
2768 |
+
},
|
2769 |
+
{
|
2770 |
+
"epoch": 0.8765117053145457,
|
2771 |
+
"grad_norm": 1.5234375,
|
2772 |
+
"learning_rate": 1.7296261370810695e-06,
|
2773 |
+
"loss": 0.4734,
|
2774 |
+
"step": 7900
|
2775 |
+
},
|
2776 |
+
{
|
2777 |
+
"epoch": 0.8787307222900255,
|
2778 |
+
"grad_norm": 1.828125,
|
2779 |
+
"learning_rate": 1.669193041021041e-06,
|
2780 |
+
"loss": 0.547,
|
2781 |
+
"step": 7920
|
2782 |
+
},
|
2783 |
+
{
|
2784 |
+
"epoch": 0.8809497392655053,
|
2785 |
+
"grad_norm": 1.4453125,
|
2786 |
+
"learning_rate": 1.6097723234258188e-06,
|
2787 |
+
"loss": 0.5001,
|
2788 |
+
"step": 7940
|
2789 |
+
},
|
2790 |
+
{
|
2791 |
+
"epoch": 0.8831687562409852,
|
2792 |
+
"grad_norm": 1.6875,
|
2793 |
+
"learning_rate": 1.5513684968695574e-06,
|
2794 |
+
"loss": 0.447,
|
2795 |
+
"step": 7960
|
2796 |
+
},
|
2797 |
+
{
|
2798 |
+
"epoch": 0.8853877732164651,
|
2799 |
+
"grad_norm": 1.578125,
|
2800 |
+
"learning_rate": 1.4939859967008768e-06,
|
2801 |
+
"loss": 0.4161,
|
2802 |
+
"step": 7980
|
2803 |
+
},
|
2804 |
+
{
|
2805 |
+
"epoch": 0.887606790191945,
|
2806 |
+
"grad_norm": 1.78125,
|
2807 |
+
"learning_rate": 1.437629180706037e-06,
|
2808 |
+
"loss": 0.4606,
|
2809 |
+
"step": 8000
|
2810 |
+
},
|
2811 |
+
{
|
2812 |
+
"epoch": 0.8898258071674249,
|
2813 |
+
"grad_norm": 1.6015625,
|
2814 |
+
"learning_rate": 1.382302328778e-06,
|
2815 |
+
"loss": 0.4126,
|
2816 |
+
"step": 8020
|
2817 |
+
},
|
2818 |
+
{
|
2819 |
+
"epoch": 0.8920448241429046,
|
2820 |
+
"grad_norm": 1.6015625,
|
2821 |
+
"learning_rate": 1.328009642591394e-06,
|
2822 |
+
"loss": 0.4313,
|
2823 |
+
"step": 8040
|
2824 |
+
},
|
2825 |
+
{
|
2826 |
+
"epoch": 0.8942638411183845,
|
2827 |
+
"grad_norm": 1.4296875,
|
2828 |
+
"learning_rate": 1.2747552452834388e-06,
|
2829 |
+
"loss": 0.4436,
|
2830 |
+
"step": 8060
|
2831 |
+
},
|
2832 |
+
{
|
2833 |
+
"epoch": 0.8964828580938644,
|
2834 |
+
"grad_norm": 1.6015625,
|
2835 |
+
"learning_rate": 1.2225431811408133e-06,
|
2836 |
+
"loss": 0.4591,
|
2837 |
+
"step": 8080
|
2838 |
+
},
|
2839 |
+
{
|
2840 |
+
"epoch": 0.8987018750693443,
|
2841 |
+
"grad_norm": 1.484375,
|
2842 |
+
"learning_rate": 1.1713774152925195e-06,
|
2843 |
+
"loss": 0.4103,
|
2844 |
+
"step": 8100
|
2845 |
+
},
|
2846 |
+
{
|
2847 |
+
"epoch": 0.9009208920448242,
|
2848 |
+
"grad_norm": 1.890625,
|
2849 |
+
"learning_rate": 1.1212618334087693e-06,
|
2850 |
+
"loss": 0.4196,
|
2851 |
+
"step": 8120
|
2852 |
+
},
|
2853 |
+
{
|
2854 |
+
"epoch": 0.903139909020304,
|
2855 |
+
"grad_norm": 2.125,
|
2856 |
+
"learning_rate": 1.0722002414058868e-06,
|
2857 |
+
"loss": 0.4701,
|
2858 |
+
"step": 8140
|
2859 |
+
},
|
2860 |
+
{
|
2861 |
+
"epoch": 0.9053589259957838,
|
2862 |
+
"grad_norm": 1.8671875,
|
2863 |
+
"learning_rate": 1.0241963651572867e-06,
|
2864 |
+
"loss": 0.4452,
|
2865 |
+
"step": 8160
|
2866 |
+
},
|
2867 |
+
{
|
2868 |
+
"epoch": 0.9075779429712637,
|
2869 |
+
"grad_norm": 2.21875,
|
2870 |
+
"learning_rate": 9.772538502105093e-07,
|
2871 |
+
"loss": 0.4122,
|
2872 |
+
"step": 8180
|
2873 |
+
},
|
2874 |
+
{
|
2875 |
+
"epoch": 0.9097969599467436,
|
2876 |
+
"grad_norm": 1.625,
|
2877 |
+
"learning_rate": 9.313762615103761e-07,
|
2878 |
+
"loss": 0.4265,
|
2879 |
+
"step": 8200
|
2880 |
+
},
|
2881 |
+
{
|
2882 |
+
"epoch": 0.9120159769222235,
|
2883 |
+
"grad_norm": 1.9296875,
|
2884 |
+
"learning_rate": 8.865670831282513e-07,
|
2885 |
+
"loss": 0.4678,
|
2886 |
+
"step": 8220
|
2887 |
+
},
|
2888 |
+
{
|
2889 |
+
"epoch": 0.9142349938977034,
|
2890 |
+
"grad_norm": 1.671875,
|
2891 |
+
"learning_rate": 8.42829717997457e-07,
|
2892 |
+
"loss": 0.4137,
|
2893 |
+
"step": 8240
|
2894 |
+
},
|
2895 |
+
{
|
2896 |
+
"epoch": 0.9164540108731832,
|
2897 |
+
"grad_norm": 1.6484375,
|
2898 |
+
"learning_rate": 8.001674876548471e-07,
|
2899 |
+
"loss": 0.4939,
|
2900 |
+
"step": 8260
|
2901 |
+
},
|
2902 |
+
{
|
2903 |
+
"epoch": 0.918673027848663,
|
2904 |
+
"grad_norm": 1.640625,
|
2905 |
+
"learning_rate": 7.585836319885525e-07,
|
2906 |
+
"loss": 0.4888,
|
2907 |
+
"step": 8280
|
2908 |
+
},
|
2909 |
+
{
|
2910 |
+
"epoch": 0.9208920448241429,
|
2911 |
+
"grad_norm": 1.578125,
|
2912 |
+
"learning_rate": 7.180813089919403e-07,
|
2913 |
+
"loss": 0.4352,
|
2914 |
+
"step": 8300
|
2915 |
+
},
|
2916 |
+
{
|
2917 |
+
"epoch": 0.9231110617996228,
|
2918 |
+
"grad_norm": 1.6640625,
|
2919 |
+
"learning_rate": 6.78663594523788e-07,
|
2920 |
+
"loss": 0.5086,
|
2921 |
+
"step": 8320
|
2922 |
+
},
|
2923 |
+
{
|
2924 |
+
"epoch": 0.9253300787751026,
|
2925 |
+
"grad_norm": 1.96875,
|
2926 |
+
"learning_rate": 6.403334820746876e-07,
|
2927 |
+
"loss": 0.4695,
|
2928 |
+
"step": 8340
|
2929 |
+
},
|
2930 |
+
{
|
2931 |
+
"epoch": 0.9275490957505825,
|
2932 |
+
"grad_norm": 1.5234375,
|
2933 |
+
"learning_rate": 6.030938825397225e-07,
|
2934 |
+
"loss": 0.3946,
|
2935 |
+
"step": 8360
|
2936 |
+
},
|
2937 |
+
{
|
2938 |
+
"epoch": 0.9297681127260623,
|
2939 |
+
"grad_norm": 1.609375,
|
2940 |
+
"learning_rate": 5.669476239973975e-07,
|
2941 |
+
"loss": 0.4797,
|
2942 |
+
"step": 8380
|
2943 |
+
},
|
2944 |
+
{
|
2945 |
+
"epoch": 0.9319871297015422,
|
2946 |
+
"grad_norm": 1.796875,
|
2947 |
+
"learning_rate": 5.318974514948672e-07,
|
2948 |
+
"loss": 0.4274,
|
2949 |
+
"step": 8400
|
2950 |
+
},
|
2951 |
+
{
|
2952 |
+
"epoch": 0.9342061466770221,
|
2953 |
+
"grad_norm": 1.453125,
|
2954 |
+
"learning_rate": 4.979460268394726e-07,
|
2955 |
+
"loss": 0.4369,
|
2956 |
+
"step": 8420
|
2957 |
+
},
|
2958 |
+
{
|
2959 |
+
"epoch": 0.936425163652502,
|
2960 |
+
"grad_norm": 1.6640625,
|
2961 |
+
"learning_rate": 4.6509592839659666e-07,
|
2962 |
+
"loss": 0.4452,
|
2963 |
+
"step": 8440
|
2964 |
+
},
|
2965 |
+
{
|
2966 |
+
"epoch": 0.9386441806279818,
|
2967 |
+
"grad_norm": 1.7734375,
|
2968 |
+
"learning_rate": 4.333496508938506e-07,
|
2969 |
+
"loss": 0.4949,
|
2970 |
+
"step": 8460
|
2971 |
+
},
|
2972 |
+
{
|
2973 |
+
"epoch": 0.9408631976034617,
|
2974 |
+
"grad_norm": 2.078125,
|
2975 |
+
"learning_rate": 4.02709605231627e-07,
|
2976 |
+
"loss": 0.4815,
|
2977 |
+
"step": 8480
|
2978 |
+
},
|
2979 |
+
{
|
2980 |
+
"epoch": 0.9430822145789415,
|
2981 |
+
"grad_norm": 2.109375,
|
2982 |
+
"learning_rate": 3.731781182999983e-07,
|
2983 |
+
"loss": 0.5533,
|
2984 |
+
"step": 8500
|
2985 |
+
},
|
2986 |
+
{
|
2987 |
+
"epoch": 0.9453012315544214,
|
2988 |
+
"grad_norm": 1.5234375,
|
2989 |
+
"learning_rate": 3.447574328020109e-07,
|
2990 |
+
"loss": 0.4741,
|
2991 |
+
"step": 8520
|
2992 |
+
},
|
2993 |
+
{
|
2994 |
+
"epoch": 0.9475202485299012,
|
2995 |
+
"grad_norm": 1.5546875,
|
2996 |
+
"learning_rate": 3.1744970708337205e-07,
|
2997 |
+
"loss": 0.5182,
|
2998 |
+
"step": 8540
|
2999 |
+
},
|
3000 |
+
{
|
3001 |
+
"epoch": 0.9497392655053811,
|
3002 |
+
"grad_norm": 1.4296875,
|
3003 |
+
"learning_rate": 2.912570149685323e-07,
|
3004 |
+
"loss": 0.4612,
|
3005 |
+
"step": 8560
|
3006 |
+
},
|
3007 |
+
{
|
3008 |
+
"epoch": 0.951958282480861,
|
3009 |
+
"grad_norm": 1.3984375,
|
3010 |
+
"learning_rate": 2.661813456032014e-07,
|
3011 |
+
"loss": 0.4253,
|
3012 |
+
"step": 8580
|
3013 |
+
},
|
3014 |
+
{
|
3015 |
+
"epoch": 0.9541772994563409,
|
3016 |
+
"grad_norm": 2.125,
|
3017 |
+
"learning_rate": 2.4222460330327933e-07,
|
3018 |
+
"loss": 0.5029,
|
3019 |
+
"step": 8600
|
3020 |
+
},
|
3021 |
+
{
|
3022 |
+
"epoch": 0.9563963164318207,
|
3023 |
+
"grad_norm": 1.9921875,
|
3024 |
+
"learning_rate": 2.1938860741023858e-07,
|
3025 |
+
"loss": 0.4444,
|
3026 |
+
"step": 8620
|
3027 |
+
},
|
3028 |
+
{
|
3029 |
+
"epoch": 0.9586153334073005,
|
3030 |
+
"grad_norm": 1.390625,
|
3031 |
+
"learning_rate": 1.9767509215296297e-07,
|
3032 |
+
"loss": 0.4607,
|
3033 |
+
"step": 8640
|
3034 |
+
},
|
3035 |
+
{
|
3036 |
+
"epoch": 0.9608343503827804,
|
3037 |
+
"grad_norm": 1.7890625,
|
3038 |
+
"learning_rate": 1.7708570651604306e-07,
|
3039 |
+
"loss": 0.5045,
|
3040 |
+
"step": 8660
|
3041 |
+
},
|
3042 |
+
{
|
3043 |
+
"epoch": 0.9630533673582603,
|
3044 |
+
"grad_norm": 1.484375,
|
3045 |
+
"learning_rate": 1.5762201411454626e-07,
|
3046 |
+
"loss": 0.4525,
|
3047 |
+
"step": 8680
|
3048 |
+
},
|
3049 |
+
{
|
3050 |
+
"epoch": 0.9652723843337402,
|
3051 |
+
"grad_norm": 1.28125,
|
3052 |
+
"learning_rate": 1.3928549307527183e-07,
|
3053 |
+
"loss": 0.4484,
|
3054 |
+
"step": 8700
|
3055 |
+
},
|
3056 |
+
{
|
3057 |
+
"epoch": 0.9674914013092201,
|
3058 |
+
"grad_norm": 1.7265625,
|
3059 |
+
"learning_rate": 1.2207753592450078e-07,
|
3060 |
+
"loss": 0.4194,
|
3061 |
+
"step": 8720
|
3062 |
+
},
|
3063 |
+
{
|
3064 |
+
"epoch": 0.9697104182846998,
|
3065 |
+
"grad_norm": 1.7734375,
|
3066 |
+
"learning_rate": 1.059994494822386e-07,
|
3067 |
+
"loss": 0.4822,
|
3068 |
+
"step": 8740
|
3069 |
+
},
|
3070 |
+
{
|
3071 |
+
"epoch": 0.9719294352601797,
|
3072 |
+
"grad_norm": 1.7421875,
|
3073 |
+
"learning_rate": 9.105245476297653e-08,
|
3074 |
+
"loss": 0.4584,
|
3075 |
+
"step": 8760
|
3076 |
+
},
|
3077 |
+
{
|
3078 |
+
"epoch": 0.9741484522356596,
|
3079 |
+
"grad_norm": 1.5546875,
|
3080 |
+
"learning_rate": 7.723768688296217e-08,
|
3081 |
+
"loss": 0.4508,
|
3082 |
+
"step": 8780
|
3083 |
+
},
|
3084 |
+
{
|
3085 |
+
"epoch": 0.9763674692111395,
|
3086 |
+
"grad_norm": 1.4921875,
|
3087 |
+
"learning_rate": 6.455619497399534e-08,
|
3088 |
+
"loss": 0.4953,
|
3089 |
+
"step": 8800
|
3090 |
+
},
|
3091 |
+
{
|
3092 |
+
"epoch": 0.9785864861866194,
|
3093 |
+
"grad_norm": 1.9375,
|
3094 |
+
"learning_rate": 5.300894210375329e-08,
|
3095 |
+
"loss": 0.4791,
|
3096 |
+
"step": 8820
|
3097 |
+
},
|
3098 |
+
{
|
3099 |
+
"epoch": 0.9808055031620991,
|
3100 |
+
"grad_norm": 1.4765625,
|
3101 |
+
"learning_rate": 4.259680520265596e-08,
|
3102 |
+
"loss": 0.4083,
|
3103 |
+
"step": 8840
|
3104 |
+
},
|
3105 |
+
{
|
3106 |
+
"epoch": 0.983024520137579,
|
3107 |
+
"grad_norm": 1.6328125,
|
3108 |
+
"learning_rate": 3.3320574997267595e-08,
|
3109 |
+
"loss": 0.449,
|
3110 |
+
"step": 8860
|
3111 |
+
},
|
3112 |
+
{
|
3113 |
+
"epoch": 0.9852435371130589,
|
3114 |
+
"grad_norm": 1.84375,
|
3115 |
+
"learning_rate": 2.5180955950243056e-08,
|
3116 |
+
"loss": 0.5022,
|
3117 |
+
"step": 8880
|
3118 |
+
},
|
3119 |
+
{
|
3120 |
+
"epoch": 0.9874625540885388,
|
3121 |
+
"grad_norm": 1.203125,
|
3122 |
+
"learning_rate": 1.8178566206837334e-08,
|
3123 |
+
"loss": 0.54,
|
3124 |
+
"step": 8900
|
3125 |
+
},
|
3126 |
+
{
|
3127 |
+
"epoch": 0.9896815710640187,
|
3128 |
+
"grad_norm": 1.8203125,
|
3129 |
+
"learning_rate": 1.231393754795307e-08,
|
3130 |
+
"loss": 0.4788,
|
3131 |
+
"step": 8920
|
3132 |
+
},
|
3133 |
+
{
|
3134 |
+
"epoch": 0.9919005880394985,
|
3135 |
+
"grad_norm": 1.5546875,
|
3136 |
+
"learning_rate": 7.587515349762874e-09,
|
3137 |
+
"loss": 0.5039,
|
3138 |
+
"step": 8940
|
3139 |
+
},
|
3140 |
+
{
|
3141 |
+
"epoch": 0.9941196050149783,
|
3142 |
+
"grad_norm": 1.8984375,
|
3143 |
+
"learning_rate": 3.9996585498797145e-09,
|
3144 |
+
"loss": 0.5317,
|
3145 |
+
"step": 8960
|
3146 |
+
},
|
3147 |
+
{
|
3148 |
+
"epoch": 0.9963386219904582,
|
3149 |
+
"grad_norm": 2.0,
|
3150 |
+
"learning_rate": 1.550639620103711e-09,
|
3151 |
+
"loss": 0.4578,
|
3152 |
+
"step": 8980
|
3153 |
+
},
|
3154 |
+
{
|
3155 |
+
"epoch": 0.9985576389659381,
|
3156 |
+
"grad_norm": 1.5234375,
|
3157 |
+
"learning_rate": 2.406445457253659e-10,
|
3158 |
+
"loss": 0.474,
|
3159 |
+
"step": 9000
|
3160 |
+
},
|
3161 |
+
{
|
3162 |
+
"epoch": 1.0,
|
3163 |
+
"step": 9013,
|
3164 |
+
"total_flos": 5.485972481640161e+17,
|
3165 |
+
"train_loss": 0.4824531834622566,
|
3166 |
+
"train_runtime": 26326.043,
|
3167 |
+
"train_samples_per_second": 0.685,
|
3168 |
+
"train_steps_per_second": 0.342
|
3169 |
+
}
|
3170 |
+
],
|
3171 |
+
"logging_steps": 20,
|
3172 |
+
"max_steps": 9013,
|
3173 |
+
"num_input_tokens_seen": 0,
|
3174 |
+
"num_train_epochs": 1,
|
3175 |
+
"save_steps": 100,
|
3176 |
+
"stateful_callbacks": {
|
3177 |
+
"TrainerControl": {
|
3178 |
+
"args": {
|
3179 |
+
"should_epoch_stop": false,
|
3180 |
+
"should_evaluate": false,
|
3181 |
+
"should_log": false,
|
3182 |
+
"should_save": true,
|
3183 |
+
"should_training_stop": true
|
3184 |
+
},
|
3185 |
+
"attributes": {}
|
3186 |
+
}
|
3187 |
+
},
|
3188 |
+
"total_flos": 5.485972481640161e+17,
|
3189 |
+
"train_batch_size": 2,
|
3190 |
+
"trial_name": null,
|
3191 |
+
"trial_params": null
|
3192 |
+
}
|