ChiyuSONG commited on
Commit
dd2a8ad
1 Parent(s): 99ac780

Upload 23 files

Browse files
config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "_name_or_path": "models/Baichuan2-13B-Base",
4
+ "architectures": [
5
+ "BaichuanForCausalLM"
6
+ ],
7
+ "auto_map": {
8
+ "AutoConfig": "configuration_baichuan.BaichuanConfig",
9
+ "AutoModelForCausalLM": "modeling_baichuan.BaichuanForCausalLM"
10
+ },
11
+ "bos_token_id": 1,
12
+ "eos_token_id": 2,
13
+ "hidden_act": "silu",
14
+ "hidden_size": 5120,
15
+ "initializer_range": 0.02,
16
+ "intermediate_size": 13696,
17
+ "model_max_length": 4096,
18
+ "model_type": "baichuan",
19
+ "num_attention_heads": 40,
20
+ "num_hidden_layers": 40,
21
+ "pad_token_id": 0,
22
+ "rms_norm_eps": 1e-06,
23
+ "tie_word_embeddings": false,
24
+ "torch_dtype": "bfloat16",
25
+ "transformers_version": "4.30.2",
26
+ "use_cache": true,
27
+ "vocab_size": 125696,
28
+ "z_loss_weight": 0
29
+ }
configuration_baichuan.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2023, Baichuan Intelligent Technology. All rights reserved.
2
+
3
+ from transformers.configuration_utils import PretrainedConfig
4
+
5
+
6
+ class BaichuanConfig(PretrainedConfig):
7
+ model_type = "baichuan"
8
+ keys_to_ignore_at_inference = ["past_key_values"]
9
+
10
+ def __init__(
11
+ self,
12
+ vocab_size=64000,
13
+ hidden_size=5120,
14
+ intermediate_size=13696,
15
+ num_hidden_layers=40,
16
+ num_attention_heads=40,
17
+ hidden_act="silu",
18
+ model_max_length=4096,
19
+ initializer_range=0.02,
20
+ rms_norm_eps=1e-6,
21
+ use_cache=True,
22
+ pad_token_id=0,
23
+ bos_token_id=1,
24
+ eos_token_id=2,
25
+ tie_word_embeddings=False,
26
+ gradient_checkpointing=False,
27
+ z_loss_weight=0,
28
+ **kwargs,
29
+ ):
30
+ self.vocab_size = vocab_size
31
+ self.model_max_length = model_max_length
32
+ self.hidden_size = hidden_size
33
+ self.intermediate_size = intermediate_size
34
+ self.num_hidden_layers = num_hidden_layers
35
+ self.num_attention_heads = num_attention_heads
36
+ self.hidden_act = hidden_act
37
+ self.initializer_range = initializer_range
38
+ self.rms_norm_eps = rms_norm_eps
39
+ self.use_cache = use_cache
40
+ self.z_loss_weight = z_loss_weight
41
+ self.gradient_checkpointing = (gradient_checkpointing,)
42
+ super().__init__(
43
+ pad_token_id=pad_token_id,
44
+ bos_token_id=bos_token_id,
45
+ eos_token_id=eos_token_id,
46
+ tie_word_embeddings=tie_word_embeddings,
47
+ **kwargs,
48
+ )
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "pad_token_id": 0,
6
+ "transformers_version": "4.30.2"
7
+ }
generation_utils.py ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List
2
+ from queue import Queue
3
+
4
+ import torch
5
+
6
+
7
+ def build_chat_input(model, tokenizer, messages: List[dict], max_new_tokens: int=0):
8
+ def _parse_messages(messages, split_role="user"):
9
+ system, rounds = "", []
10
+ round = []
11
+ for i, message in enumerate(messages):
12
+ if message["role"] == "system":
13
+ assert i == 0
14
+ system = message["content"]
15
+ continue
16
+ if message["role"] == split_role and round:
17
+ rounds.append(round)
18
+ round = []
19
+ round.append(message)
20
+ if round:
21
+ rounds.append(round)
22
+ return system, rounds
23
+
24
+ max_new_tokens = max_new_tokens or model.generation_config.max_new_tokens
25
+ max_input_tokens = model.config.model_max_length - max_new_tokens
26
+ system, rounds = _parse_messages(messages, split_role="user")
27
+ system_tokens = tokenizer.encode(system)
28
+ max_history_tokens = max_input_tokens - len(system_tokens)
29
+
30
+ history_tokens = []
31
+ for round in rounds[::-1]:
32
+ round_tokens = []
33
+ for message in round:
34
+ if message["role"] == "user":
35
+ round_tokens.append(model.generation_config.user_token_id)
36
+ else:
37
+ round_tokens.append(model.generation_config.assistant_token_id)
38
+ round_tokens.extend(tokenizer.encode(message["content"]))
39
+ if len(history_tokens) == 0 or len(history_tokens) + len(round_tokens) <= max_history_tokens:
40
+ history_tokens = round_tokens + history_tokens # concat left
41
+ if len(history_tokens) < max_history_tokens:
42
+ continue
43
+ break
44
+
45
+ input_tokens = system_tokens + history_tokens
46
+ if messages[-1]["role"] != "assistant":
47
+ input_tokens.append(model.generation_config.assistant_token_id)
48
+ input_tokens = input_tokens[-max_input_tokens:] # truncate left
49
+ return torch.LongTensor([input_tokens]).to(model.device)
50
+
51
+
52
+ class TextIterStreamer:
53
+ def __init__(self, tokenizer, skip_prompt=False, skip_special_tokens=False):
54
+ self.tokenizer = tokenizer
55
+ self.skip_prompt = skip_prompt
56
+ self.skip_special_tokens = skip_special_tokens
57
+ self.tokens = []
58
+ self.text_queue = Queue()
59
+ self.next_tokens_are_prompt = True
60
+
61
+ def put(self, value):
62
+ if self.skip_prompt and self.next_tokens_are_prompt:
63
+ self.next_tokens_are_prompt = False
64
+ else:
65
+ if len(value.shape) > 1:
66
+ value = value[0]
67
+ self.tokens.extend(value.tolist())
68
+ self.text_queue.put(
69
+ self.tokenizer.decode(self.tokens, skip_special_tokens=self.skip_special_tokens))
70
+
71
+ def end(self):
72
+ self.text_queue.put(None)
73
+
74
+ def __iter__(self):
75
+ return self
76
+
77
+ def __next__(self):
78
+ value = self.text_queue.get()
79
+ if value is None:
80
+ raise StopIteration()
81
+ else:
82
+ return value
83
+
latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step5930
modeling_baichuan.py ADDED
@@ -0,0 +1,826 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2023, Baichuan Intelligent Technology. All rights reserved.
2
+
3
+ from .configuration_baichuan import BaichuanConfig
4
+ from .generation_utils import build_chat_input, TextIterStreamer
5
+
6
+ import math
7
+ from threading import Thread
8
+ from typing import List, Optional, Tuple, Union
9
+
10
+ import torch
11
+ from torch import nn
12
+ from torch.nn import CrossEntropyLoss
13
+ from torch.nn import functional as F
14
+ from transformers import PreTrainedModel, PretrainedConfig
15
+ from transformers.activations import ACT2FN
16
+ from transformers.generation.utils import GenerationConfig
17
+ from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
18
+ from transformers.utils import logging, ContextManagers
19
+
20
+ import os
21
+ from contextlib import contextmanager
22
+ from accelerate import init_empty_weights
23
+
24
+ logger = logging.get_logger(__name__)
25
+
26
+ try:
27
+ from xformers import ops as xops
28
+ except ImportError:
29
+ xops = None
30
+ logger.warning(
31
+ "Xformers is not installed correctly. If you want to use memory_efficient_attention to accelerate training use the following command to install Xformers\npip install xformers."
32
+ )
33
+
34
+
35
+ def _get_interleave(n):
36
+ def _get_interleave_power_of_2(n):
37
+ start = 2 ** (-(2 ** -(math.log2(n) - 3)))
38
+ ratio = start
39
+ return [start * ratio**i for i in range(n)]
40
+
41
+ if math.log2(n).is_integer():
42
+ return _get_interleave_power_of_2(n)
43
+ else:
44
+ closest_power_of_2 = 2 ** math.floor(math.log2(n))
45
+ return (
46
+ _get_interleave_power_of_2(closest_power_of_2)
47
+ + _get_interleave(2 * closest_power_of_2)[0::2][: n - closest_power_of_2]
48
+ )
49
+
50
+
51
+ def _fill_with_neg_inf(t):
52
+ """FP16-compatible function that fills a tensor with -inf."""
53
+ return t.float().fill_(float("-inf")).type_as(t)
54
+
55
+
56
+ def _buffered_future_mask(tensor, maxpos, alibi, attn_heads):
57
+ _future_mask = torch.triu(_fill_with_neg_inf(torch.zeros([maxpos, maxpos])), 1)
58
+ _future_mask = _future_mask.unsqueeze(0) + alibi
59
+ new_future_mask = _future_mask.to(tensor)
60
+ return new_future_mask[: tensor.shape[0] * attn_heads, :maxpos, :maxpos]
61
+
62
+
63
+ def _gen_alibi_mask(tensor, n_head, max_pos):
64
+ slopes = torch.Tensor(_get_interleave(n_head))
65
+ position_point = torch.arange(max_pos) - max_pos + 1
66
+ position_point = position_point.unsqueeze(0).unsqueeze(0).expand(n_head, -1, -1)
67
+ diag = torch.diag(position_point[0])
68
+ position_point = position_point - diag.unsqueeze(0).unsqueeze(0).transpose(-1, -2)
69
+ alibi = slopes.unsqueeze(1).unsqueeze(1) * position_point
70
+ alibi = alibi.view(n_head, 1, max_pos)
71
+ alibi_mask = torch.triu(_fill_with_neg_inf(torch.zeros([max_pos, max_pos])), 1)
72
+ alibi_mask = alibi_mask.unsqueeze(0) + alibi
73
+ return alibi_mask
74
+
75
+
76
+ class RMSNorm(torch.nn.Module):
77
+ def __init__(self, hidden_size, epsilon=1e-6):
78
+ super().__init__()
79
+ self.weight = torch.nn.Parameter(torch.empty(hidden_size))
80
+ self.epsilon = epsilon
81
+
82
+ def forward(self, hidden_states):
83
+ variance = hidden_states.to(torch.float32).pow(2).mean(-1, keepdim=True)
84
+ hidden_states = hidden_states * torch.rsqrt(variance + self.epsilon)
85
+
86
+ # convert into half-precision
87
+ if self.weight.dtype in [torch.float16, torch.bfloat16]:
88
+ hidden_states = hidden_states.to(self.weight.dtype)
89
+
90
+ return self.weight * hidden_states
91
+
92
+
93
+ class MLP(torch.nn.Module):
94
+ def __init__(
95
+ self,
96
+ hidden_size: int,
97
+ intermediate_size: int,
98
+ hidden_act: str,
99
+ ):
100
+ super().__init__()
101
+ self.gate_proj = torch.nn.Linear(hidden_size, intermediate_size, bias=False)
102
+ self.down_proj = torch.nn.Linear(intermediate_size, hidden_size, bias=False)
103
+ self.up_proj = torch.nn.Linear(hidden_size, intermediate_size, bias=False)
104
+ self.act_fn = ACT2FN[hidden_act]
105
+
106
+ def forward(self, x):
107
+ return self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
108
+
109
+
110
+ class BaichuanAttention(torch.nn.Module):
111
+ def __init__(self, config: BaichuanConfig):
112
+ super().__init__()
113
+ self.config = config
114
+ self.hidden_size = config.hidden_size
115
+ self.num_heads = config.num_attention_heads
116
+ self.head_dim = self.hidden_size // self.num_heads
117
+ self.max_position_embeddings = config.model_max_length
118
+
119
+ if (self.head_dim * self.num_heads) != self.hidden_size:
120
+ raise ValueError(
121
+ f"hidden_size {self.hidden_size} is not divisible by num_heads {self.num_heads}"
122
+ )
123
+ self.W_pack = torch.nn.Linear(
124
+ self.hidden_size, 3 * self.hidden_size, bias=False
125
+ )
126
+ self.o_proj = torch.nn.Linear(
127
+ self.num_heads * self.head_dim, self.hidden_size, bias=False
128
+ )
129
+
130
+ def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
131
+ return (
132
+ tensor.view(bsz, seq_len, self.num_heads, self.head_dim)
133
+ .transpose(1, 2)
134
+ .contiguous()
135
+ )
136
+
137
+ def forward(
138
+ self,
139
+ hidden_states: torch.Tensor,
140
+ attention_mask: Optional[torch.Tensor] = None,
141
+ past_key_value: Optional[Tuple[torch.Tensor]] = None,
142
+ output_attentions: bool = False,
143
+ use_cache: bool = False,
144
+ ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
145
+ bsz, q_len, _ = hidden_states.size()
146
+
147
+ proj = self.W_pack(hidden_states)
148
+ proj = (
149
+ proj.unflatten(-1, (3, self.hidden_size))
150
+ .unsqueeze(0)
151
+ .transpose(0, -2)
152
+ .squeeze(-2)
153
+ )
154
+ query_states = (
155
+ proj[0].view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
156
+ )
157
+ key_states = (
158
+ proj[1].view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
159
+ )
160
+ value_states = (
161
+ proj[2].view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
162
+ )
163
+
164
+ kv_seq_len = key_states.shape[-2]
165
+ if past_key_value is not None:
166
+ kv_seq_len += past_key_value[0].shape[-2]
167
+
168
+ if past_key_value is not None:
169
+ # reuse k, v, self_attention
170
+ key_states = torch.cat([past_key_value[0], key_states], dim=2)
171
+ value_states = torch.cat([past_key_value[1], value_states], dim=2)
172
+
173
+ past_key_value = (key_states, value_states) if use_cache else None
174
+ if xops is not None and self.training:
175
+ attn_weights = None
176
+ # query_states = query_states.transpose(1, 2)
177
+ # key_states = key_states.transpose(1, 2)
178
+ # value_states = value_states.transpose(1, 2)
179
+ # attn_output = xops.memory_efficient_attention(
180
+ # query_states, key_states, value_states, attn_bias=attention_mask
181
+ # )
182
+ with torch.backends.cuda.sdp_kernel(enable_flash=True, enable_math=True, enable_mem_efficient=True):
183
+ attn_output = F.scaled_dot_product_attention(query_states, key_states, value_states, attn_mask = attention_mask)
184
+ attn_output = attn_output.transpose(1, 2)
185
+ else:
186
+ attn_weights = torch.matmul(
187
+ query_states, key_states.transpose(2, 3)
188
+ ) / math.sqrt(self.head_dim)
189
+
190
+ if attention_mask is not None:
191
+ if q_len == 1: # inference with cache
192
+ if len(attention_mask.size()) == 4:
193
+ attention_mask = attention_mask[:, :, -1:, :]
194
+ else:
195
+ attention_mask = attention_mask[:, -1:, :]
196
+ attn_weights = attn_weights + attention_mask
197
+ attn_weights = torch.max(
198
+ attn_weights, torch.tensor(torch.finfo(attn_weights.dtype).min)
199
+ )
200
+
201
+ attn_weights = torch.nn.functional.softmax(attn_weights, dim=-1)
202
+ attn_output = torch.matmul(attn_weights, value_states)
203
+
204
+ attn_output = attn_output.transpose(1, 2)
205
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
206
+ attn_output = self.o_proj(attn_output)
207
+
208
+ if not output_attentions:
209
+ attn_weights = None
210
+
211
+ return attn_output, attn_weights, past_key_value
212
+
213
+
214
+ class BaichuanLayer(torch.nn.Module):
215
+ def __init__(self, config: BaichuanConfig):
216
+ super().__init__()
217
+ self.hidden_size = config.hidden_size
218
+ self.self_attn = BaichuanAttention(config=config)
219
+ self.mlp = MLP(
220
+ hidden_size=self.hidden_size,
221
+ intermediate_size=config.intermediate_size,
222
+ hidden_act=config.hidden_act,
223
+ )
224
+ self.input_layernorm = RMSNorm(config.hidden_size, epsilon=config.rms_norm_eps)
225
+ self.post_attention_layernorm = RMSNorm(
226
+ config.hidden_size, epsilon=config.rms_norm_eps
227
+ )
228
+
229
+ def forward(
230
+ self,
231
+ hidden_states: torch.Tensor,
232
+ attention_mask: Optional[torch.Tensor] = None,
233
+ past_key_value: Optional[Tuple[torch.Tensor]] = None,
234
+ output_attentions: Optional[bool] = False,
235
+ use_cache: Optional[bool] = False,
236
+ ) -> Tuple[
237
+ torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]]
238
+ ]:
239
+ residual = hidden_states
240
+
241
+ hidden_states = self.input_layernorm(hidden_states)
242
+
243
+ # Self Attention
244
+ hidden_states, self_attn_weights, present_key_value = self.self_attn(
245
+ hidden_states=hidden_states,
246
+ attention_mask=attention_mask,
247
+ past_key_value=past_key_value,
248
+ output_attentions=output_attentions,
249
+ use_cache=use_cache,
250
+ )
251
+ hidden_states = residual + hidden_states
252
+
253
+ # Fully Connected
254
+ residual = hidden_states
255
+ hidden_states = self.post_attention_layernorm(hidden_states)
256
+ hidden_states = self.mlp(hidden_states)
257
+ hidden_states = residual + hidden_states
258
+
259
+ outputs = (hidden_states,)
260
+
261
+ if use_cache:
262
+ outputs += (present_key_value,)
263
+
264
+ return outputs
265
+
266
+
267
+ class BaichuanPreTrainedModel(PreTrainedModel):
268
+ config_class = BaichuanConfig
269
+ base_model_prefix = "model"
270
+ supports_gradient_checkpointing = True
271
+ _no_split_modules = ["BaichuanLayer"]
272
+ _keys_to_ignore_on_load_unexpected = [r"decoder\.version"]
273
+
274
+ def _init_weights(self, module):
275
+ std = self.config.initializer_range
276
+ if isinstance(module, torch.nn.Linear):
277
+ module.weight.data.normal_(mean=0.0, std=std)
278
+ if module.bias is not None:
279
+ module.bias.data.zero_()
280
+ elif isinstance(module, torch.nn.Embedding):
281
+ module.weight.data.normal_(mean=0.0, std=std)
282
+ if module.padding_idx is not None:
283
+ module.weight.data[module.padding_idx].zero_()
284
+
285
+ def _set_gradient_checkpointing(self, module, value=False):
286
+ if isinstance(module, BaichuanModel):
287
+ module.gradient_checkpointing = value
288
+
289
+
290
+ class BaichuanModel(BaichuanPreTrainedModel):
291
+ def __init__(self, config: BaichuanConfig):
292
+ super().__init__(config)
293
+ self.padding_idx = config.pad_token_id
294
+ self.vocab_size = config.vocab_size
295
+ self.n_head = config.num_attention_heads
296
+ self.embed_tokens = torch.nn.Embedding(
297
+ config.vocab_size, config.hidden_size, self.padding_idx
298
+ )
299
+ self.layers = torch.nn.ModuleList(
300
+ [BaichuanLayer(config) for _ in range(config.num_hidden_layers)]
301
+ )
302
+ self.norm = RMSNorm(config.hidden_size, epsilon=config.rms_norm_eps)
303
+
304
+ self.gradient_checkpointing = config.gradient_checkpointing
305
+ self.post_init()
306
+ self.max_cache_pos = config.model_max_length
307
+ self.first_run = True
308
+ self.alibi_mask = None
309
+
310
+ def get_input_embeddings(self):
311
+ return self.embed_tokens
312
+
313
+ def set_input_embeddings(self, value):
314
+ self.embed_tokens = value
315
+
316
+ def get_alibi_mask(self, tensor, seq_length_with_past):
317
+ if self.training:
318
+ slopes = torch.Tensor(_get_interleave(self.n_head))
319
+ position_point = (
320
+ torch.arange(seq_length_with_past) - seq_length_with_past + 1
321
+ )
322
+ position_point = (
323
+ position_point.unsqueeze(0)
324
+ .unsqueeze(0)
325
+ .expand(self.n_head, seq_length_with_past, -1)
326
+ )
327
+ diag = torch.diag(position_point[0])
328
+ position_point = position_point - diag.unsqueeze(0).unsqueeze(0).transpose(
329
+ -1, -2
330
+ )
331
+ alibi = slopes.unsqueeze(1).unsqueeze(1) * position_point
332
+ mask = _buffered_future_mask(
333
+ tensor, seq_length_with_past, alibi, self.n_head
334
+ )
335
+ else:
336
+ if self.first_run:
337
+ self.first_run = False
338
+ self.register_buffer(
339
+ "future_mask",
340
+ _gen_alibi_mask(tensor, self.n_head, self.max_cache_pos).to(
341
+ tensor
342
+ ),
343
+ persistent=False,
344
+ )
345
+ if seq_length_with_past > self.max_cache_pos:
346
+ self.max_cache_pos = seq_length_with_past
347
+ self.register_buffer(
348
+ "future_mask",
349
+ _gen_alibi_mask(tensor, self.n_head, self.max_cache_pos).to(
350
+ tensor
351
+ ),
352
+ persistent=False,
353
+ )
354
+ mask = self.future_mask[
355
+ : self.n_head, :seq_length_with_past, :seq_length_with_past
356
+ ]
357
+ return mask
358
+
359
+ def forward(
360
+ self,
361
+ input_ids: torch.LongTensor = None,
362
+ attention_mask: Optional[torch.Tensor] = None,
363
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
364
+ inputs_embeds: Optional[torch.FloatTensor] = None,
365
+ use_cache: Optional[bool] = False,
366
+ output_attentions: Optional[bool] = False,
367
+ output_hidden_states: Optional[bool] = False,
368
+ return_dict: Optional[bool] = True,
369
+ ) -> Union[Tuple, BaseModelOutputWithPast]:
370
+ if input_ids is not None and inputs_embeds is not None:
371
+ raise ValueError(
372
+ "You cannot provide both input_ids and inputs_embeds simultaneously"
373
+ )
374
+ elif input_ids is not None:
375
+ batch_size, seq_length = input_ids.shape
376
+ elif inputs_embeds is not None:
377
+ batch_size, seq_length, _ = inputs_embeds.shape
378
+ else:
379
+ raise ValueError("You need to provide input_ids or inputs_embeds")
380
+
381
+ return_dict = (
382
+ return_dict if return_dict is not None else self.config.use_return_dict
383
+ )
384
+
385
+ seq_length_with_past = seq_length
386
+
387
+ if past_key_values is not None:
388
+ past_key_values_length = past_key_values[0][0].shape[2]
389
+ seq_length_with_past = seq_length_with_past + past_key_values_length
390
+
391
+ if inputs_embeds is None:
392
+ inputs_embeds = self.embed_tokens(input_ids)
393
+
394
+ if self.training:
395
+ if (
396
+ self.alibi_mask is None
397
+ or self.alibi_mask.shape[-1] != seq_length_with_past
398
+ ):
399
+ self.alibi_mask = self.get_alibi_mask(
400
+ inputs_embeds, seq_length_with_past
401
+ )
402
+ alibi_mask = self.alibi_mask
403
+ else:
404
+ alibi_mask = self.get_alibi_mask(inputs_embeds, seq_length_with_past)
405
+
406
+ if attention_mask is not None:
407
+ if len(attention_mask.shape) == 2:
408
+ expanded_mask = attention_mask.to(alibi_mask.dtype)
409
+ expanded_mask = torch.tril(
410
+ torch.gt(expanded_mask[:, :, None] * expanded_mask[:, None, :], 0)
411
+ ) * torch.eq(expanded_mask[:, :, None] - expanded_mask[:, None, :], 0)
412
+ else:
413
+ expanded_mask = attention_mask
414
+ bsz = inputs_embeds.size(0)
415
+ src_len, tgt_len = alibi_mask.size()[-2:]
416
+ expanded_mask = (
417
+ expanded_mask.unsqueeze(1)
418
+ .expand(bsz, 1, src_len, tgt_len)
419
+ .to(alibi_mask.dtype)
420
+ )
421
+ inverted_mask = 1.0 - expanded_mask
422
+ inverted_mask = inverted_mask.masked_fill(
423
+ inverted_mask.to(torch.bool), torch.finfo(alibi_mask.dtype).min
424
+ )
425
+ attention_mask = inverted_mask + alibi_mask.unsqueeze(0)
426
+ else:
427
+ attention_mask = alibi_mask
428
+
429
+ hidden_states = inputs_embeds
430
+
431
+ if self.gradient_checkpointing and self.training:
432
+ if use_cache:
433
+ logger.warning_once(
434
+ "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
435
+ )
436
+ use_cache = False
437
+
438
+ # decoder layers
439
+ all_hidden_states = () if output_hidden_states else None
440
+ all_self_attns = () if output_attentions else None
441
+ next_decoder_cache = () if use_cache else None
442
+
443
+ for idx, decoder_layer in enumerate(self.layers):
444
+ if output_hidden_states:
445
+ all_hidden_states += (hidden_states,)
446
+
447
+ past_key_value = (
448
+ past_key_values[idx] if past_key_values is not None else None
449
+ )
450
+
451
+ if self.gradient_checkpointing and self.training:
452
+
453
+ def create_custom_forward(module):
454
+ def custom_forward(*inputs):
455
+ # None for past_key_value
456
+ return module(*inputs, output_attentions, None)
457
+
458
+ return custom_forward
459
+
460
+ layer_outputs = torch.utils.checkpoint.checkpoint(
461
+ create_custom_forward(decoder_layer),
462
+ hidden_states,
463
+ attention_mask,
464
+ None,
465
+ )
466
+ else:
467
+ layer_outputs = decoder_layer(
468
+ hidden_states,
469
+ attention_mask=attention_mask,
470
+ past_key_value=past_key_value,
471
+ output_attentions=output_attentions,
472
+ use_cache=use_cache,
473
+ )
474
+
475
+ hidden_states = layer_outputs[0]
476
+
477
+ if use_cache:
478
+ next_decoder_cache += (layer_outputs[2 if output_attentions else 1],)
479
+
480
+ if output_attentions:
481
+ all_self_attns += (layer_outputs[1],)
482
+
483
+ hidden_states = self.norm(hidden_states)
484
+
485
+ # add hidden states from the last decoder layer
486
+ if output_hidden_states:
487
+ all_hidden_states += (hidden_states,)
488
+
489
+ next_cache = next_decoder_cache if use_cache else None
490
+ if not return_dict:
491
+ return tuple(
492
+ v
493
+ for v in [hidden_states, next_cache, all_hidden_states, all_self_attns]
494
+ if v is not None
495
+ )
496
+ return BaseModelOutputWithPast(
497
+ last_hidden_state=hidden_states,
498
+ past_key_values=next_cache,
499
+ hidden_states=all_hidden_states,
500
+ attentions=all_self_attns,
501
+ )
502
+
503
+
504
+ class NormHead(nn.Module):
505
+ def __init__(self, hidden_size, vocab_size, bias=False):
506
+ super().__init__()
507
+ self.weight = nn.Parameter(torch.empty((vocab_size, hidden_size)))
508
+ nn.init.kaiming_uniform_(self.weight, a=math.sqrt(5))
509
+ self.first_flag = True
510
+
511
+ def forward(self, hidden_states):
512
+ if self.training:
513
+ norm_weight = nn.functional.normalize(self.weight)
514
+ elif self.first_flag:
515
+ self.first_flag = False
516
+ self.weight = nn.Parameter(nn.functional.normalize(self.weight))
517
+ norm_weight = self.weight
518
+ else:
519
+ norm_weight = self.weight
520
+ return nn.functional.linear(hidden_states, norm_weight)
521
+
522
+ _init_weights = True
523
+ @contextmanager
524
+ def no_init_weights(_enable=True):
525
+ global _init_weights
526
+ old_init_weights = _init_weights
527
+ if _enable:
528
+ _init_weights = False
529
+ try:
530
+ yield
531
+ finally:
532
+ _init_weights = old_init_weights
533
+
534
+
535
+ class BaichuanForCausalLM(BaichuanPreTrainedModel):
536
+ def __init__(self, config, *model_args, **model_kwargs):
537
+ super().__init__(config, *model_args, **model_kwargs)
538
+ self.model = BaichuanModel(config)
539
+ self.lm_head = NormHead(config.hidden_size, config.vocab_size, bias=False)
540
+ #if hasattr(config, "quantization_config") and config.quantization_config['load_in_4bit']:
541
+ if hasattr(config, "quantization_config") and isinstance(config.quantization_config, dict) and config.quantization_config.get('load_in_4bit', False):
542
+ try:
543
+ from .quantizer import quantize_offline, init_model_weight_int4
544
+ except ImportError:
545
+ raise ImportError(f"Needs quantize_offline to run quantize.")
546
+ quantize_offline(self, 4)
547
+ # Initialize weights and apply final processing
548
+ self.post_init()
549
+
550
+ def get_input_embeddings(self):
551
+ return self.model.embed_tokens
552
+
553
+ def set_input_embeddings(self, value):
554
+ self.model.embed_tokens = value
555
+
556
+ def get_output_embeddings(self):
557
+ return self.lm_head
558
+
559
+ def set_output_embeddings(self, new_embeddings):
560
+ self.lm_head = new_embeddings
561
+
562
+ def set_decoder(self, decoder):
563
+ self.model = decoder
564
+
565
+ def get_decoder(self):
566
+ return self.model
567
+
568
+ @classmethod
569
+ def from_pretrained(
570
+ cls,
571
+ pretrained_model_name_or_path: Optional[Union[str, os.PathLike]],
572
+ *model_args,
573
+ config: Optional[Union[PretrainedConfig, str, os.PathLike]] = None,
574
+ cache_dir: Optional[Union[str, os.PathLike]] = None,
575
+ ignore_mismatched_sizes: bool = False,
576
+ force_download: bool = False,
577
+ local_files_only: bool = False,
578
+ token: Optional[Union[str, bool]] = None,
579
+ revision: str = "main",
580
+ use_safetensors: bool = None,
581
+ **kwargs,
582
+ ):
583
+
584
+ # Load config if we don't provide a configuration
585
+ if not isinstance(config, PretrainedConfig):
586
+ config_path = config if config is not None else pretrained_model_name_or_path
587
+ config, model_kwargs = cls.config_class.from_pretrained(
588
+ config_path,
589
+ cache_dir=cache_dir,
590
+ return_unused_kwargs=True,
591
+ force_download=force_download,
592
+ resume_download=False,
593
+ proxies=None,
594
+ local_files_only=local_files_only,
595
+ token=token,
596
+ revision=revision,
597
+ subfolder="",
598
+ _from_auto=False,
599
+ _from_pipeline=None,
600
+ **kwargs,
601
+ )
602
+ else:
603
+ model_kwargs = kwargs
604
+
605
+ if hasattr(config, "quantization_config") and config.quantization_config['load_in_4bit']:
606
+ try:
607
+ from .quantizer import init_model_weight_int4
608
+ from accelerate import init_empty_weights, dispatch_model, infer_auto_device_map
609
+ from accelerate.utils import CustomDtype
610
+ from accelerate.utils import get_balanced_memory
611
+ except ImportError:
612
+ raise ImportError(f"Needs import model weight init func to run quantize.")
613
+ # Instantiate model.
614
+ init_contexts = [no_init_weights(_enable=True)]
615
+ init_contexts.append(init_empty_weights())
616
+ with ContextManagers(init_contexts):
617
+ model = cls(config)
618
+
619
+ model_file = os.path.join(pretrained_model_name_or_path, 'pytorch_model.bin')
620
+ state_dict = torch.load(model_file, map_location="cpu")
621
+ model.is_quantized = True
622
+
623
+ device_map = kwargs.pop("device_map", None)
624
+ torch_dtype = kwargs.pop("torch_dtype", None)
625
+ if device_map is not None:
626
+ kwargs = {"no_split_module_classes": model._no_split_modules}
627
+ target_dtype = CustomDtype.INT4
628
+ max_memory = get_balanced_memory(
629
+ model,
630
+ dtype=target_dtype,
631
+ low_zero=(device_map == "balanced_low_0"),
632
+ max_memory=None,
633
+ **kwargs,
634
+ )
635
+ kwargs["max_memory"] = max_memory
636
+ device_map = infer_auto_device_map(model, dtype=target_dtype, **kwargs)
637
+ model = init_model_weight_int4(config, model, state_dict)
638
+
639
+ # Set model in evaluation mode to deactivate DropOut modules by default
640
+ model.eval()
641
+ # If it is a model with generation capabilities, attempt to load the generation config
642
+ if model.can_generate():
643
+ try:
644
+ model.generation_config = GenerationConfig.from_pretrained(
645
+ pretrained_model_name_or_path,
646
+ cache_dir=cache_dir,
647
+ force_download=force_download,
648
+ resume_download=False,
649
+ proxies=None,
650
+ local_files_only=local_files_only,
651
+ token=token,
652
+ revision=revision,
653
+ subfolder="",
654
+ _from_auto=False,
655
+ _from_pipeline=None,
656
+ **kwargs,
657
+ )
658
+ except (OSError, TypeError):
659
+ logger.info(
660
+ "Generation config file not found, using a generation config created from the model config."
661
+ )
662
+ pass
663
+
664
+ if device_map is not None:
665
+ dispatch_model(model, device_map=device_map)
666
+
667
+ return model
668
+
669
+ return super(BaichuanForCausalLM, cls).from_pretrained(pretrained_model_name_or_path, *model_args,
670
+ config=config, cache_dir=cache_dir, ignore_mismatched_sizes=ignore_mismatched_sizes,
671
+ force_download=force_download, local_files_only=local_files_only, token=token, revision=revision,
672
+ use_safetensors=use_safetensors, **kwargs)
673
+
674
+ def forward(
675
+ self,
676
+ input_ids: torch.LongTensor = None,
677
+ attention_mask: Optional[torch.Tensor] = None,
678
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
679
+ inputs_embeds: Optional[torch.FloatTensor] = None,
680
+ labels: Optional[torch.LongTensor] = None,
681
+ use_cache: Optional[bool] = None,
682
+ output_attentions: Optional[bool] = False,
683
+ output_hidden_states: Optional[bool] = False,
684
+ return_dict: Optional[bool] = True,
685
+ **kwargs,
686
+ ) -> Union[Tuple, CausalLMOutputWithPast]:
687
+ return_dict = (
688
+ return_dict if return_dict is not None else self.config.use_return_dict
689
+ )
690
+
691
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
692
+ outputs = self.model(
693
+ input_ids=input_ids,
694
+ attention_mask=attention_mask,
695
+ past_key_values=past_key_values,
696
+ inputs_embeds=inputs_embeds,
697
+ use_cache=use_cache,
698
+ output_attentions=output_attentions,
699
+ output_hidden_states=output_hidden_states,
700
+ return_dict=return_dict,
701
+ )
702
+
703
+ hidden_states = outputs[0]
704
+ logits = self.lm_head(hidden_states)
705
+ loss = None
706
+ if labels is not None:
707
+ # Shift so that tokens < n predict n
708
+ shift_logits = logits[..., :-1, :].contiguous()
709
+ shift_labels = labels[..., 1:].contiguous()
710
+ # Flatten the tokens
711
+ loss_fct = CrossEntropyLoss()
712
+ shift_logits = shift_logits.view(-1, self.config.vocab_size)
713
+ shift_labels = shift_labels.view(-1)
714
+ softmax_normalizer = shift_logits.max(-1).values ** 2
715
+ z_loss = self.config.z_loss_weight * softmax_normalizer.mean()
716
+ # Enable model parallelism
717
+ shift_labels = shift_labels.to(shift_logits.device)
718
+ loss = loss_fct(shift_logits, shift_labels) + z_loss
719
+
720
+ if not return_dict:
721
+ output = (logits,) + outputs[1:]
722
+ return (loss,) + output if loss is not None else output
723
+
724
+ return CausalLMOutputWithPast(
725
+ loss=loss,
726
+ logits=logits,
727
+ past_key_values=outputs.past_key_values,
728
+ hidden_states=outputs.hidden_states,
729
+ attentions=outputs.attentions,
730
+ )
731
+
732
+ def quantize(self, bits: int):
733
+ try:
734
+ from .quantizer import quantize_online
735
+ except ImportError:
736
+ raise ImportError(f"Needs QLinear to run quantize.")
737
+ return quantize_online(self, bits)
738
+
739
+ def prepare_inputs_for_generation(
740
+ self,
741
+ input_ids: torch.LongTensor,
742
+ past_key_values: Optional[torch.Tensor] = None,
743
+ attention_mask: Optional[torch.Tensor] = None,
744
+ inputs_embeds: Optional[torch.Tensor] = None,
745
+ **kwargs,
746
+ ):
747
+ if past_key_values:
748
+ input_ids = input_ids[:, -1:]
749
+
750
+ # if `inputs_embeds` are passed, we only want to use them in the 1st generation step
751
+ if inputs_embeds is not None and past_key_values is None:
752
+ model_inputs = {"inputs_embeds": inputs_embeds}
753
+ else:
754
+ model_inputs = {"input_ids": input_ids}
755
+
756
+ model_inputs.update(
757
+ {
758
+ "past_key_values": past_key_values,
759
+ "use_cache": kwargs.get("use_cache"),
760
+ "attention_mask": attention_mask,
761
+ }
762
+ )
763
+ return model_inputs
764
+
765
+ @staticmethod
766
+ def _reorder_cache(past_key_values, beam_idx):
767
+ return tuple(
768
+ tuple(past_state.index_select(0, beam_idx) for past_state in layer_past)
769
+ for layer_past in past_key_values
770
+ )
771
+
772
+ def _build_chat_input(
773
+ self, tokenizer, messages: List[dict], max_new_tokens: int = 0
774
+ ):
775
+ max_new_tokens = max_new_tokens or self.generation_config.max_new_tokens
776
+ max_input_tokens = self.config.model_max_length - max_new_tokens
777
+ max_input_tokens = max(self.config.model_max_length // 2, max_input_tokens)
778
+ total_input, round_input = [], []
779
+ for i, message in enumerate(messages[::-1]):
780
+ content_tokens = tokenizer.encode(message["content"])
781
+ if message["role"] == "user":
782
+ round_input = (
783
+ [self.generation_config.user_token_id]
784
+ + content_tokens
785
+ + round_input
786
+ )
787
+ if (
788
+ total_input
789
+ and len(total_input) + len(round_input) > max_input_tokens
790
+ ):
791
+ break
792
+ else:
793
+ total_input = round_input + total_input
794
+ if len(total_input) >= max_input_tokens:
795
+ break
796
+ else:
797
+ round_input = []
798
+ elif message["role"] == "assistant":
799
+ round_input = (
800
+ [self.generation_config.assistant_token_id]
801
+ + content_tokens
802
+ + [self.generation_config.eos_token_id]
803
+ + round_input
804
+ )
805
+ else:
806
+ raise ValueError(f"message role not supported yet: {message['role']}")
807
+ total_input = total_input[-max_input_tokens:] # truncate left
808
+ total_input.append(self.generation_config.assistant_token_id)
809
+ total_input = torch.LongTensor([total_input]).to(self.device)
810
+ return total_input
811
+
812
+ def chat(self, tokenizer, messages: List[dict], stream=False,
813
+ generation_config: Optional[GenerationConfig]=None):
814
+ generation_config = generation_config or self.generation_config
815
+ input_ids = build_chat_input(self, tokenizer, messages, generation_config.max_new_tokens)
816
+ if stream:
817
+ streamer = TextIterStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
818
+ Thread(target=self.generate, kwargs=dict(
819
+ inputs=input_ids, streamer=streamer,
820
+ generation_config=generation_config,
821
+ )).start()
822
+ return streamer
823
+ else:
824
+ outputs = self.generate(input_ids, generation_config=generation_config)
825
+ response = tokenizer.decode(outputs[0][len(input_ids[0]):], skip_special_tokens=True)
826
+ return response
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5070f02c0778e02cdd67d351df660662ae062a92879858b0dadcee06128a07ca
3
+ size 29080502643
quantizer.py ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import bitsandbytes as bnb
2
+ from accelerate import init_empty_weights
3
+ from bitsandbytes.nn.modules import Params4bit, Int8Params
4
+ import torch
5
+
6
+ def Params4bitCuda(self, device):
7
+ self.data = self.data.cuda(device)
8
+ self.quant_state[0] = self.quant_state[0].cuda(device)
9
+ self.quant_state[4][0] = self.quant_state[4][0].cuda(device)
10
+ self.quant_state[4][1][0] = self.quant_state[4][1][0].cuda(device)
11
+ self.quant_state[4][1][1] = self.quant_state[4][1][1].cuda(device)
12
+
13
+ self.quant_state[6] = self.quant_state[6].cuda(device)
14
+ return self
15
+
16
+ class Linear4bitOnline(torch.nn.Module):
17
+ def __init__(self, weight, bias, quant_type):
18
+ super().__init__()
19
+ self.weight = Params4bit(
20
+ weight.data, requires_grad=False, compress_statistics=True, quant_type=quant_type
21
+ )
22
+ self.compute_dtype = None
23
+ #self.weight.cuda(weight.device)
24
+ self.bias = bias
25
+
26
+ def forward(self, x: torch.Tensor):
27
+ # weights are cast automatically as Int8Params, but the bias has to be cast manually
28
+ if self.bias is not None and self.bias.dtype != x.dtype:
29
+ self.bias.data = self.bias.data.to(x.dtype)
30
+
31
+ if getattr(self.weight, "quant_state", None) is None:
32
+ print(
33
+ "FP4 quantization state not initialized. Please call .cuda() or .to(device) on the LinearFP4 layer first."
34
+ )
35
+ inp_dtype = x.dtype
36
+ if self.compute_dtype is not None:
37
+ x = x.to(self.compute_dtype)
38
+
39
+ bias = None if self.bias is None else self.bias.to(self.compute_dtype)
40
+ out = bnb.matmul_4bit(
41
+ x, self.weight.t(), bias=bias, quant_state=self.weight.quant_state
42
+ )
43
+
44
+ out = out.to(inp_dtype)
45
+
46
+ return out
47
+
48
+ class Linear8bitLtOnline(torch.nn.Module):
49
+ def __init__(
50
+ self,
51
+ weight,
52
+ bias,
53
+ has_fp16_weights=True,
54
+ memory_efficient_backward=False,
55
+ threshold=0.0,
56
+ index=None,
57
+ ):
58
+ super().__init__()
59
+ assert (
60
+ not memory_efficient_backward
61
+ ), "memory_efficient_backward is no longer required and the argument is deprecated in 0.37.0 and will be removed in 0.39.0"
62
+ self.state = bnb.MatmulLtState()
63
+ self.index = index
64
+
65
+ # Necessary for stacked layers
66
+ self.state.threshold = threshold
67
+ self.state.has_fp16_weights = has_fp16_weights
68
+ self.state.memory_efficient_backward = memory_efficient_backward
69
+ if threshold > 0.0 and not has_fp16_weights:
70
+ self.state.use_pool = True
71
+
72
+ self.weight = Int8Params(
73
+ weight.data,
74
+ has_fp16_weights=has_fp16_weights,
75
+ requires_grad=has_fp16_weights,
76
+ )
77
+ self.bias = bias
78
+
79
+ def init_8bit_state(self):
80
+ self.state.CB = self.weight.CB
81
+ self.state.SCB = self.weight.SCB
82
+ self.weight.CB = None
83
+ self.weight.SCB = None
84
+
85
+ def forward(self, x: torch.Tensor):
86
+ self.state.is_training = self.training
87
+ if self.weight.CB is not None:
88
+ self.init_8bit_state()
89
+
90
+ # weights are cast automatically as Int8Params, but the bias has to be cast manually
91
+ if self.bias is not None and self.bias.dtype != x.dtype:
92
+ self.bias.data = self.bias.data.to(x.dtype)
93
+
94
+ out = bnb.matmul(x, self.weight, bias=self.bias, state=self.state)
95
+
96
+ if not self.state.has_fp16_weights:
97
+ if self.state.CB is not None and self.state.CxB is not None:
98
+ # we converted 8-bit row major to turing/ampere format in the first inference pass
99
+ # we no longer need the row-major weight
100
+ del self.state.CB
101
+ self.weight.data = self.state.CxB
102
+ return out
103
+
104
+ def quantize_offline(model, bits: int):
105
+ assert (bits == 4), f'bits: {bits} is not supported'
106
+
107
+ for i, layer in enumerate(model.model.layers):
108
+ layer.self_attn.W_pack = bnb.nn.Linear4bit(
109
+ layer.self_attn.W_pack.weight.shape[1],
110
+ layer.self_attn.W_pack.weight.shape[0],
111
+ False,
112
+ torch.float16,
113
+ compress_statistics=True,
114
+ quant_type="nf4",
115
+ )
116
+ layer.self_attn.o_proj = bnb.nn.Linear4bit(
117
+ layer.self_attn.o_proj.weight.shape[1],
118
+ layer.self_attn.o_proj.weight.shape[0],
119
+ False,
120
+ torch.float16,
121
+ compress_statistics=True,
122
+ quant_type="nf4",
123
+ )
124
+
125
+ layer.mlp.gate_proj = bnb.nn.Linear4bit(
126
+ layer.mlp.gate_proj.weight.shape[1],
127
+ layer.mlp.gate_proj.weight.shape[0],
128
+ False,
129
+ torch.float16,
130
+ compress_statistics=True,
131
+ quant_type="nf4",
132
+ )
133
+ layer.mlp.down_proj = bnb.nn.Linear4bit(
134
+ layer.mlp.down_proj.weight.shape[1],
135
+ layer.mlp.down_proj.weight.shape[0],
136
+ False,
137
+ torch.float16,
138
+ compress_statistics=True,
139
+ quant_type="nf4",
140
+ )
141
+ layer.mlp.up_proj = bnb.nn.Linear4bit(
142
+ layer.mlp.up_proj.weight.shape[1],
143
+ layer.mlp.up_proj.weight.shape[0],
144
+ False,
145
+ torch.float16,
146
+ compress_statistics=True,
147
+ quant_type="nf4",
148
+ )
149
+ return model
150
+
151
+ def quantize_online(model, bits: int):
152
+ def quant(weight, bias=None):
153
+ if bits == 8:
154
+ linear = Linear8bitLtOnline(
155
+ weight,
156
+ bias,
157
+ has_fp16_weights=False,
158
+ threshold=6.0,
159
+ )
160
+ if bias is not None:
161
+ linear.bias = torch.nn.Parameter(bias)
162
+ elif bits == 4:
163
+ linear = Linear4bitOnline(
164
+ weight,
165
+ bias,
166
+ quant_type="nf4", #fp4/nf4
167
+ )
168
+ else:
169
+ raise ValueError("quantize only support 4/8 bit")
170
+ return linear
171
+
172
+ for i, layer in enumerate(model.model.layers):
173
+ layer.self_attn.W_pack = quant(layer.self_attn.W_pack.weight)
174
+ layer.self_attn.o_proj = quant(layer.self_attn.o_proj.weight)
175
+ layer.mlp.gate_proj = quant(layer.mlp.gate_proj.weight)
176
+ layer.mlp.down_proj = quant(layer.mlp.down_proj.weight)
177
+ layer.mlp.up_proj = quant(layer.mlp.up_proj.weight)
178
+ return model
179
+
180
+ def init_model_weight_int4(config, model, state_dict):
181
+ #replace Params4bit.cuda with Params4bitCuda
182
+ Params4bit.cuda = Params4bitCuda
183
+
184
+ for i in range(config.num_hidden_layers):
185
+ weight_data = state_dict[f'model.layers.{i}.self_attn.W_pack.weight.data']
186
+ weight_quant_state = state_dict[f'model.layers.{i}.self_attn.W_pack.weight.quant_state']
187
+ model.model.layers[i].self_attn.W_pack.weight = Params4bit(weight_data, requires_grad=False, quant_state=weight_quant_state)
188
+
189
+ weight_data = state_dict[f'model.layers.{i}.self_attn.o_proj.weight.data']
190
+ weight_quant_state = state_dict[f'model.layers.{i}.self_attn.o_proj.weight.quant_state']
191
+ model.model.layers[i].self_attn.o_proj.weight = Params4bit(weight_data, requires_grad=False, quant_state=weight_quant_state)
192
+
193
+ weight_data = state_dict[f'model.layers.{i}.mlp.gate_proj.weight.data']
194
+ weight_quant_state = state_dict[f'model.layers.{i}.mlp.gate_proj.weight.quant_state']
195
+ model.model.layers[i].mlp.gate_proj.weight = Params4bit(weight_data, requires_grad=False, quant_state=weight_quant_state)
196
+
197
+ weight_data = state_dict[f'model.layers.{i}.mlp.up_proj.weight.data']
198
+ weight_quant_state = state_dict[f'model.layers.{i}.mlp.up_proj.weight.quant_state']
199
+ model.model.layers[i].mlp.up_proj.weight = Params4bit(weight_data, requires_grad=False, quant_state=weight_quant_state)
200
+
201
+ weight_data = state_dict[f'model.layers.{i}.mlp.down_proj.weight.data']
202
+ weight_quant_state = state_dict[f'model.layers.{i}.mlp.down_proj.weight.quant_state']
203
+ model.model.layers[i].mlp.down_proj.weight = Params4bit(weight_data, requires_grad=False, quant_state=weight_quant_state)
204
+
205
+ model.model.layers[i].input_layernorm.weight = state_dict[f'model.layers.{i}.input_layernorm.weight']
206
+ model.model.layers[i].post_attention_layernorm.weight = state_dict[f'model.layers.{i}.post_attention_layernorm.weight']
207
+
208
+ model.model.embed_tokens.weight = state_dict['model.embed_tokens.weight']
209
+ model.model.norm.weight = state_dict['model.norm.weight']
210
+ model.lm_head.weight = state_dict['lm_head.weight']
211
+ return model
rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4547d25b82ba64d9faa267de2e504b4ea84528cc19f0cc94c349c2b971e9872
3
+ size 21623
rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f22fa4a1570431c4194cf7b615c4d2f7a8906210d284301d228215bee88181b3
3
+ size 21623
rng_state_2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da027964f40fd57685b85fd951af2b40686c88769ac372724aef8f4394c30560
3
+ size 21623
rng_state_3.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:adb3731b987e36248fb79ac21dbe0840d4cb8ae55603151838c7bbf0ff64dc3c
3
+ size 21623
rng_state_4.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8762ee183e1560a34b62be47800a29fc56ff6a290d451e8ebe90eecd4a38199e
3
+ size 21623
rng_state_5.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:63dfa85f80f60513066f18021a3be35cf5bbd7789513512a5c690256d110a741
3
+ size 21623
rng_state_6.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:454f8ce5599b4fcef2a91bbccbd18127a853e3ef0c511b43360421006b5deb96
3
+ size 21623
rng_state_7.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:88b8ed012685f65992f02156e2bbdddae6eadf3754967bcaa9b0b7897e9f1c4f
3
+ size 21623
special_tokens_map.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<reserved_108>",
4
+ "<reserved_109>",
5
+ "<reserved_110>"
6
+ ],
7
+ "bos_token": {
8
+ "content": "<s>",
9
+ "lstrip": false,
10
+ "normalized": true,
11
+ "rstrip": false,
12
+ "single_word": true
13
+ },
14
+ "eos_token": {
15
+ "content": "</s>",
16
+ "lstrip": false,
17
+ "normalized": true,
18
+ "rstrip": false,
19
+ "single_word": true
20
+ },
21
+ "pad_token": {
22
+ "content": "<unk>",
23
+ "lstrip": false,
24
+ "normalized": true,
25
+ "rstrip": false,
26
+ "single_word": true
27
+ },
28
+ "unk_token": {
29
+ "content": "<unk>",
30
+ "lstrip": false,
31
+ "normalized": true,
32
+ "rstrip": false,
33
+ "single_word": true
34
+ }
35
+ }
tokenization_baichuan.py ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2023, Baichuan Intelligent Technology. All rights reserved.
2
+
3
+ import os
4
+ from shutil import copyfile
5
+ from typing import Any, Dict, List, Optional, Tuple
6
+
7
+ import sentencepiece as spm
8
+ from transformers.tokenization_utils import AddedToken, PreTrainedTokenizer
9
+ from transformers.utils import logging
10
+
11
+
12
+ logger = logging.get_logger(__name__)
13
+
14
+ VOCAB_FILES_NAMES = {"vocab_file": "tokenizer.model"}
15
+
16
+ PRETRAINED_VOCAB_FILES_MAP = {
17
+ "vocab_file": {},
18
+ "tokenizer_file": {},
19
+ }
20
+ PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {}
21
+
22
+
23
+ class BaichuanTokenizer(PreTrainedTokenizer):
24
+ """
25
+ Construct a Baichuan tokenizer. Based on byte-level Byte-Pair-Encoding.
26
+
27
+ Args:
28
+ vocab_file (`str`):
29
+ Path to the vocabulary file.
30
+ """
31
+
32
+ vocab_files_names = VOCAB_FILES_NAMES
33
+ pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
34
+ max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
35
+ model_input_names = ["input_ids", "attention_mask"]
36
+
37
+ def __init__(
38
+ self,
39
+ vocab_file,
40
+ unk_token="<unk>",
41
+ bos_token="<s>",
42
+ eos_token="</s>",
43
+ pad_token=None,
44
+ sp_model_kwargs: Optional[Dict[str, Any]] = None,
45
+ add_bos_token=True,
46
+ add_eos_token=False,
47
+ clean_up_tokenization_spaces=False,
48
+ **kwargs,
49
+ ):
50
+ self.sp_model_kwargs = {} if sp_model_kwargs is None else sp_model_kwargs
51
+ bos_token = (
52
+ AddedToken(bos_token, lstrip=False, rstrip=False)
53
+ if isinstance(bos_token, str)
54
+ else bos_token
55
+ )
56
+ eos_token = (
57
+ AddedToken(eos_token, lstrip=False, rstrip=False)
58
+ if isinstance(eos_token, str)
59
+ else eos_token
60
+ )
61
+ unk_token = (
62
+ AddedToken(unk_token, lstrip=False, rstrip=False)
63
+ if isinstance(unk_token, str)
64
+ else unk_token
65
+ )
66
+ pad_token = (
67
+ AddedToken(pad_token, lstrip=False, rstrip=False)
68
+ if isinstance(pad_token, str)
69
+ else pad_token
70
+ )
71
+ super().__init__(
72
+ bos_token=bos_token,
73
+ eos_token=eos_token,
74
+ unk_token=unk_token,
75
+ pad_token=pad_token,
76
+ add_bos_token=add_bos_token,
77
+ add_eos_token=add_eos_token,
78
+ sp_model_kwargs=self.sp_model_kwargs,
79
+ clean_up_tokenization_spaces=clean_up_tokenization_spaces,
80
+ **kwargs,
81
+ )
82
+ self.vocab_file = vocab_file
83
+ self.add_bos_token = add_bos_token
84
+ self.add_eos_token = add_eos_token
85
+ self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
86
+ self.sp_model.Load(vocab_file)
87
+
88
+ def __getstate__(self):
89
+ state = self.__dict__.copy()
90
+ state["sp_model"] = None
91
+ return state
92
+
93
+ def __setstate__(self, d):
94
+ self.__dict__ = d
95
+ self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
96
+ self.sp_model.Load(self.vocab_file)
97
+
98
+ @property
99
+ def vocab_size(self):
100
+ """Returns vocab size"""
101
+ return self.sp_model.get_piece_size()
102
+
103
+ def get_vocab(self):
104
+ """Returns vocab as a dict"""
105
+ vocab = {self.convert_ids_to_tokens(i): i for i in range(self.vocab_size)}
106
+ vocab.update(self.added_tokens_encoder)
107
+ return vocab
108
+
109
+ def _tokenize(self, text):
110
+ """Returns a tokenized string."""
111
+ return self.sp_model.encode(text, out_type=str)
112
+
113
+ def _convert_token_to_id(self, token):
114
+ """Converts a token (str) in an id using the vocab."""
115
+ return self.sp_model.piece_to_id(token)
116
+
117
+ def _convert_id_to_token(self, index):
118
+ """Converts an index (integer) in a token (str) using the vocab."""
119
+ token = self.sp_model.IdToPiece(index)
120
+ return token
121
+
122
+ def convert_tokens_to_string(self, tokens):
123
+ """Converts a sequence of tokens (string) in a single string."""
124
+ current_sub_tokens = []
125
+ out_string = ""
126
+ prev_is_special = False
127
+ for i, token in enumerate(tokens):
128
+ # make sure that special tokens are not decoded using sentencepiece model
129
+ if token in self.all_special_tokens:
130
+ if not prev_is_special and i != 0:
131
+ out_string += " "
132
+ out_string += self.sp_model.decode(current_sub_tokens) + token
133
+ prev_is_special = True
134
+ current_sub_tokens = []
135
+ else:
136
+ current_sub_tokens.append(token)
137
+ prev_is_special = False
138
+ out_string += self.sp_model.decode(current_sub_tokens)
139
+ return out_string
140
+
141
+ def save_vocabulary(
142
+ self, save_directory, filename_prefix: Optional[str] = None
143
+ ) -> Tuple[str]:
144
+ """
145
+ Save the vocabulary and special tokens file to a directory.
146
+
147
+ Args:
148
+ save_directory (`str`):
149
+ The directory in which to save the vocabulary.
150
+
151
+ Returns:
152
+ `Tuple(str)`: Paths to the files saved.
153
+ """
154
+ if not os.path.isdir(save_directory):
155
+ logger.error(f"Vocabulary path ({save_directory}) should be a directory")
156
+ return
157
+ out_vocab_file = os.path.join(
158
+ save_directory,
159
+ (filename_prefix + "-" if filename_prefix else "")
160
+ + VOCAB_FILES_NAMES["vocab_file"],
161
+ )
162
+
163
+ if os.path.abspath(self.vocab_file) != os.path.abspath(
164
+ out_vocab_file
165
+ ) and os.path.isfile(self.vocab_file):
166
+ copyfile(self.vocab_file, out_vocab_file)
167
+ elif not os.path.isfile(self.vocab_file):
168
+ with open(out_vocab_file, "wb") as fi:
169
+ content_spiece_model = self.sp_model.serialized_model_proto()
170
+ fi.write(content_spiece_model)
171
+
172
+ return (out_vocab_file,)
173
+
174
+ def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None):
175
+ bos_token_id = [self.bos_token_id] if self.add_bos_token else []
176
+ eos_token_id = [self.eos_token_id] if self.add_eos_token else []
177
+
178
+ output = bos_token_id + token_ids_0 + eos_token_id
179
+
180
+ if token_ids_1 is not None:
181
+ output = output + bos_token_id + token_ids_1 + eos_token_id
182
+
183
+ return output
184
+
185
+ def get_special_tokens_mask(
186
+ self,
187
+ token_ids_0: List[int],
188
+ token_ids_1: Optional[List[int]] = None,
189
+ already_has_special_tokens: bool = False,
190
+ ) -> List[int]:
191
+ """
192
+ Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
193
+ special tokens using the tokenizer `prepare_for_model` method.
194
+
195
+ Args:
196
+ token_ids_0 (`List[int]`):
197
+ List of IDs.
198
+ token_ids_1 (`List[int]`, *optional*):
199
+ Optional second list of IDs for sequence pairs.
200
+ already_has_special_tokens (`bool`, *optional*, defaults to `False`):
201
+ Whether or not the token list is already formatted with special tokens for the model.
202
+
203
+ Returns:
204
+ `List[int]`: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.
205
+ """
206
+ if already_has_special_tokens:
207
+ return super().get_special_tokens_mask(
208
+ token_ids_0=token_ids_0,
209
+ token_ids_1=token_ids_1,
210
+ already_has_special_tokens=True,
211
+ )
212
+
213
+ bos_token_id = [1] if self.add_bos_token else []
214
+ eos_token_id = [1] if self.add_eos_token else []
215
+
216
+ if token_ids_1 is None:
217
+ return bos_token_id + ([0] * len(token_ids_0)) + eos_token_id
218
+ return (
219
+ bos_token_id
220
+ + ([0] * len(token_ids_0))
221
+ + eos_token_id
222
+ + bos_token_id
223
+ + ([0] * len(token_ids_1))
224
+ + eos_token_id
225
+ )
226
+
227
+ def create_token_type_ids_from_sequences(
228
+ self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
229
+ ) -> List[int]:
230
+ """
231
+ Creates a mask from the two sequences passed to be used in a sequence-pair classification task. An ALBERT
232
+ sequence pair mask has the following format:
233
+
234
+ ```
235
+ 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
236
+ | first sequence | second sequence |
237
+ ```
238
+
239
+ if token_ids_1 is None, only returns the first portion of the mask (0s).
240
+
241
+ Args:
242
+ token_ids_0 (`List[int]`):
243
+ List of ids.
244
+ token_ids_1 (`List[int]`, *optional*):
245
+ Optional second list of IDs for sequence pairs.
246
+
247
+ Returns:
248
+ `List[int]`: List of [token type IDs](../glossary#token-type-ids) according to the given sequence(s).
249
+ """
250
+ bos_token_id = [self.bos_token_id] if self.add_bos_token else []
251
+ eos_token_id = [self.eos_token_id] if self.add_eos_token else []
252
+
253
+ output = [0] * len(bos_token_id + token_ids_0 + eos_token_id)
254
+
255
+ if token_ids_1 is not None:
256
+ output += [1] * len(bos_token_id + token_ids_1 + eos_token_id)
257
+
258
+ return output
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:79452955be6b419a65984273a9f08af86042e1c2a75ee3ba989cbf620a133cc2
3
+ size 2001107
tokenizer_config.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_eos_token": false,
4
+ "auto_map": {
5
+ "AutoTokenizer": [
6
+ "tokenization_baichuan.BaichuanTokenizer",
7
+ null
8
+ ]
9
+ },
10
+ "bos_token": {
11
+ "__type": "AddedToken",
12
+ "content": "<s>",
13
+ "lstrip": false,
14
+ "normalized": true,
15
+ "rstrip": false,
16
+ "single_word": true
17
+ },
18
+ "clean_up_tokenization_spaces": false,
19
+ "eos_token": {
20
+ "__type": "AddedToken",
21
+ "content": "</s>",
22
+ "lstrip": false,
23
+ "normalized": true,
24
+ "rstrip": false,
25
+ "single_word": true
26
+ },
27
+ "model_max_length": 4096,
28
+ "pad_token": {
29
+ "__type": "AddedToken",
30
+ "content": "<unk>",
31
+ "lstrip": false,
32
+ "normalized": true,
33
+ "rstrip": false,
34
+ "single_word": true
35
+ },
36
+ "sp_model_kwargs": {},
37
+ "tokenizer_class": "BaichuanTokenizer",
38
+ "unk_token": {
39
+ "__type": "AddedToken",
40
+ "content": "<unk>",
41
+ "lstrip": false,
42
+ "normalized": true,
43
+ "rstrip": false,
44
+ "single_word": true
45
+ }
46
+ }
trainer_state.json ADDED
@@ -0,0 +1,3606 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 4.0,
5
+ "global_step": 5930,
6
+ "is_hyper_param_search": false,
7
+ "is_local_process_zero": true,
8
+ "is_world_process_zero": true,
9
+ "log_history": [
10
+ {
11
+ "epoch": 0.01,
12
+ "learning_rate": 9.995951417004049e-06,
13
+ "loss": 4.0911,
14
+ "step": 10
15
+ },
16
+ {
17
+ "epoch": 0.01,
18
+ "learning_rate": 9.991902834008098e-06,
19
+ "loss": 2.8012,
20
+ "step": 20
21
+ },
22
+ {
23
+ "epoch": 0.02,
24
+ "learning_rate": 9.987854251012146e-06,
25
+ "loss": 2.389,
26
+ "step": 30
27
+ },
28
+ {
29
+ "epoch": 0.03,
30
+ "learning_rate": 9.983805668016194e-06,
31
+ "loss": 2.1658,
32
+ "step": 40
33
+ },
34
+ {
35
+ "epoch": 0.03,
36
+ "learning_rate": 9.979757085020244e-06,
37
+ "loss": 2.026,
38
+ "step": 50
39
+ },
40
+ {
41
+ "epoch": 0.04,
42
+ "learning_rate": 9.975708502024292e-06,
43
+ "loss": 1.7846,
44
+ "step": 60
45
+ },
46
+ {
47
+ "epoch": 0.05,
48
+ "learning_rate": 9.971659919028341e-06,
49
+ "loss": 1.703,
50
+ "step": 70
51
+ },
52
+ {
53
+ "epoch": 0.05,
54
+ "learning_rate": 9.96761133603239e-06,
55
+ "loss": 1.5691,
56
+ "step": 80
57
+ },
58
+ {
59
+ "epoch": 0.06,
60
+ "learning_rate": 9.963562753036437e-06,
61
+ "loss": 1.4297,
62
+ "step": 90
63
+ },
64
+ {
65
+ "epoch": 0.07,
66
+ "learning_rate": 9.959514170040487e-06,
67
+ "loss": 1.4341,
68
+ "step": 100
69
+ },
70
+ {
71
+ "epoch": 0.07,
72
+ "learning_rate": 9.955465587044535e-06,
73
+ "loss": 1.3304,
74
+ "step": 110
75
+ },
76
+ {
77
+ "epoch": 0.08,
78
+ "learning_rate": 9.951417004048583e-06,
79
+ "loss": 1.3988,
80
+ "step": 120
81
+ },
82
+ {
83
+ "epoch": 0.09,
84
+ "learning_rate": 9.947368421052632e-06,
85
+ "loss": 1.3272,
86
+ "step": 130
87
+ },
88
+ {
89
+ "epoch": 0.09,
90
+ "learning_rate": 9.943319838056682e-06,
91
+ "loss": 1.2999,
92
+ "step": 140
93
+ },
94
+ {
95
+ "epoch": 0.1,
96
+ "learning_rate": 9.93927125506073e-06,
97
+ "loss": 1.2997,
98
+ "step": 150
99
+ },
100
+ {
101
+ "epoch": 0.11,
102
+ "learning_rate": 9.935222672064778e-06,
103
+ "loss": 1.3704,
104
+ "step": 160
105
+ },
106
+ {
107
+ "epoch": 0.11,
108
+ "learning_rate": 9.931174089068828e-06,
109
+ "loss": 1.3313,
110
+ "step": 170
111
+ },
112
+ {
113
+ "epoch": 0.12,
114
+ "learning_rate": 9.927125506072876e-06,
115
+ "loss": 1.3554,
116
+ "step": 180
117
+ },
118
+ {
119
+ "epoch": 0.13,
120
+ "learning_rate": 9.923076923076923e-06,
121
+ "loss": 1.41,
122
+ "step": 190
123
+ },
124
+ {
125
+ "epoch": 0.13,
126
+ "learning_rate": 9.919028340080973e-06,
127
+ "loss": 1.3005,
128
+ "step": 200
129
+ },
130
+ {
131
+ "epoch": 0.14,
132
+ "learning_rate": 9.914979757085021e-06,
133
+ "loss": 1.2311,
134
+ "step": 210
135
+ },
136
+ {
137
+ "epoch": 0.15,
138
+ "learning_rate": 9.910931174089069e-06,
139
+ "loss": 1.3162,
140
+ "step": 220
141
+ },
142
+ {
143
+ "epoch": 0.16,
144
+ "learning_rate": 9.906882591093119e-06,
145
+ "loss": 1.2895,
146
+ "step": 230
147
+ },
148
+ {
149
+ "epoch": 0.16,
150
+ "learning_rate": 9.902834008097167e-06,
151
+ "loss": 1.2812,
152
+ "step": 240
153
+ },
154
+ {
155
+ "epoch": 0.17,
156
+ "learning_rate": 9.898785425101216e-06,
157
+ "loss": 1.2682,
158
+ "step": 250
159
+ },
160
+ {
161
+ "epoch": 0.18,
162
+ "learning_rate": 9.894736842105264e-06,
163
+ "loss": 1.2992,
164
+ "step": 260
165
+ },
166
+ {
167
+ "epoch": 0.18,
168
+ "learning_rate": 9.890688259109312e-06,
169
+ "loss": 1.2832,
170
+ "step": 270
171
+ },
172
+ {
173
+ "epoch": 0.19,
174
+ "learning_rate": 9.886639676113362e-06,
175
+ "loss": 1.2912,
176
+ "step": 280
177
+ },
178
+ {
179
+ "epoch": 0.2,
180
+ "learning_rate": 9.88259109311741e-06,
181
+ "loss": 1.2949,
182
+ "step": 290
183
+ },
184
+ {
185
+ "epoch": 0.2,
186
+ "learning_rate": 9.878542510121458e-06,
187
+ "loss": 1.2557,
188
+ "step": 300
189
+ },
190
+ {
191
+ "epoch": 0.21,
192
+ "learning_rate": 9.874493927125507e-06,
193
+ "loss": 1.3119,
194
+ "step": 310
195
+ },
196
+ {
197
+ "epoch": 0.22,
198
+ "learning_rate": 9.870445344129555e-06,
199
+ "loss": 1.3092,
200
+ "step": 320
201
+ },
202
+ {
203
+ "epoch": 0.22,
204
+ "learning_rate": 9.866396761133603e-06,
205
+ "loss": 1.2441,
206
+ "step": 330
207
+ },
208
+ {
209
+ "epoch": 0.23,
210
+ "learning_rate": 9.862348178137653e-06,
211
+ "loss": 1.3288,
212
+ "step": 340
213
+ },
214
+ {
215
+ "epoch": 0.24,
216
+ "learning_rate": 9.8582995951417e-06,
217
+ "loss": 1.2382,
218
+ "step": 350
219
+ },
220
+ {
221
+ "epoch": 0.24,
222
+ "learning_rate": 9.85425101214575e-06,
223
+ "loss": 1.2819,
224
+ "step": 360
225
+ },
226
+ {
227
+ "epoch": 0.25,
228
+ "learning_rate": 9.850202429149798e-06,
229
+ "loss": 1.3011,
230
+ "step": 370
231
+ },
232
+ {
233
+ "epoch": 0.26,
234
+ "learning_rate": 9.846153846153846e-06,
235
+ "loss": 1.2421,
236
+ "step": 380
237
+ },
238
+ {
239
+ "epoch": 0.26,
240
+ "learning_rate": 9.842105263157896e-06,
241
+ "loss": 1.2071,
242
+ "step": 390
243
+ },
244
+ {
245
+ "epoch": 0.27,
246
+ "learning_rate": 9.838056680161945e-06,
247
+ "loss": 1.2838,
248
+ "step": 400
249
+ },
250
+ {
251
+ "epoch": 0.28,
252
+ "learning_rate": 9.834008097165993e-06,
253
+ "loss": 1.298,
254
+ "step": 410
255
+ },
256
+ {
257
+ "epoch": 0.28,
258
+ "learning_rate": 9.829959514170041e-06,
259
+ "loss": 1.2867,
260
+ "step": 420
261
+ },
262
+ {
263
+ "epoch": 0.29,
264
+ "learning_rate": 9.825910931174091e-06,
265
+ "loss": 1.1868,
266
+ "step": 430
267
+ },
268
+ {
269
+ "epoch": 0.3,
270
+ "learning_rate": 9.821862348178139e-06,
271
+ "loss": 1.2263,
272
+ "step": 440
273
+ },
274
+ {
275
+ "epoch": 0.3,
276
+ "learning_rate": 9.817813765182187e-06,
277
+ "loss": 1.2701,
278
+ "step": 450
279
+ },
280
+ {
281
+ "epoch": 0.31,
282
+ "learning_rate": 9.813765182186236e-06,
283
+ "loss": 1.2542,
284
+ "step": 460
285
+ },
286
+ {
287
+ "epoch": 0.32,
288
+ "learning_rate": 9.809716599190284e-06,
289
+ "loss": 1.2833,
290
+ "step": 470
291
+ },
292
+ {
293
+ "epoch": 0.32,
294
+ "learning_rate": 9.805668016194332e-06,
295
+ "loss": 1.2109,
296
+ "step": 480
297
+ },
298
+ {
299
+ "epoch": 0.33,
300
+ "learning_rate": 9.801619433198382e-06,
301
+ "loss": 1.2657,
302
+ "step": 490
303
+ },
304
+ {
305
+ "epoch": 0.34,
306
+ "learning_rate": 9.79757085020243e-06,
307
+ "loss": 1.2587,
308
+ "step": 500
309
+ },
310
+ {
311
+ "epoch": 0.34,
312
+ "learning_rate": 9.79352226720648e-06,
313
+ "loss": 1.2647,
314
+ "step": 510
315
+ },
316
+ {
317
+ "epoch": 0.35,
318
+ "learning_rate": 9.789473684210527e-06,
319
+ "loss": 1.1917,
320
+ "step": 520
321
+ },
322
+ {
323
+ "epoch": 0.36,
324
+ "learning_rate": 9.785425101214575e-06,
325
+ "loss": 1.2281,
326
+ "step": 530
327
+ },
328
+ {
329
+ "epoch": 0.36,
330
+ "learning_rate": 9.781376518218625e-06,
331
+ "loss": 1.2677,
332
+ "step": 540
333
+ },
334
+ {
335
+ "epoch": 0.37,
336
+ "learning_rate": 9.777327935222673e-06,
337
+ "loss": 1.2299,
338
+ "step": 550
339
+ },
340
+ {
341
+ "epoch": 0.38,
342
+ "learning_rate": 9.77327935222672e-06,
343
+ "loss": 1.2524,
344
+ "step": 560
345
+ },
346
+ {
347
+ "epoch": 0.38,
348
+ "learning_rate": 9.76923076923077e-06,
349
+ "loss": 1.2902,
350
+ "step": 570
351
+ },
352
+ {
353
+ "epoch": 0.39,
354
+ "learning_rate": 9.765182186234818e-06,
355
+ "loss": 1.2603,
356
+ "step": 580
357
+ },
358
+ {
359
+ "epoch": 0.4,
360
+ "learning_rate": 9.761133603238866e-06,
361
+ "loss": 1.2572,
362
+ "step": 590
363
+ },
364
+ {
365
+ "epoch": 0.4,
366
+ "learning_rate": 9.757085020242916e-06,
367
+ "loss": 1.2223,
368
+ "step": 600
369
+ },
370
+ {
371
+ "epoch": 0.41,
372
+ "learning_rate": 9.753036437246964e-06,
373
+ "loss": 1.2284,
374
+ "step": 610
375
+ },
376
+ {
377
+ "epoch": 0.42,
378
+ "learning_rate": 9.748987854251012e-06,
379
+ "loss": 1.2331,
380
+ "step": 620
381
+ },
382
+ {
383
+ "epoch": 0.42,
384
+ "learning_rate": 9.744939271255061e-06,
385
+ "loss": 1.2601,
386
+ "step": 630
387
+ },
388
+ {
389
+ "epoch": 0.43,
390
+ "learning_rate": 9.74089068825911e-06,
391
+ "loss": 1.195,
392
+ "step": 640
393
+ },
394
+ {
395
+ "epoch": 0.44,
396
+ "learning_rate": 9.736842105263159e-06,
397
+ "loss": 1.2176,
398
+ "step": 650
399
+ },
400
+ {
401
+ "epoch": 0.45,
402
+ "learning_rate": 9.732793522267207e-06,
403
+ "loss": 1.2684,
404
+ "step": 660
405
+ },
406
+ {
407
+ "epoch": 0.45,
408
+ "learning_rate": 9.728744939271257e-06,
409
+ "loss": 1.2575,
410
+ "step": 670
411
+ },
412
+ {
413
+ "epoch": 0.46,
414
+ "learning_rate": 9.724696356275305e-06,
415
+ "loss": 1.2187,
416
+ "step": 680
417
+ },
418
+ {
419
+ "epoch": 0.47,
420
+ "learning_rate": 9.720647773279354e-06,
421
+ "loss": 1.2184,
422
+ "step": 690
423
+ },
424
+ {
425
+ "epoch": 0.47,
426
+ "learning_rate": 9.716599190283402e-06,
427
+ "loss": 1.282,
428
+ "step": 700
429
+ },
430
+ {
431
+ "epoch": 0.48,
432
+ "learning_rate": 9.71255060728745e-06,
433
+ "loss": 1.2464,
434
+ "step": 710
435
+ },
436
+ {
437
+ "epoch": 0.49,
438
+ "learning_rate": 9.7085020242915e-06,
439
+ "loss": 1.2041,
440
+ "step": 720
441
+ },
442
+ {
443
+ "epoch": 0.49,
444
+ "learning_rate": 9.704453441295548e-06,
445
+ "loss": 1.26,
446
+ "step": 730
447
+ },
448
+ {
449
+ "epoch": 0.5,
450
+ "learning_rate": 9.700404858299596e-06,
451
+ "loss": 1.2401,
452
+ "step": 740
453
+ },
454
+ {
455
+ "epoch": 0.51,
456
+ "learning_rate": 9.696356275303645e-06,
457
+ "loss": 1.2289,
458
+ "step": 750
459
+ },
460
+ {
461
+ "epoch": 0.51,
462
+ "learning_rate": 9.692307692307693e-06,
463
+ "loss": 1.2587,
464
+ "step": 760
465
+ },
466
+ {
467
+ "epoch": 0.52,
468
+ "learning_rate": 9.688259109311741e-06,
469
+ "loss": 1.2078,
470
+ "step": 770
471
+ },
472
+ {
473
+ "epoch": 0.53,
474
+ "learning_rate": 9.68421052631579e-06,
475
+ "loss": 1.192,
476
+ "step": 780
477
+ },
478
+ {
479
+ "epoch": 0.53,
480
+ "learning_rate": 9.680161943319839e-06,
481
+ "loss": 1.2981,
482
+ "step": 790
483
+ },
484
+ {
485
+ "epoch": 0.54,
486
+ "learning_rate": 9.676113360323888e-06,
487
+ "loss": 1.1942,
488
+ "step": 800
489
+ },
490
+ {
491
+ "epoch": 0.55,
492
+ "learning_rate": 9.672064777327936e-06,
493
+ "loss": 1.247,
494
+ "step": 810
495
+ },
496
+ {
497
+ "epoch": 0.55,
498
+ "learning_rate": 9.668016194331984e-06,
499
+ "loss": 1.1902,
500
+ "step": 820
501
+ },
502
+ {
503
+ "epoch": 0.56,
504
+ "learning_rate": 9.663967611336034e-06,
505
+ "loss": 1.2271,
506
+ "step": 830
507
+ },
508
+ {
509
+ "epoch": 0.57,
510
+ "learning_rate": 9.659919028340082e-06,
511
+ "loss": 1.2407,
512
+ "step": 840
513
+ },
514
+ {
515
+ "epoch": 0.57,
516
+ "learning_rate": 9.65587044534413e-06,
517
+ "loss": 1.2067,
518
+ "step": 850
519
+ },
520
+ {
521
+ "epoch": 0.58,
522
+ "learning_rate": 9.65182186234818e-06,
523
+ "loss": 1.2284,
524
+ "step": 860
525
+ },
526
+ {
527
+ "epoch": 0.59,
528
+ "learning_rate": 9.647773279352227e-06,
529
+ "loss": 1.2676,
530
+ "step": 870
531
+ },
532
+ {
533
+ "epoch": 0.59,
534
+ "learning_rate": 9.643724696356275e-06,
535
+ "loss": 1.2542,
536
+ "step": 880
537
+ },
538
+ {
539
+ "epoch": 0.6,
540
+ "learning_rate": 9.639676113360325e-06,
541
+ "loss": 1.2364,
542
+ "step": 890
543
+ },
544
+ {
545
+ "epoch": 0.61,
546
+ "learning_rate": 9.635627530364373e-06,
547
+ "loss": 1.3608,
548
+ "step": 900
549
+ },
550
+ {
551
+ "epoch": 0.61,
552
+ "learning_rate": 9.63157894736842e-06,
553
+ "loss": 1.2739,
554
+ "step": 910
555
+ },
556
+ {
557
+ "epoch": 0.62,
558
+ "learning_rate": 9.62753036437247e-06,
559
+ "loss": 1.1984,
560
+ "step": 920
561
+ },
562
+ {
563
+ "epoch": 0.63,
564
+ "learning_rate": 9.62348178137652e-06,
565
+ "loss": 1.1875,
566
+ "step": 930
567
+ },
568
+ {
569
+ "epoch": 0.63,
570
+ "learning_rate": 9.619433198380568e-06,
571
+ "loss": 1.2447,
572
+ "step": 940
573
+ },
574
+ {
575
+ "epoch": 0.64,
576
+ "learning_rate": 9.615384615384616e-06,
577
+ "loss": 1.26,
578
+ "step": 950
579
+ },
580
+ {
581
+ "epoch": 0.65,
582
+ "learning_rate": 9.611336032388665e-06,
583
+ "loss": 1.2059,
584
+ "step": 960
585
+ },
586
+ {
587
+ "epoch": 0.65,
588
+ "learning_rate": 9.607287449392713e-06,
589
+ "loss": 1.233,
590
+ "step": 970
591
+ },
592
+ {
593
+ "epoch": 0.66,
594
+ "learning_rate": 9.603238866396763e-06,
595
+ "loss": 1.244,
596
+ "step": 980
597
+ },
598
+ {
599
+ "epoch": 0.67,
600
+ "learning_rate": 9.59919028340081e-06,
601
+ "loss": 1.2613,
602
+ "step": 990
603
+ },
604
+ {
605
+ "epoch": 0.67,
606
+ "learning_rate": 9.595141700404859e-06,
607
+ "loss": 1.2274,
608
+ "step": 1000
609
+ },
610
+ {
611
+ "epoch": 0.68,
612
+ "learning_rate": 9.591093117408908e-06,
613
+ "loss": 1.2727,
614
+ "step": 1010
615
+ },
616
+ {
617
+ "epoch": 0.69,
618
+ "learning_rate": 9.587044534412956e-06,
619
+ "loss": 1.2834,
620
+ "step": 1020
621
+ },
622
+ {
623
+ "epoch": 0.69,
624
+ "learning_rate": 9.582995951417004e-06,
625
+ "loss": 1.259,
626
+ "step": 1030
627
+ },
628
+ {
629
+ "epoch": 0.7,
630
+ "learning_rate": 9.578947368421054e-06,
631
+ "loss": 1.2742,
632
+ "step": 1040
633
+ },
634
+ {
635
+ "epoch": 0.71,
636
+ "learning_rate": 9.574898785425102e-06,
637
+ "loss": 1.2658,
638
+ "step": 1050
639
+ },
640
+ {
641
+ "epoch": 0.72,
642
+ "learning_rate": 9.57085020242915e-06,
643
+ "loss": 1.2203,
644
+ "step": 1060
645
+ },
646
+ {
647
+ "epoch": 0.72,
648
+ "learning_rate": 9.5668016194332e-06,
649
+ "loss": 1.1757,
650
+ "step": 1070
651
+ },
652
+ {
653
+ "epoch": 0.73,
654
+ "learning_rate": 9.562753036437247e-06,
655
+ "loss": 1.2296,
656
+ "step": 1080
657
+ },
658
+ {
659
+ "epoch": 0.74,
660
+ "learning_rate": 9.558704453441297e-06,
661
+ "loss": 1.2714,
662
+ "step": 1090
663
+ },
664
+ {
665
+ "epoch": 0.74,
666
+ "learning_rate": 9.554655870445345e-06,
667
+ "loss": 1.2265,
668
+ "step": 1100
669
+ },
670
+ {
671
+ "epoch": 0.75,
672
+ "learning_rate": 9.550607287449393e-06,
673
+ "loss": 1.1984,
674
+ "step": 1110
675
+ },
676
+ {
677
+ "epoch": 0.76,
678
+ "learning_rate": 9.546558704453442e-06,
679
+ "loss": 1.2706,
680
+ "step": 1120
681
+ },
682
+ {
683
+ "epoch": 0.76,
684
+ "learning_rate": 9.54251012145749e-06,
685
+ "loss": 1.2611,
686
+ "step": 1130
687
+ },
688
+ {
689
+ "epoch": 0.77,
690
+ "learning_rate": 9.538461538461538e-06,
691
+ "loss": 1.2584,
692
+ "step": 1140
693
+ },
694
+ {
695
+ "epoch": 0.78,
696
+ "learning_rate": 9.534412955465588e-06,
697
+ "loss": 1.2849,
698
+ "step": 1150
699
+ },
700
+ {
701
+ "epoch": 0.78,
702
+ "learning_rate": 9.530364372469636e-06,
703
+ "loss": 1.2254,
704
+ "step": 1160
705
+ },
706
+ {
707
+ "epoch": 0.79,
708
+ "learning_rate": 9.526315789473686e-06,
709
+ "loss": 1.2698,
710
+ "step": 1170
711
+ },
712
+ {
713
+ "epoch": 0.8,
714
+ "learning_rate": 9.522267206477733e-06,
715
+ "loss": 1.2037,
716
+ "step": 1180
717
+ },
718
+ {
719
+ "epoch": 0.8,
720
+ "learning_rate": 9.518218623481783e-06,
721
+ "loss": 1.2408,
722
+ "step": 1190
723
+ },
724
+ {
725
+ "epoch": 0.81,
726
+ "learning_rate": 9.514170040485831e-06,
727
+ "loss": 1.2116,
728
+ "step": 1200
729
+ },
730
+ {
731
+ "epoch": 0.82,
732
+ "learning_rate": 9.510121457489879e-06,
733
+ "loss": 1.2393,
734
+ "step": 1210
735
+ },
736
+ {
737
+ "epoch": 0.82,
738
+ "learning_rate": 9.506072874493929e-06,
739
+ "loss": 1.2177,
740
+ "step": 1220
741
+ },
742
+ {
743
+ "epoch": 0.83,
744
+ "learning_rate": 9.502024291497977e-06,
745
+ "loss": 1.23,
746
+ "step": 1230
747
+ },
748
+ {
749
+ "epoch": 0.84,
750
+ "learning_rate": 9.497975708502026e-06,
751
+ "loss": 1.2245,
752
+ "step": 1240
753
+ },
754
+ {
755
+ "epoch": 0.84,
756
+ "learning_rate": 9.493927125506074e-06,
757
+ "loss": 1.2602,
758
+ "step": 1250
759
+ },
760
+ {
761
+ "epoch": 0.85,
762
+ "learning_rate": 9.489878542510122e-06,
763
+ "loss": 1.2017,
764
+ "step": 1260
765
+ },
766
+ {
767
+ "epoch": 0.86,
768
+ "learning_rate": 9.485829959514172e-06,
769
+ "loss": 1.2281,
770
+ "step": 1270
771
+ },
772
+ {
773
+ "epoch": 0.86,
774
+ "learning_rate": 9.48178137651822e-06,
775
+ "loss": 1.2808,
776
+ "step": 1280
777
+ },
778
+ {
779
+ "epoch": 0.87,
780
+ "learning_rate": 9.477732793522268e-06,
781
+ "loss": 1.2017,
782
+ "step": 1290
783
+ },
784
+ {
785
+ "epoch": 0.88,
786
+ "learning_rate": 9.473684210526317e-06,
787
+ "loss": 1.2557,
788
+ "step": 1300
789
+ },
790
+ {
791
+ "epoch": 0.88,
792
+ "learning_rate": 9.469635627530365e-06,
793
+ "loss": 1.2952,
794
+ "step": 1310
795
+ },
796
+ {
797
+ "epoch": 0.89,
798
+ "learning_rate": 9.465587044534413e-06,
799
+ "loss": 1.2477,
800
+ "step": 1320
801
+ },
802
+ {
803
+ "epoch": 0.9,
804
+ "learning_rate": 9.461538461538463e-06,
805
+ "loss": 1.2397,
806
+ "step": 1330
807
+ },
808
+ {
809
+ "epoch": 0.9,
810
+ "learning_rate": 9.45748987854251e-06,
811
+ "loss": 1.1556,
812
+ "step": 1340
813
+ },
814
+ {
815
+ "epoch": 0.91,
816
+ "learning_rate": 9.453441295546559e-06,
817
+ "loss": 1.217,
818
+ "step": 1350
819
+ },
820
+ {
821
+ "epoch": 0.92,
822
+ "learning_rate": 9.449392712550608e-06,
823
+ "loss": 1.2725,
824
+ "step": 1360
825
+ },
826
+ {
827
+ "epoch": 0.92,
828
+ "learning_rate": 9.445344129554656e-06,
829
+ "loss": 1.2079,
830
+ "step": 1370
831
+ },
832
+ {
833
+ "epoch": 0.93,
834
+ "learning_rate": 9.441295546558706e-06,
835
+ "loss": 1.2646,
836
+ "step": 1380
837
+ },
838
+ {
839
+ "epoch": 0.94,
840
+ "learning_rate": 9.437246963562754e-06,
841
+ "loss": 1.2034,
842
+ "step": 1390
843
+ },
844
+ {
845
+ "epoch": 0.94,
846
+ "learning_rate": 9.433198380566802e-06,
847
+ "loss": 1.2442,
848
+ "step": 1400
849
+ },
850
+ {
851
+ "epoch": 0.95,
852
+ "learning_rate": 9.429149797570851e-06,
853
+ "loss": 1.2463,
854
+ "step": 1410
855
+ },
856
+ {
857
+ "epoch": 0.96,
858
+ "learning_rate": 9.4251012145749e-06,
859
+ "loss": 1.2257,
860
+ "step": 1420
861
+ },
862
+ {
863
+ "epoch": 0.96,
864
+ "learning_rate": 9.421052631578947e-06,
865
+ "loss": 1.2969,
866
+ "step": 1430
867
+ },
868
+ {
869
+ "epoch": 0.97,
870
+ "learning_rate": 9.417004048582997e-06,
871
+ "loss": 1.2288,
872
+ "step": 1440
873
+ },
874
+ {
875
+ "epoch": 0.98,
876
+ "learning_rate": 9.412955465587045e-06,
877
+ "loss": 1.2307,
878
+ "step": 1450
879
+ },
880
+ {
881
+ "epoch": 0.98,
882
+ "learning_rate": 9.408906882591094e-06,
883
+ "loss": 1.2101,
884
+ "step": 1460
885
+ },
886
+ {
887
+ "epoch": 0.99,
888
+ "learning_rate": 9.404858299595142e-06,
889
+ "loss": 1.2009,
890
+ "step": 1470
891
+ },
892
+ {
893
+ "epoch": 1.0,
894
+ "learning_rate": 9.400809716599192e-06,
895
+ "loss": 1.2698,
896
+ "step": 1480
897
+ },
898
+ {
899
+ "epoch": 1.0,
900
+ "eval_loss": 1.1532880067825317,
901
+ "eval_runtime": 11.4194,
902
+ "eval_samples_per_second": 96.327,
903
+ "eval_steps_per_second": 12.085,
904
+ "step": 1482
905
+ },
906
+ {
907
+ "epoch": 1.01,
908
+ "learning_rate": 9.39676113360324e-06,
909
+ "loss": 1.1808,
910
+ "step": 1490
911
+ },
912
+ {
913
+ "epoch": 1.01,
914
+ "learning_rate": 9.392712550607288e-06,
915
+ "loss": 1.1629,
916
+ "step": 1500
917
+ },
918
+ {
919
+ "epoch": 1.02,
920
+ "learning_rate": 9.388663967611337e-06,
921
+ "loss": 1.1656,
922
+ "step": 1510
923
+ },
924
+ {
925
+ "epoch": 1.03,
926
+ "learning_rate": 9.384615384615385e-06,
927
+ "loss": 1.1163,
928
+ "step": 1520
929
+ },
930
+ {
931
+ "epoch": 1.03,
932
+ "learning_rate": 9.380566801619435e-06,
933
+ "loss": 1.1403,
934
+ "step": 1530
935
+ },
936
+ {
937
+ "epoch": 1.04,
938
+ "learning_rate": 9.376518218623483e-06,
939
+ "loss": 1.122,
940
+ "step": 1540
941
+ },
942
+ {
943
+ "epoch": 1.05,
944
+ "learning_rate": 9.37246963562753e-06,
945
+ "loss": 1.1426,
946
+ "step": 1550
947
+ },
948
+ {
949
+ "epoch": 1.05,
950
+ "learning_rate": 9.36842105263158e-06,
951
+ "loss": 1.1142,
952
+ "step": 1560
953
+ },
954
+ {
955
+ "epoch": 1.06,
956
+ "learning_rate": 9.364372469635628e-06,
957
+ "loss": 1.1143,
958
+ "step": 1570
959
+ },
960
+ {
961
+ "epoch": 1.07,
962
+ "learning_rate": 9.360323886639676e-06,
963
+ "loss": 1.1798,
964
+ "step": 1580
965
+ },
966
+ {
967
+ "epoch": 1.07,
968
+ "learning_rate": 9.356275303643726e-06,
969
+ "loss": 1.1575,
970
+ "step": 1590
971
+ },
972
+ {
973
+ "epoch": 1.08,
974
+ "learning_rate": 9.352226720647774e-06,
975
+ "loss": 1.1459,
976
+ "step": 1600
977
+ },
978
+ {
979
+ "epoch": 1.09,
980
+ "learning_rate": 9.348178137651822e-06,
981
+ "loss": 1.199,
982
+ "step": 1610
983
+ },
984
+ {
985
+ "epoch": 1.09,
986
+ "learning_rate": 9.344129554655871e-06,
987
+ "loss": 1.1568,
988
+ "step": 1620
989
+ },
990
+ {
991
+ "epoch": 1.1,
992
+ "learning_rate": 9.34008097165992e-06,
993
+ "loss": 1.1577,
994
+ "step": 1630
995
+ },
996
+ {
997
+ "epoch": 1.11,
998
+ "learning_rate": 9.336032388663967e-06,
999
+ "loss": 1.0549,
1000
+ "step": 1640
1001
+ },
1002
+ {
1003
+ "epoch": 1.11,
1004
+ "learning_rate": 9.331983805668017e-06,
1005
+ "loss": 1.1889,
1006
+ "step": 1650
1007
+ },
1008
+ {
1009
+ "epoch": 1.12,
1010
+ "learning_rate": 9.327935222672065e-06,
1011
+ "loss": 1.1355,
1012
+ "step": 1660
1013
+ },
1014
+ {
1015
+ "epoch": 1.13,
1016
+ "learning_rate": 9.323886639676115e-06,
1017
+ "loss": 1.1725,
1018
+ "step": 1670
1019
+ },
1020
+ {
1021
+ "epoch": 1.13,
1022
+ "learning_rate": 9.319838056680162e-06,
1023
+ "loss": 1.1096,
1024
+ "step": 1680
1025
+ },
1026
+ {
1027
+ "epoch": 1.14,
1028
+ "learning_rate": 9.315789473684212e-06,
1029
+ "loss": 1.2392,
1030
+ "step": 1690
1031
+ },
1032
+ {
1033
+ "epoch": 1.15,
1034
+ "learning_rate": 9.31174089068826e-06,
1035
+ "loss": 1.1508,
1036
+ "step": 1700
1037
+ },
1038
+ {
1039
+ "epoch": 1.15,
1040
+ "learning_rate": 9.30769230769231e-06,
1041
+ "loss": 1.1437,
1042
+ "step": 1710
1043
+ },
1044
+ {
1045
+ "epoch": 1.16,
1046
+ "learning_rate": 9.303643724696358e-06,
1047
+ "loss": 1.204,
1048
+ "step": 1720
1049
+ },
1050
+ {
1051
+ "epoch": 1.17,
1052
+ "learning_rate": 9.299595141700406e-06,
1053
+ "loss": 1.1795,
1054
+ "step": 1730
1055
+ },
1056
+ {
1057
+ "epoch": 1.17,
1058
+ "learning_rate": 9.295546558704455e-06,
1059
+ "loss": 1.112,
1060
+ "step": 1740
1061
+ },
1062
+ {
1063
+ "epoch": 1.18,
1064
+ "learning_rate": 9.291497975708503e-06,
1065
+ "loss": 1.2072,
1066
+ "step": 1750
1067
+ },
1068
+ {
1069
+ "epoch": 1.19,
1070
+ "learning_rate": 9.287449392712551e-06,
1071
+ "loss": 1.1518,
1072
+ "step": 1760
1073
+ },
1074
+ {
1075
+ "epoch": 1.19,
1076
+ "learning_rate": 9.2834008097166e-06,
1077
+ "loss": 1.1479,
1078
+ "step": 1770
1079
+ },
1080
+ {
1081
+ "epoch": 1.2,
1082
+ "learning_rate": 9.279352226720649e-06,
1083
+ "loss": 1.1183,
1084
+ "step": 1780
1085
+ },
1086
+ {
1087
+ "epoch": 1.21,
1088
+ "learning_rate": 9.275303643724697e-06,
1089
+ "loss": 1.1493,
1090
+ "step": 1790
1091
+ },
1092
+ {
1093
+ "epoch": 1.21,
1094
+ "learning_rate": 9.271255060728746e-06,
1095
+ "loss": 1.1603,
1096
+ "step": 1800
1097
+ },
1098
+ {
1099
+ "epoch": 1.22,
1100
+ "learning_rate": 9.267206477732794e-06,
1101
+ "loss": 1.186,
1102
+ "step": 1810
1103
+ },
1104
+ {
1105
+ "epoch": 1.23,
1106
+ "learning_rate": 9.263157894736844e-06,
1107
+ "loss": 1.1857,
1108
+ "step": 1820
1109
+ },
1110
+ {
1111
+ "epoch": 1.23,
1112
+ "learning_rate": 9.259109311740892e-06,
1113
+ "loss": 1.1957,
1114
+ "step": 1830
1115
+ },
1116
+ {
1117
+ "epoch": 1.24,
1118
+ "learning_rate": 9.25506072874494e-06,
1119
+ "loss": 1.1102,
1120
+ "step": 1840
1121
+ },
1122
+ {
1123
+ "epoch": 1.25,
1124
+ "learning_rate": 9.25101214574899e-06,
1125
+ "loss": 1.1439,
1126
+ "step": 1850
1127
+ },
1128
+ {
1129
+ "epoch": 1.25,
1130
+ "learning_rate": 9.246963562753037e-06,
1131
+ "loss": 1.1252,
1132
+ "step": 1860
1133
+ },
1134
+ {
1135
+ "epoch": 1.26,
1136
+ "learning_rate": 9.242914979757085e-06,
1137
+ "loss": 1.1238,
1138
+ "step": 1870
1139
+ },
1140
+ {
1141
+ "epoch": 1.27,
1142
+ "learning_rate": 9.238866396761135e-06,
1143
+ "loss": 1.135,
1144
+ "step": 1880
1145
+ },
1146
+ {
1147
+ "epoch": 1.27,
1148
+ "learning_rate": 9.234817813765183e-06,
1149
+ "loss": 1.1542,
1150
+ "step": 1890
1151
+ },
1152
+ {
1153
+ "epoch": 1.28,
1154
+ "learning_rate": 9.23076923076923e-06,
1155
+ "loss": 1.1481,
1156
+ "step": 1900
1157
+ },
1158
+ {
1159
+ "epoch": 1.29,
1160
+ "learning_rate": 9.22672064777328e-06,
1161
+ "loss": 1.0846,
1162
+ "step": 1910
1163
+ },
1164
+ {
1165
+ "epoch": 1.3,
1166
+ "learning_rate": 9.222672064777328e-06,
1167
+ "loss": 1.1346,
1168
+ "step": 1920
1169
+ },
1170
+ {
1171
+ "epoch": 1.3,
1172
+ "learning_rate": 9.218623481781376e-06,
1173
+ "loss": 1.0831,
1174
+ "step": 1930
1175
+ },
1176
+ {
1177
+ "epoch": 1.31,
1178
+ "learning_rate": 9.214574898785426e-06,
1179
+ "loss": 1.2031,
1180
+ "step": 1940
1181
+ },
1182
+ {
1183
+ "epoch": 1.32,
1184
+ "learning_rate": 9.210526315789474e-06,
1185
+ "loss": 1.0651,
1186
+ "step": 1950
1187
+ },
1188
+ {
1189
+ "epoch": 1.32,
1190
+ "learning_rate": 9.206477732793523e-06,
1191
+ "loss": 1.1237,
1192
+ "step": 1960
1193
+ },
1194
+ {
1195
+ "epoch": 1.33,
1196
+ "learning_rate": 9.202429149797571e-06,
1197
+ "loss": 1.0612,
1198
+ "step": 1970
1199
+ },
1200
+ {
1201
+ "epoch": 1.34,
1202
+ "learning_rate": 9.198380566801621e-06,
1203
+ "loss": 1.1377,
1204
+ "step": 1980
1205
+ },
1206
+ {
1207
+ "epoch": 1.34,
1208
+ "learning_rate": 9.194331983805669e-06,
1209
+ "loss": 1.1692,
1210
+ "step": 1990
1211
+ },
1212
+ {
1213
+ "epoch": 1.35,
1214
+ "learning_rate": 9.190283400809718e-06,
1215
+ "loss": 1.1136,
1216
+ "step": 2000
1217
+ },
1218
+ {
1219
+ "epoch": 1.36,
1220
+ "learning_rate": 9.186234817813766e-06,
1221
+ "loss": 1.1361,
1222
+ "step": 2010
1223
+ },
1224
+ {
1225
+ "epoch": 1.36,
1226
+ "learning_rate": 9.182186234817814e-06,
1227
+ "loss": 1.1663,
1228
+ "step": 2020
1229
+ },
1230
+ {
1231
+ "epoch": 1.37,
1232
+ "learning_rate": 9.178137651821864e-06,
1233
+ "loss": 1.1054,
1234
+ "step": 2030
1235
+ },
1236
+ {
1237
+ "epoch": 1.38,
1238
+ "learning_rate": 9.174089068825912e-06,
1239
+ "loss": 1.1427,
1240
+ "step": 2040
1241
+ },
1242
+ {
1243
+ "epoch": 1.38,
1244
+ "learning_rate": 9.17004048582996e-06,
1245
+ "loss": 1.1392,
1246
+ "step": 2050
1247
+ },
1248
+ {
1249
+ "epoch": 1.39,
1250
+ "learning_rate": 9.16599190283401e-06,
1251
+ "loss": 1.191,
1252
+ "step": 2060
1253
+ },
1254
+ {
1255
+ "epoch": 1.4,
1256
+ "learning_rate": 9.161943319838057e-06,
1257
+ "loss": 1.1006,
1258
+ "step": 2070
1259
+ },
1260
+ {
1261
+ "epoch": 1.4,
1262
+ "learning_rate": 9.157894736842105e-06,
1263
+ "loss": 1.1372,
1264
+ "step": 2080
1265
+ },
1266
+ {
1267
+ "epoch": 1.41,
1268
+ "learning_rate": 9.153846153846155e-06,
1269
+ "loss": 1.1428,
1270
+ "step": 2090
1271
+ },
1272
+ {
1273
+ "epoch": 1.42,
1274
+ "learning_rate": 9.149797570850203e-06,
1275
+ "loss": 1.1433,
1276
+ "step": 2100
1277
+ },
1278
+ {
1279
+ "epoch": 1.42,
1280
+ "learning_rate": 9.145748987854253e-06,
1281
+ "loss": 1.0997,
1282
+ "step": 2110
1283
+ },
1284
+ {
1285
+ "epoch": 1.43,
1286
+ "learning_rate": 9.1417004048583e-06,
1287
+ "loss": 1.1478,
1288
+ "step": 2120
1289
+ },
1290
+ {
1291
+ "epoch": 1.44,
1292
+ "learning_rate": 9.137651821862348e-06,
1293
+ "loss": 1.0928,
1294
+ "step": 2130
1295
+ },
1296
+ {
1297
+ "epoch": 1.44,
1298
+ "learning_rate": 9.133603238866398e-06,
1299
+ "loss": 1.0993,
1300
+ "step": 2140
1301
+ },
1302
+ {
1303
+ "epoch": 1.45,
1304
+ "learning_rate": 9.129554655870446e-06,
1305
+ "loss": 1.1306,
1306
+ "step": 2150
1307
+ },
1308
+ {
1309
+ "epoch": 1.46,
1310
+ "learning_rate": 9.125506072874494e-06,
1311
+ "loss": 1.1527,
1312
+ "step": 2160
1313
+ },
1314
+ {
1315
+ "epoch": 1.46,
1316
+ "learning_rate": 9.121457489878544e-06,
1317
+ "loss": 1.1394,
1318
+ "step": 2170
1319
+ },
1320
+ {
1321
+ "epoch": 1.47,
1322
+ "learning_rate": 9.117408906882591e-06,
1323
+ "loss": 1.1787,
1324
+ "step": 2180
1325
+ },
1326
+ {
1327
+ "epoch": 1.48,
1328
+ "learning_rate": 9.11336032388664e-06,
1329
+ "loss": 1.1295,
1330
+ "step": 2190
1331
+ },
1332
+ {
1333
+ "epoch": 1.48,
1334
+ "learning_rate": 9.109311740890689e-06,
1335
+ "loss": 1.1843,
1336
+ "step": 2200
1337
+ },
1338
+ {
1339
+ "epoch": 1.49,
1340
+ "learning_rate": 9.105263157894739e-06,
1341
+ "loss": 1.1243,
1342
+ "step": 2210
1343
+ },
1344
+ {
1345
+ "epoch": 1.5,
1346
+ "learning_rate": 9.101214574898785e-06,
1347
+ "loss": 1.1748,
1348
+ "step": 2220
1349
+ },
1350
+ {
1351
+ "epoch": 1.5,
1352
+ "learning_rate": 9.097165991902835e-06,
1353
+ "loss": 1.1282,
1354
+ "step": 2230
1355
+ },
1356
+ {
1357
+ "epoch": 1.51,
1358
+ "learning_rate": 9.093117408906884e-06,
1359
+ "loss": 1.0969,
1360
+ "step": 2240
1361
+ },
1362
+ {
1363
+ "epoch": 1.52,
1364
+ "learning_rate": 9.089068825910932e-06,
1365
+ "loss": 1.158,
1366
+ "step": 2250
1367
+ },
1368
+ {
1369
+ "epoch": 1.52,
1370
+ "learning_rate": 9.085020242914982e-06,
1371
+ "loss": 1.1417,
1372
+ "step": 2260
1373
+ },
1374
+ {
1375
+ "epoch": 1.53,
1376
+ "learning_rate": 9.08097165991903e-06,
1377
+ "loss": 1.1397,
1378
+ "step": 2270
1379
+ },
1380
+ {
1381
+ "epoch": 1.54,
1382
+ "learning_rate": 9.076923076923078e-06,
1383
+ "loss": 1.1622,
1384
+ "step": 2280
1385
+ },
1386
+ {
1387
+ "epoch": 1.54,
1388
+ "learning_rate": 9.072874493927127e-06,
1389
+ "loss": 1.1217,
1390
+ "step": 2290
1391
+ },
1392
+ {
1393
+ "epoch": 1.55,
1394
+ "learning_rate": 9.068825910931175e-06,
1395
+ "loss": 1.1527,
1396
+ "step": 2300
1397
+ },
1398
+ {
1399
+ "epoch": 1.56,
1400
+ "learning_rate": 9.064777327935223e-06,
1401
+ "loss": 1.1927,
1402
+ "step": 2310
1403
+ },
1404
+ {
1405
+ "epoch": 1.56,
1406
+ "learning_rate": 9.060728744939273e-06,
1407
+ "loss": 1.1505,
1408
+ "step": 2320
1409
+ },
1410
+ {
1411
+ "epoch": 1.57,
1412
+ "learning_rate": 9.05668016194332e-06,
1413
+ "loss": 1.123,
1414
+ "step": 2330
1415
+ },
1416
+ {
1417
+ "epoch": 1.58,
1418
+ "learning_rate": 9.052631578947369e-06,
1419
+ "loss": 1.1453,
1420
+ "step": 2340
1421
+ },
1422
+ {
1423
+ "epoch": 1.59,
1424
+ "learning_rate": 9.048582995951418e-06,
1425
+ "loss": 1.1903,
1426
+ "step": 2350
1427
+ },
1428
+ {
1429
+ "epoch": 1.59,
1430
+ "learning_rate": 9.044534412955466e-06,
1431
+ "loss": 1.144,
1432
+ "step": 2360
1433
+ },
1434
+ {
1435
+ "epoch": 1.6,
1436
+ "learning_rate": 9.040485829959514e-06,
1437
+ "loss": 1.1469,
1438
+ "step": 2370
1439
+ },
1440
+ {
1441
+ "epoch": 1.61,
1442
+ "learning_rate": 9.036437246963564e-06,
1443
+ "loss": 1.1463,
1444
+ "step": 2380
1445
+ },
1446
+ {
1447
+ "epoch": 1.61,
1448
+ "learning_rate": 9.032388663967612e-06,
1449
+ "loss": 1.1702,
1450
+ "step": 2390
1451
+ },
1452
+ {
1453
+ "epoch": 1.62,
1454
+ "learning_rate": 9.028340080971661e-06,
1455
+ "loss": 1.078,
1456
+ "step": 2400
1457
+ },
1458
+ {
1459
+ "epoch": 1.63,
1460
+ "learning_rate": 9.02429149797571e-06,
1461
+ "loss": 1.0907,
1462
+ "step": 2410
1463
+ },
1464
+ {
1465
+ "epoch": 1.63,
1466
+ "learning_rate": 9.020242914979757e-06,
1467
+ "loss": 1.1621,
1468
+ "step": 2420
1469
+ },
1470
+ {
1471
+ "epoch": 1.64,
1472
+ "learning_rate": 9.016194331983807e-06,
1473
+ "loss": 1.0947,
1474
+ "step": 2430
1475
+ },
1476
+ {
1477
+ "epoch": 1.65,
1478
+ "learning_rate": 9.012145748987855e-06,
1479
+ "loss": 1.1301,
1480
+ "step": 2440
1481
+ },
1482
+ {
1483
+ "epoch": 1.65,
1484
+ "learning_rate": 9.008097165991903e-06,
1485
+ "loss": 1.1232,
1486
+ "step": 2450
1487
+ },
1488
+ {
1489
+ "epoch": 1.66,
1490
+ "learning_rate": 9.004048582995952e-06,
1491
+ "loss": 1.1737,
1492
+ "step": 2460
1493
+ },
1494
+ {
1495
+ "epoch": 1.67,
1496
+ "learning_rate": 9e-06,
1497
+ "loss": 1.1475,
1498
+ "step": 2470
1499
+ },
1500
+ {
1501
+ "epoch": 1.67,
1502
+ "learning_rate": 8.99595141700405e-06,
1503
+ "loss": 1.1242,
1504
+ "step": 2480
1505
+ },
1506
+ {
1507
+ "epoch": 1.68,
1508
+ "learning_rate": 8.991902834008098e-06,
1509
+ "loss": 1.1321,
1510
+ "step": 2490
1511
+ },
1512
+ {
1513
+ "epoch": 1.69,
1514
+ "learning_rate": 8.987854251012147e-06,
1515
+ "loss": 1.1131,
1516
+ "step": 2500
1517
+ },
1518
+ {
1519
+ "epoch": 1.69,
1520
+ "learning_rate": 8.983805668016195e-06,
1521
+ "loss": 1.1456,
1522
+ "step": 2510
1523
+ },
1524
+ {
1525
+ "epoch": 1.7,
1526
+ "learning_rate": 8.979757085020243e-06,
1527
+ "loss": 1.0983,
1528
+ "step": 2520
1529
+ },
1530
+ {
1531
+ "epoch": 1.71,
1532
+ "learning_rate": 8.975708502024293e-06,
1533
+ "loss": 1.1598,
1534
+ "step": 2530
1535
+ },
1536
+ {
1537
+ "epoch": 1.71,
1538
+ "learning_rate": 8.971659919028341e-06,
1539
+ "loss": 1.1861,
1540
+ "step": 2540
1541
+ },
1542
+ {
1543
+ "epoch": 1.72,
1544
+ "learning_rate": 8.96761133603239e-06,
1545
+ "loss": 1.1334,
1546
+ "step": 2550
1547
+ },
1548
+ {
1549
+ "epoch": 1.73,
1550
+ "learning_rate": 8.963562753036438e-06,
1551
+ "loss": 1.1605,
1552
+ "step": 2560
1553
+ },
1554
+ {
1555
+ "epoch": 1.73,
1556
+ "learning_rate": 8.959514170040486e-06,
1557
+ "loss": 1.136,
1558
+ "step": 2570
1559
+ },
1560
+ {
1561
+ "epoch": 1.74,
1562
+ "learning_rate": 8.955465587044536e-06,
1563
+ "loss": 1.1162,
1564
+ "step": 2580
1565
+ },
1566
+ {
1567
+ "epoch": 1.75,
1568
+ "learning_rate": 8.951417004048584e-06,
1569
+ "loss": 1.1115,
1570
+ "step": 2590
1571
+ },
1572
+ {
1573
+ "epoch": 1.75,
1574
+ "learning_rate": 8.947368421052632e-06,
1575
+ "loss": 1.1025,
1576
+ "step": 2600
1577
+ },
1578
+ {
1579
+ "epoch": 1.76,
1580
+ "learning_rate": 8.943319838056681e-06,
1581
+ "loss": 1.1616,
1582
+ "step": 2610
1583
+ },
1584
+ {
1585
+ "epoch": 1.77,
1586
+ "learning_rate": 8.93927125506073e-06,
1587
+ "loss": 1.1407,
1588
+ "step": 2620
1589
+ },
1590
+ {
1591
+ "epoch": 1.77,
1592
+ "learning_rate": 8.935222672064777e-06,
1593
+ "loss": 1.1016,
1594
+ "step": 2630
1595
+ },
1596
+ {
1597
+ "epoch": 1.78,
1598
+ "learning_rate": 8.931174089068827e-06,
1599
+ "loss": 1.111,
1600
+ "step": 2640
1601
+ },
1602
+ {
1603
+ "epoch": 1.79,
1604
+ "learning_rate": 8.927125506072875e-06,
1605
+ "loss": 1.1226,
1606
+ "step": 2650
1607
+ },
1608
+ {
1609
+ "epoch": 1.79,
1610
+ "learning_rate": 8.923076923076923e-06,
1611
+ "loss": 1.1105,
1612
+ "step": 2660
1613
+ },
1614
+ {
1615
+ "epoch": 1.8,
1616
+ "learning_rate": 8.919028340080972e-06,
1617
+ "loss": 1.1227,
1618
+ "step": 2670
1619
+ },
1620
+ {
1621
+ "epoch": 1.81,
1622
+ "learning_rate": 8.91497975708502e-06,
1623
+ "loss": 1.1462,
1624
+ "step": 2680
1625
+ },
1626
+ {
1627
+ "epoch": 1.81,
1628
+ "learning_rate": 8.91093117408907e-06,
1629
+ "loss": 1.1119,
1630
+ "step": 2690
1631
+ },
1632
+ {
1633
+ "epoch": 1.82,
1634
+ "learning_rate": 8.906882591093118e-06,
1635
+ "loss": 1.1567,
1636
+ "step": 2700
1637
+ },
1638
+ {
1639
+ "epoch": 1.83,
1640
+ "learning_rate": 8.902834008097166e-06,
1641
+ "loss": 1.1565,
1642
+ "step": 2710
1643
+ },
1644
+ {
1645
+ "epoch": 1.83,
1646
+ "learning_rate": 8.898785425101216e-06,
1647
+ "loss": 1.1116,
1648
+ "step": 2720
1649
+ },
1650
+ {
1651
+ "epoch": 1.84,
1652
+ "learning_rate": 8.894736842105265e-06,
1653
+ "loss": 1.1139,
1654
+ "step": 2730
1655
+ },
1656
+ {
1657
+ "epoch": 1.85,
1658
+ "learning_rate": 8.890688259109311e-06,
1659
+ "loss": 1.1454,
1660
+ "step": 2740
1661
+ },
1662
+ {
1663
+ "epoch": 1.85,
1664
+ "learning_rate": 8.886639676113361e-06,
1665
+ "loss": 1.1084,
1666
+ "step": 2750
1667
+ },
1668
+ {
1669
+ "epoch": 1.86,
1670
+ "learning_rate": 8.882591093117409e-06,
1671
+ "loss": 1.1829,
1672
+ "step": 2760
1673
+ },
1674
+ {
1675
+ "epoch": 1.87,
1676
+ "learning_rate": 8.878542510121459e-06,
1677
+ "loss": 1.1262,
1678
+ "step": 2770
1679
+ },
1680
+ {
1681
+ "epoch": 1.88,
1682
+ "learning_rate": 8.874493927125507e-06,
1683
+ "loss": 1.1754,
1684
+ "step": 2780
1685
+ },
1686
+ {
1687
+ "epoch": 1.88,
1688
+ "learning_rate": 8.870445344129556e-06,
1689
+ "loss": 1.1269,
1690
+ "step": 2790
1691
+ },
1692
+ {
1693
+ "epoch": 1.89,
1694
+ "learning_rate": 8.866396761133604e-06,
1695
+ "loss": 1.1663,
1696
+ "step": 2800
1697
+ },
1698
+ {
1699
+ "epoch": 1.9,
1700
+ "learning_rate": 8.862348178137652e-06,
1701
+ "loss": 1.1457,
1702
+ "step": 2810
1703
+ },
1704
+ {
1705
+ "epoch": 1.9,
1706
+ "learning_rate": 8.858299595141702e-06,
1707
+ "loss": 1.1143,
1708
+ "step": 2820
1709
+ },
1710
+ {
1711
+ "epoch": 1.91,
1712
+ "learning_rate": 8.85425101214575e-06,
1713
+ "loss": 1.1956,
1714
+ "step": 2830
1715
+ },
1716
+ {
1717
+ "epoch": 1.92,
1718
+ "learning_rate": 8.8502024291498e-06,
1719
+ "loss": 1.152,
1720
+ "step": 2840
1721
+ },
1722
+ {
1723
+ "epoch": 1.92,
1724
+ "learning_rate": 8.846153846153847e-06,
1725
+ "loss": 1.1365,
1726
+ "step": 2850
1727
+ },
1728
+ {
1729
+ "epoch": 1.93,
1730
+ "learning_rate": 8.842105263157895e-06,
1731
+ "loss": 1.1519,
1732
+ "step": 2860
1733
+ },
1734
+ {
1735
+ "epoch": 1.94,
1736
+ "learning_rate": 8.838056680161945e-06,
1737
+ "loss": 1.126,
1738
+ "step": 2870
1739
+ },
1740
+ {
1741
+ "epoch": 1.94,
1742
+ "learning_rate": 8.834008097165993e-06,
1743
+ "loss": 1.1408,
1744
+ "step": 2880
1745
+ },
1746
+ {
1747
+ "epoch": 1.95,
1748
+ "learning_rate": 8.82995951417004e-06,
1749
+ "loss": 1.1522,
1750
+ "step": 2890
1751
+ },
1752
+ {
1753
+ "epoch": 1.96,
1754
+ "learning_rate": 8.82591093117409e-06,
1755
+ "loss": 1.1236,
1756
+ "step": 2900
1757
+ },
1758
+ {
1759
+ "epoch": 1.96,
1760
+ "learning_rate": 8.821862348178138e-06,
1761
+ "loss": 1.0927,
1762
+ "step": 2910
1763
+ },
1764
+ {
1765
+ "epoch": 1.97,
1766
+ "learning_rate": 8.817813765182186e-06,
1767
+ "loss": 1.21,
1768
+ "step": 2920
1769
+ },
1770
+ {
1771
+ "epoch": 1.98,
1772
+ "learning_rate": 8.813765182186236e-06,
1773
+ "loss": 1.1119,
1774
+ "step": 2930
1775
+ },
1776
+ {
1777
+ "epoch": 1.98,
1778
+ "learning_rate": 8.809716599190284e-06,
1779
+ "loss": 1.1383,
1780
+ "step": 2940
1781
+ },
1782
+ {
1783
+ "epoch": 1.99,
1784
+ "learning_rate": 8.805668016194333e-06,
1785
+ "loss": 1.1438,
1786
+ "step": 2950
1787
+ },
1788
+ {
1789
+ "epoch": 2.0,
1790
+ "learning_rate": 8.801619433198381e-06,
1791
+ "loss": 1.1747,
1792
+ "step": 2960
1793
+ },
1794
+ {
1795
+ "epoch": 2.0,
1796
+ "eval_loss": 1.1016342639923096,
1797
+ "eval_runtime": 10.6294,
1798
+ "eval_samples_per_second": 103.487,
1799
+ "eval_steps_per_second": 12.983,
1800
+ "step": 2965
1801
+ },
1802
+ {
1803
+ "epoch": 2.0,
1804
+ "learning_rate": 8.79757085020243e-06,
1805
+ "loss": 1.083,
1806
+ "step": 2970
1807
+ },
1808
+ {
1809
+ "epoch": 2.01,
1810
+ "learning_rate": 8.793522267206479e-06,
1811
+ "loss": 1.0542,
1812
+ "step": 2980
1813
+ },
1814
+ {
1815
+ "epoch": 2.02,
1816
+ "learning_rate": 8.789473684210527e-06,
1817
+ "loss": 1.0974,
1818
+ "step": 2990
1819
+ },
1820
+ {
1821
+ "epoch": 2.02,
1822
+ "learning_rate": 8.785425101214576e-06,
1823
+ "loss": 1.0074,
1824
+ "step": 3000
1825
+ },
1826
+ {
1827
+ "epoch": 2.03,
1828
+ "learning_rate": 8.781376518218624e-06,
1829
+ "loss": 1.0825,
1830
+ "step": 3010
1831
+ },
1832
+ {
1833
+ "epoch": 2.04,
1834
+ "learning_rate": 8.777327935222674e-06,
1835
+ "loss": 1.065,
1836
+ "step": 3020
1837
+ },
1838
+ {
1839
+ "epoch": 2.04,
1840
+ "learning_rate": 8.77327935222672e-06,
1841
+ "loss": 1.0996,
1842
+ "step": 3030
1843
+ },
1844
+ {
1845
+ "epoch": 2.05,
1846
+ "learning_rate": 8.76923076923077e-06,
1847
+ "loss": 1.1079,
1848
+ "step": 3040
1849
+ },
1850
+ {
1851
+ "epoch": 2.06,
1852
+ "learning_rate": 8.76518218623482e-06,
1853
+ "loss": 1.0803,
1854
+ "step": 3050
1855
+ },
1856
+ {
1857
+ "epoch": 2.06,
1858
+ "learning_rate": 8.761133603238867e-06,
1859
+ "loss": 1.0923,
1860
+ "step": 3060
1861
+ },
1862
+ {
1863
+ "epoch": 2.07,
1864
+ "learning_rate": 8.757085020242915e-06,
1865
+ "loss": 1.1171,
1866
+ "step": 3070
1867
+ },
1868
+ {
1869
+ "epoch": 2.08,
1870
+ "learning_rate": 8.753036437246965e-06,
1871
+ "loss": 1.0404,
1872
+ "step": 3080
1873
+ },
1874
+ {
1875
+ "epoch": 2.08,
1876
+ "learning_rate": 8.748987854251013e-06,
1877
+ "loss": 1.0881,
1878
+ "step": 3090
1879
+ },
1880
+ {
1881
+ "epoch": 2.09,
1882
+ "learning_rate": 8.744939271255061e-06,
1883
+ "loss": 1.1536,
1884
+ "step": 3100
1885
+ },
1886
+ {
1887
+ "epoch": 2.1,
1888
+ "learning_rate": 8.74089068825911e-06,
1889
+ "loss": 1.0868,
1890
+ "step": 3110
1891
+ },
1892
+ {
1893
+ "epoch": 2.1,
1894
+ "learning_rate": 8.736842105263158e-06,
1895
+ "loss": 1.1422,
1896
+ "step": 3120
1897
+ },
1898
+ {
1899
+ "epoch": 2.11,
1900
+ "learning_rate": 8.732793522267208e-06,
1901
+ "loss": 1.1048,
1902
+ "step": 3130
1903
+ },
1904
+ {
1905
+ "epoch": 2.12,
1906
+ "learning_rate": 8.728744939271256e-06,
1907
+ "loss": 1.136,
1908
+ "step": 3140
1909
+ },
1910
+ {
1911
+ "epoch": 2.12,
1912
+ "learning_rate": 8.724696356275304e-06,
1913
+ "loss": 1.07,
1914
+ "step": 3150
1915
+ },
1916
+ {
1917
+ "epoch": 2.13,
1918
+ "learning_rate": 8.720647773279354e-06,
1919
+ "loss": 1.1336,
1920
+ "step": 3160
1921
+ },
1922
+ {
1923
+ "epoch": 2.14,
1924
+ "learning_rate": 8.716599190283401e-06,
1925
+ "loss": 1.0946,
1926
+ "step": 3170
1927
+ },
1928
+ {
1929
+ "epoch": 2.15,
1930
+ "learning_rate": 8.71255060728745e-06,
1931
+ "loss": 1.061,
1932
+ "step": 3180
1933
+ },
1934
+ {
1935
+ "epoch": 2.15,
1936
+ "learning_rate": 8.708502024291499e-06,
1937
+ "loss": 1.0275,
1938
+ "step": 3190
1939
+ },
1940
+ {
1941
+ "epoch": 2.16,
1942
+ "learning_rate": 8.704453441295547e-06,
1943
+ "loss": 1.0665,
1944
+ "step": 3200
1945
+ },
1946
+ {
1947
+ "epoch": 2.17,
1948
+ "learning_rate": 8.700404858299595e-06,
1949
+ "loss": 1.0563,
1950
+ "step": 3210
1951
+ },
1952
+ {
1953
+ "epoch": 2.17,
1954
+ "learning_rate": 8.696356275303645e-06,
1955
+ "loss": 1.0756,
1956
+ "step": 3220
1957
+ },
1958
+ {
1959
+ "epoch": 2.18,
1960
+ "learning_rate": 8.692307692307692e-06,
1961
+ "loss": 1.0981,
1962
+ "step": 3230
1963
+ },
1964
+ {
1965
+ "epoch": 2.19,
1966
+ "learning_rate": 8.688259109311742e-06,
1967
+ "loss": 1.1138,
1968
+ "step": 3240
1969
+ },
1970
+ {
1971
+ "epoch": 2.19,
1972
+ "learning_rate": 8.68421052631579e-06,
1973
+ "loss": 1.0838,
1974
+ "step": 3250
1975
+ },
1976
+ {
1977
+ "epoch": 2.2,
1978
+ "learning_rate": 8.680161943319838e-06,
1979
+ "loss": 1.1053,
1980
+ "step": 3260
1981
+ },
1982
+ {
1983
+ "epoch": 2.21,
1984
+ "learning_rate": 8.676113360323888e-06,
1985
+ "loss": 1.1099,
1986
+ "step": 3270
1987
+ },
1988
+ {
1989
+ "epoch": 2.21,
1990
+ "learning_rate": 8.672064777327936e-06,
1991
+ "loss": 1.0884,
1992
+ "step": 3280
1993
+ },
1994
+ {
1995
+ "epoch": 2.22,
1996
+ "learning_rate": 8.668016194331985e-06,
1997
+ "loss": 1.0857,
1998
+ "step": 3290
1999
+ },
2000
+ {
2001
+ "epoch": 2.23,
2002
+ "learning_rate": 8.663967611336033e-06,
2003
+ "loss": 1.0629,
2004
+ "step": 3300
2005
+ },
2006
+ {
2007
+ "epoch": 2.23,
2008
+ "learning_rate": 8.659919028340083e-06,
2009
+ "loss": 1.0753,
2010
+ "step": 3310
2011
+ },
2012
+ {
2013
+ "epoch": 2.24,
2014
+ "learning_rate": 8.65587044534413e-06,
2015
+ "loss": 1.1481,
2016
+ "step": 3320
2017
+ },
2018
+ {
2019
+ "epoch": 2.25,
2020
+ "learning_rate": 8.651821862348179e-06,
2021
+ "loss": 1.1127,
2022
+ "step": 3330
2023
+ },
2024
+ {
2025
+ "epoch": 2.25,
2026
+ "learning_rate": 8.647773279352228e-06,
2027
+ "loss": 1.1666,
2028
+ "step": 3340
2029
+ },
2030
+ {
2031
+ "epoch": 2.26,
2032
+ "learning_rate": 8.643724696356276e-06,
2033
+ "loss": 1.1086,
2034
+ "step": 3350
2035
+ },
2036
+ {
2037
+ "epoch": 2.27,
2038
+ "learning_rate": 8.639676113360324e-06,
2039
+ "loss": 1.1102,
2040
+ "step": 3360
2041
+ },
2042
+ {
2043
+ "epoch": 2.27,
2044
+ "learning_rate": 8.635627530364374e-06,
2045
+ "loss": 1.1194,
2046
+ "step": 3370
2047
+ },
2048
+ {
2049
+ "epoch": 2.28,
2050
+ "learning_rate": 8.631578947368422e-06,
2051
+ "loss": 1.145,
2052
+ "step": 3380
2053
+ },
2054
+ {
2055
+ "epoch": 2.29,
2056
+ "learning_rate": 8.62753036437247e-06,
2057
+ "loss": 1.1103,
2058
+ "step": 3390
2059
+ },
2060
+ {
2061
+ "epoch": 2.29,
2062
+ "learning_rate": 8.62348178137652e-06,
2063
+ "loss": 1.0998,
2064
+ "step": 3400
2065
+ },
2066
+ {
2067
+ "epoch": 2.3,
2068
+ "learning_rate": 8.619433198380567e-06,
2069
+ "loss": 1.1551,
2070
+ "step": 3410
2071
+ },
2072
+ {
2073
+ "epoch": 2.31,
2074
+ "learning_rate": 8.615384615384615e-06,
2075
+ "loss": 1.0687,
2076
+ "step": 3420
2077
+ },
2078
+ {
2079
+ "epoch": 2.31,
2080
+ "learning_rate": 8.611336032388665e-06,
2081
+ "loss": 1.0959,
2082
+ "step": 3430
2083
+ },
2084
+ {
2085
+ "epoch": 2.32,
2086
+ "learning_rate": 8.607287449392713e-06,
2087
+ "loss": 1.0799,
2088
+ "step": 3440
2089
+ },
2090
+ {
2091
+ "epoch": 2.33,
2092
+ "learning_rate": 8.60323886639676e-06,
2093
+ "loss": 1.0673,
2094
+ "step": 3450
2095
+ },
2096
+ {
2097
+ "epoch": 2.33,
2098
+ "learning_rate": 8.59919028340081e-06,
2099
+ "loss": 1.0873,
2100
+ "step": 3460
2101
+ },
2102
+ {
2103
+ "epoch": 2.34,
2104
+ "learning_rate": 8.595141700404858e-06,
2105
+ "loss": 1.1119,
2106
+ "step": 3470
2107
+ },
2108
+ {
2109
+ "epoch": 2.35,
2110
+ "learning_rate": 8.591093117408906e-06,
2111
+ "loss": 1.1356,
2112
+ "step": 3480
2113
+ },
2114
+ {
2115
+ "epoch": 2.35,
2116
+ "learning_rate": 8.587044534412956e-06,
2117
+ "loss": 1.0924,
2118
+ "step": 3490
2119
+ },
2120
+ {
2121
+ "epoch": 2.36,
2122
+ "learning_rate": 8.582995951417005e-06,
2123
+ "loss": 1.0818,
2124
+ "step": 3500
2125
+ },
2126
+ {
2127
+ "epoch": 2.37,
2128
+ "learning_rate": 8.578947368421053e-06,
2129
+ "loss": 1.1007,
2130
+ "step": 3510
2131
+ },
2132
+ {
2133
+ "epoch": 2.37,
2134
+ "learning_rate": 8.574898785425103e-06,
2135
+ "loss": 1.0591,
2136
+ "step": 3520
2137
+ },
2138
+ {
2139
+ "epoch": 2.38,
2140
+ "learning_rate": 8.57085020242915e-06,
2141
+ "loss": 1.1069,
2142
+ "step": 3530
2143
+ },
2144
+ {
2145
+ "epoch": 2.39,
2146
+ "learning_rate": 8.566801619433199e-06,
2147
+ "loss": 1.1191,
2148
+ "step": 3540
2149
+ },
2150
+ {
2151
+ "epoch": 2.39,
2152
+ "learning_rate": 8.562753036437247e-06,
2153
+ "loss": 1.077,
2154
+ "step": 3550
2155
+ },
2156
+ {
2157
+ "epoch": 2.4,
2158
+ "learning_rate": 8.558704453441296e-06,
2159
+ "loss": 1.104,
2160
+ "step": 3560
2161
+ },
2162
+ {
2163
+ "epoch": 2.41,
2164
+ "learning_rate": 8.554655870445344e-06,
2165
+ "loss": 1.0758,
2166
+ "step": 3570
2167
+ },
2168
+ {
2169
+ "epoch": 2.41,
2170
+ "learning_rate": 8.550607287449394e-06,
2171
+ "loss": 1.0885,
2172
+ "step": 3580
2173
+ },
2174
+ {
2175
+ "epoch": 2.42,
2176
+ "learning_rate": 8.546558704453442e-06,
2177
+ "loss": 1.084,
2178
+ "step": 3590
2179
+ },
2180
+ {
2181
+ "epoch": 2.43,
2182
+ "learning_rate": 8.54251012145749e-06,
2183
+ "loss": 1.0869,
2184
+ "step": 3600
2185
+ },
2186
+ {
2187
+ "epoch": 2.44,
2188
+ "learning_rate": 8.53846153846154e-06,
2189
+ "loss": 1.073,
2190
+ "step": 3610
2191
+ },
2192
+ {
2193
+ "epoch": 2.44,
2194
+ "learning_rate": 8.534412955465587e-06,
2195
+ "loss": 1.0766,
2196
+ "step": 3620
2197
+ },
2198
+ {
2199
+ "epoch": 2.45,
2200
+ "learning_rate": 8.530364372469635e-06,
2201
+ "loss": 1.1085,
2202
+ "step": 3630
2203
+ },
2204
+ {
2205
+ "epoch": 2.46,
2206
+ "learning_rate": 8.526315789473685e-06,
2207
+ "loss": 1.097,
2208
+ "step": 3640
2209
+ },
2210
+ {
2211
+ "epoch": 2.46,
2212
+ "learning_rate": 8.522267206477733e-06,
2213
+ "loss": 1.0968,
2214
+ "step": 3650
2215
+ },
2216
+ {
2217
+ "epoch": 2.47,
2218
+ "learning_rate": 8.518218623481783e-06,
2219
+ "loss": 1.0917,
2220
+ "step": 3660
2221
+ },
2222
+ {
2223
+ "epoch": 2.48,
2224
+ "learning_rate": 8.51417004048583e-06,
2225
+ "loss": 1.047,
2226
+ "step": 3670
2227
+ },
2228
+ {
2229
+ "epoch": 2.48,
2230
+ "learning_rate": 8.510121457489878e-06,
2231
+ "loss": 1.0469,
2232
+ "step": 3680
2233
+ },
2234
+ {
2235
+ "epoch": 2.49,
2236
+ "learning_rate": 8.506072874493928e-06,
2237
+ "loss": 1.1114,
2238
+ "step": 3690
2239
+ },
2240
+ {
2241
+ "epoch": 2.5,
2242
+ "learning_rate": 8.502024291497976e-06,
2243
+ "loss": 1.0319,
2244
+ "step": 3700
2245
+ },
2246
+ {
2247
+ "epoch": 2.5,
2248
+ "learning_rate": 8.497975708502024e-06,
2249
+ "loss": 1.0733,
2250
+ "step": 3710
2251
+ },
2252
+ {
2253
+ "epoch": 2.51,
2254
+ "learning_rate": 8.493927125506074e-06,
2255
+ "loss": 1.1237,
2256
+ "step": 3720
2257
+ },
2258
+ {
2259
+ "epoch": 2.52,
2260
+ "learning_rate": 8.489878542510121e-06,
2261
+ "loss": 1.0649,
2262
+ "step": 3730
2263
+ },
2264
+ {
2265
+ "epoch": 2.52,
2266
+ "learning_rate": 8.48582995951417e-06,
2267
+ "loss": 1.0903,
2268
+ "step": 3740
2269
+ },
2270
+ {
2271
+ "epoch": 2.53,
2272
+ "learning_rate": 8.481781376518219e-06,
2273
+ "loss": 1.0633,
2274
+ "step": 3750
2275
+ },
2276
+ {
2277
+ "epoch": 2.54,
2278
+ "learning_rate": 8.477732793522267e-06,
2279
+ "loss": 1.1259,
2280
+ "step": 3760
2281
+ },
2282
+ {
2283
+ "epoch": 2.54,
2284
+ "learning_rate": 8.473684210526317e-06,
2285
+ "loss": 1.0978,
2286
+ "step": 3770
2287
+ },
2288
+ {
2289
+ "epoch": 2.55,
2290
+ "learning_rate": 8.469635627530365e-06,
2291
+ "loss": 1.1362,
2292
+ "step": 3780
2293
+ },
2294
+ {
2295
+ "epoch": 2.56,
2296
+ "learning_rate": 8.465587044534414e-06,
2297
+ "loss": 1.1487,
2298
+ "step": 3790
2299
+ },
2300
+ {
2301
+ "epoch": 2.56,
2302
+ "learning_rate": 8.461538461538462e-06,
2303
+ "loss": 1.0887,
2304
+ "step": 3800
2305
+ },
2306
+ {
2307
+ "epoch": 2.57,
2308
+ "learning_rate": 8.457489878542512e-06,
2309
+ "loss": 1.1039,
2310
+ "step": 3810
2311
+ },
2312
+ {
2313
+ "epoch": 2.58,
2314
+ "learning_rate": 8.453441295546558e-06,
2315
+ "loss": 1.0906,
2316
+ "step": 3820
2317
+ },
2318
+ {
2319
+ "epoch": 2.58,
2320
+ "learning_rate": 8.449392712550608e-06,
2321
+ "loss": 1.1039,
2322
+ "step": 3830
2323
+ },
2324
+ {
2325
+ "epoch": 2.59,
2326
+ "learning_rate": 8.445344129554657e-06,
2327
+ "loss": 1.0432,
2328
+ "step": 3840
2329
+ },
2330
+ {
2331
+ "epoch": 2.6,
2332
+ "learning_rate": 8.441295546558705e-06,
2333
+ "loss": 1.1565,
2334
+ "step": 3850
2335
+ },
2336
+ {
2337
+ "epoch": 2.6,
2338
+ "learning_rate": 8.437246963562753e-06,
2339
+ "loss": 1.1786,
2340
+ "step": 3860
2341
+ },
2342
+ {
2343
+ "epoch": 2.61,
2344
+ "learning_rate": 8.433198380566803e-06,
2345
+ "loss": 1.0724,
2346
+ "step": 3870
2347
+ },
2348
+ {
2349
+ "epoch": 2.62,
2350
+ "learning_rate": 8.42914979757085e-06,
2351
+ "loss": 1.0863,
2352
+ "step": 3880
2353
+ },
2354
+ {
2355
+ "epoch": 2.62,
2356
+ "learning_rate": 8.425101214574899e-06,
2357
+ "loss": 1.0825,
2358
+ "step": 3890
2359
+ },
2360
+ {
2361
+ "epoch": 2.63,
2362
+ "learning_rate": 8.421052631578948e-06,
2363
+ "loss": 1.0831,
2364
+ "step": 3900
2365
+ },
2366
+ {
2367
+ "epoch": 2.64,
2368
+ "learning_rate": 8.417004048582996e-06,
2369
+ "loss": 1.0681,
2370
+ "step": 3910
2371
+ },
2372
+ {
2373
+ "epoch": 2.64,
2374
+ "learning_rate": 8.412955465587044e-06,
2375
+ "loss": 1.0871,
2376
+ "step": 3920
2377
+ },
2378
+ {
2379
+ "epoch": 2.65,
2380
+ "learning_rate": 8.408906882591094e-06,
2381
+ "loss": 1.0531,
2382
+ "step": 3930
2383
+ },
2384
+ {
2385
+ "epoch": 2.66,
2386
+ "learning_rate": 8.404858299595142e-06,
2387
+ "loss": 1.1174,
2388
+ "step": 3940
2389
+ },
2390
+ {
2391
+ "epoch": 2.66,
2392
+ "learning_rate": 8.400809716599191e-06,
2393
+ "loss": 1.117,
2394
+ "step": 3950
2395
+ },
2396
+ {
2397
+ "epoch": 2.67,
2398
+ "learning_rate": 8.39676113360324e-06,
2399
+ "loss": 1.0938,
2400
+ "step": 3960
2401
+ },
2402
+ {
2403
+ "epoch": 2.68,
2404
+ "learning_rate": 8.392712550607287e-06,
2405
+ "loss": 1.0736,
2406
+ "step": 3970
2407
+ },
2408
+ {
2409
+ "epoch": 2.68,
2410
+ "learning_rate": 8.388663967611337e-06,
2411
+ "loss": 1.0872,
2412
+ "step": 3980
2413
+ },
2414
+ {
2415
+ "epoch": 2.69,
2416
+ "learning_rate": 8.384615384615385e-06,
2417
+ "loss": 1.1,
2418
+ "step": 3990
2419
+ },
2420
+ {
2421
+ "epoch": 2.7,
2422
+ "learning_rate": 8.380566801619433e-06,
2423
+ "loss": 1.1201,
2424
+ "step": 4000
2425
+ },
2426
+ {
2427
+ "epoch": 2.7,
2428
+ "learning_rate": 8.376518218623482e-06,
2429
+ "loss": 1.0755,
2430
+ "step": 4010
2431
+ },
2432
+ {
2433
+ "epoch": 2.71,
2434
+ "learning_rate": 8.37246963562753e-06,
2435
+ "loss": 1.0917,
2436
+ "step": 4020
2437
+ },
2438
+ {
2439
+ "epoch": 2.72,
2440
+ "learning_rate": 8.368421052631578e-06,
2441
+ "loss": 1.0873,
2442
+ "step": 4030
2443
+ },
2444
+ {
2445
+ "epoch": 2.73,
2446
+ "learning_rate": 8.364372469635628e-06,
2447
+ "loss": 1.0858,
2448
+ "step": 4040
2449
+ },
2450
+ {
2451
+ "epoch": 2.73,
2452
+ "learning_rate": 8.360323886639676e-06,
2453
+ "loss": 1.0721,
2454
+ "step": 4050
2455
+ },
2456
+ {
2457
+ "epoch": 2.74,
2458
+ "learning_rate": 8.356275303643725e-06,
2459
+ "loss": 1.138,
2460
+ "step": 4060
2461
+ },
2462
+ {
2463
+ "epoch": 2.75,
2464
+ "learning_rate": 8.352226720647773e-06,
2465
+ "loss": 1.1194,
2466
+ "step": 4070
2467
+ },
2468
+ {
2469
+ "epoch": 2.75,
2470
+ "learning_rate": 8.348178137651823e-06,
2471
+ "loss": 1.1364,
2472
+ "step": 4080
2473
+ },
2474
+ {
2475
+ "epoch": 2.76,
2476
+ "learning_rate": 8.344129554655871e-06,
2477
+ "loss": 1.1201,
2478
+ "step": 4090
2479
+ },
2480
+ {
2481
+ "epoch": 2.77,
2482
+ "learning_rate": 8.34008097165992e-06,
2483
+ "loss": 1.0585,
2484
+ "step": 4100
2485
+ },
2486
+ {
2487
+ "epoch": 2.77,
2488
+ "learning_rate": 8.336032388663968e-06,
2489
+ "loss": 1.0613,
2490
+ "step": 4110
2491
+ },
2492
+ {
2493
+ "epoch": 2.78,
2494
+ "learning_rate": 8.331983805668016e-06,
2495
+ "loss": 1.1091,
2496
+ "step": 4120
2497
+ },
2498
+ {
2499
+ "epoch": 2.79,
2500
+ "learning_rate": 8.327935222672066e-06,
2501
+ "loss": 1.1446,
2502
+ "step": 4130
2503
+ },
2504
+ {
2505
+ "epoch": 2.79,
2506
+ "learning_rate": 8.323886639676114e-06,
2507
+ "loss": 1.0413,
2508
+ "step": 4140
2509
+ },
2510
+ {
2511
+ "epoch": 2.8,
2512
+ "learning_rate": 8.319838056680162e-06,
2513
+ "loss": 1.1225,
2514
+ "step": 4150
2515
+ },
2516
+ {
2517
+ "epoch": 2.81,
2518
+ "learning_rate": 8.315789473684212e-06,
2519
+ "loss": 1.1121,
2520
+ "step": 4160
2521
+ },
2522
+ {
2523
+ "epoch": 2.81,
2524
+ "learning_rate": 8.31174089068826e-06,
2525
+ "loss": 1.0534,
2526
+ "step": 4170
2527
+ },
2528
+ {
2529
+ "epoch": 2.82,
2530
+ "learning_rate": 8.307692307692307e-06,
2531
+ "loss": 1.1097,
2532
+ "step": 4180
2533
+ },
2534
+ {
2535
+ "epoch": 2.83,
2536
+ "learning_rate": 8.303643724696357e-06,
2537
+ "loss": 1.1147,
2538
+ "step": 4190
2539
+ },
2540
+ {
2541
+ "epoch": 2.83,
2542
+ "learning_rate": 8.299595141700405e-06,
2543
+ "loss": 1.1009,
2544
+ "step": 4200
2545
+ },
2546
+ {
2547
+ "epoch": 2.84,
2548
+ "learning_rate": 8.295546558704453e-06,
2549
+ "loss": 1.0584,
2550
+ "step": 4210
2551
+ },
2552
+ {
2553
+ "epoch": 2.85,
2554
+ "learning_rate": 8.291497975708503e-06,
2555
+ "loss": 1.1045,
2556
+ "step": 4220
2557
+ },
2558
+ {
2559
+ "epoch": 2.85,
2560
+ "learning_rate": 8.28744939271255e-06,
2561
+ "loss": 1.0559,
2562
+ "step": 4230
2563
+ },
2564
+ {
2565
+ "epoch": 2.86,
2566
+ "learning_rate": 8.2834008097166e-06,
2567
+ "loss": 1.063,
2568
+ "step": 4240
2569
+ },
2570
+ {
2571
+ "epoch": 2.87,
2572
+ "learning_rate": 8.279352226720648e-06,
2573
+ "loss": 1.1671,
2574
+ "step": 4250
2575
+ },
2576
+ {
2577
+ "epoch": 2.87,
2578
+ "learning_rate": 8.275303643724696e-06,
2579
+ "loss": 1.077,
2580
+ "step": 4260
2581
+ },
2582
+ {
2583
+ "epoch": 2.88,
2584
+ "learning_rate": 8.271255060728746e-06,
2585
+ "loss": 1.1119,
2586
+ "step": 4270
2587
+ },
2588
+ {
2589
+ "epoch": 2.89,
2590
+ "learning_rate": 8.267206477732794e-06,
2591
+ "loss": 1.0773,
2592
+ "step": 4280
2593
+ },
2594
+ {
2595
+ "epoch": 2.89,
2596
+ "learning_rate": 8.263157894736843e-06,
2597
+ "loss": 1.0874,
2598
+ "step": 4290
2599
+ },
2600
+ {
2601
+ "epoch": 2.9,
2602
+ "learning_rate": 8.259109311740891e-06,
2603
+ "loss": 1.0793,
2604
+ "step": 4300
2605
+ },
2606
+ {
2607
+ "epoch": 2.91,
2608
+ "learning_rate": 8.25506072874494e-06,
2609
+ "loss": 1.1011,
2610
+ "step": 4310
2611
+ },
2612
+ {
2613
+ "epoch": 2.91,
2614
+ "learning_rate": 8.251012145748987e-06,
2615
+ "loss": 1.1232,
2616
+ "step": 4320
2617
+ },
2618
+ {
2619
+ "epoch": 2.92,
2620
+ "learning_rate": 8.246963562753037e-06,
2621
+ "loss": 1.0953,
2622
+ "step": 4330
2623
+ },
2624
+ {
2625
+ "epoch": 2.93,
2626
+ "learning_rate": 8.242914979757085e-06,
2627
+ "loss": 1.0841,
2628
+ "step": 4340
2629
+ },
2630
+ {
2631
+ "epoch": 2.93,
2632
+ "learning_rate": 8.238866396761134e-06,
2633
+ "loss": 1.1036,
2634
+ "step": 4350
2635
+ },
2636
+ {
2637
+ "epoch": 2.94,
2638
+ "learning_rate": 8.234817813765182e-06,
2639
+ "loss": 1.1207,
2640
+ "step": 4360
2641
+ },
2642
+ {
2643
+ "epoch": 2.95,
2644
+ "learning_rate": 8.230769230769232e-06,
2645
+ "loss": 1.1033,
2646
+ "step": 4370
2647
+ },
2648
+ {
2649
+ "epoch": 2.95,
2650
+ "learning_rate": 8.22672064777328e-06,
2651
+ "loss": 1.0719,
2652
+ "step": 4380
2653
+ },
2654
+ {
2655
+ "epoch": 2.96,
2656
+ "learning_rate": 8.22267206477733e-06,
2657
+ "loss": 1.0539,
2658
+ "step": 4390
2659
+ },
2660
+ {
2661
+ "epoch": 2.97,
2662
+ "learning_rate": 8.218623481781377e-06,
2663
+ "loss": 1.0818,
2664
+ "step": 4400
2665
+ },
2666
+ {
2667
+ "epoch": 2.97,
2668
+ "learning_rate": 8.214574898785425e-06,
2669
+ "loss": 1.1149,
2670
+ "step": 4410
2671
+ },
2672
+ {
2673
+ "epoch": 2.98,
2674
+ "learning_rate": 8.210526315789475e-06,
2675
+ "loss": 1.0624,
2676
+ "step": 4420
2677
+ },
2678
+ {
2679
+ "epoch": 2.99,
2680
+ "learning_rate": 8.206477732793523e-06,
2681
+ "loss": 1.1197,
2682
+ "step": 4430
2683
+ },
2684
+ {
2685
+ "epoch": 2.99,
2686
+ "learning_rate": 8.20242914979757e-06,
2687
+ "loss": 1.0567,
2688
+ "step": 4440
2689
+ },
2690
+ {
2691
+ "epoch": 3.0,
2692
+ "eval_loss": 1.0876251459121704,
2693
+ "eval_runtime": 10.6357,
2694
+ "eval_samples_per_second": 103.425,
2695
+ "eval_steps_per_second": 12.975,
2696
+ "step": 4447
2697
+ },
2698
+ {
2699
+ "epoch": 3.0,
2700
+ "learning_rate": 8.19838056680162e-06,
2701
+ "loss": 1.0768,
2702
+ "step": 4450
2703
+ },
2704
+ {
2705
+ "epoch": 3.01,
2706
+ "learning_rate": 8.194331983805668e-06,
2707
+ "loss": 1.0687,
2708
+ "step": 4460
2709
+ },
2710
+ {
2711
+ "epoch": 3.02,
2712
+ "learning_rate": 8.190283400809716e-06,
2713
+ "loss": 1.1029,
2714
+ "step": 4470
2715
+ },
2716
+ {
2717
+ "epoch": 3.02,
2718
+ "learning_rate": 8.186234817813766e-06,
2719
+ "loss": 1.0569,
2720
+ "step": 4480
2721
+ },
2722
+ {
2723
+ "epoch": 3.03,
2724
+ "learning_rate": 8.182186234817814e-06,
2725
+ "loss": 1.0151,
2726
+ "step": 4490
2727
+ },
2728
+ {
2729
+ "epoch": 3.04,
2730
+ "learning_rate": 8.178137651821862e-06,
2731
+ "loss": 1.0405,
2732
+ "step": 4500
2733
+ },
2734
+ {
2735
+ "epoch": 3.04,
2736
+ "learning_rate": 8.174089068825911e-06,
2737
+ "loss": 1.07,
2738
+ "step": 4510
2739
+ },
2740
+ {
2741
+ "epoch": 3.05,
2742
+ "learning_rate": 8.17004048582996e-06,
2743
+ "loss": 1.0643,
2744
+ "step": 4520
2745
+ },
2746
+ {
2747
+ "epoch": 3.06,
2748
+ "learning_rate": 8.165991902834009e-06,
2749
+ "loss": 1.0859,
2750
+ "step": 4530
2751
+ },
2752
+ {
2753
+ "epoch": 3.06,
2754
+ "learning_rate": 8.161943319838057e-06,
2755
+ "loss": 1.0384,
2756
+ "step": 4540
2757
+ },
2758
+ {
2759
+ "epoch": 3.07,
2760
+ "learning_rate": 8.157894736842105e-06,
2761
+ "loss": 1.0873,
2762
+ "step": 4550
2763
+ },
2764
+ {
2765
+ "epoch": 3.08,
2766
+ "learning_rate": 8.153846153846154e-06,
2767
+ "loss": 1.0847,
2768
+ "step": 4560
2769
+ },
2770
+ {
2771
+ "epoch": 3.08,
2772
+ "learning_rate": 8.149797570850202e-06,
2773
+ "loss": 1.0105,
2774
+ "step": 4570
2775
+ },
2776
+ {
2777
+ "epoch": 3.09,
2778
+ "learning_rate": 8.145748987854252e-06,
2779
+ "loss": 1.0407,
2780
+ "step": 4580
2781
+ },
2782
+ {
2783
+ "epoch": 3.1,
2784
+ "learning_rate": 8.1417004048583e-06,
2785
+ "loss": 1.0437,
2786
+ "step": 4590
2787
+ },
2788
+ {
2789
+ "epoch": 3.1,
2790
+ "learning_rate": 8.13765182186235e-06,
2791
+ "loss": 1.0641,
2792
+ "step": 4600
2793
+ },
2794
+ {
2795
+ "epoch": 3.11,
2796
+ "learning_rate": 8.133603238866397e-06,
2797
+ "loss": 1.0662,
2798
+ "step": 4610
2799
+ },
2800
+ {
2801
+ "epoch": 3.12,
2802
+ "learning_rate": 8.129554655870445e-06,
2803
+ "loss": 1.0608,
2804
+ "step": 4620
2805
+ },
2806
+ {
2807
+ "epoch": 3.12,
2808
+ "learning_rate": 8.125506072874495e-06,
2809
+ "loss": 1.0728,
2810
+ "step": 4630
2811
+ },
2812
+ {
2813
+ "epoch": 3.13,
2814
+ "learning_rate": 8.121457489878543e-06,
2815
+ "loss": 1.039,
2816
+ "step": 4640
2817
+ },
2818
+ {
2819
+ "epoch": 3.14,
2820
+ "learning_rate": 8.117408906882591e-06,
2821
+ "loss": 1.0898,
2822
+ "step": 4650
2823
+ },
2824
+ {
2825
+ "epoch": 3.14,
2826
+ "learning_rate": 8.11336032388664e-06,
2827
+ "loss": 1.107,
2828
+ "step": 4660
2829
+ },
2830
+ {
2831
+ "epoch": 3.15,
2832
+ "learning_rate": 8.109311740890688e-06,
2833
+ "loss": 1.1001,
2834
+ "step": 4670
2835
+ },
2836
+ {
2837
+ "epoch": 3.16,
2838
+ "learning_rate": 8.105263157894738e-06,
2839
+ "loss": 1.0371,
2840
+ "step": 4680
2841
+ },
2842
+ {
2843
+ "epoch": 3.16,
2844
+ "learning_rate": 8.101214574898786e-06,
2845
+ "loss": 1.0945,
2846
+ "step": 4690
2847
+ },
2848
+ {
2849
+ "epoch": 3.17,
2850
+ "learning_rate": 8.097165991902834e-06,
2851
+ "loss": 1.0509,
2852
+ "step": 4700
2853
+ },
2854
+ {
2855
+ "epoch": 3.18,
2856
+ "learning_rate": 8.093117408906884e-06,
2857
+ "loss": 1.0694,
2858
+ "step": 4710
2859
+ },
2860
+ {
2861
+ "epoch": 3.18,
2862
+ "learning_rate": 8.089068825910931e-06,
2863
+ "loss": 1.0153,
2864
+ "step": 4720
2865
+ },
2866
+ {
2867
+ "epoch": 3.19,
2868
+ "learning_rate": 8.08502024291498e-06,
2869
+ "loss": 1.0373,
2870
+ "step": 4730
2871
+ },
2872
+ {
2873
+ "epoch": 3.2,
2874
+ "learning_rate": 8.080971659919029e-06,
2875
+ "loss": 1.0583,
2876
+ "step": 4740
2877
+ },
2878
+ {
2879
+ "epoch": 3.2,
2880
+ "learning_rate": 8.076923076923077e-06,
2881
+ "loss": 1.0213,
2882
+ "step": 4750
2883
+ },
2884
+ {
2885
+ "epoch": 3.21,
2886
+ "learning_rate": 8.072874493927125e-06,
2887
+ "loss": 1.0707,
2888
+ "step": 4760
2889
+ },
2890
+ {
2891
+ "epoch": 3.22,
2892
+ "learning_rate": 8.068825910931175e-06,
2893
+ "loss": 1.0801,
2894
+ "step": 4770
2895
+ },
2896
+ {
2897
+ "epoch": 3.22,
2898
+ "learning_rate": 8.064777327935222e-06,
2899
+ "loss": 1.0336,
2900
+ "step": 4780
2901
+ },
2902
+ {
2903
+ "epoch": 3.23,
2904
+ "learning_rate": 8.060728744939272e-06,
2905
+ "loss": 1.0829,
2906
+ "step": 4790
2907
+ },
2908
+ {
2909
+ "epoch": 3.24,
2910
+ "learning_rate": 8.05668016194332e-06,
2911
+ "loss": 1.0853,
2912
+ "step": 4800
2913
+ },
2914
+ {
2915
+ "epoch": 3.24,
2916
+ "learning_rate": 8.05263157894737e-06,
2917
+ "loss": 1.074,
2918
+ "step": 4810
2919
+ },
2920
+ {
2921
+ "epoch": 3.25,
2922
+ "learning_rate": 8.048582995951418e-06,
2923
+ "loss": 1.0805,
2924
+ "step": 4820
2925
+ },
2926
+ {
2927
+ "epoch": 3.26,
2928
+ "learning_rate": 8.044534412955467e-06,
2929
+ "loss": 1.0644,
2930
+ "step": 4830
2931
+ },
2932
+ {
2933
+ "epoch": 3.26,
2934
+ "learning_rate": 8.040485829959514e-06,
2935
+ "loss": 1.039,
2936
+ "step": 4840
2937
+ },
2938
+ {
2939
+ "epoch": 3.27,
2940
+ "learning_rate": 8.036437246963563e-06,
2941
+ "loss": 1.0326,
2942
+ "step": 4850
2943
+ },
2944
+ {
2945
+ "epoch": 3.28,
2946
+ "learning_rate": 8.032388663967611e-06,
2947
+ "loss": 1.0776,
2948
+ "step": 4860
2949
+ },
2950
+ {
2951
+ "epoch": 3.28,
2952
+ "learning_rate": 8.02834008097166e-06,
2953
+ "loss": 1.043,
2954
+ "step": 4870
2955
+ },
2956
+ {
2957
+ "epoch": 3.29,
2958
+ "learning_rate": 8.024291497975709e-06,
2959
+ "loss": 1.0784,
2960
+ "step": 4880
2961
+ },
2962
+ {
2963
+ "epoch": 3.3,
2964
+ "learning_rate": 8.020242914979758e-06,
2965
+ "loss": 1.0783,
2966
+ "step": 4890
2967
+ },
2968
+ {
2969
+ "epoch": 3.31,
2970
+ "learning_rate": 8.016194331983806e-06,
2971
+ "loss": 1.0987,
2972
+ "step": 4900
2973
+ },
2974
+ {
2975
+ "epoch": 3.31,
2976
+ "learning_rate": 8.012145748987854e-06,
2977
+ "loss": 1.0515,
2978
+ "step": 4910
2979
+ },
2980
+ {
2981
+ "epoch": 3.32,
2982
+ "learning_rate": 8.008097165991904e-06,
2983
+ "loss": 1.0667,
2984
+ "step": 4920
2985
+ },
2986
+ {
2987
+ "epoch": 3.33,
2988
+ "learning_rate": 8.004048582995952e-06,
2989
+ "loss": 1.1095,
2990
+ "step": 4930
2991
+ },
2992
+ {
2993
+ "epoch": 3.33,
2994
+ "learning_rate": 8e-06,
2995
+ "loss": 1.0245,
2996
+ "step": 4940
2997
+ },
2998
+ {
2999
+ "epoch": 3.34,
3000
+ "learning_rate": 7.99595141700405e-06,
3001
+ "loss": 1.0753,
3002
+ "step": 4950
3003
+ },
3004
+ {
3005
+ "epoch": 3.35,
3006
+ "learning_rate": 7.991902834008097e-06,
3007
+ "loss": 1.0522,
3008
+ "step": 4960
3009
+ },
3010
+ {
3011
+ "epoch": 3.35,
3012
+ "learning_rate": 7.987854251012147e-06,
3013
+ "loss": 1.0106,
3014
+ "step": 4970
3015
+ },
3016
+ {
3017
+ "epoch": 3.36,
3018
+ "learning_rate": 7.983805668016195e-06,
3019
+ "loss": 1.0948,
3020
+ "step": 4980
3021
+ },
3022
+ {
3023
+ "epoch": 3.37,
3024
+ "learning_rate": 7.979757085020243e-06,
3025
+ "loss": 1.0649,
3026
+ "step": 4990
3027
+ },
3028
+ {
3029
+ "epoch": 3.37,
3030
+ "learning_rate": 7.975708502024292e-06,
3031
+ "loss": 1.0096,
3032
+ "step": 5000
3033
+ },
3034
+ {
3035
+ "epoch": 3.38,
3036
+ "learning_rate": 7.97165991902834e-06,
3037
+ "loss": 1.0076,
3038
+ "step": 5010
3039
+ },
3040
+ {
3041
+ "epoch": 3.39,
3042
+ "learning_rate": 7.967611336032388e-06,
3043
+ "loss": 1.0605,
3044
+ "step": 5020
3045
+ },
3046
+ {
3047
+ "epoch": 3.39,
3048
+ "learning_rate": 7.963562753036438e-06,
3049
+ "loss": 1.0544,
3050
+ "step": 5030
3051
+ },
3052
+ {
3053
+ "epoch": 3.4,
3054
+ "learning_rate": 7.959514170040486e-06,
3055
+ "loss": 1.0638,
3056
+ "step": 5040
3057
+ },
3058
+ {
3059
+ "epoch": 3.41,
3060
+ "learning_rate": 7.955465587044534e-06,
3061
+ "loss": 1.021,
3062
+ "step": 5050
3063
+ },
3064
+ {
3065
+ "epoch": 3.41,
3066
+ "learning_rate": 7.951417004048583e-06,
3067
+ "loss": 1.0622,
3068
+ "step": 5060
3069
+ },
3070
+ {
3071
+ "epoch": 3.42,
3072
+ "learning_rate": 7.947368421052631e-06,
3073
+ "loss": 1.0452,
3074
+ "step": 5070
3075
+ },
3076
+ {
3077
+ "epoch": 3.43,
3078
+ "learning_rate": 7.943319838056681e-06,
3079
+ "loss": 1.0678,
3080
+ "step": 5080
3081
+ },
3082
+ {
3083
+ "epoch": 3.43,
3084
+ "learning_rate": 7.939271255060729e-06,
3085
+ "loss": 0.9841,
3086
+ "step": 5090
3087
+ },
3088
+ {
3089
+ "epoch": 3.44,
3090
+ "learning_rate": 7.935222672064778e-06,
3091
+ "loss": 1.0684,
3092
+ "step": 5100
3093
+ },
3094
+ {
3095
+ "epoch": 3.45,
3096
+ "learning_rate": 7.931174089068826e-06,
3097
+ "loss": 1.0393,
3098
+ "step": 5110
3099
+ },
3100
+ {
3101
+ "epoch": 3.45,
3102
+ "learning_rate": 7.927125506072876e-06,
3103
+ "loss": 1.0816,
3104
+ "step": 5120
3105
+ },
3106
+ {
3107
+ "epoch": 3.46,
3108
+ "learning_rate": 7.923076923076922e-06,
3109
+ "loss": 1.0744,
3110
+ "step": 5130
3111
+ },
3112
+ {
3113
+ "epoch": 3.47,
3114
+ "learning_rate": 7.919028340080972e-06,
3115
+ "loss": 1.0575,
3116
+ "step": 5140
3117
+ },
3118
+ {
3119
+ "epoch": 3.47,
3120
+ "learning_rate": 7.914979757085022e-06,
3121
+ "loss": 1.119,
3122
+ "step": 5150
3123
+ },
3124
+ {
3125
+ "epoch": 3.48,
3126
+ "learning_rate": 7.91093117408907e-06,
3127
+ "loss": 1.0652,
3128
+ "step": 5160
3129
+ },
3130
+ {
3131
+ "epoch": 3.49,
3132
+ "learning_rate": 7.906882591093117e-06,
3133
+ "loss": 0.9888,
3134
+ "step": 5170
3135
+ },
3136
+ {
3137
+ "epoch": 3.49,
3138
+ "learning_rate": 7.902834008097167e-06,
3139
+ "loss": 1.0415,
3140
+ "step": 5180
3141
+ },
3142
+ {
3143
+ "epoch": 3.5,
3144
+ "learning_rate": 7.898785425101215e-06,
3145
+ "loss": 1.0266,
3146
+ "step": 5190
3147
+ },
3148
+ {
3149
+ "epoch": 3.51,
3150
+ "learning_rate": 7.894736842105263e-06,
3151
+ "loss": 1.0204,
3152
+ "step": 5200
3153
+ },
3154
+ {
3155
+ "epoch": 3.51,
3156
+ "learning_rate": 7.890688259109313e-06,
3157
+ "loss": 1.0709,
3158
+ "step": 5210
3159
+ },
3160
+ {
3161
+ "epoch": 3.52,
3162
+ "learning_rate": 7.88663967611336e-06,
3163
+ "loss": 1.0342,
3164
+ "step": 5220
3165
+ },
3166
+ {
3167
+ "epoch": 3.53,
3168
+ "learning_rate": 7.882591093117408e-06,
3169
+ "loss": 1.0492,
3170
+ "step": 5230
3171
+ },
3172
+ {
3173
+ "epoch": 3.53,
3174
+ "learning_rate": 7.878542510121458e-06,
3175
+ "loss": 1.0375,
3176
+ "step": 5240
3177
+ },
3178
+ {
3179
+ "epoch": 3.54,
3180
+ "learning_rate": 7.874493927125506e-06,
3181
+ "loss": 1.0188,
3182
+ "step": 5250
3183
+ },
3184
+ {
3185
+ "epoch": 3.55,
3186
+ "learning_rate": 7.870445344129556e-06,
3187
+ "loss": 1.0951,
3188
+ "step": 5260
3189
+ },
3190
+ {
3191
+ "epoch": 3.55,
3192
+ "learning_rate": 7.866396761133604e-06,
3193
+ "loss": 1.0133,
3194
+ "step": 5270
3195
+ },
3196
+ {
3197
+ "epoch": 3.56,
3198
+ "learning_rate": 7.862348178137651e-06,
3199
+ "loss": 1.0414,
3200
+ "step": 5280
3201
+ },
3202
+ {
3203
+ "epoch": 3.57,
3204
+ "learning_rate": 7.858299595141701e-06,
3205
+ "loss": 1.0863,
3206
+ "step": 5290
3207
+ },
3208
+ {
3209
+ "epoch": 3.58,
3210
+ "learning_rate": 7.854251012145749e-06,
3211
+ "loss": 1.0998,
3212
+ "step": 5300
3213
+ },
3214
+ {
3215
+ "epoch": 3.58,
3216
+ "learning_rate": 7.850202429149797e-06,
3217
+ "loss": 1.0854,
3218
+ "step": 5310
3219
+ },
3220
+ {
3221
+ "epoch": 3.59,
3222
+ "learning_rate": 7.846153846153847e-06,
3223
+ "loss": 1.0594,
3224
+ "step": 5320
3225
+ },
3226
+ {
3227
+ "epoch": 3.6,
3228
+ "learning_rate": 7.842105263157896e-06,
3229
+ "loss": 1.0225,
3230
+ "step": 5330
3231
+ },
3232
+ {
3233
+ "epoch": 3.6,
3234
+ "learning_rate": 7.838056680161942e-06,
3235
+ "loss": 1.0728,
3236
+ "step": 5340
3237
+ },
3238
+ {
3239
+ "epoch": 3.61,
3240
+ "learning_rate": 7.834008097165992e-06,
3241
+ "loss": 1.0417,
3242
+ "step": 5350
3243
+ },
3244
+ {
3245
+ "epoch": 3.62,
3246
+ "learning_rate": 7.82995951417004e-06,
3247
+ "loss": 1.0226,
3248
+ "step": 5360
3249
+ },
3250
+ {
3251
+ "epoch": 3.62,
3252
+ "learning_rate": 7.82591093117409e-06,
3253
+ "loss": 1.0953,
3254
+ "step": 5370
3255
+ },
3256
+ {
3257
+ "epoch": 3.63,
3258
+ "learning_rate": 7.821862348178138e-06,
3259
+ "loss": 1.053,
3260
+ "step": 5380
3261
+ },
3262
+ {
3263
+ "epoch": 3.64,
3264
+ "learning_rate": 7.817813765182187e-06,
3265
+ "loss": 1.0523,
3266
+ "step": 5390
3267
+ },
3268
+ {
3269
+ "epoch": 3.64,
3270
+ "learning_rate": 7.813765182186235e-06,
3271
+ "loss": 1.1017,
3272
+ "step": 5400
3273
+ },
3274
+ {
3275
+ "epoch": 3.65,
3276
+ "learning_rate": 7.809716599190285e-06,
3277
+ "loss": 1.0032,
3278
+ "step": 5410
3279
+ },
3280
+ {
3281
+ "epoch": 3.66,
3282
+ "learning_rate": 7.805668016194333e-06,
3283
+ "loss": 1.0331,
3284
+ "step": 5420
3285
+ },
3286
+ {
3287
+ "epoch": 3.66,
3288
+ "learning_rate": 7.80161943319838e-06,
3289
+ "loss": 1.0483,
3290
+ "step": 5430
3291
+ },
3292
+ {
3293
+ "epoch": 3.67,
3294
+ "learning_rate": 7.79757085020243e-06,
3295
+ "loss": 1.0291,
3296
+ "step": 5440
3297
+ },
3298
+ {
3299
+ "epoch": 3.68,
3300
+ "learning_rate": 7.793522267206478e-06,
3301
+ "loss": 1.0113,
3302
+ "step": 5450
3303
+ },
3304
+ {
3305
+ "epoch": 3.68,
3306
+ "learning_rate": 7.789473684210526e-06,
3307
+ "loss": 1.0407,
3308
+ "step": 5460
3309
+ },
3310
+ {
3311
+ "epoch": 3.69,
3312
+ "learning_rate": 7.785425101214576e-06,
3313
+ "loss": 1.077,
3314
+ "step": 5470
3315
+ },
3316
+ {
3317
+ "epoch": 3.7,
3318
+ "learning_rate": 7.781376518218624e-06,
3319
+ "loss": 1.1063,
3320
+ "step": 5480
3321
+ },
3322
+ {
3323
+ "epoch": 3.7,
3324
+ "learning_rate": 7.777327935222672e-06,
3325
+ "loss": 1.0377,
3326
+ "step": 5490
3327
+ },
3328
+ {
3329
+ "epoch": 3.71,
3330
+ "learning_rate": 7.773279352226721e-06,
3331
+ "loss": 1.0841,
3332
+ "step": 5500
3333
+ },
3334
+ {
3335
+ "epoch": 3.72,
3336
+ "learning_rate": 7.76923076923077e-06,
3337
+ "loss": 1.0638,
3338
+ "step": 5510
3339
+ },
3340
+ {
3341
+ "epoch": 3.72,
3342
+ "learning_rate": 7.765182186234819e-06,
3343
+ "loss": 1.0525,
3344
+ "step": 5520
3345
+ },
3346
+ {
3347
+ "epoch": 3.73,
3348
+ "learning_rate": 7.761133603238867e-06,
3349
+ "loss": 1.0638,
3350
+ "step": 5530
3351
+ },
3352
+ {
3353
+ "epoch": 3.74,
3354
+ "learning_rate": 7.757085020242915e-06,
3355
+ "loss": 1.0478,
3356
+ "step": 5540
3357
+ },
3358
+ {
3359
+ "epoch": 3.74,
3360
+ "learning_rate": 7.753036437246964e-06,
3361
+ "loss": 1.0429,
3362
+ "step": 5550
3363
+ },
3364
+ {
3365
+ "epoch": 3.75,
3366
+ "learning_rate": 7.748987854251014e-06,
3367
+ "loss": 1.0615,
3368
+ "step": 5560
3369
+ },
3370
+ {
3371
+ "epoch": 3.76,
3372
+ "learning_rate": 7.74493927125506e-06,
3373
+ "loss": 1.0653,
3374
+ "step": 5570
3375
+ },
3376
+ {
3377
+ "epoch": 3.76,
3378
+ "learning_rate": 7.74089068825911e-06,
3379
+ "loss": 1.0755,
3380
+ "step": 5580
3381
+ },
3382
+ {
3383
+ "epoch": 3.77,
3384
+ "learning_rate": 7.736842105263158e-06,
3385
+ "loss": 1.0447,
3386
+ "step": 5590
3387
+ },
3388
+ {
3389
+ "epoch": 3.78,
3390
+ "learning_rate": 7.732793522267207e-06,
3391
+ "loss": 1.0372,
3392
+ "step": 5600
3393
+ },
3394
+ {
3395
+ "epoch": 3.78,
3396
+ "learning_rate": 7.728744939271255e-06,
3397
+ "loss": 1.1158,
3398
+ "step": 5610
3399
+ },
3400
+ {
3401
+ "epoch": 3.79,
3402
+ "learning_rate": 7.724696356275305e-06,
3403
+ "loss": 1.1195,
3404
+ "step": 5620
3405
+ },
3406
+ {
3407
+ "epoch": 3.8,
3408
+ "learning_rate": 7.720647773279351e-06,
3409
+ "loss": 1.0246,
3410
+ "step": 5630
3411
+ },
3412
+ {
3413
+ "epoch": 3.8,
3414
+ "learning_rate": 7.716599190283401e-06,
3415
+ "loss": 1.0339,
3416
+ "step": 5640
3417
+ },
3418
+ {
3419
+ "epoch": 3.81,
3420
+ "learning_rate": 7.712550607287449e-06,
3421
+ "loss": 1.0578,
3422
+ "step": 5650
3423
+ },
3424
+ {
3425
+ "epoch": 3.82,
3426
+ "learning_rate": 7.708502024291498e-06,
3427
+ "loss": 1.0747,
3428
+ "step": 5660
3429
+ },
3430
+ {
3431
+ "epoch": 3.82,
3432
+ "learning_rate": 7.704453441295546e-06,
3433
+ "loss": 1.0301,
3434
+ "step": 5670
3435
+ },
3436
+ {
3437
+ "epoch": 3.83,
3438
+ "learning_rate": 7.700404858299596e-06,
3439
+ "loss": 0.9873,
3440
+ "step": 5680
3441
+ },
3442
+ {
3443
+ "epoch": 3.84,
3444
+ "learning_rate": 7.696356275303644e-06,
3445
+ "loss": 1.0217,
3446
+ "step": 5690
3447
+ },
3448
+ {
3449
+ "epoch": 3.84,
3450
+ "learning_rate": 7.692307692307694e-06,
3451
+ "loss": 1.0941,
3452
+ "step": 5700
3453
+ },
3454
+ {
3455
+ "epoch": 3.85,
3456
+ "learning_rate": 7.688259109311742e-06,
3457
+ "loss": 1.0842,
3458
+ "step": 5710
3459
+ },
3460
+ {
3461
+ "epoch": 3.86,
3462
+ "learning_rate": 7.68421052631579e-06,
3463
+ "loss": 1.0163,
3464
+ "step": 5720
3465
+ },
3466
+ {
3467
+ "epoch": 3.87,
3468
+ "learning_rate": 7.680161943319839e-06,
3469
+ "loss": 1.0387,
3470
+ "step": 5730
3471
+ },
3472
+ {
3473
+ "epoch": 3.87,
3474
+ "learning_rate": 7.676113360323887e-06,
3475
+ "loss": 1.0719,
3476
+ "step": 5740
3477
+ },
3478
+ {
3479
+ "epoch": 3.88,
3480
+ "learning_rate": 7.672064777327935e-06,
3481
+ "loss": 1.0495,
3482
+ "step": 5750
3483
+ },
3484
+ {
3485
+ "epoch": 3.89,
3486
+ "learning_rate": 7.668016194331985e-06,
3487
+ "loss": 1.0669,
3488
+ "step": 5760
3489
+ },
3490
+ {
3491
+ "epoch": 3.89,
3492
+ "learning_rate": 7.663967611336033e-06,
3493
+ "loss": 1.1226,
3494
+ "step": 5770
3495
+ },
3496
+ {
3497
+ "epoch": 3.9,
3498
+ "learning_rate": 7.65991902834008e-06,
3499
+ "loss": 1.0147,
3500
+ "step": 5780
3501
+ },
3502
+ {
3503
+ "epoch": 3.91,
3504
+ "learning_rate": 7.65587044534413e-06,
3505
+ "loss": 1.0244,
3506
+ "step": 5790
3507
+ },
3508
+ {
3509
+ "epoch": 3.91,
3510
+ "learning_rate": 7.651821862348178e-06,
3511
+ "loss": 1.0134,
3512
+ "step": 5800
3513
+ },
3514
+ {
3515
+ "epoch": 3.92,
3516
+ "learning_rate": 7.647773279352228e-06,
3517
+ "loss": 1.0215,
3518
+ "step": 5810
3519
+ },
3520
+ {
3521
+ "epoch": 3.93,
3522
+ "learning_rate": 7.643724696356276e-06,
3523
+ "loss": 1.1177,
3524
+ "step": 5820
3525
+ },
3526
+ {
3527
+ "epoch": 3.93,
3528
+ "learning_rate": 7.639676113360325e-06,
3529
+ "loss": 1.0472,
3530
+ "step": 5830
3531
+ },
3532
+ {
3533
+ "epoch": 3.94,
3534
+ "learning_rate": 7.635627530364373e-06,
3535
+ "loss": 1.0335,
3536
+ "step": 5840
3537
+ },
3538
+ {
3539
+ "epoch": 3.95,
3540
+ "learning_rate": 7.631578947368423e-06,
3541
+ "loss": 1.0346,
3542
+ "step": 5850
3543
+ },
3544
+ {
3545
+ "epoch": 3.95,
3546
+ "learning_rate": 7.627530364372468e-06,
3547
+ "loss": 1.0354,
3548
+ "step": 5860
3549
+ },
3550
+ {
3551
+ "epoch": 3.96,
3552
+ "learning_rate": 7.623481781376519e-06,
3553
+ "loss": 1.0663,
3554
+ "step": 5870
3555
+ },
3556
+ {
3557
+ "epoch": 3.97,
3558
+ "learning_rate": 7.619433198380567e-06,
3559
+ "loss": 1.0602,
3560
+ "step": 5880
3561
+ },
3562
+ {
3563
+ "epoch": 3.97,
3564
+ "learning_rate": 7.615384615384615e-06,
3565
+ "loss": 1.0458,
3566
+ "step": 5890
3567
+ },
3568
+ {
3569
+ "epoch": 3.98,
3570
+ "learning_rate": 7.611336032388663e-06,
3571
+ "loss": 1.079,
3572
+ "step": 5900
3573
+ },
3574
+ {
3575
+ "epoch": 3.99,
3576
+ "learning_rate": 7.607287449392713e-06,
3577
+ "loss": 1.0888,
3578
+ "step": 5910
3579
+ },
3580
+ {
3581
+ "epoch": 3.99,
3582
+ "learning_rate": 7.60323886639676e-06,
3583
+ "loss": 1.0395,
3584
+ "step": 5920
3585
+ },
3586
+ {
3587
+ "epoch": 4.0,
3588
+ "learning_rate": 7.5991902834008105e-06,
3589
+ "loss": 1.1178,
3590
+ "step": 5930
3591
+ },
3592
+ {
3593
+ "epoch": 4.0,
3594
+ "eval_loss": 1.0923843383789062,
3595
+ "eval_runtime": 10.6309,
3596
+ "eval_samples_per_second": 103.472,
3597
+ "eval_steps_per_second": 12.981,
3598
+ "step": 5930
3599
+ }
3600
+ ],
3601
+ "max_steps": 22230,
3602
+ "num_train_epochs": 15,
3603
+ "total_flos": 6.084121621168128e+18,
3604
+ "trial_name": null,
3605
+ "trial_params": null
3606
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b1cdc00ed543342a31cca3e2c908e7445062959a1a372014b76c542fbe5d37d
3
+ size 5307
zero_to_fp32.py ADDED
@@ -0,0 +1,578 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example: python zero_to_fp32.py . pytorch_model.bin
14
+
15
+ import argparse
16
+ import torch
17
+ import glob
18
+ import math
19
+ import os
20
+ import re
21
+ from collections import OrderedDict
22
+ from dataclasses import dataclass
23
+
24
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
25
+ # DeepSpeed data structures it has to be available in the current python environment.
26
+ from deepspeed.utils import logger
27
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
28
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
29
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
30
+
31
+
32
+ @dataclass
33
+ class zero_model_state:
34
+ buffers: dict()
35
+ param_shapes: dict()
36
+ shared_params: list
37
+ ds_version: int
38
+ frozen_param_shapes: dict()
39
+ frozen_param_fragments: dict()
40
+
41
+
42
+ debug = 0
43
+
44
+ # load to cpu
45
+ device = torch.device('cpu')
46
+
47
+
48
+ def atoi(text):
49
+ return int(text) if text.isdigit() else text
50
+
51
+
52
+ def natural_keys(text):
53
+ '''
54
+ alist.sort(key=natural_keys) sorts in human order
55
+ http://nedbatchelder.com/blog/200712/human_sorting.html
56
+ (See Toothy's implementation in the comments)
57
+ '''
58
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
59
+
60
+
61
+ def get_model_state_file(checkpoint_dir, zero_stage):
62
+ if not os.path.isdir(checkpoint_dir):
63
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
64
+
65
+ # there should be only one file
66
+ if zero_stage == 2:
67
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
68
+ elif zero_stage == 3:
69
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
70
+
71
+ if not os.path.exists(file):
72
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
73
+
74
+ return file
75
+
76
+
77
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
78
+ # XXX: need to test that this simple glob rule works for multi-node setup too
79
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
80
+
81
+ if len(ckpt_files) == 0:
82
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
83
+
84
+ return ckpt_files
85
+
86
+
87
+ def get_optim_files(checkpoint_dir):
88
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
89
+
90
+
91
+ def get_model_state_files(checkpoint_dir):
92
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
93
+
94
+
95
+ def parse_model_states(files):
96
+ zero_model_states = []
97
+ for file in files:
98
+ state_dict = torch.load(file, map_location=device)
99
+
100
+ if BUFFER_NAMES not in state_dict:
101
+ raise ValueError(f"{file} is not a model state checkpoint")
102
+ buffer_names = state_dict[BUFFER_NAMES]
103
+ if debug:
104
+ print("Found buffers:", buffer_names)
105
+
106
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
107
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
108
+ param_shapes = state_dict[PARAM_SHAPES]
109
+
110
+ # collect parameters that are included in param_shapes
111
+ param_names = []
112
+ for s in param_shapes:
113
+ for name in s.keys():
114
+ param_names.append(name)
115
+
116
+ # update with frozen parameters
117
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
118
+ if frozen_param_shapes is not None:
119
+ if debug:
120
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
121
+ param_names += list(frozen_param_shapes.keys())
122
+
123
+ # handle shared params
124
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
125
+
126
+ ds_version = state_dict.get(DS_VERSION, None)
127
+
128
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
129
+
130
+ z_model_state = zero_model_state(buffers=buffers,
131
+ param_shapes=param_shapes,
132
+ shared_params=shared_params,
133
+ ds_version=ds_version,
134
+ frozen_param_shapes=frozen_param_shapes,
135
+ frozen_param_fragments=frozen_param_fragments)
136
+ zero_model_states.append(z_model_state)
137
+
138
+ return zero_model_states
139
+
140
+
141
+ def parse_optim_states(files, ds_checkpoint_dir):
142
+
143
+ total_files = len(files)
144
+ state_dicts = []
145
+ for f in files:
146
+ state_dicts.append(torch.load(f, map_location=device))
147
+
148
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
149
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
150
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
151
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
152
+
153
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
154
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
155
+ # use the max of the partition_count to get the dp world_size.
156
+
157
+ if type(world_size) is list:
158
+ world_size = max(world_size)
159
+
160
+ if world_size != total_files:
161
+ raise ValueError(
162
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
163
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
164
+ )
165
+
166
+ # the groups are named differently in each stage
167
+ if zero_stage == 2:
168
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
169
+ elif zero_stage == 3:
170
+ fp32_groups_key = FP32_FLAT_GROUPS
171
+ else:
172
+ raise ValueError(f"unknown zero stage {zero_stage}")
173
+
174
+ if zero_stage == 2:
175
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
176
+ elif zero_stage == 3:
177
+ # if there is more than one param group, there will be multiple flattened tensors - one
178
+ # flattened tensor per group - for simplicity merge them into a single tensor
179
+ #
180
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
181
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
182
+
183
+ fp32_flat_groups = [
184
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key], 0) for i in range(len(state_dicts))
185
+ ]
186
+
187
+ return zero_stage, world_size, fp32_flat_groups
188
+
189
+
190
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir):
191
+ """
192
+ Returns fp32 state_dict reconstructed from ds checkpoint
193
+
194
+ Args:
195
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
196
+
197
+ """
198
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
199
+
200
+ optim_files = get_optim_files(ds_checkpoint_dir)
201
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
202
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
203
+
204
+ model_files = get_model_state_files(ds_checkpoint_dir)
205
+
206
+ zero_model_states = parse_model_states(model_files)
207
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
208
+
209
+ if zero_stage == 2:
210
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states)
211
+ elif zero_stage == 3:
212
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states)
213
+
214
+
215
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
216
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
217
+ return
218
+
219
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
220
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
221
+
222
+ if debug:
223
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
224
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
225
+
226
+ wanted_params = len(frozen_param_shapes)
227
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
228
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
229
+ print(f'Frozen params: Have {avail_numel} numels to process.')
230
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
231
+
232
+ total_params = 0
233
+ total_numel = 0
234
+ for name, shape in frozen_param_shapes.items():
235
+ total_params += 1
236
+ unpartitioned_numel = shape.numel()
237
+ total_numel += unpartitioned_numel
238
+
239
+ state_dict[name] = frozen_param_fragments[name]
240
+
241
+ if debug:
242
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
243
+
244
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
245
+
246
+
247
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
248
+ param_shapes = zero_model_states[0].param_shapes
249
+
250
+ # Reconstruction protocol:
251
+ #
252
+ # XXX: document this
253
+
254
+ if debug:
255
+ for i in range(world_size):
256
+ for j in range(len(fp32_flat_groups[0])):
257
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
258
+
259
+ # XXX: memory usage doubles here (zero2)
260
+ num_param_groups = len(fp32_flat_groups[0])
261
+ merged_single_partition_of_fp32_groups = []
262
+ for i in range(num_param_groups):
263
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
264
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
265
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
266
+ avail_numel = sum(
267
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
268
+
269
+ if debug:
270
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
271
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
272
+ # not asserting if there is a mismatch due to possible padding
273
+ print(f"Have {avail_numel} numels to process.")
274
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
275
+
276
+ # params
277
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
278
+ # out-of-core computing solution
279
+ total_numel = 0
280
+ total_params = 0
281
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
282
+ offset = 0
283
+ avail_numel = full_single_fp32_vector.numel()
284
+ for name, shape in shapes.items():
285
+
286
+ unpartitioned_numel = shape.numel()
287
+ total_numel += unpartitioned_numel
288
+ total_params += 1
289
+
290
+ if debug:
291
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
292
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
293
+ offset += unpartitioned_numel
294
+
295
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
296
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
297
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
298
+ # live optimizer object, so we are checking that the numbers are within the right range
299
+ align_to = 2 * world_size
300
+
301
+ def zero2_align(x):
302
+ return align_to * math.ceil(x / align_to)
303
+
304
+ if debug:
305
+ print(f"original offset={offset}, avail_numel={avail_numel}")
306
+
307
+ offset = zero2_align(offset)
308
+ avail_numel = zero2_align(avail_numel)
309
+
310
+ if debug:
311
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
312
+
313
+ # Sanity check
314
+ if offset != avail_numel:
315
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
316
+
317
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
318
+
319
+
320
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states):
321
+ state_dict = OrderedDict()
322
+
323
+ # buffers
324
+ buffers = zero_model_states[0].buffers
325
+ state_dict.update(buffers)
326
+ if debug:
327
+ print(f"added {len(buffers)} buffers")
328
+
329
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
330
+
331
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
332
+
333
+ # recover shared parameters
334
+ for pair in zero_model_states[0].shared_params:
335
+ if pair[1] in state_dict:
336
+ state_dict[pair[0]] = state_dict[pair[1]]
337
+
338
+ return state_dict
339
+
340
+
341
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
342
+ remainder = unpartitioned_numel % world_size
343
+ padding_numel = (world_size - remainder) if remainder else 0
344
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
345
+ return partitioned_numel, padding_numel
346
+
347
+
348
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
349
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
350
+ return
351
+
352
+ if debug:
353
+ for i in range(world_size):
354
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
355
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
356
+
357
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
358
+ wanted_params = len(frozen_param_shapes)
359
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
360
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
361
+ print(f'Frozen params: Have {avail_numel} numels to process.')
362
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
363
+
364
+ total_params = 0
365
+ total_numel = 0
366
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
367
+ total_params += 1
368
+ unpartitioned_numel = shape.numel()
369
+ total_numel += unpartitioned_numel
370
+
371
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
372
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
373
+
374
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
375
+
376
+ if debug:
377
+ print(
378
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
379
+ )
380
+
381
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
382
+
383
+
384
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
385
+ param_shapes = zero_model_states[0].param_shapes
386
+ avail_numel = fp32_flat_groups[0].numel() * world_size
387
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
388
+ # param, re-consolidating each param, while dealing with padding if any
389
+
390
+ # merge list of dicts, preserving order
391
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
392
+
393
+ if debug:
394
+ for i in range(world_size):
395
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
396
+
397
+ wanted_params = len(param_shapes)
398
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
399
+ # not asserting if there is a mismatch due to possible padding
400
+ avail_numel = fp32_flat_groups[0].numel() * world_size
401
+ print(f"Trainable params: Have {avail_numel} numels to process.")
402
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
403
+
404
+ # params
405
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
406
+ # out-of-core computing solution
407
+ offset = 0
408
+ total_numel = 0
409
+ total_params = 0
410
+ for name, shape in param_shapes.items():
411
+
412
+ unpartitioned_numel = shape.numel()
413
+ total_numel += unpartitioned_numel
414
+ total_params += 1
415
+
416
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
417
+
418
+ if debug:
419
+ print(
420
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
421
+ )
422
+
423
+ # XXX: memory usage doubles here
424
+ state_dict[name] = torch.cat(
425
+ tuple(fp32_flat_groups[i].narrow(0, offset, partitioned_numel) for i in range(world_size)),
426
+ 0).narrow(0, 0, unpartitioned_numel).view(shape)
427
+ offset += partitioned_numel
428
+
429
+ offset *= world_size
430
+
431
+ # Sanity check
432
+ if offset != avail_numel:
433
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
434
+
435
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
436
+
437
+
438
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states):
439
+ state_dict = OrderedDict()
440
+
441
+ # buffers
442
+ buffers = zero_model_states[0].buffers
443
+ state_dict.update(buffers)
444
+ if debug:
445
+ print(f"added {len(buffers)} buffers")
446
+
447
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
448
+
449
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
450
+
451
+ # recover shared parameters
452
+ for pair in zero_model_states[0].shared_params:
453
+ if pair[1] in state_dict:
454
+ state_dict[pair[0]] = state_dict[pair[1]]
455
+
456
+ return state_dict
457
+
458
+
459
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None):
460
+ """
461
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
462
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
463
+ via a model hub.
464
+
465
+ Args:
466
+ - ``checkpoint_dir``: path to the desired checkpoint folder
467
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in 'latest' file. e.g., ``global_step14``
468
+
469
+ Returns:
470
+ - pytorch ``state_dict``
471
+
472
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
473
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
474
+ the checkpoint.
475
+
476
+ A typical usage might be ::
477
+
478
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
479
+ # do the training and checkpoint saving
480
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
481
+ model = model.cpu() # move to cpu
482
+ model.load_state_dict(state_dict)
483
+ # submit to model hub or save the model to share with others
484
+
485
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
486
+ application. i.e. you will need to re-initialize the deepspeed engine, since
487
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
488
+
489
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
490
+
491
+ """
492
+ if tag is None:
493
+ latest_path = os.path.join(checkpoint_dir, 'latest')
494
+ if os.path.isfile(latest_path):
495
+ with open(latest_path, 'r') as fd:
496
+ tag = fd.read().strip()
497
+ else:
498
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
499
+
500
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
501
+
502
+ if not os.path.isdir(ds_checkpoint_dir):
503
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
504
+
505
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir)
506
+
507
+
508
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None):
509
+ """
510
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
511
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
512
+
513
+ Args:
514
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
515
+ - ``output_file``: path to the pytorch fp32 state_dict output file (e.g. path/pytorch_model.bin)
516
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
517
+ """
518
+
519
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
520
+ print(f"Saving fp32 state dict to {output_file}")
521
+ torch.save(state_dict, output_file)
522
+
523
+
524
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
525
+ """
526
+ 1. Put the provided model to cpu
527
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
528
+ 3. Load it into the provided model
529
+
530
+ Args:
531
+ - ``model``: the model object to update
532
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
533
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
534
+
535
+ Returns:
536
+ - ``model`: modified model
537
+
538
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
539
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
540
+ conveniently placed for you in the checkpoint folder.
541
+
542
+ A typical usage might be ::
543
+
544
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
545
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
546
+ # submit to model hub or save the model to share with others
547
+
548
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
549
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
550
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
551
+
552
+ """
553
+ logger.info(f"Extracting fp32 weights")
554
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
555
+
556
+ logger.info(f"Overwriting model with fp32 weights")
557
+ model = model.cpu()
558
+ model.load_state_dict(state_dict, strict=False)
559
+
560
+ return model
561
+
562
+
563
+ if __name__ == "__main__":
564
+
565
+ parser = argparse.ArgumentParser()
566
+ parser.add_argument("checkpoint_dir",
567
+ type=str,
568
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
569
+ parser.add_argument(
570
+ "output_file",
571
+ type=str,
572
+ help="path to the pytorch fp32 state_dict output file (e.g. path/checkpoint-12/pytorch_model.bin)")
573
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
574
+ args = parser.parse_args()
575
+
576
+ debug = args.debug
577
+
578
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir, args.output_file)