siyuan commited on
Commit
547d9eb
·
1 Parent(s): 7023bcc

add model ckpt

Browse files
.gitattributes CHANGED
@@ -33,3 +33,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ pytorch_model-00001-of-00003.bin filter=lfs diff=lfs merge=lfs -text
37
+ pytorch_model-00002-of-00003.bin filter=lfs diff=lfs merge=lfs -text
38
+ pytorch_model-00003-of-00003.bin filter=lfs diff=lfs merge=lfs -text
39
+ training_args.bin filter=lfs diff=lfs merge=lfs -text
40
+ tokenizer.model filter=lfs diff=lfs merge=lfs -text
config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "_name_or_path": "/opt/ml/input/data/Baichuan2-13B-Chat",
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
+ "tokenizer_class": "BaichuanTokenizer",
25
+ "torch_dtype": "bfloat16",
26
+ "transformers_version": "4.31.0",
27
+ "use_cache": false,
28
+ "vocab_size": 125696,
29
+ "z_loss_weight": 0
30
+ }
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,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "assistant_token_id": 196,
3
+ "bos_token_id": 1,
4
+ "do_sample": true,
5
+ "eos_token_id": 2,
6
+ "max_new_tokens": 2048,
7
+ "pad_token_id": 0,
8
+ "repetition_penalty": 1.05,
9
+ "temperature": 0.3,
10
+ "top_k": 5,
11
+ "top_p": 0.85,
12
+ "transformers_version": "4.31.0",
13
+ "user_token_id": 195
14
+ }
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_step5000
modeling_baichuan.py ADDED
@@ -0,0 +1,827 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ self.first_flag = True
515
+ elif self.first_flag:
516
+ self.first_flag = False
517
+ self.weight.data = nn.functional.normalize(self.weight)
518
+ norm_weight = self.weight
519
+ else:
520
+ norm_weight = self.weight
521
+ return nn.functional.linear(hidden_states, norm_weight)
522
+
523
+ _init_weights = True
524
+ @contextmanager
525
+ def no_init_weights(_enable=True):
526
+ global _init_weights
527
+ old_init_weights = _init_weights
528
+ if _enable:
529
+ _init_weights = False
530
+ try:
531
+ yield
532
+ finally:
533
+ _init_weights = old_init_weights
534
+
535
+
536
+ class BaichuanForCausalLM(BaichuanPreTrainedModel):
537
+ def __init__(self, config, *model_args, **model_kwargs):
538
+ super().__init__(config, *model_args, **model_kwargs)
539
+ self.model = BaichuanModel(config)
540
+ self.lm_head = NormHead(config.hidden_size, config.vocab_size, bias=False)
541
+ #if hasattr(config, "quantization_config") and config.quantization_config['load_in_4bit']:
542
+ if hasattr(config, "quantization_config") and isinstance(config.quantization_config, dict) and config.quantization_config.get('load_in_4bit', False):
543
+ try:
544
+ from .quantizer import quantize_offline, init_model_weight_int4
545
+ except ImportError:
546
+ raise ImportError(f"Needs quantize_offline to run quantize.")
547
+ quantize_offline(self, 4)
548
+ # Initialize weights and apply final processing
549
+ self.post_init()
550
+
551
+ def get_input_embeddings(self):
552
+ return self.model.embed_tokens
553
+
554
+ def set_input_embeddings(self, value):
555
+ self.model.embed_tokens = value
556
+
557
+ def get_output_embeddings(self):
558
+ return self.lm_head
559
+
560
+ def set_output_embeddings(self, new_embeddings):
561
+ self.lm_head = new_embeddings
562
+
563
+ def set_decoder(self, decoder):
564
+ self.model = decoder
565
+
566
+ def get_decoder(self):
567
+ return self.model
568
+
569
+ @classmethod
570
+ def from_pretrained(
571
+ cls,
572
+ pretrained_model_name_or_path: Optional[Union[str, os.PathLike]],
573
+ *model_args,
574
+ config: Optional[Union[PretrainedConfig, str, os.PathLike]] = None,
575
+ cache_dir: Optional[Union[str, os.PathLike]] = None,
576
+ ignore_mismatched_sizes: bool = False,
577
+ force_download: bool = False,
578
+ local_files_only: bool = False,
579
+ token: Optional[Union[str, bool]] = None,
580
+ revision: str = "main",
581
+ use_safetensors: bool = None,
582
+ **kwargs,
583
+ ):
584
+
585
+ # Load config if we don't provide a configuration
586
+ if not isinstance(config, PretrainedConfig):
587
+ config_path = config if config is not None else pretrained_model_name_or_path
588
+ config, model_kwargs = cls.config_class.from_pretrained(
589
+ config_path,
590
+ cache_dir=cache_dir,
591
+ return_unused_kwargs=True,
592
+ force_download=force_download,
593
+ resume_download=False,
594
+ proxies=None,
595
+ local_files_only=local_files_only,
596
+ token=token,
597
+ revision=revision,
598
+ subfolder="",
599
+ _from_auto=False,
600
+ _from_pipeline=None,
601
+ **kwargs,
602
+ )
603
+ else:
604
+ model_kwargs = kwargs
605
+
606
+ if hasattr(config, "quantization_config") and config.quantization_config['load_in_4bit']:
607
+ try:
608
+ from .quantizer import init_model_weight_int4
609
+ from accelerate import init_empty_weights, dispatch_model, infer_auto_device_map
610
+ from accelerate.utils import CustomDtype
611
+ from accelerate.utils import get_balanced_memory
612
+ except ImportError:
613
+ raise ImportError(f"Needs import model weight init func to run quantize.")
614
+ # Instantiate model.
615
+ init_contexts = [no_init_weights(_enable=True)]
616
+ init_contexts.append(init_empty_weights())
617
+ with ContextManagers(init_contexts):
618
+ model = cls(config)
619
+
620
+ model_file = os.path.join(pretrained_model_name_or_path, 'pytorch_model.bin')
621
+ state_dict = torch.load(model_file, map_location="cpu")
622
+ model.is_quantized = True
623
+
624
+ device_map = kwargs.pop("device_map", None)
625
+ torch_dtype = kwargs.pop("torch_dtype", None)
626
+ if device_map is not None:
627
+ kwargs = {"no_split_module_classes": model._no_split_modules}
628
+ target_dtype = CustomDtype.INT4
629
+ max_memory = get_balanced_memory(
630
+ model,
631
+ dtype=target_dtype,
632
+ low_zero=(device_map == "balanced_low_0"),
633
+ max_memory=None,
634
+ **kwargs,
635
+ )
636
+ kwargs["max_memory"] = max_memory
637
+ device_map = infer_auto_device_map(model, dtype=target_dtype, **kwargs)
638
+ model = init_model_weight_int4(config, model, state_dict)
639
+
640
+ # Set model in evaluation mode to deactivate DropOut modules by default
641
+ model.eval()
642
+ # If it is a model with generation capabilities, attempt to load the generation config
643
+ if model.can_generate():
644
+ try:
645
+ model.generation_config = GenerationConfig.from_pretrained(
646
+ pretrained_model_name_or_path,
647
+ cache_dir=cache_dir,
648
+ force_download=force_download,
649
+ resume_download=False,
650
+ proxies=None,
651
+ local_files_only=local_files_only,
652
+ token=token,
653
+ revision=revision,
654
+ subfolder="",
655
+ _from_auto=False,
656
+ _from_pipeline=None,
657
+ **kwargs,
658
+ )
659
+ except (OSError, TypeError):
660
+ logger.info(
661
+ "Generation config file not found, using a generation config created from the model config."
662
+ )
663
+ pass
664
+
665
+ if device_map is not None:
666
+ dispatch_model(model, device_map=device_map)
667
+
668
+ return model
669
+
670
+ return super(BaichuanForCausalLM, cls).from_pretrained(pretrained_model_name_or_path, *model_args,
671
+ config=config, cache_dir=cache_dir, ignore_mismatched_sizes=ignore_mismatched_sizes,
672
+ force_download=force_download, local_files_only=local_files_only, token=token, revision=revision,
673
+ use_safetensors=use_safetensors, **kwargs)
674
+
675
+ def forward(
676
+ self,
677
+ input_ids: torch.LongTensor = None,
678
+ attention_mask: Optional[torch.Tensor] = None,
679
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
680
+ inputs_embeds: Optional[torch.FloatTensor] = None,
681
+ labels: Optional[torch.LongTensor] = None,
682
+ use_cache: Optional[bool] = None,
683
+ output_attentions: Optional[bool] = False,
684
+ output_hidden_states: Optional[bool] = False,
685
+ return_dict: Optional[bool] = True,
686
+ **kwargs,
687
+ ) -> Union[Tuple, CausalLMOutputWithPast]:
688
+ return_dict = (
689
+ return_dict if return_dict is not None else self.config.use_return_dict
690
+ )
691
+
692
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
693
+ outputs = self.model(
694
+ input_ids=input_ids,
695
+ attention_mask=attention_mask,
696
+ past_key_values=past_key_values,
697
+ inputs_embeds=inputs_embeds,
698
+ use_cache=use_cache,
699
+ output_attentions=output_attentions,
700
+ output_hidden_states=output_hidden_states,
701
+ return_dict=return_dict,
702
+ )
703
+
704
+ hidden_states = outputs[0]
705
+ logits = self.lm_head(hidden_states)
706
+ loss = None
707
+ if labels is not None:
708
+ # Shift so that tokens < n predict n
709
+ shift_logits = logits[..., :-1, :].contiguous()
710
+ shift_labels = labels[..., 1:].contiguous()
711
+ # Flatten the tokens
712
+ loss_fct = CrossEntropyLoss()
713
+ shift_logits = shift_logits.view(-1, self.config.vocab_size)
714
+ shift_labels = shift_labels.view(-1)
715
+ softmax_normalizer = shift_logits.max(-1).values ** 2
716
+ z_loss = self.config.z_loss_weight * softmax_normalizer.mean()
717
+ # Enable model parallelism
718
+ shift_labels = shift_labels.to(shift_logits.device)
719
+ loss = loss_fct(shift_logits, shift_labels) + z_loss
720
+
721
+ if not return_dict:
722
+ output = (logits,) + outputs[1:]
723
+ return (loss,) + output if loss is not None else output
724
+
725
+ return CausalLMOutputWithPast(
726
+ loss=loss,
727
+ logits=logits,
728
+ past_key_values=outputs.past_key_values,
729
+ hidden_states=outputs.hidden_states,
730
+ attentions=outputs.attentions,
731
+ )
732
+
733
+ def quantize(self, bits: int):
734
+ try:
735
+ from .quantizer import quantize_online
736
+ except ImportError:
737
+ raise ImportError(f"Needs QLinear to run quantize.")
738
+ return quantize_online(self, bits)
739
+
740
+ def prepare_inputs_for_generation(
741
+ self,
742
+ input_ids: torch.LongTensor,
743
+ past_key_values: Optional[torch.Tensor] = None,
744
+ attention_mask: Optional[torch.Tensor] = None,
745
+ inputs_embeds: Optional[torch.Tensor] = None,
746
+ **kwargs,
747
+ ):
748
+ if past_key_values:
749
+ input_ids = input_ids[:, -1:]
750
+
751
+ # if `inputs_embeds` are passed, we only want to use them in the 1st generation step
752
+ if inputs_embeds is not None and past_key_values is None:
753
+ model_inputs = {"inputs_embeds": inputs_embeds}
754
+ else:
755
+ model_inputs = {"input_ids": input_ids}
756
+
757
+ model_inputs.update(
758
+ {
759
+ "past_key_values": past_key_values,
760
+ "use_cache": kwargs.get("use_cache"),
761
+ "attention_mask": attention_mask,
762
+ }
763
+ )
764
+ return model_inputs
765
+
766
+ @staticmethod
767
+ def _reorder_cache(past_key_values, beam_idx):
768
+ return tuple(
769
+ tuple(past_state.index_select(0, beam_idx) for past_state in layer_past)
770
+ for layer_past in past_key_values
771
+ )
772
+
773
+ def _build_chat_input(
774
+ self, tokenizer, messages: List[dict], max_new_tokens: int = 0
775
+ ):
776
+ max_new_tokens = max_new_tokens or self.generation_config.max_new_tokens
777
+ max_input_tokens = self.config.model_max_length - max_new_tokens
778
+ max_input_tokens = max(self.config.model_max_length // 2, max_input_tokens)
779
+ total_input, round_input = [], []
780
+ for i, message in enumerate(messages[::-1]):
781
+ content_tokens = tokenizer.encode(message["content"])
782
+ if message["role"] == "user":
783
+ round_input = (
784
+ [self.generation_config.user_token_id]
785
+ + content_tokens
786
+ + round_input
787
+ )
788
+ if (
789
+ total_input
790
+ and len(total_input) + len(round_input) > max_input_tokens
791
+ ):
792
+ break
793
+ else:
794
+ total_input = round_input + total_input
795
+ if len(total_input) >= max_input_tokens:
796
+ break
797
+ else:
798
+ round_input = []
799
+ elif message["role"] == "assistant":
800
+ round_input = (
801
+ [self.generation_config.assistant_token_id]
802
+ + content_tokens
803
+ + [self.generation_config.eos_token_id]
804
+ + round_input
805
+ )
806
+ else:
807
+ raise ValueError(f"message role not supported yet: {message['role']}")
808
+ total_input = total_input[-max_input_tokens:] # truncate left
809
+ total_input.append(self.generation_config.assistant_token_id)
810
+ total_input = torch.LongTensor([total_input]).to(self.device)
811
+ return total_input
812
+
813
+ def chat(self, tokenizer, messages: List[dict], stream=False,
814
+ generation_config: Optional[GenerationConfig]=None):
815
+ generation_config = generation_config or self.generation_config
816
+ input_ids = build_chat_input(self, tokenizer, messages, generation_config.max_new_tokens)
817
+ if stream:
818
+ streamer = TextIterStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
819
+ Thread(target=self.generate, kwargs=dict(
820
+ inputs=input_ids, streamer=streamer,
821
+ generation_config=generation_config,
822
+ )).start()
823
+ return streamer
824
+ else:
825
+ outputs = self.generate(input_ids, generation_config=generation_config)
826
+ response = tokenizer.decode(outputs[0][len(input_ids[0]):], skip_special_tokens=True)
827
+ return response
pytorch_model-00001-of-00003.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ade05578e80d82d67cf4c4d2becbcf9d54edf9608f8156f52042672c9634b726
3
+ size 9973567639
pytorch_model-00002-of-00003.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f80a4693aaffe8f22acbf5fa9f01110fe430b199de1372c813fcb62636936970
3
+ size 9947419824
pytorch_model-00003-of-00003.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:915621daf2f8ec4d08f75672ff226bf6bdadb5e2ef60718f4e0889af983da5ac
3
+ size 7872445619
pytorch_model.bin.index.json ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 27793336320
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "pytorch_model-00003-of-00003.bin",
7
+ "model.embed_tokens.weight": "pytorch_model-00001-of-00003.bin",
8
+ "model.layers.0.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
9
+ "model.layers.0.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
10
+ "model.layers.0.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
11
+ "model.layers.0.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
12
+ "model.layers.0.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
13
+ "model.layers.0.self_attn.W_pack.weight": "pytorch_model-00001-of-00003.bin",
14
+ "model.layers.0.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
15
+ "model.layers.1.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
16
+ "model.layers.1.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
17
+ "model.layers.1.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
18
+ "model.layers.1.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
19
+ "model.layers.1.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
20
+ "model.layers.1.self_attn.W_pack.weight": "pytorch_model-00001-of-00003.bin",
21
+ "model.layers.1.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
22
+ "model.layers.10.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
23
+ "model.layers.10.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
24
+ "model.layers.10.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
25
+ "model.layers.10.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
26
+ "model.layers.10.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
27
+ "model.layers.10.self_attn.W_pack.weight": "pytorch_model-00001-of-00003.bin",
28
+ "model.layers.10.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
29
+ "model.layers.11.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
30
+ "model.layers.11.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
31
+ "model.layers.11.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
32
+ "model.layers.11.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
33
+ "model.layers.11.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
34
+ "model.layers.11.self_attn.W_pack.weight": "pytorch_model-00001-of-00003.bin",
35
+ "model.layers.11.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
36
+ "model.layers.12.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
37
+ "model.layers.12.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
38
+ "model.layers.12.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
39
+ "model.layers.12.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
40
+ "model.layers.12.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
41
+ "model.layers.12.self_attn.W_pack.weight": "pytorch_model-00001-of-00003.bin",
42
+ "model.layers.12.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
43
+ "model.layers.13.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
44
+ "model.layers.13.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
45
+ "model.layers.13.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
46
+ "model.layers.13.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
47
+ "model.layers.13.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
48
+ "model.layers.13.self_attn.W_pack.weight": "pytorch_model-00001-of-00003.bin",
49
+ "model.layers.13.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
50
+ "model.layers.14.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
51
+ "model.layers.14.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
52
+ "model.layers.14.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
53
+ "model.layers.14.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
54
+ "model.layers.14.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
55
+ "model.layers.14.self_attn.W_pack.weight": "pytorch_model-00002-of-00003.bin",
56
+ "model.layers.14.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
57
+ "model.layers.15.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
58
+ "model.layers.15.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
59
+ "model.layers.15.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
60
+ "model.layers.15.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
61
+ "model.layers.15.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
62
+ "model.layers.15.self_attn.W_pack.weight": "pytorch_model-00002-of-00003.bin",
63
+ "model.layers.15.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
64
+ "model.layers.16.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
65
+ "model.layers.16.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
66
+ "model.layers.16.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
67
+ "model.layers.16.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
68
+ "model.layers.16.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
69
+ "model.layers.16.self_attn.W_pack.weight": "pytorch_model-00002-of-00003.bin",
70
+ "model.layers.16.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
71
+ "model.layers.17.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
72
+ "model.layers.17.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
73
+ "model.layers.17.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
74
+ "model.layers.17.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
75
+ "model.layers.17.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
76
+ "model.layers.17.self_attn.W_pack.weight": "pytorch_model-00002-of-00003.bin",
77
+ "model.layers.17.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
78
+ "model.layers.18.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
79
+ "model.layers.18.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
80
+ "model.layers.18.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
81
+ "model.layers.18.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
82
+ "model.layers.18.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
83
+ "model.layers.18.self_attn.W_pack.weight": "pytorch_model-00002-of-00003.bin",
84
+ "model.layers.18.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
85
+ "model.layers.19.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
86
+ "model.layers.19.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
87
+ "model.layers.19.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
88
+ "model.layers.19.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
89
+ "model.layers.19.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
90
+ "model.layers.19.self_attn.W_pack.weight": "pytorch_model-00002-of-00003.bin",
91
+ "model.layers.19.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
92
+ "model.layers.2.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
93
+ "model.layers.2.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
94
+ "model.layers.2.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
95
+ "model.layers.2.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
96
+ "model.layers.2.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
97
+ "model.layers.2.self_attn.W_pack.weight": "pytorch_model-00001-of-00003.bin",
98
+ "model.layers.2.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
99
+ "model.layers.20.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
100
+ "model.layers.20.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
101
+ "model.layers.20.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
102
+ "model.layers.20.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
103
+ "model.layers.20.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
104
+ "model.layers.20.self_attn.W_pack.weight": "pytorch_model-00002-of-00003.bin",
105
+ "model.layers.20.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
106
+ "model.layers.21.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
107
+ "model.layers.21.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
108
+ "model.layers.21.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
109
+ "model.layers.21.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
110
+ "model.layers.21.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
111
+ "model.layers.21.self_attn.W_pack.weight": "pytorch_model-00002-of-00003.bin",
112
+ "model.layers.21.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
113
+ "model.layers.22.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
114
+ "model.layers.22.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
115
+ "model.layers.22.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
116
+ "model.layers.22.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
117
+ "model.layers.22.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
118
+ "model.layers.22.self_attn.W_pack.weight": "pytorch_model-00002-of-00003.bin",
119
+ "model.layers.22.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
120
+ "model.layers.23.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
121
+ "model.layers.23.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
122
+ "model.layers.23.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
123
+ "model.layers.23.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
124
+ "model.layers.23.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
125
+ "model.layers.23.self_attn.W_pack.weight": "pytorch_model-00002-of-00003.bin",
126
+ "model.layers.23.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
127
+ "model.layers.24.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
128
+ "model.layers.24.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
129
+ "model.layers.24.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
130
+ "model.layers.24.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
131
+ "model.layers.24.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
132
+ "model.layers.24.self_attn.W_pack.weight": "pytorch_model-00002-of-00003.bin",
133
+ "model.layers.24.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
134
+ "model.layers.25.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
135
+ "model.layers.25.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
136
+ "model.layers.25.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
137
+ "model.layers.25.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
138
+ "model.layers.25.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
139
+ "model.layers.25.self_attn.W_pack.weight": "pytorch_model-00002-of-00003.bin",
140
+ "model.layers.25.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
141
+ "model.layers.26.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
142
+ "model.layers.26.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
143
+ "model.layers.26.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
144
+ "model.layers.26.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
145
+ "model.layers.26.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
146
+ "model.layers.26.self_attn.W_pack.weight": "pytorch_model-00002-of-00003.bin",
147
+ "model.layers.26.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
148
+ "model.layers.27.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
149
+ "model.layers.27.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
150
+ "model.layers.27.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
151
+ "model.layers.27.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
152
+ "model.layers.27.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
153
+ "model.layers.27.self_attn.W_pack.weight": "pytorch_model-00002-of-00003.bin",
154
+ "model.layers.27.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
155
+ "model.layers.28.input_layernorm.weight": "pytorch_model-00002-of-00003.bin",
156
+ "model.layers.28.mlp.down_proj.weight": "pytorch_model-00002-of-00003.bin",
157
+ "model.layers.28.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
158
+ "model.layers.28.mlp.up_proj.weight": "pytorch_model-00002-of-00003.bin",
159
+ "model.layers.28.post_attention_layernorm.weight": "pytorch_model-00002-of-00003.bin",
160
+ "model.layers.28.self_attn.W_pack.weight": "pytorch_model-00002-of-00003.bin",
161
+ "model.layers.28.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
162
+ "model.layers.29.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
163
+ "model.layers.29.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
164
+ "model.layers.29.mlp.gate_proj.weight": "pytorch_model-00002-of-00003.bin",
165
+ "model.layers.29.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
166
+ "model.layers.29.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
167
+ "model.layers.29.self_attn.W_pack.weight": "pytorch_model-00002-of-00003.bin",
168
+ "model.layers.29.self_attn.o_proj.weight": "pytorch_model-00002-of-00003.bin",
169
+ "model.layers.3.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
170
+ "model.layers.3.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
171
+ "model.layers.3.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
172
+ "model.layers.3.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
173
+ "model.layers.3.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
174
+ "model.layers.3.self_attn.W_pack.weight": "pytorch_model-00001-of-00003.bin",
175
+ "model.layers.3.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
176
+ "model.layers.30.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
177
+ "model.layers.30.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
178
+ "model.layers.30.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
179
+ "model.layers.30.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
180
+ "model.layers.30.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
181
+ "model.layers.30.self_attn.W_pack.weight": "pytorch_model-00003-of-00003.bin",
182
+ "model.layers.30.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
183
+ "model.layers.31.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
184
+ "model.layers.31.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
185
+ "model.layers.31.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
186
+ "model.layers.31.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
187
+ "model.layers.31.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
188
+ "model.layers.31.self_attn.W_pack.weight": "pytorch_model-00003-of-00003.bin",
189
+ "model.layers.31.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
190
+ "model.layers.32.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
191
+ "model.layers.32.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
192
+ "model.layers.32.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
193
+ "model.layers.32.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
194
+ "model.layers.32.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
195
+ "model.layers.32.self_attn.W_pack.weight": "pytorch_model-00003-of-00003.bin",
196
+ "model.layers.32.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
197
+ "model.layers.33.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
198
+ "model.layers.33.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
199
+ "model.layers.33.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
200
+ "model.layers.33.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
201
+ "model.layers.33.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
202
+ "model.layers.33.self_attn.W_pack.weight": "pytorch_model-00003-of-00003.bin",
203
+ "model.layers.33.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
204
+ "model.layers.34.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
205
+ "model.layers.34.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
206
+ "model.layers.34.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
207
+ "model.layers.34.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
208
+ "model.layers.34.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
209
+ "model.layers.34.self_attn.W_pack.weight": "pytorch_model-00003-of-00003.bin",
210
+ "model.layers.34.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
211
+ "model.layers.35.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
212
+ "model.layers.35.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
213
+ "model.layers.35.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
214
+ "model.layers.35.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
215
+ "model.layers.35.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
216
+ "model.layers.35.self_attn.W_pack.weight": "pytorch_model-00003-of-00003.bin",
217
+ "model.layers.35.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
218
+ "model.layers.36.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
219
+ "model.layers.36.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
220
+ "model.layers.36.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
221
+ "model.layers.36.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
222
+ "model.layers.36.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
223
+ "model.layers.36.self_attn.W_pack.weight": "pytorch_model-00003-of-00003.bin",
224
+ "model.layers.36.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
225
+ "model.layers.37.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
226
+ "model.layers.37.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
227
+ "model.layers.37.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
228
+ "model.layers.37.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
229
+ "model.layers.37.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
230
+ "model.layers.37.self_attn.W_pack.weight": "pytorch_model-00003-of-00003.bin",
231
+ "model.layers.37.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
232
+ "model.layers.38.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
233
+ "model.layers.38.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
234
+ "model.layers.38.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
235
+ "model.layers.38.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
236
+ "model.layers.38.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
237
+ "model.layers.38.self_attn.W_pack.weight": "pytorch_model-00003-of-00003.bin",
238
+ "model.layers.38.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
239
+ "model.layers.39.input_layernorm.weight": "pytorch_model-00003-of-00003.bin",
240
+ "model.layers.39.mlp.down_proj.weight": "pytorch_model-00003-of-00003.bin",
241
+ "model.layers.39.mlp.gate_proj.weight": "pytorch_model-00003-of-00003.bin",
242
+ "model.layers.39.mlp.up_proj.weight": "pytorch_model-00003-of-00003.bin",
243
+ "model.layers.39.post_attention_layernorm.weight": "pytorch_model-00003-of-00003.bin",
244
+ "model.layers.39.self_attn.W_pack.weight": "pytorch_model-00003-of-00003.bin",
245
+ "model.layers.39.self_attn.o_proj.weight": "pytorch_model-00003-of-00003.bin",
246
+ "model.layers.4.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
247
+ "model.layers.4.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
248
+ "model.layers.4.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
249
+ "model.layers.4.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
250
+ "model.layers.4.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
251
+ "model.layers.4.self_attn.W_pack.weight": "pytorch_model-00001-of-00003.bin",
252
+ "model.layers.4.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
253
+ "model.layers.5.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
254
+ "model.layers.5.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
255
+ "model.layers.5.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
256
+ "model.layers.5.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
257
+ "model.layers.5.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
258
+ "model.layers.5.self_attn.W_pack.weight": "pytorch_model-00001-of-00003.bin",
259
+ "model.layers.5.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
260
+ "model.layers.6.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
261
+ "model.layers.6.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
262
+ "model.layers.6.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
263
+ "model.layers.6.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
264
+ "model.layers.6.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
265
+ "model.layers.6.self_attn.W_pack.weight": "pytorch_model-00001-of-00003.bin",
266
+ "model.layers.6.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
267
+ "model.layers.7.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
268
+ "model.layers.7.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
269
+ "model.layers.7.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
270
+ "model.layers.7.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
271
+ "model.layers.7.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
272
+ "model.layers.7.self_attn.W_pack.weight": "pytorch_model-00001-of-00003.bin",
273
+ "model.layers.7.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
274
+ "model.layers.8.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
275
+ "model.layers.8.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
276
+ "model.layers.8.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
277
+ "model.layers.8.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
278
+ "model.layers.8.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
279
+ "model.layers.8.self_attn.W_pack.weight": "pytorch_model-00001-of-00003.bin",
280
+ "model.layers.8.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
281
+ "model.layers.9.input_layernorm.weight": "pytorch_model-00001-of-00003.bin",
282
+ "model.layers.9.mlp.down_proj.weight": "pytorch_model-00001-of-00003.bin",
283
+ "model.layers.9.mlp.gate_proj.weight": "pytorch_model-00001-of-00003.bin",
284
+ "model.layers.9.mlp.up_proj.weight": "pytorch_model-00001-of-00003.bin",
285
+ "model.layers.9.post_attention_layernorm.weight": "pytorch_model-00001-of-00003.bin",
286
+ "model.layers.9.self_attn.W_pack.weight": "pytorch_model-00001-of-00003.bin",
287
+ "model.layers.9.self_attn.o_proj.weight": "pytorch_model-00001-of-00003.bin",
288
+ "model.norm.weight": "pytorch_model-00003-of-00003.bin"
289
+ }
290
+ }
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
special_tokens_map.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": true
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": true,
13
+ "rstrip": false,
14
+ "single_word": true
15
+ },
16
+ "pad_token": "<unk>",
17
+ "unk_token": {
18
+ "content": "<unk>",
19
+ "lstrip": false,
20
+ "normalized": true,
21
+ "rstrip": false,
22
+ "single_word": true
23
+ }
24
+ }
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,3016 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 1.0451505016722409,
5
+ "global_step": 5000,
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.0,
12
+ "learning_rate": 9.992682416893165e-06,
13
+ "loss": 1.2194,
14
+ "step": 10
15
+ },
16
+ {
17
+ "epoch": 0.0,
18
+ "learning_rate": 9.98222872674054e-06,
19
+ "loss": 1.149,
20
+ "step": 20
21
+ },
22
+ {
23
+ "epoch": 0.01,
24
+ "learning_rate": 9.971775036587917e-06,
25
+ "loss": 1.0958,
26
+ "step": 30
27
+ },
28
+ {
29
+ "epoch": 0.01,
30
+ "learning_rate": 9.961321346435293e-06,
31
+ "loss": 1.0791,
32
+ "step": 40
33
+ },
34
+ {
35
+ "epoch": 0.01,
36
+ "learning_rate": 9.950867656282669e-06,
37
+ "loss": 1.1471,
38
+ "step": 50
39
+ },
40
+ {
41
+ "epoch": 0.01,
42
+ "learning_rate": 9.940413966130045e-06,
43
+ "loss": 1.1,
44
+ "step": 60
45
+ },
46
+ {
47
+ "epoch": 0.01,
48
+ "learning_rate": 9.92996027597742e-06,
49
+ "loss": 1.0613,
50
+ "step": 70
51
+ },
52
+ {
53
+ "epoch": 0.02,
54
+ "learning_rate": 9.919506585824797e-06,
55
+ "loss": 0.9759,
56
+ "step": 80
57
+ },
58
+ {
59
+ "epoch": 0.02,
60
+ "learning_rate": 9.909052895672173e-06,
61
+ "loss": 1.0735,
62
+ "step": 90
63
+ },
64
+ {
65
+ "epoch": 0.02,
66
+ "learning_rate": 9.898599205519549e-06,
67
+ "loss": 1.0464,
68
+ "step": 100
69
+ },
70
+ {
71
+ "epoch": 0.02,
72
+ "learning_rate": 9.888145515366925e-06,
73
+ "loss": 1.032,
74
+ "step": 110
75
+ },
76
+ {
77
+ "epoch": 0.03,
78
+ "learning_rate": 9.877691825214302e-06,
79
+ "loss": 0.9523,
80
+ "step": 120
81
+ },
82
+ {
83
+ "epoch": 0.03,
84
+ "learning_rate": 9.867238135061677e-06,
85
+ "loss": 1.0126,
86
+ "step": 130
87
+ },
88
+ {
89
+ "epoch": 0.03,
90
+ "learning_rate": 9.856784444909053e-06,
91
+ "loss": 1.0132,
92
+ "step": 140
93
+ },
94
+ {
95
+ "epoch": 0.03,
96
+ "learning_rate": 9.84633075475643e-06,
97
+ "loss": 1.0023,
98
+ "step": 150
99
+ },
100
+ {
101
+ "epoch": 0.03,
102
+ "learning_rate": 9.835877064603807e-06,
103
+ "loss": 0.9862,
104
+ "step": 160
105
+ },
106
+ {
107
+ "epoch": 0.04,
108
+ "learning_rate": 9.825423374451183e-06,
109
+ "loss": 0.9808,
110
+ "step": 170
111
+ },
112
+ {
113
+ "epoch": 0.04,
114
+ "learning_rate": 9.814969684298559e-06,
115
+ "loss": 0.9914,
116
+ "step": 180
117
+ },
118
+ {
119
+ "epoch": 0.04,
120
+ "learning_rate": 9.804515994145935e-06,
121
+ "loss": 1.0308,
122
+ "step": 190
123
+ },
124
+ {
125
+ "epoch": 0.04,
126
+ "learning_rate": 9.79406230399331e-06,
127
+ "loss": 1.0149,
128
+ "step": 200
129
+ },
130
+ {
131
+ "epoch": 0.04,
132
+ "learning_rate": 9.783608613840687e-06,
133
+ "loss": 0.936,
134
+ "step": 210
135
+ },
136
+ {
137
+ "epoch": 0.05,
138
+ "learning_rate": 9.773154923688063e-06,
139
+ "loss": 0.984,
140
+ "step": 220
141
+ },
142
+ {
143
+ "epoch": 0.05,
144
+ "learning_rate": 9.762701233535439e-06,
145
+ "loss": 0.9522,
146
+ "step": 230
147
+ },
148
+ {
149
+ "epoch": 0.05,
150
+ "learning_rate": 9.752247543382815e-06,
151
+ "loss": 0.9451,
152
+ "step": 240
153
+ },
154
+ {
155
+ "epoch": 0.05,
156
+ "learning_rate": 9.74179385323019e-06,
157
+ "loss": 0.9503,
158
+ "step": 250
159
+ },
160
+ {
161
+ "epoch": 0.05,
162
+ "learning_rate": 9.731340163077567e-06,
163
+ "loss": 1.0045,
164
+ "step": 260
165
+ },
166
+ {
167
+ "epoch": 0.06,
168
+ "learning_rate": 9.720886472924943e-06,
169
+ "loss": 0.9055,
170
+ "step": 270
171
+ },
172
+ {
173
+ "epoch": 0.06,
174
+ "learning_rate": 9.71043278277232e-06,
175
+ "loss": 0.9534,
176
+ "step": 280
177
+ },
178
+ {
179
+ "epoch": 0.06,
180
+ "learning_rate": 9.699979092619696e-06,
181
+ "loss": 0.9923,
182
+ "step": 290
183
+ },
184
+ {
185
+ "epoch": 0.06,
186
+ "learning_rate": 9.689525402467072e-06,
187
+ "loss": 1.0029,
188
+ "step": 300
189
+ },
190
+ {
191
+ "epoch": 0.06,
192
+ "learning_rate": 9.679071712314447e-06,
193
+ "loss": 0.9809,
194
+ "step": 310
195
+ },
196
+ {
197
+ "epoch": 0.07,
198
+ "learning_rate": 9.668618022161824e-06,
199
+ "loss": 0.9893,
200
+ "step": 320
201
+ },
202
+ {
203
+ "epoch": 0.07,
204
+ "learning_rate": 9.6581643320092e-06,
205
+ "loss": 0.9599,
206
+ "step": 330
207
+ },
208
+ {
209
+ "epoch": 0.07,
210
+ "learning_rate": 9.647710641856576e-06,
211
+ "loss": 0.995,
212
+ "step": 340
213
+ },
214
+ {
215
+ "epoch": 0.07,
216
+ "learning_rate": 9.637256951703952e-06,
217
+ "loss": 0.9273,
218
+ "step": 350
219
+ },
220
+ {
221
+ "epoch": 0.08,
222
+ "learning_rate": 9.626803261551328e-06,
223
+ "loss": 0.9223,
224
+ "step": 360
225
+ },
226
+ {
227
+ "epoch": 0.08,
228
+ "learning_rate": 9.616349571398704e-06,
229
+ "loss": 0.9966,
230
+ "step": 370
231
+ },
232
+ {
233
+ "epoch": 0.08,
234
+ "learning_rate": 9.60589588124608e-06,
235
+ "loss": 1.0168,
236
+ "step": 380
237
+ },
238
+ {
239
+ "epoch": 0.08,
240
+ "learning_rate": 9.595442191093456e-06,
241
+ "loss": 0.9002,
242
+ "step": 390
243
+ },
244
+ {
245
+ "epoch": 0.08,
246
+ "learning_rate": 9.584988500940832e-06,
247
+ "loss": 0.9722,
248
+ "step": 400
249
+ },
250
+ {
251
+ "epoch": 0.09,
252
+ "learning_rate": 9.574534810788208e-06,
253
+ "loss": 0.8962,
254
+ "step": 410
255
+ },
256
+ {
257
+ "epoch": 0.09,
258
+ "learning_rate": 9.564081120635586e-06,
259
+ "loss": 0.925,
260
+ "step": 420
261
+ },
262
+ {
263
+ "epoch": 0.09,
264
+ "learning_rate": 9.55362743048296e-06,
265
+ "loss": 0.9328,
266
+ "step": 430
267
+ },
268
+ {
269
+ "epoch": 0.09,
270
+ "learning_rate": 9.543173740330336e-06,
271
+ "loss": 0.9643,
272
+ "step": 440
273
+ },
274
+ {
275
+ "epoch": 0.09,
276
+ "learning_rate": 9.532720050177714e-06,
277
+ "loss": 0.9741,
278
+ "step": 450
279
+ },
280
+ {
281
+ "epoch": 0.1,
282
+ "learning_rate": 9.52226636002509e-06,
283
+ "loss": 0.9868,
284
+ "step": 460
285
+ },
286
+ {
287
+ "epoch": 0.1,
288
+ "learning_rate": 9.511812669872466e-06,
289
+ "loss": 0.9064,
290
+ "step": 470
291
+ },
292
+ {
293
+ "epoch": 0.1,
294
+ "learning_rate": 9.50135897971984e-06,
295
+ "loss": 0.9556,
296
+ "step": 480
297
+ },
298
+ {
299
+ "epoch": 0.1,
300
+ "learning_rate": 9.490905289567218e-06,
301
+ "loss": 0.8907,
302
+ "step": 490
303
+ },
304
+ {
305
+ "epoch": 0.1,
306
+ "learning_rate": 9.480451599414594e-06,
307
+ "loss": 0.9452,
308
+ "step": 500
309
+ },
310
+ {
311
+ "epoch": 0.11,
312
+ "learning_rate": 9.46999790926197e-06,
313
+ "loss": 0.8982,
314
+ "step": 510
315
+ },
316
+ {
317
+ "epoch": 0.11,
318
+ "learning_rate": 9.459544219109346e-06,
319
+ "loss": 0.9202,
320
+ "step": 520
321
+ },
322
+ {
323
+ "epoch": 0.11,
324
+ "learning_rate": 9.449090528956722e-06,
325
+ "loss": 0.9163,
326
+ "step": 530
327
+ },
328
+ {
329
+ "epoch": 0.11,
330
+ "learning_rate": 9.438636838804098e-06,
331
+ "loss": 1.0045,
332
+ "step": 540
333
+ },
334
+ {
335
+ "epoch": 0.11,
336
+ "learning_rate": 9.428183148651476e-06,
337
+ "loss": 0.9638,
338
+ "step": 550
339
+ },
340
+ {
341
+ "epoch": 0.12,
342
+ "learning_rate": 9.41772945849885e-06,
343
+ "loss": 1.0104,
344
+ "step": 560
345
+ },
346
+ {
347
+ "epoch": 0.12,
348
+ "learning_rate": 9.407275768346226e-06,
349
+ "loss": 0.9684,
350
+ "step": 570
351
+ },
352
+ {
353
+ "epoch": 0.12,
354
+ "learning_rate": 9.396822078193602e-06,
355
+ "loss": 1.0572,
356
+ "step": 580
357
+ },
358
+ {
359
+ "epoch": 0.12,
360
+ "learning_rate": 9.38636838804098e-06,
361
+ "loss": 0.93,
362
+ "step": 590
363
+ },
364
+ {
365
+ "epoch": 0.13,
366
+ "learning_rate": 9.375914697888356e-06,
367
+ "loss": 0.8864,
368
+ "step": 600
369
+ },
370
+ {
371
+ "epoch": 0.13,
372
+ "learning_rate": 9.36546100773573e-06,
373
+ "loss": 0.9299,
374
+ "step": 610
375
+ },
376
+ {
377
+ "epoch": 0.13,
378
+ "learning_rate": 9.355007317583108e-06,
379
+ "loss": 0.9593,
380
+ "step": 620
381
+ },
382
+ {
383
+ "epoch": 0.13,
384
+ "learning_rate": 9.344553627430484e-06,
385
+ "loss": 1.0237,
386
+ "step": 630
387
+ },
388
+ {
389
+ "epoch": 0.13,
390
+ "learning_rate": 9.33409993727786e-06,
391
+ "loss": 0.8734,
392
+ "step": 640
393
+ },
394
+ {
395
+ "epoch": 0.14,
396
+ "learning_rate": 9.323646247125236e-06,
397
+ "loss": 0.9851,
398
+ "step": 650
399
+ },
400
+ {
401
+ "epoch": 0.14,
402
+ "learning_rate": 9.313192556972612e-06,
403
+ "loss": 0.9216,
404
+ "step": 660
405
+ },
406
+ {
407
+ "epoch": 0.14,
408
+ "learning_rate": 9.302738866819988e-06,
409
+ "loss": 1.0198,
410
+ "step": 670
411
+ },
412
+ {
413
+ "epoch": 0.14,
414
+ "learning_rate": 9.292285176667364e-06,
415
+ "loss": 0.905,
416
+ "step": 680
417
+ },
418
+ {
419
+ "epoch": 0.14,
420
+ "learning_rate": 9.28183148651474e-06,
421
+ "loss": 1.0569,
422
+ "step": 690
423
+ },
424
+ {
425
+ "epoch": 0.15,
426
+ "learning_rate": 9.271377796362116e-06,
427
+ "loss": 0.923,
428
+ "step": 700
429
+ },
430
+ {
431
+ "epoch": 0.15,
432
+ "learning_rate": 9.260924106209492e-06,
433
+ "loss": 0.9127,
434
+ "step": 710
435
+ },
436
+ {
437
+ "epoch": 0.15,
438
+ "learning_rate": 9.25047041605687e-06,
439
+ "loss": 0.9825,
440
+ "step": 720
441
+ },
442
+ {
443
+ "epoch": 0.15,
444
+ "learning_rate": 9.240016725904246e-06,
445
+ "loss": 0.9216,
446
+ "step": 730
447
+ },
448
+ {
449
+ "epoch": 0.15,
450
+ "learning_rate": 9.22956303575162e-06,
451
+ "loss": 0.977,
452
+ "step": 740
453
+ },
454
+ {
455
+ "epoch": 0.16,
456
+ "learning_rate": 9.219109345598998e-06,
457
+ "loss": 0.8867,
458
+ "step": 750
459
+ },
460
+ {
461
+ "epoch": 0.16,
462
+ "learning_rate": 9.208655655446374e-06,
463
+ "loss": 0.916,
464
+ "step": 760
465
+ },
466
+ {
467
+ "epoch": 0.16,
468
+ "learning_rate": 9.19820196529375e-06,
469
+ "loss": 0.9983,
470
+ "step": 770
471
+ },
472
+ {
473
+ "epoch": 0.16,
474
+ "learning_rate": 9.187748275141126e-06,
475
+ "loss": 0.9232,
476
+ "step": 780
477
+ },
478
+ {
479
+ "epoch": 0.17,
480
+ "learning_rate": 9.177294584988502e-06,
481
+ "loss": 0.9142,
482
+ "step": 790
483
+ },
484
+ {
485
+ "epoch": 0.17,
486
+ "learning_rate": 9.166840894835878e-06,
487
+ "loss": 0.9104,
488
+ "step": 800
489
+ },
490
+ {
491
+ "epoch": 0.17,
492
+ "learning_rate": 9.156387204683254e-06,
493
+ "loss": 0.9219,
494
+ "step": 810
495
+ },
496
+ {
497
+ "epoch": 0.17,
498
+ "learning_rate": 9.14593351453063e-06,
499
+ "loss": 0.9512,
500
+ "step": 820
501
+ },
502
+ {
503
+ "epoch": 0.17,
504
+ "learning_rate": 9.135479824378006e-06,
505
+ "loss": 0.9737,
506
+ "step": 830
507
+ },
508
+ {
509
+ "epoch": 0.18,
510
+ "learning_rate": 9.125026134225382e-06,
511
+ "loss": 0.9051,
512
+ "step": 840
513
+ },
514
+ {
515
+ "epoch": 0.18,
516
+ "learning_rate": 9.114572444072758e-06,
517
+ "loss": 0.9342,
518
+ "step": 850
519
+ },
520
+ {
521
+ "epoch": 0.18,
522
+ "learning_rate": 9.104118753920134e-06,
523
+ "loss": 0.9987,
524
+ "step": 860
525
+ },
526
+ {
527
+ "epoch": 0.18,
528
+ "learning_rate": 9.09366506376751e-06,
529
+ "loss": 0.9175,
530
+ "step": 870
531
+ },
532
+ {
533
+ "epoch": 0.18,
534
+ "learning_rate": 9.083211373614886e-06,
535
+ "loss": 0.966,
536
+ "step": 880
537
+ },
538
+ {
539
+ "epoch": 0.19,
540
+ "learning_rate": 9.072757683462264e-06,
541
+ "loss": 0.8929,
542
+ "step": 890
543
+ },
544
+ {
545
+ "epoch": 0.19,
546
+ "learning_rate": 9.06230399330964e-06,
547
+ "loss": 1.0035,
548
+ "step": 900
549
+ },
550
+ {
551
+ "epoch": 0.19,
552
+ "learning_rate": 9.051850303157016e-06,
553
+ "loss": 0.9159,
554
+ "step": 910
555
+ },
556
+ {
557
+ "epoch": 0.19,
558
+ "learning_rate": 9.041396613004392e-06,
559
+ "loss": 0.8713,
560
+ "step": 920
561
+ },
562
+ {
563
+ "epoch": 0.19,
564
+ "learning_rate": 9.030942922851768e-06,
565
+ "loss": 0.9428,
566
+ "step": 930
567
+ },
568
+ {
569
+ "epoch": 0.2,
570
+ "learning_rate": 9.020489232699144e-06,
571
+ "loss": 0.9068,
572
+ "step": 940
573
+ },
574
+ {
575
+ "epoch": 0.2,
576
+ "learning_rate": 9.01003554254652e-06,
577
+ "loss": 0.9257,
578
+ "step": 950
579
+ },
580
+ {
581
+ "epoch": 0.2,
582
+ "learning_rate": 8.999581852393896e-06,
583
+ "loss": 0.8979,
584
+ "step": 960
585
+ },
586
+ {
587
+ "epoch": 0.2,
588
+ "learning_rate": 8.989128162241272e-06,
589
+ "loss": 0.9692,
590
+ "step": 970
591
+ },
592
+ {
593
+ "epoch": 0.2,
594
+ "learning_rate": 8.978674472088648e-06,
595
+ "loss": 0.891,
596
+ "step": 980
597
+ },
598
+ {
599
+ "epoch": 0.21,
600
+ "learning_rate": 8.968220781936024e-06,
601
+ "loss": 0.9504,
602
+ "step": 990
603
+ },
604
+ {
605
+ "epoch": 0.21,
606
+ "learning_rate": 8.9577670917834e-06,
607
+ "loss": 0.8841,
608
+ "step": 1000
609
+ },
610
+ {
611
+ "epoch": 0.21,
612
+ "learning_rate": 8.947313401630776e-06,
613
+ "loss": 0.9707,
614
+ "step": 1010
615
+ },
616
+ {
617
+ "epoch": 0.21,
618
+ "learning_rate": 8.936859711478153e-06,
619
+ "loss": 0.9047,
620
+ "step": 1020
621
+ },
622
+ {
623
+ "epoch": 0.22,
624
+ "learning_rate": 8.92640602132553e-06,
625
+ "loss": 0.9127,
626
+ "step": 1030
627
+ },
628
+ {
629
+ "epoch": 0.22,
630
+ "learning_rate": 8.915952331172904e-06,
631
+ "loss": 0.9204,
632
+ "step": 1040
633
+ },
634
+ {
635
+ "epoch": 0.22,
636
+ "learning_rate": 8.90549864102028e-06,
637
+ "loss": 0.9721,
638
+ "step": 1050
639
+ },
640
+ {
641
+ "epoch": 0.22,
642
+ "learning_rate": 8.895044950867658e-06,
643
+ "loss": 0.8829,
644
+ "step": 1060
645
+ },
646
+ {
647
+ "epoch": 0.22,
648
+ "learning_rate": 8.884591260715034e-06,
649
+ "loss": 0.9252,
650
+ "step": 1070
651
+ },
652
+ {
653
+ "epoch": 0.23,
654
+ "learning_rate": 8.87413757056241e-06,
655
+ "loss": 0.9248,
656
+ "step": 1080
657
+ },
658
+ {
659
+ "epoch": 0.23,
660
+ "learning_rate": 8.863683880409786e-06,
661
+ "loss": 0.9494,
662
+ "step": 1090
663
+ },
664
+ {
665
+ "epoch": 0.23,
666
+ "learning_rate": 8.853230190257162e-06,
667
+ "loss": 0.9655,
668
+ "step": 1100
669
+ },
670
+ {
671
+ "epoch": 0.23,
672
+ "learning_rate": 8.842776500104538e-06,
673
+ "loss": 0.9307,
674
+ "step": 1110
675
+ },
676
+ {
677
+ "epoch": 0.23,
678
+ "learning_rate": 8.832322809951914e-06,
679
+ "loss": 0.888,
680
+ "step": 1120
681
+ },
682
+ {
683
+ "epoch": 0.24,
684
+ "learning_rate": 8.82186911979929e-06,
685
+ "loss": 0.931,
686
+ "step": 1130
687
+ },
688
+ {
689
+ "epoch": 0.24,
690
+ "learning_rate": 8.811415429646666e-06,
691
+ "loss": 0.9236,
692
+ "step": 1140
693
+ },
694
+ {
695
+ "epoch": 0.24,
696
+ "learning_rate": 8.800961739494042e-06,
697
+ "loss": 0.9462,
698
+ "step": 1150
699
+ },
700
+ {
701
+ "epoch": 0.24,
702
+ "learning_rate": 8.79050804934142e-06,
703
+ "loss": 0.9676,
704
+ "step": 1160
705
+ },
706
+ {
707
+ "epoch": 0.24,
708
+ "learning_rate": 8.780054359188794e-06,
709
+ "loss": 0.9015,
710
+ "step": 1170
711
+ },
712
+ {
713
+ "epoch": 0.25,
714
+ "learning_rate": 8.76960066903617e-06,
715
+ "loss": 0.9533,
716
+ "step": 1180
717
+ },
718
+ {
719
+ "epoch": 0.25,
720
+ "learning_rate": 8.759146978883547e-06,
721
+ "loss": 0.8977,
722
+ "step": 1190
723
+ },
724
+ {
725
+ "epoch": 0.25,
726
+ "learning_rate": 8.748693288730923e-06,
727
+ "loss": 0.861,
728
+ "step": 1200
729
+ },
730
+ {
731
+ "epoch": 0.25,
732
+ "learning_rate": 8.7382395985783e-06,
733
+ "loss": 0.9662,
734
+ "step": 1210
735
+ },
736
+ {
737
+ "epoch": 0.26,
738
+ "learning_rate": 8.727785908425675e-06,
739
+ "loss": 0.9749,
740
+ "step": 1220
741
+ },
742
+ {
743
+ "epoch": 0.26,
744
+ "learning_rate": 8.717332218273051e-06,
745
+ "loss": 0.8911,
746
+ "step": 1230
747
+ },
748
+ {
749
+ "epoch": 0.26,
750
+ "learning_rate": 8.706878528120427e-06,
751
+ "loss": 0.9127,
752
+ "step": 1240
753
+ },
754
+ {
755
+ "epoch": 0.26,
756
+ "learning_rate": 8.696424837967803e-06,
757
+ "loss": 0.8746,
758
+ "step": 1250
759
+ },
760
+ {
761
+ "epoch": 0.26,
762
+ "learning_rate": 8.68597114781518e-06,
763
+ "loss": 0.9181,
764
+ "step": 1260
765
+ },
766
+ {
767
+ "epoch": 0.27,
768
+ "learning_rate": 8.675517457662555e-06,
769
+ "loss": 0.9101,
770
+ "step": 1270
771
+ },
772
+ {
773
+ "epoch": 0.27,
774
+ "learning_rate": 8.665063767509931e-06,
775
+ "loss": 0.8764,
776
+ "step": 1280
777
+ },
778
+ {
779
+ "epoch": 0.27,
780
+ "learning_rate": 8.654610077357309e-06,
781
+ "loss": 0.8952,
782
+ "step": 1290
783
+ },
784
+ {
785
+ "epoch": 0.27,
786
+ "learning_rate": 8.644156387204683e-06,
787
+ "loss": 0.9548,
788
+ "step": 1300
789
+ },
790
+ {
791
+ "epoch": 0.27,
792
+ "learning_rate": 8.63370269705206e-06,
793
+ "loss": 0.955,
794
+ "step": 1310
795
+ },
796
+ {
797
+ "epoch": 0.28,
798
+ "learning_rate": 8.623249006899435e-06,
799
+ "loss": 0.9375,
800
+ "step": 1320
801
+ },
802
+ {
803
+ "epoch": 0.28,
804
+ "learning_rate": 8.612795316746813e-06,
805
+ "loss": 0.9587,
806
+ "step": 1330
807
+ },
808
+ {
809
+ "epoch": 0.28,
810
+ "learning_rate": 8.60234162659419e-06,
811
+ "loss": 0.9171,
812
+ "step": 1340
813
+ },
814
+ {
815
+ "epoch": 0.28,
816
+ "learning_rate": 8.591887936441563e-06,
817
+ "loss": 0.971,
818
+ "step": 1350
819
+ },
820
+ {
821
+ "epoch": 0.28,
822
+ "learning_rate": 8.581434246288941e-06,
823
+ "loss": 0.9503,
824
+ "step": 1360
825
+ },
826
+ {
827
+ "epoch": 0.29,
828
+ "learning_rate": 8.570980556136317e-06,
829
+ "loss": 0.9779,
830
+ "step": 1370
831
+ },
832
+ {
833
+ "epoch": 0.29,
834
+ "learning_rate": 8.560526865983693e-06,
835
+ "loss": 0.8802,
836
+ "step": 1380
837
+ },
838
+ {
839
+ "epoch": 0.29,
840
+ "learning_rate": 8.55007317583107e-06,
841
+ "loss": 0.9075,
842
+ "step": 1390
843
+ },
844
+ {
845
+ "epoch": 0.29,
846
+ "learning_rate": 8.539619485678445e-06,
847
+ "loss": 0.8784,
848
+ "step": 1400
849
+ },
850
+ {
851
+ "epoch": 0.29,
852
+ "learning_rate": 8.529165795525821e-06,
853
+ "loss": 0.9136,
854
+ "step": 1410
855
+ },
856
+ {
857
+ "epoch": 0.3,
858
+ "learning_rate": 8.518712105373197e-06,
859
+ "loss": 0.9078,
860
+ "step": 1420
861
+ },
862
+ {
863
+ "epoch": 0.3,
864
+ "learning_rate": 8.508258415220573e-06,
865
+ "loss": 0.981,
866
+ "step": 1430
867
+ },
868
+ {
869
+ "epoch": 0.3,
870
+ "learning_rate": 8.49780472506795e-06,
871
+ "loss": 0.9346,
872
+ "step": 1440
873
+ },
874
+ {
875
+ "epoch": 0.3,
876
+ "learning_rate": 8.487351034915325e-06,
877
+ "loss": 0.8989,
878
+ "step": 1450
879
+ },
880
+ {
881
+ "epoch": 0.31,
882
+ "learning_rate": 8.476897344762703e-06,
883
+ "loss": 0.9462,
884
+ "step": 1460
885
+ },
886
+ {
887
+ "epoch": 0.31,
888
+ "learning_rate": 8.466443654610077e-06,
889
+ "loss": 0.8866,
890
+ "step": 1470
891
+ },
892
+ {
893
+ "epoch": 0.31,
894
+ "learning_rate": 8.455989964457453e-06,
895
+ "loss": 0.8557,
896
+ "step": 1480
897
+ },
898
+ {
899
+ "epoch": 0.31,
900
+ "learning_rate": 8.445536274304831e-06,
901
+ "loss": 0.9636,
902
+ "step": 1490
903
+ },
904
+ {
905
+ "epoch": 0.31,
906
+ "learning_rate": 8.435082584152207e-06,
907
+ "loss": 0.8861,
908
+ "step": 1500
909
+ },
910
+ {
911
+ "epoch": 0.32,
912
+ "learning_rate": 8.424628893999583e-06,
913
+ "loss": 0.95,
914
+ "step": 1510
915
+ },
916
+ {
917
+ "epoch": 0.32,
918
+ "learning_rate": 8.414175203846957e-06,
919
+ "loss": 0.8743,
920
+ "step": 1520
921
+ },
922
+ {
923
+ "epoch": 0.32,
924
+ "learning_rate": 8.403721513694335e-06,
925
+ "loss": 0.8983,
926
+ "step": 1530
927
+ },
928
+ {
929
+ "epoch": 0.32,
930
+ "learning_rate": 8.393267823541711e-06,
931
+ "loss": 0.9549,
932
+ "step": 1540
933
+ },
934
+ {
935
+ "epoch": 0.32,
936
+ "learning_rate": 8.382814133389087e-06,
937
+ "loss": 1.0213,
938
+ "step": 1550
939
+ },
940
+ {
941
+ "epoch": 0.33,
942
+ "learning_rate": 8.372360443236463e-06,
943
+ "loss": 0.9463,
944
+ "step": 1560
945
+ },
946
+ {
947
+ "epoch": 0.33,
948
+ "learning_rate": 8.361906753083839e-06,
949
+ "loss": 1.0107,
950
+ "step": 1570
951
+ },
952
+ {
953
+ "epoch": 0.33,
954
+ "learning_rate": 8.351453062931215e-06,
955
+ "loss": 0.9134,
956
+ "step": 1580
957
+ },
958
+ {
959
+ "epoch": 0.33,
960
+ "learning_rate": 8.340999372778593e-06,
961
+ "loss": 0.9037,
962
+ "step": 1590
963
+ },
964
+ {
965
+ "epoch": 0.33,
966
+ "learning_rate": 8.330545682625967e-06,
967
+ "loss": 1.0,
968
+ "step": 1600
969
+ },
970
+ {
971
+ "epoch": 0.34,
972
+ "learning_rate": 8.320091992473343e-06,
973
+ "loss": 0.9319,
974
+ "step": 1610
975
+ },
976
+ {
977
+ "epoch": 0.34,
978
+ "learning_rate": 8.309638302320719e-06,
979
+ "loss": 0.8916,
980
+ "step": 1620
981
+ },
982
+ {
983
+ "epoch": 0.34,
984
+ "learning_rate": 8.299184612168097e-06,
985
+ "loss": 0.9546,
986
+ "step": 1630
987
+ },
988
+ {
989
+ "epoch": 0.34,
990
+ "learning_rate": 8.288730922015473e-06,
991
+ "loss": 0.9687,
992
+ "step": 1640
993
+ },
994
+ {
995
+ "epoch": 0.34,
996
+ "learning_rate": 8.278277231862847e-06,
997
+ "loss": 0.888,
998
+ "step": 1650
999
+ },
1000
+ {
1001
+ "epoch": 0.35,
1002
+ "learning_rate": 8.267823541710225e-06,
1003
+ "loss": 0.924,
1004
+ "step": 1660
1005
+ },
1006
+ {
1007
+ "epoch": 0.35,
1008
+ "learning_rate": 8.257369851557601e-06,
1009
+ "loss": 0.9409,
1010
+ "step": 1670
1011
+ },
1012
+ {
1013
+ "epoch": 0.35,
1014
+ "learning_rate": 8.246916161404977e-06,
1015
+ "loss": 0.9448,
1016
+ "step": 1680
1017
+ },
1018
+ {
1019
+ "epoch": 0.35,
1020
+ "learning_rate": 8.236462471252353e-06,
1021
+ "loss": 0.8798,
1022
+ "step": 1690
1023
+ },
1024
+ {
1025
+ "epoch": 0.36,
1026
+ "learning_rate": 8.226008781099729e-06,
1027
+ "loss": 0.8185,
1028
+ "step": 1700
1029
+ },
1030
+ {
1031
+ "epoch": 0.36,
1032
+ "learning_rate": 8.215555090947105e-06,
1033
+ "loss": 0.8991,
1034
+ "step": 1710
1035
+ },
1036
+ {
1037
+ "epoch": 0.36,
1038
+ "learning_rate": 8.205101400794481e-06,
1039
+ "loss": 0.9261,
1040
+ "step": 1720
1041
+ },
1042
+ {
1043
+ "epoch": 0.36,
1044
+ "learning_rate": 8.194647710641857e-06,
1045
+ "loss": 0.9167,
1046
+ "step": 1730
1047
+ },
1048
+ {
1049
+ "epoch": 0.36,
1050
+ "learning_rate": 8.184194020489233e-06,
1051
+ "loss": 0.9146,
1052
+ "step": 1740
1053
+ },
1054
+ {
1055
+ "epoch": 0.37,
1056
+ "learning_rate": 8.173740330336609e-06,
1057
+ "loss": 0.8829,
1058
+ "step": 1750
1059
+ },
1060
+ {
1061
+ "epoch": 0.37,
1062
+ "learning_rate": 8.163286640183987e-06,
1063
+ "loss": 0.8972,
1064
+ "step": 1760
1065
+ },
1066
+ {
1067
+ "epoch": 0.37,
1068
+ "learning_rate": 8.152832950031363e-06,
1069
+ "loss": 0.9056,
1070
+ "step": 1770
1071
+ },
1072
+ {
1073
+ "epoch": 0.37,
1074
+ "learning_rate": 8.142379259878737e-06,
1075
+ "loss": 0.8516,
1076
+ "step": 1780
1077
+ },
1078
+ {
1079
+ "epoch": 0.37,
1080
+ "learning_rate": 8.131925569726113e-06,
1081
+ "loss": 0.9755,
1082
+ "step": 1790
1083
+ },
1084
+ {
1085
+ "epoch": 0.38,
1086
+ "learning_rate": 8.12147187957349e-06,
1087
+ "loss": 0.9584,
1088
+ "step": 1800
1089
+ },
1090
+ {
1091
+ "epoch": 0.38,
1092
+ "learning_rate": 8.111018189420867e-06,
1093
+ "loss": 0.9286,
1094
+ "step": 1810
1095
+ },
1096
+ {
1097
+ "epoch": 0.38,
1098
+ "learning_rate": 8.100564499268243e-06,
1099
+ "loss": 0.9321,
1100
+ "step": 1820
1101
+ },
1102
+ {
1103
+ "epoch": 0.38,
1104
+ "learning_rate": 8.090110809115619e-06,
1105
+ "loss": 0.8993,
1106
+ "step": 1830
1107
+ },
1108
+ {
1109
+ "epoch": 0.38,
1110
+ "learning_rate": 8.079657118962995e-06,
1111
+ "loss": 0.8684,
1112
+ "step": 1840
1113
+ },
1114
+ {
1115
+ "epoch": 0.39,
1116
+ "learning_rate": 8.06920342881037e-06,
1117
+ "loss": 0.9466,
1118
+ "step": 1850
1119
+ },
1120
+ {
1121
+ "epoch": 0.39,
1122
+ "learning_rate": 8.058749738657747e-06,
1123
+ "loss": 0.8792,
1124
+ "step": 1860
1125
+ },
1126
+ {
1127
+ "epoch": 0.39,
1128
+ "learning_rate": 8.048296048505123e-06,
1129
+ "loss": 0.9253,
1130
+ "step": 1870
1131
+ },
1132
+ {
1133
+ "epoch": 0.39,
1134
+ "learning_rate": 8.037842358352499e-06,
1135
+ "loss": 0.9671,
1136
+ "step": 1880
1137
+ },
1138
+ {
1139
+ "epoch": 0.4,
1140
+ "learning_rate": 8.027388668199875e-06,
1141
+ "loss": 0.9155,
1142
+ "step": 1890
1143
+ },
1144
+ {
1145
+ "epoch": 0.4,
1146
+ "learning_rate": 8.016934978047252e-06,
1147
+ "loss": 0.9275,
1148
+ "step": 1900
1149
+ },
1150
+ {
1151
+ "epoch": 0.4,
1152
+ "learning_rate": 8.006481287894627e-06,
1153
+ "loss": 0.9119,
1154
+ "step": 1910
1155
+ },
1156
+ {
1157
+ "epoch": 0.4,
1158
+ "learning_rate": 7.996027597742003e-06,
1159
+ "loss": 0.8613,
1160
+ "step": 1920
1161
+ },
1162
+ {
1163
+ "epoch": 0.4,
1164
+ "learning_rate": 7.98557390758938e-06,
1165
+ "loss": 0.8958,
1166
+ "step": 1930
1167
+ },
1168
+ {
1169
+ "epoch": 0.41,
1170
+ "learning_rate": 7.975120217436757e-06,
1171
+ "loss": 0.9375,
1172
+ "step": 1940
1173
+ },
1174
+ {
1175
+ "epoch": 0.41,
1176
+ "learning_rate": 7.964666527284133e-06,
1177
+ "loss": 0.9341,
1178
+ "step": 1950
1179
+ },
1180
+ {
1181
+ "epoch": 0.41,
1182
+ "learning_rate": 7.954212837131509e-06,
1183
+ "loss": 0.8851,
1184
+ "step": 1960
1185
+ },
1186
+ {
1187
+ "epoch": 0.41,
1188
+ "learning_rate": 7.943759146978885e-06,
1189
+ "loss": 0.8582,
1190
+ "step": 1970
1191
+ },
1192
+ {
1193
+ "epoch": 0.41,
1194
+ "learning_rate": 7.93330545682626e-06,
1195
+ "loss": 0.9287,
1196
+ "step": 1980
1197
+ },
1198
+ {
1199
+ "epoch": 0.42,
1200
+ "learning_rate": 7.922851766673637e-06,
1201
+ "loss": 0.8866,
1202
+ "step": 1990
1203
+ },
1204
+ {
1205
+ "epoch": 0.42,
1206
+ "learning_rate": 7.912398076521013e-06,
1207
+ "loss": 0.9085,
1208
+ "step": 2000
1209
+ },
1210
+ {
1211
+ "epoch": 0.42,
1212
+ "learning_rate": 7.901944386368389e-06,
1213
+ "loss": 0.9195,
1214
+ "step": 2010
1215
+ },
1216
+ {
1217
+ "epoch": 0.42,
1218
+ "learning_rate": 7.891490696215765e-06,
1219
+ "loss": 0.8571,
1220
+ "step": 2020
1221
+ },
1222
+ {
1223
+ "epoch": 0.42,
1224
+ "learning_rate": 7.88103700606314e-06,
1225
+ "loss": 0.8742,
1226
+ "step": 2030
1227
+ },
1228
+ {
1229
+ "epoch": 0.43,
1230
+ "learning_rate": 7.870583315910517e-06,
1231
+ "loss": 0.9843,
1232
+ "step": 2040
1233
+ },
1234
+ {
1235
+ "epoch": 0.43,
1236
+ "learning_rate": 7.860129625757893e-06,
1237
+ "loss": 0.9768,
1238
+ "step": 2050
1239
+ },
1240
+ {
1241
+ "epoch": 0.43,
1242
+ "learning_rate": 7.849675935605269e-06,
1243
+ "loss": 0.9654,
1244
+ "step": 2060
1245
+ },
1246
+ {
1247
+ "epoch": 0.43,
1248
+ "learning_rate": 7.839222245452646e-06,
1249
+ "loss": 0.8788,
1250
+ "step": 2070
1251
+ },
1252
+ {
1253
+ "epoch": 0.43,
1254
+ "learning_rate": 7.82876855530002e-06,
1255
+ "loss": 0.8983,
1256
+ "step": 2080
1257
+ },
1258
+ {
1259
+ "epoch": 0.44,
1260
+ "learning_rate": 7.818314865147397e-06,
1261
+ "loss": 0.8889,
1262
+ "step": 2090
1263
+ },
1264
+ {
1265
+ "epoch": 0.44,
1266
+ "learning_rate": 7.807861174994774e-06,
1267
+ "loss": 0.9339,
1268
+ "step": 2100
1269
+ },
1270
+ {
1271
+ "epoch": 0.44,
1272
+ "learning_rate": 7.79740748484215e-06,
1273
+ "loss": 0.9302,
1274
+ "step": 2110
1275
+ },
1276
+ {
1277
+ "epoch": 0.44,
1278
+ "learning_rate": 7.786953794689526e-06,
1279
+ "loss": 0.8483,
1280
+ "step": 2120
1281
+ },
1282
+ {
1283
+ "epoch": 0.45,
1284
+ "learning_rate": 7.776500104536902e-06,
1285
+ "loss": 0.9208,
1286
+ "step": 2130
1287
+ },
1288
+ {
1289
+ "epoch": 0.45,
1290
+ "learning_rate": 7.766046414384278e-06,
1291
+ "loss": 0.9515,
1292
+ "step": 2140
1293
+ },
1294
+ {
1295
+ "epoch": 0.45,
1296
+ "learning_rate": 7.755592724231654e-06,
1297
+ "loss": 0.8451,
1298
+ "step": 2150
1299
+ },
1300
+ {
1301
+ "epoch": 0.45,
1302
+ "learning_rate": 7.74513903407903e-06,
1303
+ "loss": 0.9629,
1304
+ "step": 2160
1305
+ },
1306
+ {
1307
+ "epoch": 0.45,
1308
+ "learning_rate": 7.734685343926406e-06,
1309
+ "loss": 0.8991,
1310
+ "step": 2170
1311
+ },
1312
+ {
1313
+ "epoch": 0.46,
1314
+ "learning_rate": 7.724231653773782e-06,
1315
+ "loss": 0.8856,
1316
+ "step": 2180
1317
+ },
1318
+ {
1319
+ "epoch": 0.46,
1320
+ "learning_rate": 7.713777963621158e-06,
1321
+ "loss": 0.901,
1322
+ "step": 2190
1323
+ },
1324
+ {
1325
+ "epoch": 0.46,
1326
+ "learning_rate": 7.703324273468536e-06,
1327
+ "loss": 0.896,
1328
+ "step": 2200
1329
+ },
1330
+ {
1331
+ "epoch": 0.46,
1332
+ "learning_rate": 7.69287058331591e-06,
1333
+ "loss": 0.9733,
1334
+ "step": 2210
1335
+ },
1336
+ {
1337
+ "epoch": 0.46,
1338
+ "learning_rate": 7.682416893163286e-06,
1339
+ "loss": 0.9834,
1340
+ "step": 2220
1341
+ },
1342
+ {
1343
+ "epoch": 0.47,
1344
+ "learning_rate": 7.671963203010664e-06,
1345
+ "loss": 0.8649,
1346
+ "step": 2230
1347
+ },
1348
+ {
1349
+ "epoch": 0.47,
1350
+ "learning_rate": 7.66150951285804e-06,
1351
+ "loss": 0.9071,
1352
+ "step": 2240
1353
+ },
1354
+ {
1355
+ "epoch": 0.47,
1356
+ "learning_rate": 7.651055822705416e-06,
1357
+ "loss": 0.9331,
1358
+ "step": 2250
1359
+ },
1360
+ {
1361
+ "epoch": 0.47,
1362
+ "learning_rate": 7.64060213255279e-06,
1363
+ "loss": 0.9564,
1364
+ "step": 2260
1365
+ },
1366
+ {
1367
+ "epoch": 0.47,
1368
+ "learning_rate": 7.630148442400168e-06,
1369
+ "loss": 0.9174,
1370
+ "step": 2270
1371
+ },
1372
+ {
1373
+ "epoch": 0.48,
1374
+ "learning_rate": 7.619694752247544e-06,
1375
+ "loss": 0.9184,
1376
+ "step": 2280
1377
+ },
1378
+ {
1379
+ "epoch": 0.48,
1380
+ "learning_rate": 7.609241062094919e-06,
1381
+ "loss": 0.8832,
1382
+ "step": 2290
1383
+ },
1384
+ {
1385
+ "epoch": 0.48,
1386
+ "learning_rate": 7.598787371942297e-06,
1387
+ "loss": 1.0121,
1388
+ "step": 2300
1389
+ },
1390
+ {
1391
+ "epoch": 0.48,
1392
+ "learning_rate": 7.588333681789672e-06,
1393
+ "loss": 0.8368,
1394
+ "step": 2310
1395
+ },
1396
+ {
1397
+ "epoch": 0.48,
1398
+ "learning_rate": 7.577879991637048e-06,
1399
+ "loss": 0.938,
1400
+ "step": 2320
1401
+ },
1402
+ {
1403
+ "epoch": 0.49,
1404
+ "learning_rate": 7.567426301484425e-06,
1405
+ "loss": 0.8101,
1406
+ "step": 2330
1407
+ },
1408
+ {
1409
+ "epoch": 0.49,
1410
+ "learning_rate": 7.556972611331801e-06,
1411
+ "loss": 0.9026,
1412
+ "step": 2340
1413
+ },
1414
+ {
1415
+ "epoch": 0.49,
1416
+ "learning_rate": 7.546518921179177e-06,
1417
+ "loss": 0.9025,
1418
+ "step": 2350
1419
+ },
1420
+ {
1421
+ "epoch": 0.49,
1422
+ "learning_rate": 7.536065231026552e-06,
1423
+ "loss": 0.8843,
1424
+ "step": 2360
1425
+ },
1426
+ {
1427
+ "epoch": 0.5,
1428
+ "learning_rate": 7.525611540873929e-06,
1429
+ "loss": 0.9459,
1430
+ "step": 2370
1431
+ },
1432
+ {
1433
+ "epoch": 0.5,
1434
+ "learning_rate": 7.515157850721305e-06,
1435
+ "loss": 0.8736,
1436
+ "step": 2380
1437
+ },
1438
+ {
1439
+ "epoch": 0.5,
1440
+ "learning_rate": 7.504704160568681e-06,
1441
+ "loss": 0.9031,
1442
+ "step": 2390
1443
+ },
1444
+ {
1445
+ "epoch": 0.5,
1446
+ "learning_rate": 7.494250470416058e-06,
1447
+ "loss": 0.8856,
1448
+ "step": 2400
1449
+ },
1450
+ {
1451
+ "epoch": 0.5,
1452
+ "learning_rate": 7.483796780263434e-06,
1453
+ "loss": 0.9425,
1454
+ "step": 2410
1455
+ },
1456
+ {
1457
+ "epoch": 0.51,
1458
+ "learning_rate": 7.473343090110809e-06,
1459
+ "loss": 0.9604,
1460
+ "step": 2420
1461
+ },
1462
+ {
1463
+ "epoch": 0.51,
1464
+ "learning_rate": 7.462889399958186e-06,
1465
+ "loss": 0.9365,
1466
+ "step": 2430
1467
+ },
1468
+ {
1469
+ "epoch": 0.51,
1470
+ "learning_rate": 7.452435709805562e-06,
1471
+ "loss": 0.8897,
1472
+ "step": 2440
1473
+ },
1474
+ {
1475
+ "epoch": 0.51,
1476
+ "learning_rate": 7.441982019652938e-06,
1477
+ "loss": 0.9331,
1478
+ "step": 2450
1479
+ },
1480
+ {
1481
+ "epoch": 0.51,
1482
+ "learning_rate": 7.431528329500314e-06,
1483
+ "loss": 0.9166,
1484
+ "step": 2460
1485
+ },
1486
+ {
1487
+ "epoch": 0.52,
1488
+ "learning_rate": 7.421074639347691e-06,
1489
+ "loss": 0.9193,
1490
+ "step": 2470
1491
+ },
1492
+ {
1493
+ "epoch": 0.52,
1494
+ "learning_rate": 7.410620949195066e-06,
1495
+ "loss": 0.8827,
1496
+ "step": 2480
1497
+ },
1498
+ {
1499
+ "epoch": 0.52,
1500
+ "learning_rate": 7.400167259042442e-06,
1501
+ "loss": 0.9035,
1502
+ "step": 2490
1503
+ },
1504
+ {
1505
+ "epoch": 0.52,
1506
+ "learning_rate": 7.389713568889819e-06,
1507
+ "loss": 0.9055,
1508
+ "step": 2500
1509
+ },
1510
+ {
1511
+ "epoch": 0.52,
1512
+ "learning_rate": 7.379259878737195e-06,
1513
+ "loss": 0.8615,
1514
+ "step": 2510
1515
+ },
1516
+ {
1517
+ "epoch": 0.53,
1518
+ "learning_rate": 7.368806188584571e-06,
1519
+ "loss": 0.9127,
1520
+ "step": 2520
1521
+ },
1522
+ {
1523
+ "epoch": 0.53,
1524
+ "learning_rate": 7.358352498431946e-06,
1525
+ "loss": 0.9056,
1526
+ "step": 2530
1527
+ },
1528
+ {
1529
+ "epoch": 0.53,
1530
+ "learning_rate": 7.347898808279324e-06,
1531
+ "loss": 0.8745,
1532
+ "step": 2540
1533
+ },
1534
+ {
1535
+ "epoch": 0.53,
1536
+ "learning_rate": 7.337445118126699e-06,
1537
+ "loss": 0.8897,
1538
+ "step": 2550
1539
+ },
1540
+ {
1541
+ "epoch": 0.54,
1542
+ "learning_rate": 7.326991427974075e-06,
1543
+ "loss": 0.9375,
1544
+ "step": 2560
1545
+ },
1546
+ {
1547
+ "epoch": 0.54,
1548
+ "learning_rate": 7.316537737821452e-06,
1549
+ "loss": 0.8699,
1550
+ "step": 2570
1551
+ },
1552
+ {
1553
+ "epoch": 0.54,
1554
+ "learning_rate": 7.306084047668828e-06,
1555
+ "loss": 0.8904,
1556
+ "step": 2580
1557
+ },
1558
+ {
1559
+ "epoch": 0.54,
1560
+ "learning_rate": 7.295630357516204e-06,
1561
+ "loss": 0.8984,
1562
+ "step": 2590
1563
+ },
1564
+ {
1565
+ "epoch": 0.54,
1566
+ "learning_rate": 7.285176667363581e-06,
1567
+ "loss": 0.8784,
1568
+ "step": 2600
1569
+ },
1570
+ {
1571
+ "epoch": 0.55,
1572
+ "learning_rate": 7.274722977210956e-06,
1573
+ "loss": 0.8727,
1574
+ "step": 2610
1575
+ },
1576
+ {
1577
+ "epoch": 0.55,
1578
+ "learning_rate": 7.264269287058332e-06,
1579
+ "loss": 0.9417,
1580
+ "step": 2620
1581
+ },
1582
+ {
1583
+ "epoch": 0.55,
1584
+ "learning_rate": 7.253815596905708e-06,
1585
+ "loss": 0.865,
1586
+ "step": 2630
1587
+ },
1588
+ {
1589
+ "epoch": 0.55,
1590
+ "learning_rate": 7.243361906753085e-06,
1591
+ "loss": 0.9408,
1592
+ "step": 2640
1593
+ },
1594
+ {
1595
+ "epoch": 0.55,
1596
+ "learning_rate": 7.232908216600461e-06,
1597
+ "loss": 0.8789,
1598
+ "step": 2650
1599
+ },
1600
+ {
1601
+ "epoch": 0.56,
1602
+ "learning_rate": 7.222454526447836e-06,
1603
+ "loss": 0.9247,
1604
+ "step": 2660
1605
+ },
1606
+ {
1607
+ "epoch": 0.56,
1608
+ "learning_rate": 7.212000836295213e-06,
1609
+ "loss": 0.8336,
1610
+ "step": 2670
1611
+ },
1612
+ {
1613
+ "epoch": 0.56,
1614
+ "learning_rate": 7.201547146142589e-06,
1615
+ "loss": 0.9389,
1616
+ "step": 2680
1617
+ },
1618
+ {
1619
+ "epoch": 0.56,
1620
+ "learning_rate": 7.191093455989965e-06,
1621
+ "loss": 0.8932,
1622
+ "step": 2690
1623
+ },
1624
+ {
1625
+ "epoch": 0.56,
1626
+ "learning_rate": 7.180639765837342e-06,
1627
+ "loss": 0.8682,
1628
+ "step": 2700
1629
+ },
1630
+ {
1631
+ "epoch": 0.57,
1632
+ "learning_rate": 7.170186075684718e-06,
1633
+ "loss": 0.8646,
1634
+ "step": 2710
1635
+ },
1636
+ {
1637
+ "epoch": 0.57,
1638
+ "learning_rate": 7.159732385532093e-06,
1639
+ "loss": 0.8836,
1640
+ "step": 2720
1641
+ },
1642
+ {
1643
+ "epoch": 0.57,
1644
+ "learning_rate": 7.149278695379469e-06,
1645
+ "loss": 0.8928,
1646
+ "step": 2730
1647
+ },
1648
+ {
1649
+ "epoch": 0.57,
1650
+ "learning_rate": 7.138825005226846e-06,
1651
+ "loss": 0.8607,
1652
+ "step": 2740
1653
+ },
1654
+ {
1655
+ "epoch": 0.57,
1656
+ "learning_rate": 7.128371315074222e-06,
1657
+ "loss": 0.8347,
1658
+ "step": 2750
1659
+ },
1660
+ {
1661
+ "epoch": 0.58,
1662
+ "learning_rate": 7.117917624921598e-06,
1663
+ "loss": 0.9103,
1664
+ "step": 2760
1665
+ },
1666
+ {
1667
+ "epoch": 0.58,
1668
+ "learning_rate": 7.107463934768975e-06,
1669
+ "loss": 0.8894,
1670
+ "step": 2770
1671
+ },
1672
+ {
1673
+ "epoch": 0.58,
1674
+ "learning_rate": 7.097010244616351e-06,
1675
+ "loss": 0.8801,
1676
+ "step": 2780
1677
+ },
1678
+ {
1679
+ "epoch": 0.58,
1680
+ "learning_rate": 7.086556554463726e-06,
1681
+ "loss": 0.869,
1682
+ "step": 2790
1683
+ },
1684
+ {
1685
+ "epoch": 0.59,
1686
+ "learning_rate": 7.076102864311103e-06,
1687
+ "loss": 0.9117,
1688
+ "step": 2800
1689
+ },
1690
+ {
1691
+ "epoch": 0.59,
1692
+ "learning_rate": 7.065649174158479e-06,
1693
+ "loss": 0.9176,
1694
+ "step": 2810
1695
+ },
1696
+ {
1697
+ "epoch": 0.59,
1698
+ "learning_rate": 7.055195484005855e-06,
1699
+ "loss": 0.9837,
1700
+ "step": 2820
1701
+ },
1702
+ {
1703
+ "epoch": 0.59,
1704
+ "learning_rate": 7.044741793853231e-06,
1705
+ "loss": 0.8136,
1706
+ "step": 2830
1707
+ },
1708
+ {
1709
+ "epoch": 0.59,
1710
+ "learning_rate": 7.0342881037006075e-06,
1711
+ "loss": 0.9226,
1712
+ "step": 2840
1713
+ },
1714
+ {
1715
+ "epoch": 0.6,
1716
+ "learning_rate": 7.023834413547983e-06,
1717
+ "loss": 0.9151,
1718
+ "step": 2850
1719
+ },
1720
+ {
1721
+ "epoch": 0.6,
1722
+ "learning_rate": 7.013380723395359e-06,
1723
+ "loss": 0.9269,
1724
+ "step": 2860
1725
+ },
1726
+ {
1727
+ "epoch": 0.6,
1728
+ "learning_rate": 7.0029270332427355e-06,
1729
+ "loss": 0.8706,
1730
+ "step": 2870
1731
+ },
1732
+ {
1733
+ "epoch": 0.6,
1734
+ "learning_rate": 6.9924733430901115e-06,
1735
+ "loss": 0.9008,
1736
+ "step": 2880
1737
+ },
1738
+ {
1739
+ "epoch": 0.6,
1740
+ "learning_rate": 6.9820196529374875e-06,
1741
+ "loss": 0.9568,
1742
+ "step": 2890
1743
+ },
1744
+ {
1745
+ "epoch": 0.61,
1746
+ "learning_rate": 6.971565962784863e-06,
1747
+ "loss": 0.912,
1748
+ "step": 2900
1749
+ },
1750
+ {
1751
+ "epoch": 0.61,
1752
+ "learning_rate": 6.9611122726322396e-06,
1753
+ "loss": 0.9409,
1754
+ "step": 2910
1755
+ },
1756
+ {
1757
+ "epoch": 0.61,
1758
+ "learning_rate": 6.9506585824796156e-06,
1759
+ "loss": 0.9169,
1760
+ "step": 2920
1761
+ },
1762
+ {
1763
+ "epoch": 0.61,
1764
+ "learning_rate": 6.940204892326992e-06,
1765
+ "loss": 0.8665,
1766
+ "step": 2930
1767
+ },
1768
+ {
1769
+ "epoch": 0.61,
1770
+ "learning_rate": 6.9297512021743684e-06,
1771
+ "loss": 0.8812,
1772
+ "step": 2940
1773
+ },
1774
+ {
1775
+ "epoch": 0.62,
1776
+ "learning_rate": 6.9192975120217444e-06,
1777
+ "loss": 0.8699,
1778
+ "step": 2950
1779
+ },
1780
+ {
1781
+ "epoch": 0.62,
1782
+ "learning_rate": 6.9088438218691205e-06,
1783
+ "loss": 0.8409,
1784
+ "step": 2960
1785
+ },
1786
+ {
1787
+ "epoch": 0.62,
1788
+ "learning_rate": 6.898390131716497e-06,
1789
+ "loss": 0.9777,
1790
+ "step": 2970
1791
+ },
1792
+ {
1793
+ "epoch": 0.62,
1794
+ "learning_rate": 6.8879364415638725e-06,
1795
+ "loss": 0.8964,
1796
+ "step": 2980
1797
+ },
1798
+ {
1799
+ "epoch": 0.62,
1800
+ "learning_rate": 6.8774827514112485e-06,
1801
+ "loss": 0.9382,
1802
+ "step": 2990
1803
+ },
1804
+ {
1805
+ "epoch": 0.63,
1806
+ "learning_rate": 6.8670290612586245e-06,
1807
+ "loss": 0.8833,
1808
+ "step": 3000
1809
+ },
1810
+ {
1811
+ "epoch": 0.63,
1812
+ "learning_rate": 6.856575371106001e-06,
1813
+ "loss": 0.8316,
1814
+ "step": 3010
1815
+ },
1816
+ {
1817
+ "epoch": 0.63,
1818
+ "learning_rate": 6.846121680953377e-06,
1819
+ "loss": 0.9556,
1820
+ "step": 3020
1821
+ },
1822
+ {
1823
+ "epoch": 0.63,
1824
+ "learning_rate": 6.8356679908007525e-06,
1825
+ "loss": 0.9029,
1826
+ "step": 3030
1827
+ },
1828
+ {
1829
+ "epoch": 0.64,
1830
+ "learning_rate": 6.825214300648129e-06,
1831
+ "loss": 0.9594,
1832
+ "step": 3040
1833
+ },
1834
+ {
1835
+ "epoch": 0.64,
1836
+ "learning_rate": 6.814760610495505e-06,
1837
+ "loss": 0.9346,
1838
+ "step": 3050
1839
+ },
1840
+ {
1841
+ "epoch": 0.64,
1842
+ "learning_rate": 6.804306920342881e-06,
1843
+ "loss": 0.8544,
1844
+ "step": 3060
1845
+ },
1846
+ {
1847
+ "epoch": 0.64,
1848
+ "learning_rate": 6.793853230190258e-06,
1849
+ "loss": 0.9281,
1850
+ "step": 3070
1851
+ },
1852
+ {
1853
+ "epoch": 0.64,
1854
+ "learning_rate": 6.783399540037634e-06,
1855
+ "loss": 0.8431,
1856
+ "step": 3080
1857
+ },
1858
+ {
1859
+ "epoch": 0.65,
1860
+ "learning_rate": 6.7729458498850094e-06,
1861
+ "loss": 0.8402,
1862
+ "step": 3090
1863
+ },
1864
+ {
1865
+ "epoch": 0.65,
1866
+ "learning_rate": 6.7624921597323854e-06,
1867
+ "loss": 0.8558,
1868
+ "step": 3100
1869
+ },
1870
+ {
1871
+ "epoch": 0.65,
1872
+ "learning_rate": 6.752038469579762e-06,
1873
+ "loss": 0.8985,
1874
+ "step": 3110
1875
+ },
1876
+ {
1877
+ "epoch": 0.65,
1878
+ "learning_rate": 6.741584779427138e-06,
1879
+ "loss": 0.8913,
1880
+ "step": 3120
1881
+ },
1882
+ {
1883
+ "epoch": 0.65,
1884
+ "learning_rate": 6.731131089274514e-06,
1885
+ "loss": 0.9463,
1886
+ "step": 3130
1887
+ },
1888
+ {
1889
+ "epoch": 0.66,
1890
+ "learning_rate": 6.720677399121891e-06,
1891
+ "loss": 0.9098,
1892
+ "step": 3140
1893
+ },
1894
+ {
1895
+ "epoch": 0.66,
1896
+ "learning_rate": 6.710223708969267e-06,
1897
+ "loss": 0.8892,
1898
+ "step": 3150
1899
+ },
1900
+ {
1901
+ "epoch": 0.66,
1902
+ "learning_rate": 6.699770018816642e-06,
1903
+ "loss": 0.9503,
1904
+ "step": 3160
1905
+ },
1906
+ {
1907
+ "epoch": 0.66,
1908
+ "learning_rate": 6.689316328664019e-06,
1909
+ "loss": 0.9012,
1910
+ "step": 3170
1911
+ },
1912
+ {
1913
+ "epoch": 0.66,
1914
+ "learning_rate": 6.678862638511395e-06,
1915
+ "loss": 0.922,
1916
+ "step": 3180
1917
+ },
1918
+ {
1919
+ "epoch": 0.67,
1920
+ "learning_rate": 6.668408948358771e-06,
1921
+ "loss": 0.8312,
1922
+ "step": 3190
1923
+ },
1924
+ {
1925
+ "epoch": 0.67,
1926
+ "learning_rate": 6.657955258206147e-06,
1927
+ "loss": 0.8729,
1928
+ "step": 3200
1929
+ },
1930
+ {
1931
+ "epoch": 0.67,
1932
+ "learning_rate": 6.647501568053524e-06,
1933
+ "loss": 0.9533,
1934
+ "step": 3210
1935
+ },
1936
+ {
1937
+ "epoch": 0.67,
1938
+ "learning_rate": 6.637047877900899e-06,
1939
+ "loss": 0.9126,
1940
+ "step": 3220
1941
+ },
1942
+ {
1943
+ "epoch": 0.68,
1944
+ "learning_rate": 6.626594187748275e-06,
1945
+ "loss": 0.9615,
1946
+ "step": 3230
1947
+ },
1948
+ {
1949
+ "epoch": 0.68,
1950
+ "learning_rate": 6.616140497595652e-06,
1951
+ "loss": 0.888,
1952
+ "step": 3240
1953
+ },
1954
+ {
1955
+ "epoch": 0.68,
1956
+ "learning_rate": 6.605686807443028e-06,
1957
+ "loss": 0.9598,
1958
+ "step": 3250
1959
+ },
1960
+ {
1961
+ "epoch": 0.68,
1962
+ "learning_rate": 6.595233117290404e-06,
1963
+ "loss": 0.9514,
1964
+ "step": 3260
1965
+ },
1966
+ {
1967
+ "epoch": 0.68,
1968
+ "learning_rate": 6.584779427137779e-06,
1969
+ "loss": 0.8736,
1970
+ "step": 3270
1971
+ },
1972
+ {
1973
+ "epoch": 0.69,
1974
+ "learning_rate": 6.574325736985156e-06,
1975
+ "loss": 0.8775,
1976
+ "step": 3280
1977
+ },
1978
+ {
1979
+ "epoch": 0.69,
1980
+ "learning_rate": 6.563872046832532e-06,
1981
+ "loss": 0.9449,
1982
+ "step": 3290
1983
+ },
1984
+ {
1985
+ "epoch": 0.69,
1986
+ "learning_rate": 6.553418356679908e-06,
1987
+ "loss": 0.8699,
1988
+ "step": 3300
1989
+ },
1990
+ {
1991
+ "epoch": 0.69,
1992
+ "learning_rate": 6.542964666527285e-06,
1993
+ "loss": 0.8853,
1994
+ "step": 3310
1995
+ },
1996
+ {
1997
+ "epoch": 0.69,
1998
+ "learning_rate": 6.532510976374661e-06,
1999
+ "loss": 0.9349,
2000
+ "step": 3320
2001
+ },
2002
+ {
2003
+ "epoch": 0.7,
2004
+ "learning_rate": 6.522057286222036e-06,
2005
+ "loss": 0.9356,
2006
+ "step": 3330
2007
+ },
2008
+ {
2009
+ "epoch": 0.7,
2010
+ "learning_rate": 6.511603596069414e-06,
2011
+ "loss": 0.9341,
2012
+ "step": 3340
2013
+ },
2014
+ {
2015
+ "epoch": 0.7,
2016
+ "learning_rate": 6.501149905916789e-06,
2017
+ "loss": 0.8925,
2018
+ "step": 3350
2019
+ },
2020
+ {
2021
+ "epoch": 0.7,
2022
+ "learning_rate": 6.490696215764165e-06,
2023
+ "loss": 0.8894,
2024
+ "step": 3360
2025
+ },
2026
+ {
2027
+ "epoch": 0.7,
2028
+ "learning_rate": 6.480242525611541e-06,
2029
+ "loss": 0.8947,
2030
+ "step": 3370
2031
+ },
2032
+ {
2033
+ "epoch": 0.71,
2034
+ "learning_rate": 6.469788835458918e-06,
2035
+ "loss": 0.8991,
2036
+ "step": 3380
2037
+ },
2038
+ {
2039
+ "epoch": 0.71,
2040
+ "learning_rate": 6.459335145306294e-06,
2041
+ "loss": 0.9011,
2042
+ "step": 3390
2043
+ },
2044
+ {
2045
+ "epoch": 0.71,
2046
+ "learning_rate": 6.448881455153669e-06,
2047
+ "loss": 0.8659,
2048
+ "step": 3400
2049
+ },
2050
+ {
2051
+ "epoch": 0.71,
2052
+ "learning_rate": 6.438427765001046e-06,
2053
+ "loss": 0.9192,
2054
+ "step": 3410
2055
+ },
2056
+ {
2057
+ "epoch": 0.71,
2058
+ "learning_rate": 6.427974074848422e-06,
2059
+ "loss": 0.9916,
2060
+ "step": 3420
2061
+ },
2062
+ {
2063
+ "epoch": 0.72,
2064
+ "learning_rate": 6.417520384695798e-06,
2065
+ "loss": 0.9284,
2066
+ "step": 3430
2067
+ },
2068
+ {
2069
+ "epoch": 0.72,
2070
+ "learning_rate": 6.407066694543175e-06,
2071
+ "loss": 0.8701,
2072
+ "step": 3440
2073
+ },
2074
+ {
2075
+ "epoch": 0.72,
2076
+ "learning_rate": 6.396613004390551e-06,
2077
+ "loss": 0.9108,
2078
+ "step": 3450
2079
+ },
2080
+ {
2081
+ "epoch": 0.72,
2082
+ "learning_rate": 6.386159314237926e-06,
2083
+ "loss": 0.9475,
2084
+ "step": 3460
2085
+ },
2086
+ {
2087
+ "epoch": 0.73,
2088
+ "learning_rate": 6.375705624085302e-06,
2089
+ "loss": 0.8547,
2090
+ "step": 3470
2091
+ },
2092
+ {
2093
+ "epoch": 0.73,
2094
+ "learning_rate": 6.365251933932679e-06,
2095
+ "loss": 0.9119,
2096
+ "step": 3480
2097
+ },
2098
+ {
2099
+ "epoch": 0.73,
2100
+ "learning_rate": 6.354798243780055e-06,
2101
+ "loss": 0.861,
2102
+ "step": 3490
2103
+ },
2104
+ {
2105
+ "epoch": 0.73,
2106
+ "learning_rate": 6.344344553627431e-06,
2107
+ "loss": 0.8882,
2108
+ "step": 3500
2109
+ },
2110
+ {
2111
+ "epoch": 0.73,
2112
+ "learning_rate": 6.333890863474808e-06,
2113
+ "loss": 0.8947,
2114
+ "step": 3510
2115
+ },
2116
+ {
2117
+ "epoch": 0.74,
2118
+ "learning_rate": 6.323437173322183e-06,
2119
+ "loss": 0.9661,
2120
+ "step": 3520
2121
+ },
2122
+ {
2123
+ "epoch": 0.74,
2124
+ "learning_rate": 6.312983483169559e-06,
2125
+ "loss": 0.914,
2126
+ "step": 3530
2127
+ },
2128
+ {
2129
+ "epoch": 0.74,
2130
+ "learning_rate": 6.302529793016936e-06,
2131
+ "loss": 0.8673,
2132
+ "step": 3540
2133
+ },
2134
+ {
2135
+ "epoch": 0.74,
2136
+ "learning_rate": 6.292076102864312e-06,
2137
+ "loss": 0.9488,
2138
+ "step": 3550
2139
+ },
2140
+ {
2141
+ "epoch": 0.74,
2142
+ "learning_rate": 6.281622412711688e-06,
2143
+ "loss": 0.9209,
2144
+ "step": 3560
2145
+ },
2146
+ {
2147
+ "epoch": 0.75,
2148
+ "learning_rate": 6.271168722559064e-06,
2149
+ "loss": 0.848,
2150
+ "step": 3570
2151
+ },
2152
+ {
2153
+ "epoch": 0.75,
2154
+ "learning_rate": 6.260715032406441e-06,
2155
+ "loss": 0.8185,
2156
+ "step": 3580
2157
+ },
2158
+ {
2159
+ "epoch": 0.75,
2160
+ "learning_rate": 6.250261342253816e-06,
2161
+ "loss": 0.9759,
2162
+ "step": 3590
2163
+ },
2164
+ {
2165
+ "epoch": 0.75,
2166
+ "learning_rate": 6.239807652101192e-06,
2167
+ "loss": 0.8938,
2168
+ "step": 3600
2169
+ },
2170
+ {
2171
+ "epoch": 0.75,
2172
+ "learning_rate": 6.229353961948569e-06,
2173
+ "loss": 0.9568,
2174
+ "step": 3610
2175
+ },
2176
+ {
2177
+ "epoch": 0.76,
2178
+ "learning_rate": 6.218900271795945e-06,
2179
+ "loss": 0.877,
2180
+ "step": 3620
2181
+ },
2182
+ {
2183
+ "epoch": 0.76,
2184
+ "learning_rate": 6.208446581643321e-06,
2185
+ "loss": 0.9064,
2186
+ "step": 3630
2187
+ },
2188
+ {
2189
+ "epoch": 0.76,
2190
+ "learning_rate": 6.1979928914906976e-06,
2191
+ "loss": 0.8697,
2192
+ "step": 3640
2193
+ },
2194
+ {
2195
+ "epoch": 0.76,
2196
+ "learning_rate": 6.187539201338073e-06,
2197
+ "loss": 0.9132,
2198
+ "step": 3650
2199
+ },
2200
+ {
2201
+ "epoch": 0.77,
2202
+ "learning_rate": 6.177085511185449e-06,
2203
+ "loss": 0.8063,
2204
+ "step": 3660
2205
+ },
2206
+ {
2207
+ "epoch": 0.77,
2208
+ "learning_rate": 6.166631821032825e-06,
2209
+ "loss": 0.9361,
2210
+ "step": 3670
2211
+ },
2212
+ {
2213
+ "epoch": 0.77,
2214
+ "learning_rate": 6.156178130880202e-06,
2215
+ "loss": 0.7849,
2216
+ "step": 3680
2217
+ },
2218
+ {
2219
+ "epoch": 0.77,
2220
+ "learning_rate": 6.145724440727578e-06,
2221
+ "loss": 0.9113,
2222
+ "step": 3690
2223
+ },
2224
+ {
2225
+ "epoch": 0.77,
2226
+ "learning_rate": 6.135270750574953e-06,
2227
+ "loss": 0.9431,
2228
+ "step": 3700
2229
+ },
2230
+ {
2231
+ "epoch": 0.78,
2232
+ "learning_rate": 6.12481706042233e-06,
2233
+ "loss": 0.8772,
2234
+ "step": 3710
2235
+ },
2236
+ {
2237
+ "epoch": 0.78,
2238
+ "learning_rate": 6.114363370269706e-06,
2239
+ "loss": 0.8491,
2240
+ "step": 3720
2241
+ },
2242
+ {
2243
+ "epoch": 0.78,
2244
+ "learning_rate": 6.103909680117082e-06,
2245
+ "loss": 0.9514,
2246
+ "step": 3730
2247
+ },
2248
+ {
2249
+ "epoch": 0.78,
2250
+ "learning_rate": 6.093455989964458e-06,
2251
+ "loss": 0.9193,
2252
+ "step": 3740
2253
+ },
2254
+ {
2255
+ "epoch": 0.78,
2256
+ "learning_rate": 6.0830022998118345e-06,
2257
+ "loss": 0.8388,
2258
+ "step": 3750
2259
+ },
2260
+ {
2261
+ "epoch": 0.79,
2262
+ "learning_rate": 6.0725486096592105e-06,
2263
+ "loss": 0.8309,
2264
+ "step": 3760
2265
+ },
2266
+ {
2267
+ "epoch": 0.79,
2268
+ "learning_rate": 6.062094919506586e-06,
2269
+ "loss": 0.8447,
2270
+ "step": 3770
2271
+ },
2272
+ {
2273
+ "epoch": 0.79,
2274
+ "learning_rate": 6.0516412293539625e-06,
2275
+ "loss": 0.8534,
2276
+ "step": 3780
2277
+ },
2278
+ {
2279
+ "epoch": 0.79,
2280
+ "learning_rate": 6.0411875392013385e-06,
2281
+ "loss": 0.8391,
2282
+ "step": 3790
2283
+ },
2284
+ {
2285
+ "epoch": 0.79,
2286
+ "learning_rate": 6.0307338490487145e-06,
2287
+ "loss": 0.8798,
2288
+ "step": 3800
2289
+ },
2290
+ {
2291
+ "epoch": 0.8,
2292
+ "learning_rate": 6.020280158896091e-06,
2293
+ "loss": 0.9287,
2294
+ "step": 3810
2295
+ },
2296
+ {
2297
+ "epoch": 0.8,
2298
+ "learning_rate": 6.009826468743467e-06,
2299
+ "loss": 0.8622,
2300
+ "step": 3820
2301
+ },
2302
+ {
2303
+ "epoch": 0.8,
2304
+ "learning_rate": 5.999372778590843e-06,
2305
+ "loss": 0.9576,
2306
+ "step": 3830
2307
+ },
2308
+ {
2309
+ "epoch": 0.8,
2310
+ "learning_rate": 5.988919088438219e-06,
2311
+ "loss": 0.8898,
2312
+ "step": 3840
2313
+ },
2314
+ {
2315
+ "epoch": 0.8,
2316
+ "learning_rate": 5.9784653982855954e-06,
2317
+ "loss": 0.918,
2318
+ "step": 3850
2319
+ },
2320
+ {
2321
+ "epoch": 0.81,
2322
+ "learning_rate": 5.9680117081329715e-06,
2323
+ "loss": 0.9338,
2324
+ "step": 3860
2325
+ },
2326
+ {
2327
+ "epoch": 0.81,
2328
+ "learning_rate": 5.9575580179803475e-06,
2329
+ "loss": 0.8506,
2330
+ "step": 3870
2331
+ },
2332
+ {
2333
+ "epoch": 0.81,
2334
+ "learning_rate": 5.947104327827724e-06,
2335
+ "loss": 0.8822,
2336
+ "step": 3880
2337
+ },
2338
+ {
2339
+ "epoch": 0.81,
2340
+ "learning_rate": 5.9366506376750995e-06,
2341
+ "loss": 0.8945,
2342
+ "step": 3890
2343
+ },
2344
+ {
2345
+ "epoch": 0.82,
2346
+ "learning_rate": 5.9261969475224755e-06,
2347
+ "loss": 0.8592,
2348
+ "step": 3900
2349
+ },
2350
+ {
2351
+ "epoch": 0.82,
2352
+ "learning_rate": 5.915743257369852e-06,
2353
+ "loss": 0.9177,
2354
+ "step": 3910
2355
+ },
2356
+ {
2357
+ "epoch": 0.82,
2358
+ "learning_rate": 5.905289567217228e-06,
2359
+ "loss": 0.9195,
2360
+ "step": 3920
2361
+ },
2362
+ {
2363
+ "epoch": 0.82,
2364
+ "learning_rate": 5.894835877064604e-06,
2365
+ "loss": 0.8741,
2366
+ "step": 3930
2367
+ },
2368
+ {
2369
+ "epoch": 0.82,
2370
+ "learning_rate": 5.8843821869119795e-06,
2371
+ "loss": 0.8836,
2372
+ "step": 3940
2373
+ },
2374
+ {
2375
+ "epoch": 0.83,
2376
+ "learning_rate": 5.873928496759357e-06,
2377
+ "loss": 0.8813,
2378
+ "step": 3950
2379
+ },
2380
+ {
2381
+ "epoch": 0.83,
2382
+ "learning_rate": 5.863474806606732e-06,
2383
+ "loss": 0.8993,
2384
+ "step": 3960
2385
+ },
2386
+ {
2387
+ "epoch": 0.83,
2388
+ "learning_rate": 5.853021116454108e-06,
2389
+ "loss": 0.9148,
2390
+ "step": 3970
2391
+ },
2392
+ {
2393
+ "epoch": 0.83,
2394
+ "learning_rate": 5.842567426301485e-06,
2395
+ "loss": 0.8566,
2396
+ "step": 3980
2397
+ },
2398
+ {
2399
+ "epoch": 0.83,
2400
+ "learning_rate": 5.832113736148861e-06,
2401
+ "loss": 0.9285,
2402
+ "step": 3990
2403
+ },
2404
+ {
2405
+ "epoch": 0.84,
2406
+ "learning_rate": 5.821660045996237e-06,
2407
+ "loss": 0.8902,
2408
+ "step": 4000
2409
+ },
2410
+ {
2411
+ "epoch": 0.84,
2412
+ "learning_rate": 5.811206355843614e-06,
2413
+ "loss": 0.8892,
2414
+ "step": 4010
2415
+ },
2416
+ {
2417
+ "epoch": 0.84,
2418
+ "learning_rate": 5.800752665690989e-06,
2419
+ "loss": 0.9198,
2420
+ "step": 4020
2421
+ },
2422
+ {
2423
+ "epoch": 0.84,
2424
+ "learning_rate": 5.790298975538365e-06,
2425
+ "loss": 0.8891,
2426
+ "step": 4030
2427
+ },
2428
+ {
2429
+ "epoch": 0.84,
2430
+ "learning_rate": 5.779845285385741e-06,
2431
+ "loss": 0.853,
2432
+ "step": 4040
2433
+ },
2434
+ {
2435
+ "epoch": 0.85,
2436
+ "learning_rate": 5.769391595233118e-06,
2437
+ "loss": 0.9333,
2438
+ "step": 4050
2439
+ },
2440
+ {
2441
+ "epoch": 0.85,
2442
+ "learning_rate": 5.758937905080494e-06,
2443
+ "loss": 0.9174,
2444
+ "step": 4060
2445
+ },
2446
+ {
2447
+ "epoch": 0.85,
2448
+ "learning_rate": 5.748484214927869e-06,
2449
+ "loss": 0.8924,
2450
+ "step": 4070
2451
+ },
2452
+ {
2453
+ "epoch": 0.85,
2454
+ "learning_rate": 5.738030524775246e-06,
2455
+ "loss": 0.8677,
2456
+ "step": 4080
2457
+ },
2458
+ {
2459
+ "epoch": 0.85,
2460
+ "learning_rate": 5.727576834622622e-06,
2461
+ "loss": 0.8614,
2462
+ "step": 4090
2463
+ },
2464
+ {
2465
+ "epoch": 0.86,
2466
+ "learning_rate": 5.717123144469998e-06,
2467
+ "loss": 0.9326,
2468
+ "step": 4100
2469
+ },
2470
+ {
2471
+ "epoch": 0.86,
2472
+ "learning_rate": 5.706669454317374e-06,
2473
+ "loss": 0.8554,
2474
+ "step": 4110
2475
+ },
2476
+ {
2477
+ "epoch": 0.86,
2478
+ "learning_rate": 5.696215764164751e-06,
2479
+ "loss": 0.8976,
2480
+ "step": 4120
2481
+ },
2482
+ {
2483
+ "epoch": 0.86,
2484
+ "learning_rate": 5.685762074012126e-06,
2485
+ "loss": 0.8818,
2486
+ "step": 4130
2487
+ },
2488
+ {
2489
+ "epoch": 0.87,
2490
+ "learning_rate": 5.675308383859502e-06,
2491
+ "loss": 0.9545,
2492
+ "step": 4140
2493
+ },
2494
+ {
2495
+ "epoch": 0.87,
2496
+ "learning_rate": 5.664854693706879e-06,
2497
+ "loss": 0.8384,
2498
+ "step": 4150
2499
+ },
2500
+ {
2501
+ "epoch": 0.87,
2502
+ "learning_rate": 5.654401003554255e-06,
2503
+ "loss": 0.8158,
2504
+ "step": 4160
2505
+ },
2506
+ {
2507
+ "epoch": 0.87,
2508
+ "learning_rate": 5.643947313401631e-06,
2509
+ "loss": 0.8621,
2510
+ "step": 4170
2511
+ },
2512
+ {
2513
+ "epoch": 0.87,
2514
+ "learning_rate": 5.633493623249008e-06,
2515
+ "loss": 0.8706,
2516
+ "step": 4180
2517
+ },
2518
+ {
2519
+ "epoch": 0.88,
2520
+ "learning_rate": 5.623039933096384e-06,
2521
+ "loss": 0.8428,
2522
+ "step": 4190
2523
+ },
2524
+ {
2525
+ "epoch": 0.88,
2526
+ "learning_rate": 5.612586242943759e-06,
2527
+ "loss": 0.9087,
2528
+ "step": 4200
2529
+ },
2530
+ {
2531
+ "epoch": 0.88,
2532
+ "learning_rate": 5.602132552791135e-06,
2533
+ "loss": 0.8231,
2534
+ "step": 4210
2535
+ },
2536
+ {
2537
+ "epoch": 0.88,
2538
+ "learning_rate": 5.591678862638512e-06,
2539
+ "loss": 0.8731,
2540
+ "step": 4220
2541
+ },
2542
+ {
2543
+ "epoch": 0.88,
2544
+ "learning_rate": 5.581225172485888e-06,
2545
+ "loss": 0.9065,
2546
+ "step": 4230
2547
+ },
2548
+ {
2549
+ "epoch": 0.89,
2550
+ "learning_rate": 5.570771482333264e-06,
2551
+ "loss": 0.9498,
2552
+ "step": 4240
2553
+ },
2554
+ {
2555
+ "epoch": 0.89,
2556
+ "learning_rate": 5.560317792180641e-06,
2557
+ "loss": 0.904,
2558
+ "step": 4250
2559
+ },
2560
+ {
2561
+ "epoch": 0.89,
2562
+ "learning_rate": 5.549864102028016e-06,
2563
+ "loss": 0.8868,
2564
+ "step": 4260
2565
+ },
2566
+ {
2567
+ "epoch": 0.89,
2568
+ "learning_rate": 5.539410411875392e-06,
2569
+ "loss": 0.8935,
2570
+ "step": 4270
2571
+ },
2572
+ {
2573
+ "epoch": 0.89,
2574
+ "learning_rate": 5.528956721722769e-06,
2575
+ "loss": 0.9195,
2576
+ "step": 4280
2577
+ },
2578
+ {
2579
+ "epoch": 0.9,
2580
+ "learning_rate": 5.518503031570145e-06,
2581
+ "loss": 0.8788,
2582
+ "step": 4290
2583
+ },
2584
+ {
2585
+ "epoch": 0.9,
2586
+ "learning_rate": 5.508049341417521e-06,
2587
+ "loss": 0.8446,
2588
+ "step": 4300
2589
+ },
2590
+ {
2591
+ "epoch": 0.9,
2592
+ "learning_rate": 5.497595651264896e-06,
2593
+ "loss": 0.8088,
2594
+ "step": 4310
2595
+ },
2596
+ {
2597
+ "epoch": 0.9,
2598
+ "learning_rate": 5.487141961112273e-06,
2599
+ "loss": 0.8634,
2600
+ "step": 4320
2601
+ },
2602
+ {
2603
+ "epoch": 0.91,
2604
+ "learning_rate": 5.476688270959649e-06,
2605
+ "loss": 0.9249,
2606
+ "step": 4330
2607
+ },
2608
+ {
2609
+ "epoch": 0.91,
2610
+ "learning_rate": 5.466234580807025e-06,
2611
+ "loss": 0.8693,
2612
+ "step": 4340
2613
+ },
2614
+ {
2615
+ "epoch": 0.91,
2616
+ "learning_rate": 5.455780890654402e-06,
2617
+ "loss": 0.9334,
2618
+ "step": 4350
2619
+ },
2620
+ {
2621
+ "epoch": 0.91,
2622
+ "learning_rate": 5.445327200501778e-06,
2623
+ "loss": 0.869,
2624
+ "step": 4360
2625
+ },
2626
+ {
2627
+ "epoch": 0.91,
2628
+ "learning_rate": 5.434873510349154e-06,
2629
+ "loss": 0.9951,
2630
+ "step": 4370
2631
+ },
2632
+ {
2633
+ "epoch": 0.92,
2634
+ "learning_rate": 5.424419820196531e-06,
2635
+ "loss": 0.8824,
2636
+ "step": 4380
2637
+ },
2638
+ {
2639
+ "epoch": 0.92,
2640
+ "learning_rate": 5.413966130043906e-06,
2641
+ "loss": 0.9051,
2642
+ "step": 4390
2643
+ },
2644
+ {
2645
+ "epoch": 0.92,
2646
+ "learning_rate": 5.403512439891282e-06,
2647
+ "loss": 0.9867,
2648
+ "step": 4400
2649
+ },
2650
+ {
2651
+ "epoch": 0.92,
2652
+ "learning_rate": 5.393058749738658e-06,
2653
+ "loss": 0.9016,
2654
+ "step": 4410
2655
+ },
2656
+ {
2657
+ "epoch": 0.92,
2658
+ "learning_rate": 5.382605059586035e-06,
2659
+ "loss": 0.8548,
2660
+ "step": 4420
2661
+ },
2662
+ {
2663
+ "epoch": 0.93,
2664
+ "learning_rate": 5.372151369433411e-06,
2665
+ "loss": 0.8845,
2666
+ "step": 4430
2667
+ },
2668
+ {
2669
+ "epoch": 0.93,
2670
+ "learning_rate": 5.361697679280786e-06,
2671
+ "loss": 0.8756,
2672
+ "step": 4440
2673
+ },
2674
+ {
2675
+ "epoch": 0.93,
2676
+ "learning_rate": 5.351243989128163e-06,
2677
+ "loss": 0.8726,
2678
+ "step": 4450
2679
+ },
2680
+ {
2681
+ "epoch": 0.93,
2682
+ "learning_rate": 5.340790298975539e-06,
2683
+ "loss": 0.8493,
2684
+ "step": 4460
2685
+ },
2686
+ {
2687
+ "epoch": 0.93,
2688
+ "learning_rate": 5.330336608822915e-06,
2689
+ "loss": 0.7948,
2690
+ "step": 4470
2691
+ },
2692
+ {
2693
+ "epoch": 0.94,
2694
+ "learning_rate": 5.319882918670291e-06,
2695
+ "loss": 0.8606,
2696
+ "step": 4480
2697
+ },
2698
+ {
2699
+ "epoch": 0.94,
2700
+ "learning_rate": 5.309429228517668e-06,
2701
+ "loss": 0.8924,
2702
+ "step": 4490
2703
+ },
2704
+ {
2705
+ "epoch": 0.94,
2706
+ "learning_rate": 5.298975538365043e-06,
2707
+ "loss": 0.9294,
2708
+ "step": 4500
2709
+ },
2710
+ {
2711
+ "epoch": 0.94,
2712
+ "learning_rate": 5.288521848212419e-06,
2713
+ "loss": 0.9276,
2714
+ "step": 4510
2715
+ },
2716
+ {
2717
+ "epoch": 0.94,
2718
+ "learning_rate": 5.278068158059796e-06,
2719
+ "loss": 0.8315,
2720
+ "step": 4520
2721
+ },
2722
+ {
2723
+ "epoch": 0.95,
2724
+ "learning_rate": 5.267614467907172e-06,
2725
+ "loss": 0.8768,
2726
+ "step": 4530
2727
+ },
2728
+ {
2729
+ "epoch": 0.95,
2730
+ "learning_rate": 5.257160777754548e-06,
2731
+ "loss": 0.8714,
2732
+ "step": 4540
2733
+ },
2734
+ {
2735
+ "epoch": 0.95,
2736
+ "learning_rate": 5.2467070876019246e-06,
2737
+ "loss": 0.9204,
2738
+ "step": 4550
2739
+ },
2740
+ {
2741
+ "epoch": 0.95,
2742
+ "learning_rate": 5.2362533974493006e-06,
2743
+ "loss": 0.8387,
2744
+ "step": 4560
2745
+ },
2746
+ {
2747
+ "epoch": 0.96,
2748
+ "learning_rate": 5.225799707296676e-06,
2749
+ "loss": 0.908,
2750
+ "step": 4570
2751
+ },
2752
+ {
2753
+ "epoch": 0.96,
2754
+ "learning_rate": 5.215346017144052e-06,
2755
+ "loss": 0.9011,
2756
+ "step": 4580
2757
+ },
2758
+ {
2759
+ "epoch": 0.96,
2760
+ "learning_rate": 5.204892326991429e-06,
2761
+ "loss": 0.891,
2762
+ "step": 4590
2763
+ },
2764
+ {
2765
+ "epoch": 0.96,
2766
+ "learning_rate": 5.194438636838805e-06,
2767
+ "loss": 0.8301,
2768
+ "step": 4600
2769
+ },
2770
+ {
2771
+ "epoch": 0.96,
2772
+ "learning_rate": 5.183984946686181e-06,
2773
+ "loss": 0.9309,
2774
+ "step": 4610
2775
+ },
2776
+ {
2777
+ "epoch": 0.97,
2778
+ "learning_rate": 5.1735312565335575e-06,
2779
+ "loss": 0.9124,
2780
+ "step": 4620
2781
+ },
2782
+ {
2783
+ "epoch": 0.97,
2784
+ "learning_rate": 5.163077566380933e-06,
2785
+ "loss": 0.7651,
2786
+ "step": 4630
2787
+ },
2788
+ {
2789
+ "epoch": 0.97,
2790
+ "learning_rate": 5.152623876228309e-06,
2791
+ "loss": 0.8533,
2792
+ "step": 4640
2793
+ },
2794
+ {
2795
+ "epoch": 0.97,
2796
+ "learning_rate": 5.1421701860756855e-06,
2797
+ "loss": 0.9362,
2798
+ "step": 4650
2799
+ },
2800
+ {
2801
+ "epoch": 0.97,
2802
+ "learning_rate": 5.1317164959230615e-06,
2803
+ "loss": 0.9113,
2804
+ "step": 4660
2805
+ },
2806
+ {
2807
+ "epoch": 0.98,
2808
+ "learning_rate": 5.1212628057704375e-06,
2809
+ "loss": 0.8711,
2810
+ "step": 4670
2811
+ },
2812
+ {
2813
+ "epoch": 0.98,
2814
+ "learning_rate": 5.110809115617813e-06,
2815
+ "loss": 0.8862,
2816
+ "step": 4680
2817
+ },
2818
+ {
2819
+ "epoch": 0.98,
2820
+ "learning_rate": 5.1003554254651895e-06,
2821
+ "loss": 0.8542,
2822
+ "step": 4690
2823
+ },
2824
+ {
2825
+ "epoch": 0.98,
2826
+ "learning_rate": 5.0899017353125655e-06,
2827
+ "loss": 0.8945,
2828
+ "step": 4700
2829
+ },
2830
+ {
2831
+ "epoch": 0.98,
2832
+ "learning_rate": 5.0794480451599416e-06,
2833
+ "loss": 0.8488,
2834
+ "step": 4710
2835
+ },
2836
+ {
2837
+ "epoch": 0.99,
2838
+ "learning_rate": 5.068994355007318e-06,
2839
+ "loss": 0.9322,
2840
+ "step": 4720
2841
+ },
2842
+ {
2843
+ "epoch": 0.99,
2844
+ "learning_rate": 5.058540664854694e-06,
2845
+ "loss": 0.8453,
2846
+ "step": 4730
2847
+ },
2848
+ {
2849
+ "epoch": 0.99,
2850
+ "learning_rate": 5.04808697470207e-06,
2851
+ "loss": 0.8598,
2852
+ "step": 4740
2853
+ },
2854
+ {
2855
+ "epoch": 0.99,
2856
+ "learning_rate": 5.037633284549447e-06,
2857
+ "loss": 0.9067,
2858
+ "step": 4750
2859
+ },
2860
+ {
2861
+ "epoch": 0.99,
2862
+ "learning_rate": 5.0271795943968224e-06,
2863
+ "loss": 0.879,
2864
+ "step": 4760
2865
+ },
2866
+ {
2867
+ "epoch": 1.0,
2868
+ "learning_rate": 5.0167259042441985e-06,
2869
+ "loss": 0.8492,
2870
+ "step": 4770
2871
+ },
2872
+ {
2873
+ "epoch": 1.0,
2874
+ "learning_rate": 5.0062722140915745e-06,
2875
+ "loss": 0.9149,
2876
+ "step": 4780
2877
+ },
2878
+ {
2879
+ "epoch": 1.0,
2880
+ "learning_rate": 4.9958185239389505e-06,
2881
+ "loss": 0.774,
2882
+ "step": 4790
2883
+ },
2884
+ {
2885
+ "epoch": 1.0,
2886
+ "learning_rate": 4.985364833786327e-06,
2887
+ "loss": 0.6481,
2888
+ "step": 4800
2889
+ },
2890
+ {
2891
+ "epoch": 1.01,
2892
+ "learning_rate": 4.974911143633703e-06,
2893
+ "loss": 0.6638,
2894
+ "step": 4810
2895
+ },
2896
+ {
2897
+ "epoch": 1.01,
2898
+ "learning_rate": 4.964457453481079e-06,
2899
+ "loss": 0.6349,
2900
+ "step": 4820
2901
+ },
2902
+ {
2903
+ "epoch": 1.01,
2904
+ "learning_rate": 4.954003763328455e-06,
2905
+ "loss": 0.6898,
2906
+ "step": 4830
2907
+ },
2908
+ {
2909
+ "epoch": 1.01,
2910
+ "learning_rate": 4.943550073175831e-06,
2911
+ "loss": 0.6785,
2912
+ "step": 4840
2913
+ },
2914
+ {
2915
+ "epoch": 1.01,
2916
+ "learning_rate": 4.933096383023207e-06,
2917
+ "loss": 0.6888,
2918
+ "step": 4850
2919
+ },
2920
+ {
2921
+ "epoch": 1.02,
2922
+ "learning_rate": 4.922642692870584e-06,
2923
+ "loss": 0.706,
2924
+ "step": 4860
2925
+ },
2926
+ {
2927
+ "epoch": 1.02,
2928
+ "learning_rate": 4.912189002717959e-06,
2929
+ "loss": 0.6787,
2930
+ "step": 4870
2931
+ },
2932
+ {
2933
+ "epoch": 1.02,
2934
+ "learning_rate": 4.901735312565336e-06,
2935
+ "loss": 0.6352,
2936
+ "step": 4880
2937
+ },
2938
+ {
2939
+ "epoch": 1.02,
2940
+ "learning_rate": 4.891281622412712e-06,
2941
+ "loss": 0.7415,
2942
+ "step": 4890
2943
+ },
2944
+ {
2945
+ "epoch": 1.02,
2946
+ "learning_rate": 4.880827932260088e-06,
2947
+ "loss": 0.6576,
2948
+ "step": 4900
2949
+ },
2950
+ {
2951
+ "epoch": 1.03,
2952
+ "learning_rate": 4.870374242107464e-06,
2953
+ "loss": 0.7198,
2954
+ "step": 4910
2955
+ },
2956
+ {
2957
+ "epoch": 1.03,
2958
+ "learning_rate": 4.85992055195484e-06,
2959
+ "loss": 0.6811,
2960
+ "step": 4920
2961
+ },
2962
+ {
2963
+ "epoch": 1.03,
2964
+ "learning_rate": 4.849466861802216e-06,
2965
+ "loss": 0.6682,
2966
+ "step": 4930
2967
+ },
2968
+ {
2969
+ "epoch": 1.03,
2970
+ "learning_rate": 4.839013171649592e-06,
2971
+ "loss": 0.69,
2972
+ "step": 4940
2973
+ },
2974
+ {
2975
+ "epoch": 1.03,
2976
+ "learning_rate": 4.828559481496969e-06,
2977
+ "loss": 0.6408,
2978
+ "step": 4950
2979
+ },
2980
+ {
2981
+ "epoch": 1.04,
2982
+ "learning_rate": 4.818105791344345e-06,
2983
+ "loss": 0.6992,
2984
+ "step": 4960
2985
+ },
2986
+ {
2987
+ "epoch": 1.04,
2988
+ "learning_rate": 4.807652101191721e-06,
2989
+ "loss": 0.675,
2990
+ "step": 4970
2991
+ },
2992
+ {
2993
+ "epoch": 1.04,
2994
+ "learning_rate": 4.797198411039097e-06,
2995
+ "loss": 0.5974,
2996
+ "step": 4980
2997
+ },
2998
+ {
2999
+ "epoch": 1.04,
3000
+ "learning_rate": 4.786744720886473e-06,
3001
+ "loss": 0.7038,
3002
+ "step": 4990
3003
+ },
3004
+ {
3005
+ "epoch": 1.05,
3006
+ "learning_rate": 4.776291030733849e-06,
3007
+ "loss": 0.7172,
3008
+ "step": 5000
3009
+ }
3010
+ ],
3011
+ "max_steps": 9568,
3012
+ "num_train_epochs": 2,
3013
+ "total_flos": 691733423194112.0,
3014
+ "trial_name": null,
3015
+ "trial_params": null
3016
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:42e72920fc6230c9609e6899fb91adb9b2e466b972f00304db12a1d82520fbd3
3
+ size 6395
zero_to_fp32.py ADDED
@@ -0,0 +1,587 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 1, 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_dict = torch.load(f, map_location=device)
147
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
148
+ # and also handle the case where it was already removed by another helper script
149
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
150
+ state_dicts.append(state_dict)
151
+
152
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
153
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
154
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
155
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
156
+
157
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
158
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
159
+ # use the max of the partition_count to get the dp world_size.
160
+
161
+ if type(world_size) is list:
162
+ world_size = max(world_size)
163
+
164
+ if world_size != total_files:
165
+ raise ValueError(
166
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
167
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
168
+ )
169
+
170
+ # the groups are named differently in each stage
171
+ if zero_stage <= 2:
172
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
173
+ elif zero_stage == 3:
174
+ fp32_groups_key = FP32_FLAT_GROUPS
175
+ else:
176
+ raise ValueError(f"unknown zero stage {zero_stage}")
177
+
178
+ if zero_stage <= 2:
179
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
180
+ elif zero_stage == 3:
181
+ # if there is more than one param group, there will be multiple flattened tensors - one
182
+ # flattened tensor per group - for simplicity merge them into a single tensor
183
+ #
184
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
185
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
186
+
187
+ fp32_flat_groups = [
188
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key], 0) for i in range(len(state_dicts))
189
+ ]
190
+
191
+ return zero_stage, world_size, fp32_flat_groups
192
+
193
+
194
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir):
195
+ """
196
+ Returns fp32 state_dict reconstructed from ds checkpoint
197
+
198
+ Args:
199
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
200
+
201
+ """
202
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
203
+
204
+ optim_files = get_optim_files(ds_checkpoint_dir)
205
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
206
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
207
+
208
+ model_files = get_model_state_files(ds_checkpoint_dir)
209
+
210
+ zero_model_states = parse_model_states(model_files)
211
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
212
+
213
+ if zero_stage <= 2:
214
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states)
215
+ elif zero_stage == 3:
216
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states)
217
+
218
+
219
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
220
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
221
+ return
222
+
223
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
224
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
225
+
226
+ if debug:
227
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
228
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
229
+
230
+ wanted_params = len(frozen_param_shapes)
231
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
232
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
233
+ print(f'Frozen params: Have {avail_numel} numels to process.')
234
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
235
+
236
+ total_params = 0
237
+ total_numel = 0
238
+ for name, shape in frozen_param_shapes.items():
239
+ total_params += 1
240
+ unpartitioned_numel = shape.numel()
241
+ total_numel += unpartitioned_numel
242
+
243
+ state_dict[name] = frozen_param_fragments[name]
244
+
245
+ if debug:
246
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
247
+
248
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
249
+
250
+
251
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
252
+ param_shapes = zero_model_states[0].param_shapes
253
+
254
+ # Reconstruction protocol:
255
+ #
256
+ # XXX: document this
257
+
258
+ if debug:
259
+ for i in range(world_size):
260
+ for j in range(len(fp32_flat_groups[0])):
261
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
262
+
263
+ # XXX: memory usage doubles here (zero2)
264
+ num_param_groups = len(fp32_flat_groups[0])
265
+ merged_single_partition_of_fp32_groups = []
266
+ for i in range(num_param_groups):
267
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
268
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
269
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
270
+ avail_numel = sum(
271
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
272
+
273
+ if debug:
274
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
275
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
276
+ # not asserting if there is a mismatch due to possible padding
277
+ print(f"Have {avail_numel} numels to process.")
278
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
279
+
280
+ # params
281
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
282
+ # out-of-core computing solution
283
+ total_numel = 0
284
+ total_params = 0
285
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
286
+ offset = 0
287
+ avail_numel = full_single_fp32_vector.numel()
288
+ for name, shape in shapes.items():
289
+
290
+ unpartitioned_numel = shape.numel()
291
+ total_numel += unpartitioned_numel
292
+ total_params += 1
293
+
294
+ if debug:
295
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
296
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
297
+ offset += unpartitioned_numel
298
+
299
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
300
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
301
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
302
+ # live optimizer object, so we are checking that the numbers are within the right range
303
+ align_to = 2 * world_size
304
+
305
+ def zero2_align(x):
306
+ return align_to * math.ceil(x / align_to)
307
+
308
+ if debug:
309
+ print(f"original offset={offset}, avail_numel={avail_numel}")
310
+
311
+ offset = zero2_align(offset)
312
+ avail_numel = zero2_align(avail_numel)
313
+
314
+ if debug:
315
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
316
+
317
+ # Sanity check
318
+ if offset != avail_numel:
319
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
320
+
321
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
322
+
323
+
324
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states):
325
+ state_dict = OrderedDict()
326
+
327
+ # buffers
328
+ buffers = zero_model_states[0].buffers
329
+ state_dict.update(buffers)
330
+ if debug:
331
+ print(f"added {len(buffers)} buffers")
332
+
333
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
334
+
335
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
336
+
337
+ # recover shared parameters
338
+ for pair in zero_model_states[0].shared_params:
339
+ if pair[1] in state_dict:
340
+ state_dict[pair[0]] = state_dict[pair[1]]
341
+
342
+ return state_dict
343
+
344
+
345
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
346
+ remainder = unpartitioned_numel % world_size
347
+ padding_numel = (world_size - remainder) if remainder else 0
348
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
349
+ return partitioned_numel, padding_numel
350
+
351
+
352
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
353
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
354
+ return
355
+
356
+ if debug:
357
+ for i in range(world_size):
358
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
359
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
360
+
361
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
362
+ wanted_params = len(frozen_param_shapes)
363
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
364
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
365
+ print(f'Frozen params: Have {avail_numel} numels to process.')
366
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
367
+
368
+ total_params = 0
369
+ total_numel = 0
370
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
371
+ total_params += 1
372
+ unpartitioned_numel = shape.numel()
373
+ total_numel += unpartitioned_numel
374
+
375
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
376
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
377
+
378
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
379
+
380
+ if debug:
381
+ print(
382
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
383
+ )
384
+
385
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
386
+
387
+
388
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
389
+ param_shapes = zero_model_states[0].param_shapes
390
+ avail_numel = fp32_flat_groups[0].numel() * world_size
391
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
392
+ # param, re-consolidating each param, while dealing with padding if any
393
+
394
+ # merge list of dicts, preserving order
395
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
396
+
397
+ if debug:
398
+ for i in range(world_size):
399
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
400
+
401
+ wanted_params = len(param_shapes)
402
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
403
+ # not asserting if there is a mismatch due to possible padding
404
+ avail_numel = fp32_flat_groups[0].numel() * world_size
405
+ print(f"Trainable params: Have {avail_numel} numels to process.")
406
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
407
+
408
+ # params
409
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
410
+ # out-of-core computing solution
411
+ offset = 0
412
+ total_numel = 0
413
+ total_params = 0
414
+ for name, shape in param_shapes.items():
415
+
416
+ unpartitioned_numel = shape.numel()
417
+ total_numel += unpartitioned_numel
418
+ total_params += 1
419
+
420
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
421
+
422
+ if debug:
423
+ print(
424
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
425
+ )
426
+
427
+ # XXX: memory usage doubles here
428
+ state_dict[name] = torch.cat(
429
+ tuple(fp32_flat_groups[i].narrow(0, offset, partitioned_numel) for i in range(world_size)),
430
+ 0).narrow(0, 0, unpartitioned_numel).view(shape)
431
+ offset += partitioned_numel
432
+
433
+ offset *= world_size
434
+
435
+ # Sanity check
436
+ if offset != avail_numel:
437
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
438
+
439
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
440
+
441
+
442
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states):
443
+ state_dict = OrderedDict()
444
+
445
+ # buffers
446
+ buffers = zero_model_states[0].buffers
447
+ state_dict.update(buffers)
448
+ if debug:
449
+ print(f"added {len(buffers)} buffers")
450
+
451
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
452
+
453
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
454
+
455
+ # recover shared parameters
456
+ for pair in zero_model_states[0].shared_params:
457
+ if pair[1] in state_dict:
458
+ state_dict[pair[0]] = state_dict[pair[1]]
459
+
460
+ return state_dict
461
+
462
+
463
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None):
464
+ """
465
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
466
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
467
+ via a model hub.
468
+
469
+ Args:
470
+ - ``checkpoint_dir``: path to the desired checkpoint folder
471
+ - ``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``
472
+
473
+ Returns:
474
+ - pytorch ``state_dict``
475
+
476
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
477
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
478
+ the checkpoint.
479
+
480
+ A typical usage might be ::
481
+
482
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
483
+ # do the training and checkpoint saving
484
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
485
+ model = model.cpu() # move to cpu
486
+ model.load_state_dict(state_dict)
487
+ # submit to model hub or save the model to share with others
488
+
489
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
490
+ application. i.e. you will need to re-initialize the deepspeed engine, since
491
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
492
+
493
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
494
+
495
+ """
496
+ if tag is None:
497
+ latest_path = os.path.join(checkpoint_dir, 'latest')
498
+ if os.path.isfile(latest_path):
499
+ with open(latest_path, 'r') as fd:
500
+ tag = fd.read().strip()
501
+ else:
502
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
503
+
504
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
505
+
506
+ if not os.path.isdir(ds_checkpoint_dir):
507
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
508
+
509
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir)
510
+
511
+
512
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None):
513
+ """
514
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
515
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
516
+
517
+ Args:
518
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
519
+ - ``output_file``: path to the pytorch fp32 state_dict output file (e.g. path/pytorch_model.bin)
520
+ - ``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``
521
+ """
522
+
523
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
524
+ print(f"Saving fp32 state dict to {output_file}")
525
+ torch.save(state_dict, output_file)
526
+
527
+
528
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
529
+ """
530
+ 1. Put the provided model to cpu
531
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
532
+ 3. Load it into the provided model
533
+
534
+ Args:
535
+ - ``model``: the model object to update
536
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
537
+ - ``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``
538
+
539
+ Returns:
540
+ - ``model`: modified model
541
+
542
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
543
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
544
+ conveniently placed for you in the checkpoint folder.
545
+
546
+ A typical usage might be ::
547
+
548
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
549
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
550
+ # submit to model hub or save the model to share with others
551
+
552
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
553
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
554
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
555
+
556
+ """
557
+ logger.info(f"Extracting fp32 weights")
558
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
559
+
560
+ logger.info(f"Overwriting model with fp32 weights")
561
+ model = model.cpu()
562
+ model.load_state_dict(state_dict, strict=False)
563
+
564
+ return model
565
+
566
+
567
+ if __name__ == "__main__":
568
+
569
+ parser = argparse.ArgumentParser()
570
+ parser.add_argument("checkpoint_dir",
571
+ type=str,
572
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
573
+ parser.add_argument(
574
+ "output_file",
575
+ type=str,
576
+ help="path to the pytorch fp32 state_dict output file (e.g. path/checkpoint-12/pytorch_model.bin)")
577
+ parser.add_argument("-t",
578
+ "--tag",
579
+ type=str,
580
+ default=None,
581
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
582
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
583
+ args = parser.parse_args()
584
+
585
+ debug = args.debug
586
+
587
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir, args.output_file, tag=args.tag)