update
Browse files- config.json +42 -0
- configuration_qwen.py +71 -0
- cpp_kernels.py +55 -0
- generation_config.json +15 -0
- modeling_qwen.py +1363 -0
- pytorch_model.bin.index.json +330 -0
- qwen.tiktoken +0 -0
- qwen_generation_utils.py +416 -0
- special_tokens_map.json +3 -0
- tokenization_qwen.py +276 -0
- tokenizer_config.json +12 -0
- trainer_state.json +4597 -0
- training_args.bin +3 -0
- zero_to_fp32.py +587 -0
config.json
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "../educhat_qwen_base/checkpoint-18480",
|
3 |
+
"architectures": [
|
4 |
+
"QWenLMHeadModel"
|
5 |
+
],
|
6 |
+
"attn_dropout_prob": 0.0,
|
7 |
+
"auto_map": {
|
8 |
+
"AutoConfig": "configuration_qwen.QWenConfig",
|
9 |
+
"AutoModelForCausalLM": "modeling_qwen.QWenLMHeadModel"
|
10 |
+
},
|
11 |
+
"bf16": true,
|
12 |
+
"emb_dropout_prob": 0.0,
|
13 |
+
"fp16": false,
|
14 |
+
"fp32": false,
|
15 |
+
"hidden_size": 5120,
|
16 |
+
"initializer_range": 0.02,
|
17 |
+
"intermediate_size": 27392,
|
18 |
+
"kv_channels": 128,
|
19 |
+
"layer_norm_epsilon": 1e-06,
|
20 |
+
"max_position_embeddings": 8192,
|
21 |
+
"model_type": "qwen",
|
22 |
+
"no_bias": true,
|
23 |
+
"num_attention_heads": 40,
|
24 |
+
"num_hidden_layers": 40,
|
25 |
+
"onnx_safe": null,
|
26 |
+
"rotary_emb_base": 10000,
|
27 |
+
"rotary_pct": 1.0,
|
28 |
+
"scale_attn_weights": true,
|
29 |
+
"seq_length": 2048,
|
30 |
+
"softmax_in_fp32": false,
|
31 |
+
"tie_word_embeddings": false,
|
32 |
+
"tokenizer_class": "QWenTokenizer",
|
33 |
+
"torch_dtype": "bfloat16",
|
34 |
+
"transformers_version": "4.32.0",
|
35 |
+
"use_cache": false,
|
36 |
+
"use_cache_kernel": false,
|
37 |
+
"use_cache_quantization": false,
|
38 |
+
"use_dynamic_ntk": true,
|
39 |
+
"use_flash_attn": true,
|
40 |
+
"use_logn_attn": true,
|
41 |
+
"vocab_size": 152064
|
42 |
+
}
|
configuration_qwen.py
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Alibaba Cloud.
|
2 |
+
#
|
3 |
+
# This source code is licensed under the license found in the
|
4 |
+
# LICENSE file in the root directory of this source tree.
|
5 |
+
|
6 |
+
from transformers import PretrainedConfig
|
7 |
+
|
8 |
+
|
9 |
+
class QWenConfig(PretrainedConfig):
|
10 |
+
model_type = "qwen"
|
11 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
12 |
+
|
13 |
+
def __init__(
|
14 |
+
self,
|
15 |
+
vocab_size=151936,
|
16 |
+
hidden_size=4096,
|
17 |
+
num_hidden_layers=32,
|
18 |
+
num_attention_heads=32,
|
19 |
+
emb_dropout_prob=0.0,
|
20 |
+
attn_dropout_prob=0.0,
|
21 |
+
layer_norm_epsilon=1e-6,
|
22 |
+
initializer_range=0.02,
|
23 |
+
max_position_embeddings=8192,
|
24 |
+
scale_attn_weights=True,
|
25 |
+
use_cache=True,
|
26 |
+
bf16=False,
|
27 |
+
fp16=False,
|
28 |
+
fp32=False,
|
29 |
+
kv_channels=128,
|
30 |
+
rotary_pct=1.0,
|
31 |
+
rotary_emb_base=10000,
|
32 |
+
use_dynamic_ntk=True,
|
33 |
+
use_logn_attn=True,
|
34 |
+
use_flash_attn="auto",
|
35 |
+
intermediate_size=22016,
|
36 |
+
no_bias=True,
|
37 |
+
tie_word_embeddings=False,
|
38 |
+
use_cache_quantization=False,
|
39 |
+
use_cache_kernel=False,
|
40 |
+
softmax_in_fp32=False,
|
41 |
+
**kwargs,
|
42 |
+
):
|
43 |
+
self.vocab_size = vocab_size
|
44 |
+
self.hidden_size = hidden_size
|
45 |
+
self.intermediate_size = intermediate_size
|
46 |
+
self.num_hidden_layers = num_hidden_layers
|
47 |
+
self.num_attention_heads = num_attention_heads
|
48 |
+
self.emb_dropout_prob = emb_dropout_prob
|
49 |
+
self.attn_dropout_prob = attn_dropout_prob
|
50 |
+
self.layer_norm_epsilon = layer_norm_epsilon
|
51 |
+
self.initializer_range = initializer_range
|
52 |
+
self.scale_attn_weights = scale_attn_weights
|
53 |
+
self.use_cache = use_cache
|
54 |
+
self.max_position_embeddings = max_position_embeddings
|
55 |
+
self.bf16 = bf16
|
56 |
+
self.fp16 = fp16
|
57 |
+
self.fp32 = fp32
|
58 |
+
self.kv_channels = kv_channels
|
59 |
+
self.rotary_pct = rotary_pct
|
60 |
+
self.rotary_emb_base = rotary_emb_base
|
61 |
+
self.use_dynamic_ntk = use_dynamic_ntk
|
62 |
+
self.use_logn_attn = use_logn_attn
|
63 |
+
self.use_flash_attn = use_flash_attn
|
64 |
+
self.no_bias = no_bias
|
65 |
+
self.use_cache_quantization = use_cache_quantization
|
66 |
+
self.use_cache_kernel = use_cache_kernel
|
67 |
+
self.softmax_in_fp32 = softmax_in_fp32
|
68 |
+
super().__init__(
|
69 |
+
tie_word_embeddings=tie_word_embeddings,
|
70 |
+
**kwargs
|
71 |
+
)
|
cpp_kernels.py
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from torch.utils import cpp_extension
|
2 |
+
import pathlib
|
3 |
+
import os
|
4 |
+
import subprocess
|
5 |
+
|
6 |
+
def _get_cuda_bare_metal_version(cuda_dir):
|
7 |
+
raw_output = subprocess.check_output([cuda_dir + "/bin/nvcc", "-V"],
|
8 |
+
universal_newlines=True)
|
9 |
+
output = raw_output.split()
|
10 |
+
release_idx = output.index("release") + 1
|
11 |
+
release = output[release_idx].split(".")
|
12 |
+
bare_metal_major = release[0]
|
13 |
+
bare_metal_minor = release[1][0]
|
14 |
+
|
15 |
+
return raw_output, bare_metal_major, bare_metal_minor
|
16 |
+
|
17 |
+
def _create_build_dir(buildpath):
|
18 |
+
try:
|
19 |
+
os.mkdir(buildpath)
|
20 |
+
except OSError:
|
21 |
+
if not os.path.isdir(buildpath):
|
22 |
+
print(f"Creation of the build directory {buildpath} failed")
|
23 |
+
|
24 |
+
# Check if cuda 11 is installed for compute capability 8.0
|
25 |
+
cc_flag = []
|
26 |
+
_, bare_metal_major, bare_metal_minor = _get_cuda_bare_metal_version(cpp_extension.CUDA_HOME)
|
27 |
+
if int(bare_metal_major) >= 11:
|
28 |
+
cc_flag.append('-gencode')
|
29 |
+
cc_flag.append('arch=compute_80,code=sm_80')
|
30 |
+
if int(bare_metal_minor) >= 7:
|
31 |
+
cc_flag.append('-gencode')
|
32 |
+
cc_flag.append('arch=compute_90,code=sm_90')
|
33 |
+
|
34 |
+
# Build path
|
35 |
+
srcpath = pathlib.Path(__file__).parent.absolute()
|
36 |
+
buildpath = srcpath / 'build'
|
37 |
+
_create_build_dir(buildpath)
|
38 |
+
|
39 |
+
def _cpp_extention_load_helper(name, sources, extra_cuda_flags):
|
40 |
+
return cpp_extension.load(
|
41 |
+
name=name,
|
42 |
+
sources=sources,
|
43 |
+
build_directory=buildpath,
|
44 |
+
extra_cflags=['-O3', ],
|
45 |
+
extra_cuda_cflags=['-O3',
|
46 |
+
'-gencode', 'arch=compute_70,code=sm_70',
|
47 |
+
'--use_fast_math'] + extra_cuda_flags + cc_flag,
|
48 |
+
verbose=1
|
49 |
+
)
|
50 |
+
|
51 |
+
extra_flags = []
|
52 |
+
|
53 |
+
cache_autogptq_cuda_256_sources = ["./cache_autogptq_cuda_256.cpp",
|
54 |
+
"./cache_autogptq_cuda_kernel_256.cu"]
|
55 |
+
cache_autogptq_cuda_256 = _cpp_extention_load_helper("cache_autogptq_cuda_256", cache_autogptq_cuda_256_sources, extra_flags)
|
generation_config.json
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"chat_format": "raw",
|
3 |
+
"do_sample": true,
|
4 |
+
"eos_token_id": 151643,
|
5 |
+
"max_new_tokens": 512,
|
6 |
+
"pad_token_id": 151643,
|
7 |
+
"stop_words_ids": [
|
8 |
+
[
|
9 |
+
151643
|
10 |
+
]
|
11 |
+
],
|
12 |
+
"top_k": 0,
|
13 |
+
"top_p": 0.8,
|
14 |
+
"transformers_version": "4.32.0"
|
15 |
+
}
|
modeling_qwen.py
ADDED
@@ -0,0 +1,1363 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Alibaba Cloud.
|
2 |
+
#
|
3 |
+
# This source code is licensed under the license found in the
|
4 |
+
# LICENSE file in the root directory of this source tree.
|
5 |
+
|
6 |
+
import copy
|
7 |
+
import importlib
|
8 |
+
import math
|
9 |
+
import pathlib
|
10 |
+
from typing import TYPE_CHECKING, Optional, Tuple, Union, Callable, List, Any, Generator
|
11 |
+
|
12 |
+
import torch
|
13 |
+
import torch.nn.functional as F
|
14 |
+
import torch.utils.checkpoint
|
15 |
+
import warnings
|
16 |
+
|
17 |
+
from torch.nn import CrossEntropyLoss
|
18 |
+
from transformers import PreTrainedTokenizer, GenerationConfig, StoppingCriteriaList
|
19 |
+
from transformers.generation.logits_process import LogitsProcessorList
|
20 |
+
|
21 |
+
if TYPE_CHECKING:
|
22 |
+
from transformers.generation.streamers import BaseStreamer
|
23 |
+
from transformers.generation.utils import GenerateOutput
|
24 |
+
from transformers.modeling_outputs import (
|
25 |
+
BaseModelOutputWithPast,
|
26 |
+
CausalLMOutputWithPast,
|
27 |
+
)
|
28 |
+
from transformers.modeling_utils import PreTrainedModel
|
29 |
+
from transformers.utils import logging
|
30 |
+
|
31 |
+
try:
|
32 |
+
from einops import rearrange
|
33 |
+
except ImportError:
|
34 |
+
rearrange = None
|
35 |
+
from torch import nn
|
36 |
+
|
37 |
+
SUPPORT_CUDA = torch.cuda.is_available()
|
38 |
+
SUPPORT_BF16 = SUPPORT_CUDA and torch.cuda.is_bf16_supported()
|
39 |
+
SUPPORT_FP16 = SUPPORT_CUDA and torch.cuda.get_device_capability(0)[0] >= 7
|
40 |
+
SUPPORT_TORCH2 = hasattr(torch, '__version__') and int(torch.__version__.split(".")[0]) >= 2
|
41 |
+
|
42 |
+
|
43 |
+
from .configuration_qwen import QWenConfig
|
44 |
+
from .qwen_generation_utils import (
|
45 |
+
HistoryType,
|
46 |
+
make_context,
|
47 |
+
decode_tokens,
|
48 |
+
get_stop_words_ids,
|
49 |
+
StopWordsLogitsProcessor,
|
50 |
+
)
|
51 |
+
|
52 |
+
|
53 |
+
logger = logging.get_logger(__name__)
|
54 |
+
|
55 |
+
_CHECKPOINT_FOR_DOC = "qwen"
|
56 |
+
_CONFIG_FOR_DOC = "QWenConfig"
|
57 |
+
|
58 |
+
QWen_PRETRAINED_MODEL_ARCHIVE_LIST = ["qwen-7b"]
|
59 |
+
|
60 |
+
_ERROR_BAD_CHAT_FORMAT = """\
|
61 |
+
We detect you are probably using the pretrained model (rather than chat model) for chatting, since the chat_format in generation_config is not "chatml".
|
62 |
+
If you are directly using the model downloaded from Huggingface, please make sure you are using our "Qwen/Qwen-7B-Chat" Huggingface model (rather than "Qwen/Qwen-7B") when you call model.chat().
|
63 |
+
我们检测到您可能在使用预训练模型(而非chat模型)进行多轮chat,因为您当前在generation_config指定的chat_format,并未设置为我们在对话中所支持的"chatml"格式。
|
64 |
+
如果您在直接使用我们从Huggingface提供的模型,请确保您在调用model.chat()时,使用的是"Qwen/Qwen-7B-Chat"模型(而非"Qwen/Qwen-7B"预训练模型)。
|
65 |
+
"""
|
66 |
+
|
67 |
+
_SENTINEL = object()
|
68 |
+
_ERROR_STREAM_IN_CHAT = """\
|
69 |
+
Pass argument `stream` to model.chat() is buggy, deprecated, and marked for removal. Please use model.chat_stream(...) instead of model.chat(..., stream=True).
|
70 |
+
向model.chat()传入参数stream的用法可能存在Bug,该用法已被废弃,将在未来被移除。请使用model.chat_stream(...)代替model.chat(..., stream=True)。
|
71 |
+
"""
|
72 |
+
|
73 |
+
_ERROR_INPUT_CPU_QUERY_WITH_FLASH_ATTN_ACTIVATED = """\
|
74 |
+
We detect you have activated flash attention support, but running model computation on CPU. Please make sure that your input data has been placed on GPU. If you actually want to run CPU computation, please following the readme and set device_map="cpu" to disable flash attention when loading the model (calling AutoModelForCausalLM.from_pretrained).
|
75 |
+
检测到您的模型已激活了flash attention支持,但正在执行CPU运算任务。如使用flash attention,请您确认模型输入已经传到GPU上。如果您确认要执行CPU运算,请您在载入模型(调用AutoModelForCausalLM.from_pretrained)时,按照readme说法,指定device_map="cpu"以禁用flash attention。
|
76 |
+
"""
|
77 |
+
|
78 |
+
apply_rotary_emb_func = None
|
79 |
+
rms_norm = None
|
80 |
+
flash_attn_unpadded_func = None
|
81 |
+
flash_attn_func = None
|
82 |
+
|
83 |
+
def _import_flash_attn():
|
84 |
+
global apply_rotary_emb_func, rms_norm, flash_attn_unpadded_func, flash_attn_func
|
85 |
+
try:
|
86 |
+
from flash_attn.layers.rotary import apply_rotary_emb_func as __apply_rotary_emb_func
|
87 |
+
apply_rotary_emb_func = __apply_rotary_emb_func
|
88 |
+
except ImportError:
|
89 |
+
logger.warn(
|
90 |
+
"Warning: import flash_attn rotary fail, please install FlashAttention rotary to get higher efficiency "
|
91 |
+
"https://github.com/Dao-AILab/flash-attention/tree/main/csrc/rotary"
|
92 |
+
)
|
93 |
+
|
94 |
+
try:
|
95 |
+
from flash_attn.ops.rms_norm import rms_norm as __rms_norm
|
96 |
+
rms_norm = __rms_norm
|
97 |
+
except ImportError:
|
98 |
+
logger.warn(
|
99 |
+
"Warning: import flash_attn rms_norm fail, please install FlashAttention layer_norm to get higher efficiency "
|
100 |
+
"https://github.com/Dao-AILab/flash-attention/tree/main/csrc/layer_norm"
|
101 |
+
)
|
102 |
+
|
103 |
+
try:
|
104 |
+
import flash_attn
|
105 |
+
_flash_attn_func = None
|
106 |
+
if not hasattr(flash_attn, '__version__'):
|
107 |
+
from flash_attn.flash_attn_interface import flash_attn_unpadded_func as __flash_attn_unpadded_func
|
108 |
+
else:
|
109 |
+
if int(flash_attn.__version__.split(".")[0]) >= 2:
|
110 |
+
if int(flash_attn.__version__.split(".")[1]) >= 1:
|
111 |
+
from flash_attn.flash_attn_interface import flash_attn_func as _flash_attn_func
|
112 |
+
from flash_attn.flash_attn_interface import flash_attn_varlen_func as __flash_attn_unpadded_func
|
113 |
+
else:
|
114 |
+
from flash_attn.flash_attn_interface import flash_attn_unpadded_func as __flash_attn_unpadded_func
|
115 |
+
flash_attn_unpadded_func = __flash_attn_unpadded_func
|
116 |
+
flash_attn_func = _flash_attn_func
|
117 |
+
except ImportError:
|
118 |
+
logger.warn(
|
119 |
+
"Warning: import flash_attn fail, please install FlashAttention to get higher efficiency "
|
120 |
+
"https://github.com/Dao-AILab/flash-attention"
|
121 |
+
)
|
122 |
+
|
123 |
+
def quantize_cache_v(fdata, bits, qmax, qmin):
|
124 |
+
# b, s, head, h-dim->b, head, s, h-dim
|
125 |
+
qtype = torch.uint8
|
126 |
+
device = fdata.device
|
127 |
+
shape = fdata.shape
|
128 |
+
|
129 |
+
fdata_cal = torch.flatten(fdata, 2)
|
130 |
+
fmax = torch.amax(fdata_cal, dim=-1, keepdim=True)
|
131 |
+
fmin = torch.amin(fdata_cal, dim=-1, keepdim=True)
|
132 |
+
# Compute params
|
133 |
+
if qmax.device != fmax.device:
|
134 |
+
qmax = qmax.to(device)
|
135 |
+
qmin = qmin.to(device)
|
136 |
+
scale = (fmax - fmin) / (qmax - qmin)
|
137 |
+
zero = qmin - fmin / scale
|
138 |
+
scale = scale.unsqueeze(-1).repeat(1,1,shape[2],1).contiguous()
|
139 |
+
zero = zero.unsqueeze(-1).repeat(1,1,shape[2],1).contiguous()
|
140 |
+
# Quantize
|
141 |
+
res_data = fdata / scale + zero
|
142 |
+
qdata = torch.clamp(res_data, qmin, qmax).to(qtype)
|
143 |
+
return qdata.contiguous(), scale, zero
|
144 |
+
|
145 |
+
def dequantize_cache_torch(qdata, scale, zero):
|
146 |
+
data = scale * (qdata - zero)
|
147 |
+
return data
|
148 |
+
|
149 |
+
class FlashSelfAttention(torch.nn.Module):
|
150 |
+
def __init__(
|
151 |
+
self,
|
152 |
+
causal=False,
|
153 |
+
softmax_scale=None,
|
154 |
+
attention_dropout=0.0,
|
155 |
+
):
|
156 |
+
super().__init__()
|
157 |
+
assert flash_attn_unpadded_func is not None, (
|
158 |
+
"Please install FlashAttention first, " "e.g., with pip install flash-attn"
|
159 |
+
)
|
160 |
+
assert (
|
161 |
+
rearrange is not None
|
162 |
+
), "Please install einops first, e.g., with pip install einops"
|
163 |
+
self.causal = causal
|
164 |
+
self.softmax_scale = softmax_scale
|
165 |
+
self.dropout_p = attention_dropout
|
166 |
+
|
167 |
+
def unpad_input(self, hidden_states, attention_mask):
|
168 |
+
valid_mask = attention_mask.squeeze(1).squeeze(1).eq(0)
|
169 |
+
seqlens_in_batch = valid_mask.sum(dim=-1, dtype=torch.int32)
|
170 |
+
indices = torch.nonzero(valid_mask.flatten(), as_tuple=False).flatten()
|
171 |
+
max_seqlen_in_batch = seqlens_in_batch.max().item()
|
172 |
+
cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.torch.int32), (1, 0))
|
173 |
+
hidden_states = hidden_states[indices]
|
174 |
+
return hidden_states, indices, cu_seqlens, max_seqlen_in_batch
|
175 |
+
|
176 |
+
def pad_input(self, hidden_states, indices, batch, seqlen):
|
177 |
+
output = torch.zeros(batch * seqlen, *hidden_states.shape[1:], device=hidden_states.device,
|
178 |
+
dtype=hidden_states.dtype)
|
179 |
+
output[indices] = hidden_states
|
180 |
+
return rearrange(output, '(b s) ... -> b s ...', b=batch)
|
181 |
+
|
182 |
+
def forward(self, q, k, v, attention_mask=None):
|
183 |
+
assert all((i.dtype in [torch.float16, torch.bfloat16] for i in (q, k, v)))
|
184 |
+
assert all((i.is_cuda for i in (q, k, v)))
|
185 |
+
batch_size, seqlen_q = q.shape[0], q.shape[1]
|
186 |
+
seqlen_k = k.shape[1]
|
187 |
+
seqlen_out = seqlen_q
|
188 |
+
|
189 |
+
if flash_attn_func is not None and batch_size == 1:
|
190 |
+
dropout_p = self.dropout_p if self.training else 0
|
191 |
+
output = flash_attn_func(q, k, v, dropout_p, softmax_scale=self.softmax_scale, causal=self.causal)
|
192 |
+
return output
|
193 |
+
|
194 |
+
q, k, v = [rearrange(x, "b s ... -> (b s) ...") for x in [q, k, v]]
|
195 |
+
cu_seqlens_q = torch.arange(
|
196 |
+
0,
|
197 |
+
(batch_size + 1) * seqlen_q,
|
198 |
+
step=seqlen_q,
|
199 |
+
dtype=torch.int32,
|
200 |
+
device=q.device,
|
201 |
+
)
|
202 |
+
|
203 |
+
if batch_size > 1 and attention_mask is not None:
|
204 |
+
k, indices_k, cu_seqlens_k, seqlen_k = self.unpad_input(k, attention_mask)
|
205 |
+
if q.size(0) == v.size(0):
|
206 |
+
q = q[indices_k]
|
207 |
+
cu_seqlens_q = cu_seqlens_k
|
208 |
+
seqlen_q = seqlen_k
|
209 |
+
v = v[indices_k]
|
210 |
+
else:
|
211 |
+
cu_seqlens_k = torch.arange(
|
212 |
+
0,
|
213 |
+
(batch_size + 1) * seqlen_k,
|
214 |
+
step=seqlen_k,
|
215 |
+
dtype=torch.int32,
|
216 |
+
device=q.device,
|
217 |
+
)
|
218 |
+
|
219 |
+
if self.training:
|
220 |
+
assert seqlen_k == seqlen_q
|
221 |
+
is_causal = self.causal
|
222 |
+
dropout_p = self.dropout_p
|
223 |
+
else:
|
224 |
+
is_causal = seqlen_q == seqlen_k
|
225 |
+
dropout_p = 0
|
226 |
+
|
227 |
+
output = flash_attn_unpadded_func(
|
228 |
+
q,
|
229 |
+
k,
|
230 |
+
v,
|
231 |
+
cu_seqlens_q,
|
232 |
+
cu_seqlens_k,
|
233 |
+
seqlen_q,
|
234 |
+
seqlen_k,
|
235 |
+
dropout_p,
|
236 |
+
softmax_scale=self.softmax_scale,
|
237 |
+
causal=is_causal,
|
238 |
+
)
|
239 |
+
if batch_size > 1 and attention_mask is not None and seqlen_q == seqlen_k:
|
240 |
+
output = self.pad_input(output, indices_k, batch_size, seqlen_out)
|
241 |
+
else:
|
242 |
+
new_shape = (batch_size, output.shape[0] // batch_size) + output.shape[1:]
|
243 |
+
output = output.view(new_shape)
|
244 |
+
return output
|
245 |
+
|
246 |
+
|
247 |
+
class QWenAttention(nn.Module):
|
248 |
+
def __init__(self, config):
|
249 |
+
super().__init__()
|
250 |
+
|
251 |
+
self.register_buffer("masked_bias", torch.tensor(-1e4), persistent=False)
|
252 |
+
self.seq_length = config.seq_length
|
253 |
+
|
254 |
+
self.hidden_size = config.hidden_size
|
255 |
+
self.split_size = config.hidden_size
|
256 |
+
self.num_heads = config.num_attention_heads
|
257 |
+
self.head_dim = self.hidden_size // self.num_heads
|
258 |
+
|
259 |
+
self.use_flash_attn = config.use_flash_attn
|
260 |
+
self.scale_attn_weights = True
|
261 |
+
|
262 |
+
self.projection_size = config.kv_channels * config.num_attention_heads
|
263 |
+
|
264 |
+
assert self.projection_size % config.num_attention_heads == 0
|
265 |
+
self.hidden_size_per_attention_head = (
|
266 |
+
self.projection_size // config.num_attention_heads
|
267 |
+
)
|
268 |
+
|
269 |
+
self.c_attn = nn.Linear(config.hidden_size, 3 * self.projection_size)
|
270 |
+
|
271 |
+
self.c_proj = nn.Linear(
|
272 |
+
config.hidden_size, self.projection_size, bias=not config.no_bias
|
273 |
+
)
|
274 |
+
|
275 |
+
self.is_fp32 = not (config.bf16 or config.fp16)
|
276 |
+
if (
|
277 |
+
self.use_flash_attn
|
278 |
+
and flash_attn_unpadded_func is not None
|
279 |
+
and not self.is_fp32
|
280 |
+
):
|
281 |
+
self.core_attention_flash = FlashSelfAttention(
|
282 |
+
causal=True, attention_dropout=config.attn_dropout_prob
|
283 |
+
)
|
284 |
+
self.bf16 = config.bf16
|
285 |
+
|
286 |
+
self.use_dynamic_ntk = config.use_dynamic_ntk
|
287 |
+
self.use_logn_attn = config.use_logn_attn
|
288 |
+
|
289 |
+
logn_list = [
|
290 |
+
math.log(i, self.seq_length) if i > self.seq_length else 1
|
291 |
+
for i in range(1, 32768)
|
292 |
+
]
|
293 |
+
logn_tensor = torch.tensor(logn_list)[None, :, None, None]
|
294 |
+
self.register_buffer("logn_tensor", logn_tensor, persistent=False)
|
295 |
+
|
296 |
+
self.attn_dropout = nn.Dropout(config.attn_dropout_prob)
|
297 |
+
self.softmax_in_fp32 = config.softmax_in_fp32 if hasattr(config, 'softmax_in_fp32') else False
|
298 |
+
self.use_cache_quantization = config.use_cache_quantization if hasattr(config, 'use_cache_quantization') else False
|
299 |
+
self.use_cache_kernel = config.use_cache_kernel if hasattr(config,'use_cache_kernel') else False
|
300 |
+
cache_dtype = torch.float
|
301 |
+
if self.bf16:
|
302 |
+
cache_dtype=torch.bfloat16
|
303 |
+
elif config.fp16:
|
304 |
+
cache_dtype = torch.float16
|
305 |
+
self.cache_qmax = torch.tensor(torch.iinfo(torch.uint8).max, dtype=cache_dtype)
|
306 |
+
self.cache_qmin = torch.tensor(torch.iinfo(torch.uint8).min, dtype=cache_dtype)
|
307 |
+
|
308 |
+
if config.use_cache_quantization and config.use_cache_kernel:
|
309 |
+
# pre check if the support files existing
|
310 |
+
module_root = pathlib.Path(__file__).parent
|
311 |
+
src_files = ("cache_autogptq_cuda_256.cpp", "cache_autogptq_cuda_kernel_256.cu")
|
312 |
+
if any(not (module_root/src).is_file() for src in src_files):
|
313 |
+
warnings.warn("KV cache kernel source files (.cpp and .cu) not found.")
|
314 |
+
self.cache_kernels = None
|
315 |
+
else:
|
316 |
+
try:
|
317 |
+
from .cpp_kernels import cache_autogptq_cuda_256
|
318 |
+
self.cache_kernels = cache_autogptq_cuda_256
|
319 |
+
except ImportError:
|
320 |
+
warnings.warn("Failed to import KV cache kernels.")
|
321 |
+
self.cache_kernels = None
|
322 |
+
|
323 |
+
def _attn(self, query, key, value, causal_mask=None, attention_mask=None, head_mask=None):
|
324 |
+
device = query.device
|
325 |
+
if self.use_cache_quantization:
|
326 |
+
qk, qk_scale, qk_zero = key
|
327 |
+
if self.use_cache_kernel and self.cache_kernels is not None:
|
328 |
+
shape = query.shape[:-1] + (qk.shape[-2],)
|
329 |
+
attn_weights = torch.zeros(shape, dtype=torch.float16, device=device)
|
330 |
+
self.cache_kernels.vecquant8matmul_batched_faster_old(
|
331 |
+
query.contiguous() if query.dtype == torch.float16 else query.to(torch.float16).contiguous(),
|
332 |
+
qk.transpose(-1, -2).contiguous(),
|
333 |
+
attn_weights,
|
334 |
+
qk_scale.contiguous() if qk_scale.dtype == torch.float16 else qk_scale.to(torch.float16).contiguous(),
|
335 |
+
qk_zero.contiguous()if qk_zero.dtype == torch.float16 else qk_zero.to(torch.float16).contiguous())
|
336 |
+
# attn_weights = attn_weights.to(query.dtype).contiguous()
|
337 |
+
else:
|
338 |
+
key = dequantize_cache_torch(qk, qk_scale, qk_zero)
|
339 |
+
attn_weights = torch.matmul(query, key.transpose(-1, -2))
|
340 |
+
else:
|
341 |
+
attn_weights = torch.matmul(query, key.transpose(-1, -2))
|
342 |
+
|
343 |
+
if self.scale_attn_weights:
|
344 |
+
if self.use_cache_quantization:
|
345 |
+
size_temp = value[0].size(-1)
|
346 |
+
else:
|
347 |
+
size_temp = value.size(-1)
|
348 |
+
attn_weights = attn_weights / (size_temp ** 0.5)
|
349 |
+
|
350 |
+
mask_value = torch.finfo(attn_weights.dtype).min
|
351 |
+
if causal_mask is not None:
|
352 |
+
attn_weights = torch.where(
|
353 |
+
causal_mask, attn_weights.to(attn_weights.dtype), mask_value
|
354 |
+
)
|
355 |
+
|
356 |
+
if attention_mask is not None:
|
357 |
+
attn_weights = attn_weights + attention_mask
|
358 |
+
|
359 |
+
if self.softmax_in_fp32:
|
360 |
+
attn_weights = nn.functional.softmax(attn_weights.float(), dim=-1)
|
361 |
+
else:
|
362 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1)
|
363 |
+
|
364 |
+
attn_weights = attn_weights.type(query.dtype)
|
365 |
+
attn_weights = self.attn_dropout(attn_weights)
|
366 |
+
|
367 |
+
if head_mask is not None:
|
368 |
+
attn_weights = attn_weights * head_mask
|
369 |
+
|
370 |
+
if self.use_cache_quantization:
|
371 |
+
qv, qv_scale, qv_zero = value
|
372 |
+
if self.use_cache_kernel and self.cache_kernels is not None:
|
373 |
+
shape = attn_weights.shape[:-1] + (query.shape[-1],)
|
374 |
+
attn_output = torch.zeros(shape, dtype=torch.float16, device=device)
|
375 |
+
self.cache_kernels.vecquant8matmul_batched_column_compression_faster_old(
|
376 |
+
attn_weights.contiguous() if attn_weights.dtype == torch.float16 else attn_weights.to(torch.float16).contiguous(),
|
377 |
+
qv.contiguous(), # dtype: int32
|
378 |
+
attn_output,
|
379 |
+
qv_scale.contiguous() if qv_scale.dtype == torch.float16 else qv_scale.to(torch.float16).contiguous(),
|
380 |
+
qv_zero.contiguous() if qv_zero.dtype == torch.float16 else qv_zero.to(torch.float16).contiguous())
|
381 |
+
if attn_output.dtype != query.dtype:
|
382 |
+
attn_output = attn_output.to(query.dtype)
|
383 |
+
attn_weights = attn_weights.to(query.dtype)
|
384 |
+
else:
|
385 |
+
value = dequantize_cache_torch(qv, qv_scale, qv_zero)
|
386 |
+
attn_output = torch.matmul(attn_weights, value)
|
387 |
+
else:
|
388 |
+
attn_output = torch.matmul(attn_weights, value)
|
389 |
+
|
390 |
+
attn_output = attn_output.transpose(1, 2)
|
391 |
+
|
392 |
+
return attn_output, attn_weights
|
393 |
+
|
394 |
+
def _split_heads(self, tensor, num_heads, attn_head_size):
|
395 |
+
new_shape = tensor.size()[:-1] + (num_heads, attn_head_size)
|
396 |
+
tensor = tensor.view(new_shape)
|
397 |
+
return tensor
|
398 |
+
|
399 |
+
def _merge_heads(self, tensor, num_heads, attn_head_size):
|
400 |
+
tensor = tensor.contiguous()
|
401 |
+
new_shape = tensor.size()[:-2] + (num_heads * attn_head_size,)
|
402 |
+
return tensor.view(new_shape)
|
403 |
+
|
404 |
+
def forward(
|
405 |
+
self,
|
406 |
+
hidden_states: Optional[Tuple[torch.FloatTensor]],
|
407 |
+
rotary_pos_emb_list: Optional[List[List[torch.Tensor]]] = None,
|
408 |
+
layer_past: Optional[Tuple[torch.Tensor]] = None,
|
409 |
+
attention_mask: Optional[torch.FloatTensor] = None,
|
410 |
+
head_mask: Optional[torch.FloatTensor] = None,
|
411 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
412 |
+
encoder_attention_mask: Optional[torch.FloatTensor] = None,
|
413 |
+
output_attentions: Optional[bool] = False,
|
414 |
+
use_cache: Optional[bool] = False,
|
415 |
+
):
|
416 |
+
mixed_x_layer = self.c_attn(hidden_states)
|
417 |
+
|
418 |
+
query, key, value = mixed_x_layer.split(self.split_size, dim=2)
|
419 |
+
|
420 |
+
query = self._split_heads(query, self.num_heads, self.head_dim)
|
421 |
+
key = self._split_heads(key, self.num_heads, self.head_dim)
|
422 |
+
value = self._split_heads(value, self.num_heads, self.head_dim)
|
423 |
+
|
424 |
+
if rotary_pos_emb_list is not None:
|
425 |
+
cur_len = query.shape[1]
|
426 |
+
if len(rotary_pos_emb_list) == 1:
|
427 |
+
rotary_pos_emb = rotary_pos_emb_list[0]
|
428 |
+
rotary_pos_emb = [i[:, -cur_len:, :, :] for i in rotary_pos_emb]
|
429 |
+
rotary_pos_emb = (rotary_pos_emb,) * 2
|
430 |
+
q_pos_emb, k_pos_emb = rotary_pos_emb
|
431 |
+
# Slice the pos emb for current inference
|
432 |
+
query = apply_rotary_pos_emb(query, q_pos_emb)
|
433 |
+
key = apply_rotary_pos_emb(key, k_pos_emb)
|
434 |
+
else:
|
435 |
+
query_list = []
|
436 |
+
key_list = []
|
437 |
+
for i, rotary_pos_emb in enumerate(rotary_pos_emb_list):
|
438 |
+
rotary_pos_emb = [i[:, -cur_len:, :, :] for i in rotary_pos_emb]
|
439 |
+
rotary_pos_emb = (rotary_pos_emb,) * 2
|
440 |
+
q_pos_emb, k_pos_emb = rotary_pos_emb
|
441 |
+
# Slice the pos emb for current inference
|
442 |
+
query_list += [apply_rotary_pos_emb(query[i:i+1, :, :], q_pos_emb)]
|
443 |
+
key_list += [apply_rotary_pos_emb(key[i:i+1, :, :], k_pos_emb)]
|
444 |
+
query = torch.cat(query_list, dim=0)
|
445 |
+
key = torch.cat(key_list, dim=0)
|
446 |
+
|
447 |
+
if self.use_cache_quantization:
|
448 |
+
key = quantize_cache_v(key.permute(0, 2, 1, 3),
|
449 |
+
bits=8,
|
450 |
+
qmin=self.cache_qmin,
|
451 |
+
qmax=self.cache_qmax)
|
452 |
+
value = quantize_cache_v(value.permute(0, 2, 1, 3),
|
453 |
+
bits=8,
|
454 |
+
qmin=self.cache_qmin,
|
455 |
+
qmax=self.cache_qmax)
|
456 |
+
|
457 |
+
|
458 |
+
if layer_past is not None:
|
459 |
+
past_key, past_value = layer_past[0], layer_past[1]
|
460 |
+
if self.use_cache_quantization:
|
461 |
+
# use_cache_quantization:
|
462 |
+
# present=((q_key,key_scale,key_zero_point),
|
463 |
+
# (q_value,value_scale,value_zero_point))
|
464 |
+
key = (torch.cat((past_key[0], key[0]), dim=2),
|
465 |
+
torch.cat((past_key[1], key[1]), dim=2),
|
466 |
+
torch.cat((past_key[2], key[2]), dim=2))
|
467 |
+
value = (torch.cat((past_value[0], value[0]), dim=2),
|
468 |
+
torch.cat((past_value[1], value[1]), dim=2),
|
469 |
+
torch.cat((past_value[2], value[2]), dim=2))
|
470 |
+
else:
|
471 |
+
# not use_cache_quantization:
|
472 |
+
# present=(key,value)
|
473 |
+
key = torch.cat((past_key, key), dim=1)
|
474 |
+
value = torch.cat((past_value, value), dim=1)
|
475 |
+
|
476 |
+
if use_cache:
|
477 |
+
present = (key, value)
|
478 |
+
else:
|
479 |
+
present = None
|
480 |
+
|
481 |
+
key_size = key[0].size(2) if self.use_cache_quantization else key.size(1)
|
482 |
+
if key_size > self.seq_length and self.use_logn_attn and not self.training:
|
483 |
+
if self.use_cache_quantization:
|
484 |
+
seq_start = key[0].size(2) - query.size(1)
|
485 |
+
seq_end = key[0].size(2)
|
486 |
+
else:
|
487 |
+
seq_start = key.size(1) - query.size(1)
|
488 |
+
seq_end = key.size(1)
|
489 |
+
logn_tensor = self.logn_tensor[:, seq_start:seq_end, :, :].type_as(query)
|
490 |
+
query = query * logn_tensor.expand_as(query)
|
491 |
+
|
492 |
+
if (
|
493 |
+
self.use_flash_attn
|
494 |
+
and flash_attn_unpadded_func is not None
|
495 |
+
and not self.is_fp32
|
496 |
+
and query.is_cuda
|
497 |
+
):
|
498 |
+
q, k, v = query, key, value
|
499 |
+
attn_output = self.core_attention_flash(q, k, v, attention_mask=attention_mask)
|
500 |
+
else:
|
501 |
+
key_size = key[0].size(2) if self.use_cache_quantization else key.size(1)
|
502 |
+
if query.size(1) == key_size:
|
503 |
+
causal_mask = torch.tril(
|
504 |
+
torch.ones((key_size, key_size), dtype=torch.bool, device=query.device)
|
505 |
+
).view(1, 1, key_size, key_size)
|
506 |
+
else:
|
507 |
+
causal_mask = None
|
508 |
+
query = query.permute(0, 2, 1, 3)
|
509 |
+
if not self.use_cache_quantization:
|
510 |
+
key = key.permute(0, 2, 1, 3)
|
511 |
+
value = value.permute(0, 2, 1, 3)
|
512 |
+
if (
|
513 |
+
causal_mask is None
|
514 |
+
and self.use_flash_attn
|
515 |
+
and flash_attn_unpadded_func is not None
|
516 |
+
and not self.is_fp32
|
517 |
+
and not query.is_cuda
|
518 |
+
):
|
519 |
+
raise Exception(_ERROR_INPUT_CPU_QUERY_WITH_FLASH_ATTN_ACTIVATED)
|
520 |
+
|
521 |
+
if not self.use_cache_quantization and SUPPORT_TORCH2:
|
522 |
+
if attention_mask is not None:
|
523 |
+
attention_mask = attention_mask.expand(-1, -1, query.size(2), -1)
|
524 |
+
if causal_mask is not None:
|
525 |
+
attention_mask = attention_mask.masked_fill(~causal_mask, torch.finfo(query.dtype).min)
|
526 |
+
else:
|
527 |
+
attention_mask = causal_mask
|
528 |
+
attn_output = F.scaled_dot_product_attention(
|
529 |
+
query, key, value, attn_mask=attention_mask
|
530 |
+
).transpose(1, 2)
|
531 |
+
attn_weight = None
|
532 |
+
else:
|
533 |
+
attn_output, attn_weight = self._attn(
|
534 |
+
query, key, value, causal_mask, attention_mask, head_mask
|
535 |
+
)
|
536 |
+
context_layer = self._merge_heads(
|
537 |
+
attn_output, self.num_heads, self.head_dim
|
538 |
+
)
|
539 |
+
|
540 |
+
attn_output = self.c_proj(context_layer)
|
541 |
+
|
542 |
+
outputs = (attn_output, present)
|
543 |
+
if output_attentions:
|
544 |
+
if (
|
545 |
+
self.use_flash_attn
|
546 |
+
and flash_attn_unpadded_func is not None
|
547 |
+
and not self.is_fp32
|
548 |
+
):
|
549 |
+
raise ValueError("Cannot output attentions while using flash-attn")
|
550 |
+
elif not self.use_cache_quantization and SUPPORT_TORCH2:
|
551 |
+
raise ValueError("Cannot output attentions while using scaled_dot_product_attention")
|
552 |
+
else:
|
553 |
+
outputs += (attn_weight,)
|
554 |
+
|
555 |
+
return outputs
|
556 |
+
|
557 |
+
|
558 |
+
class QWenMLP(nn.Module):
|
559 |
+
def __init__(self, config):
|
560 |
+
super().__init__()
|
561 |
+
self.w1 = nn.Linear(
|
562 |
+
config.hidden_size, config.intermediate_size // 2, bias=not config.no_bias
|
563 |
+
)
|
564 |
+
self.w2 = nn.Linear(
|
565 |
+
config.hidden_size, config.intermediate_size // 2, bias=not config.no_bias
|
566 |
+
)
|
567 |
+
ff_dim_in = config.intermediate_size // 2
|
568 |
+
self.c_proj = nn.Linear(ff_dim_in, config.hidden_size, bias=not config.no_bias)
|
569 |
+
|
570 |
+
def forward(self, hidden_states):
|
571 |
+
a1 = self.w1(hidden_states)
|
572 |
+
a2 = self.w2(hidden_states)
|
573 |
+
intermediate_parallel = a1 * F.silu(a2)
|
574 |
+
output = self.c_proj(intermediate_parallel)
|
575 |
+
return output
|
576 |
+
|
577 |
+
|
578 |
+
class QWenBlock(nn.Module):
|
579 |
+
def __init__(self, config):
|
580 |
+
super().__init__()
|
581 |
+
hidden_size = config.hidden_size
|
582 |
+
self.bf16 = config.bf16
|
583 |
+
|
584 |
+
self.ln_1 = RMSNorm(
|
585 |
+
hidden_size,
|
586 |
+
eps=config.layer_norm_epsilon,
|
587 |
+
)
|
588 |
+
self.attn = QWenAttention(config)
|
589 |
+
self.ln_2 = RMSNorm(
|
590 |
+
hidden_size,
|
591 |
+
eps=config.layer_norm_epsilon,
|
592 |
+
)
|
593 |
+
|
594 |
+
self.mlp = QWenMLP(config)
|
595 |
+
|
596 |
+
def forward(
|
597 |
+
self,
|
598 |
+
hidden_states: Optional[Tuple[torch.FloatTensor]],
|
599 |
+
rotary_pos_emb_list: Optional[List[List[torch.Tensor]]] = None,
|
600 |
+
layer_past: Optional[Tuple[torch.Tensor]] = None,
|
601 |
+
attention_mask: Optional[torch.FloatTensor] = None,
|
602 |
+
head_mask: Optional[torch.FloatTensor] = None,
|
603 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
604 |
+
encoder_attention_mask: Optional[torch.FloatTensor] = None,
|
605 |
+
use_cache: Optional[bool] = False,
|
606 |
+
output_attentions: Optional[bool] = False,
|
607 |
+
):
|
608 |
+
layernorm_output = self.ln_1(hidden_states)
|
609 |
+
|
610 |
+
attn_outputs = self.attn(
|
611 |
+
layernorm_output,
|
612 |
+
rotary_pos_emb_list,
|
613 |
+
layer_past=layer_past,
|
614 |
+
attention_mask=attention_mask,
|
615 |
+
head_mask=head_mask,
|
616 |
+
use_cache=use_cache,
|
617 |
+
output_attentions=output_attentions,
|
618 |
+
)
|
619 |
+
attn_output = attn_outputs[0]
|
620 |
+
|
621 |
+
outputs = attn_outputs[1:]
|
622 |
+
|
623 |
+
residual = hidden_states
|
624 |
+
layernorm_input = attn_output + residual
|
625 |
+
|
626 |
+
layernorm_output = self.ln_2(layernorm_input)
|
627 |
+
|
628 |
+
residual = layernorm_input
|
629 |
+
mlp_output = self.mlp(layernorm_output)
|
630 |
+
hidden_states = residual + mlp_output
|
631 |
+
|
632 |
+
if use_cache:
|
633 |
+
outputs = (hidden_states,) + outputs
|
634 |
+
else:
|
635 |
+
outputs = (hidden_states,) + outputs[1:]
|
636 |
+
|
637 |
+
return outputs
|
638 |
+
|
639 |
+
|
640 |
+
class QWenPreTrainedModel(PreTrainedModel):
|
641 |
+
config_class = QWenConfig
|
642 |
+
base_model_prefix = "transformer"
|
643 |
+
is_parallelizable = False
|
644 |
+
supports_gradient_checkpointing = True
|
645 |
+
_no_split_modules = ["QWenBlock"]
|
646 |
+
_skip_keys_device_placement = "past_key_values"
|
647 |
+
|
648 |
+
def __init__(self, *inputs, **kwargs):
|
649 |
+
super().__init__(*inputs, **kwargs)
|
650 |
+
|
651 |
+
def _init_weights(self, module):
|
652 |
+
"""Initialize the weights."""
|
653 |
+
if isinstance(module, nn.Linear):
|
654 |
+
module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
|
655 |
+
if module.bias is not None:
|
656 |
+
module.bias.data.zero_()
|
657 |
+
elif isinstance(module, nn.Embedding):
|
658 |
+
module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
|
659 |
+
if module.padding_idx is not None:
|
660 |
+
module.weight.data[module.padding_idx].zero_()
|
661 |
+
elif isinstance(module, RMSNorm):
|
662 |
+
module.weight.data.fill_(1.0)
|
663 |
+
|
664 |
+
for name, p in module.named_parameters():
|
665 |
+
if name == "c_proj.weight":
|
666 |
+
p.data.normal_(
|
667 |
+
mean=0.0,
|
668 |
+
std=(
|
669 |
+
self.config.initializer_range
|
670 |
+
/ math.sqrt(2 * self.config.num_hidden_layers)
|
671 |
+
),
|
672 |
+
)
|
673 |
+
|
674 |
+
def _set_gradient_checkpointing(self, module, value=False):
|
675 |
+
if isinstance(module, QWenModel):
|
676 |
+
module.gradient_checkpointing = value
|
677 |
+
|
678 |
+
|
679 |
+
class QWenModel(QWenPreTrainedModel):
|
680 |
+
_keys_to_ignore_on_load_missing = ["attn.masked_bias"]
|
681 |
+
|
682 |
+
def __init__(self, config):
|
683 |
+
super().__init__(config)
|
684 |
+
self.vocab_size = config.vocab_size
|
685 |
+
self.num_hidden_layers = config.num_hidden_layers
|
686 |
+
self.embed_dim = config.hidden_size
|
687 |
+
self.use_cache_quantization = self.config.use_cache_quantization if hasattr(self.config, 'use_cache_quantization') else False
|
688 |
+
|
689 |
+
self.gradient_checkpointing = False
|
690 |
+
self.use_dynamic_ntk = config.use_dynamic_ntk
|
691 |
+
self.seq_length = config.seq_length
|
692 |
+
|
693 |
+
self.wte = nn.Embedding(self.vocab_size, self.embed_dim)
|
694 |
+
|
695 |
+
self.drop = nn.Dropout(config.emb_dropout_prob)
|
696 |
+
|
697 |
+
if config.rotary_pct == 1.0:
|
698 |
+
self.rotary_ndims = None
|
699 |
+
else:
|
700 |
+
assert config.rotary_pct < 1
|
701 |
+
self.rotary_ndims = int(
|
702 |
+
config.kv_channels * config.rotary_pct
|
703 |
+
)
|
704 |
+
dim = (
|
705 |
+
self.rotary_ndims
|
706 |
+
if self.rotary_ndims is not None
|
707 |
+
else config.kv_channels
|
708 |
+
)
|
709 |
+
self.rotary_emb = RotaryEmbedding(dim, base=config.rotary_emb_base)
|
710 |
+
|
711 |
+
self.use_flash_attn = config.use_flash_attn
|
712 |
+
self.is_fp32 = not (config.bf16 or config.fp16)
|
713 |
+
|
714 |
+
self.h = nn.ModuleList(
|
715 |
+
[
|
716 |
+
QWenBlock(
|
717 |
+
config
|
718 |
+
)
|
719 |
+
for i in range(config.num_hidden_layers)
|
720 |
+
]
|
721 |
+
)
|
722 |
+
self.ln_f = RMSNorm(
|
723 |
+
self.embed_dim,
|
724 |
+
eps=config.layer_norm_epsilon,
|
725 |
+
)
|
726 |
+
|
727 |
+
self.post_init()
|
728 |
+
|
729 |
+
def get_input_embeddings(self):
|
730 |
+
return self.wte
|
731 |
+
|
732 |
+
def set_input_embeddings(self, new_embeddings):
|
733 |
+
self.wte = new_embeddings
|
734 |
+
|
735 |
+
def get_ntk_alpha(self, true_seq_len):
|
736 |
+
context_value = math.log(true_seq_len / self.seq_length, 2) + 1
|
737 |
+
ntk_alpha = 2 ** math.ceil(context_value) - 1
|
738 |
+
ntk_alpha = max(ntk_alpha, 1)
|
739 |
+
return ntk_alpha
|
740 |
+
|
741 |
+
def forward(
|
742 |
+
self,
|
743 |
+
input_ids: Optional[torch.LongTensor] = None,
|
744 |
+
past_key_values: Optional[Tuple[Tuple[torch.Tensor]]] = None,
|
745 |
+
attention_mask: Optional[torch.FloatTensor] = None,
|
746 |
+
token_type_ids: Optional[torch.LongTensor] = None,
|
747 |
+
position_ids: Optional[torch.LongTensor] = None,
|
748 |
+
head_mask: Optional[torch.FloatTensor] = None,
|
749 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
750 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
751 |
+
encoder_attention_mask: Optional[torch.FloatTensor] = None,
|
752 |
+
use_cache: Optional[bool] = None,
|
753 |
+
output_attentions: Optional[bool] = None,
|
754 |
+
output_hidden_states: Optional[bool] = None,
|
755 |
+
return_dict: Optional[bool] = None,
|
756 |
+
):
|
757 |
+
output_attentions = (
|
758 |
+
output_attentions
|
759 |
+
if output_attentions is not None
|
760 |
+
else self.config.output_attentions
|
761 |
+
)
|
762 |
+
output_hidden_states = (
|
763 |
+
output_hidden_states
|
764 |
+
if output_hidden_states is not None
|
765 |
+
else self.config.output_hidden_states
|
766 |
+
)
|
767 |
+
use_cache = use_cache if use_cache is not None else self.config.use_cache
|
768 |
+
return_dict = (
|
769 |
+
return_dict if return_dict is not None else self.config.use_return_dict
|
770 |
+
)
|
771 |
+
|
772 |
+
if input_ids is not None and inputs_embeds is not None:
|
773 |
+
raise ValueError(
|
774 |
+
"You cannot specify both input_ids and inputs_embeds at the same time"
|
775 |
+
)
|
776 |
+
elif input_ids is not None:
|
777 |
+
input_shape = input_ids.size()
|
778 |
+
input_ids = input_ids.view(-1, input_shape[-1])
|
779 |
+
batch_size = input_ids.shape[0]
|
780 |
+
elif inputs_embeds is not None:
|
781 |
+
input_shape = inputs_embeds.size()[:-1]
|
782 |
+
batch_size = inputs_embeds.shape[0]
|
783 |
+
else:
|
784 |
+
raise ValueError("You have to specify either input_ids or inputs_embeds")
|
785 |
+
|
786 |
+
device = input_ids.device if input_ids is not None else inputs_embeds.device
|
787 |
+
|
788 |
+
if token_type_ids is not None:
|
789 |
+
token_type_ids = token_type_ids.view(-1, input_shape[-1])
|
790 |
+
if position_ids is not None:
|
791 |
+
position_ids = position_ids.view(-1, input_shape[-1])
|
792 |
+
|
793 |
+
if past_key_values is None:
|
794 |
+
past_length = 0
|
795 |
+
past_key_values = tuple([None] * len(self.h))
|
796 |
+
else:
|
797 |
+
if self.use_cache_quantization:
|
798 |
+
past_length = past_key_values[0][0][0].size(2)
|
799 |
+
else:
|
800 |
+
past_length = past_key_values[0][0].size(-2)
|
801 |
+
if position_ids is None:
|
802 |
+
position_ids = torch.arange(
|
803 |
+
past_length,
|
804 |
+
input_shape[-1] + past_length,
|
805 |
+
dtype=torch.long,
|
806 |
+
device=device,
|
807 |
+
)
|
808 |
+
position_ids = position_ids.unsqueeze(0).view(-1, input_shape[-1])
|
809 |
+
|
810 |
+
if attention_mask is not None:
|
811 |
+
if batch_size <= 0:
|
812 |
+
raise ValueError("batch_size has to be defined and > 0")
|
813 |
+
attention_mask = attention_mask.view(batch_size, -1)
|
814 |
+
attention_mask = attention_mask[:, None, None, :]
|
815 |
+
attention_mask = attention_mask.to(dtype=self.dtype)
|
816 |
+
attention_mask = (1.0 - attention_mask) * torch.finfo(self.dtype).min
|
817 |
+
|
818 |
+
encoder_attention_mask = None
|
819 |
+
head_mask = self.get_head_mask(head_mask, self.config.num_hidden_layers)
|
820 |
+
|
821 |
+
if inputs_embeds is None:
|
822 |
+
inputs_embeds = self.wte(input_ids)
|
823 |
+
hidden_states = inputs_embeds
|
824 |
+
|
825 |
+
kv_seq_len = hidden_states.size()[1]
|
826 |
+
if past_key_values[0] is not None:
|
827 |
+
# past key values[0][0] shape: bs * seq_len * head_num * dim
|
828 |
+
if self.use_cache_quantization:
|
829 |
+
kv_seq_len += past_key_values[0][0][0].shape[2]
|
830 |
+
else:
|
831 |
+
kv_seq_len += past_key_values[0][0].shape[1]
|
832 |
+
|
833 |
+
if self.training or not self.use_dynamic_ntk:
|
834 |
+
ntk_alpha_list = [1.0]
|
835 |
+
elif kv_seq_len != hidden_states.size()[1]:
|
836 |
+
ntk_alpha_list = self.rotary_emb._ntk_alpha_cached_list
|
837 |
+
else:
|
838 |
+
ntk_alpha_list = []
|
839 |
+
if attention_mask is not None and kv_seq_len > self.seq_length:
|
840 |
+
true_seq_lens = attention_mask.squeeze(1).squeeze(1).eq(0).sum(dim=-1, dtype=torch.int32)
|
841 |
+
for i in range(hidden_states.size()[0]):
|
842 |
+
true_seq_len = true_seq_lens[i].item()
|
843 |
+
ntk_alpha = self.get_ntk_alpha(true_seq_len)
|
844 |
+
ntk_alpha_list.append(ntk_alpha)
|
845 |
+
else:
|
846 |
+
ntk_alpha = self.get_ntk_alpha(kv_seq_len)
|
847 |
+
ntk_alpha_list.append(ntk_alpha)
|
848 |
+
self.rotary_emb._ntk_alpha_cached_list = ntk_alpha_list
|
849 |
+
rotary_pos_emb_list = [
|
850 |
+
self.rotary_emb(kv_seq_len, ntk_alpha=ntk_alpha) for ntk_alpha in ntk_alpha_list
|
851 |
+
]
|
852 |
+
|
853 |
+
hidden_states = self.drop(hidden_states)
|
854 |
+
output_shape = input_shape + (hidden_states.size(-1),)
|
855 |
+
|
856 |
+
if self.gradient_checkpointing and self.training:
|
857 |
+
if use_cache:
|
858 |
+
logger.warning_once(
|
859 |
+
"`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
|
860 |
+
)
|
861 |
+
use_cache = False
|
862 |
+
|
863 |
+
presents = () if use_cache else None
|
864 |
+
all_self_attentions = () if output_attentions else None
|
865 |
+
all_hidden_states = () if output_hidden_states else None
|
866 |
+
for i, (block, layer_past) in enumerate(zip(self.h, past_key_values)):
|
867 |
+
|
868 |
+
if output_hidden_states:
|
869 |
+
all_hidden_states = all_hidden_states + (hidden_states,)
|
870 |
+
|
871 |
+
if self.gradient_checkpointing and self.training:
|
872 |
+
|
873 |
+
def create_custom_forward(module):
|
874 |
+
def custom_forward(*inputs):
|
875 |
+
# None for past_key_value
|
876 |
+
return module(*inputs, use_cache, output_attentions)
|
877 |
+
|
878 |
+
return custom_forward
|
879 |
+
|
880 |
+
outputs = torch.utils.checkpoint.checkpoint(
|
881 |
+
create_custom_forward(block),
|
882 |
+
hidden_states,
|
883 |
+
rotary_pos_emb_list,
|
884 |
+
None,
|
885 |
+
attention_mask,
|
886 |
+
head_mask[i],
|
887 |
+
encoder_hidden_states,
|
888 |
+
encoder_attention_mask,
|
889 |
+
)
|
890 |
+
else:
|
891 |
+
outputs = block(
|
892 |
+
hidden_states,
|
893 |
+
layer_past=layer_past,
|
894 |
+
rotary_pos_emb_list=rotary_pos_emb_list,
|
895 |
+
attention_mask=attention_mask,
|
896 |
+
head_mask=head_mask[i],
|
897 |
+
encoder_hidden_states=encoder_hidden_states,
|
898 |
+
encoder_attention_mask=encoder_attention_mask,
|
899 |
+
use_cache=use_cache,
|
900 |
+
output_attentions=output_attentions,
|
901 |
+
)
|
902 |
+
|
903 |
+
hidden_states = outputs[0]
|
904 |
+
if use_cache is True:
|
905 |
+
presents = presents + (outputs[1],)
|
906 |
+
|
907 |
+
if output_attentions:
|
908 |
+
all_self_attentions = all_self_attentions + (outputs[2 if use_cache else 1],)
|
909 |
+
|
910 |
+
hidden_states = self.ln_f(hidden_states)
|
911 |
+
hidden_states = hidden_states.view(output_shape)
|
912 |
+
# Add last hidden state
|
913 |
+
if output_hidden_states:
|
914 |
+
all_hidden_states = all_hidden_states + (hidden_states,)
|
915 |
+
|
916 |
+
if not return_dict:
|
917 |
+
return tuple(
|
918 |
+
v for v in [hidden_states, presents, all_hidden_states] if v is not None
|
919 |
+
)
|
920 |
+
|
921 |
+
return BaseModelOutputWithPast(
|
922 |
+
last_hidden_state=hidden_states,
|
923 |
+
past_key_values=presents,
|
924 |
+
hidden_states=all_hidden_states,
|
925 |
+
attentions=all_self_attentions,
|
926 |
+
)
|
927 |
+
|
928 |
+
|
929 |
+
class QWenLMHeadModel(QWenPreTrainedModel):
|
930 |
+
_keys_to_ignore_on_load_missing = [r"h\.\d+\.attn\.rotary_emb\.inv_freq"]
|
931 |
+
_keys_to_ignore_on_load_unexpected = [r"h\.\d+\.attn\.masked_bias"]
|
932 |
+
|
933 |
+
def __init__(self, config):
|
934 |
+
super().__init__(config)
|
935 |
+
assert (
|
936 |
+
config.bf16 + config.fp16 + config.fp32 <= 1
|
937 |
+
), "Only one of \"bf16\", \"fp16\", \"fp32\" can be true"
|
938 |
+
|
939 |
+
autoset_precision = config.bf16 + config.fp16 + config.fp32 == 0
|
940 |
+
|
941 |
+
if autoset_precision:
|
942 |
+
if SUPPORT_BF16:
|
943 |
+
logger.warn(
|
944 |
+
"The model is automatically converting to bf16 for faster inference. "
|
945 |
+
"If you want to disable the automatic precision, please manually add bf16/fp16/fp32=True to \"AutoModelForCausalLM.from_pretrained\"."
|
946 |
+
)
|
947 |
+
config.bf16 = True
|
948 |
+
elif SUPPORT_FP16:
|
949 |
+
logger.warn(
|
950 |
+
"The model is automatically converting to fp16 for faster inference. "
|
951 |
+
"If you want to disable the automatic precision, please manually add bf16/fp16/fp32=True to \"AutoModelForCausalLM.from_pretrained\"."
|
952 |
+
)
|
953 |
+
config.fp16 = True
|
954 |
+
else:
|
955 |
+
config.fp32 = True
|
956 |
+
|
957 |
+
if config.bf16 and SUPPORT_CUDA and not SUPPORT_BF16:
|
958 |
+
logger.warn("Your device does NOT seem to support bf16, you can switch to fp16 or fp32 by by passing fp16/fp32=True in \"AutoModelForCausalLM.from_pretrained\".")
|
959 |
+
if config.fp16 and SUPPORT_CUDA and not SUPPORT_FP16:
|
960 |
+
logger.warn("Your device does NOT support faster inference with fp16, please switch to fp32 which is likely to be faster")
|
961 |
+
if config.fp32:
|
962 |
+
if SUPPORT_BF16:
|
963 |
+
logger.warn("Your device support faster inference by passing bf16=True in \"AutoModelForCausalLM.from_pretrained\".")
|
964 |
+
elif SUPPORT_FP16:
|
965 |
+
logger.warn("Your device support faster inference by passing fp16=True in \"AutoModelForCausalLM.from_pretrained\".")
|
966 |
+
|
967 |
+
if config.use_flash_attn == "auto":
|
968 |
+
if config.bf16 or config.fp16:
|
969 |
+
logger.warn("Try importing flash-attention for faster inference...")
|
970 |
+
config.use_flash_attn = True
|
971 |
+
else:
|
972 |
+
config.use_flash_attn = False
|
973 |
+
if config.use_flash_attn and config.fp32:
|
974 |
+
logger.warn("Flash attention will be disabled because it does NOT support fp32.")
|
975 |
+
|
976 |
+
if config.use_flash_attn:
|
977 |
+
_import_flash_attn()
|
978 |
+
|
979 |
+
self.transformer = QWenModel(config)
|
980 |
+
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
981 |
+
|
982 |
+
if config.bf16:
|
983 |
+
self.transformer.bfloat16()
|
984 |
+
self.lm_head.bfloat16()
|
985 |
+
if config.fp16:
|
986 |
+
self.transformer.half()
|
987 |
+
self.lm_head.half()
|
988 |
+
self.post_init()
|
989 |
+
|
990 |
+
def get_output_embeddings(self):
|
991 |
+
return self.lm_head
|
992 |
+
|
993 |
+
def set_output_embeddings(self, new_embeddings):
|
994 |
+
self.lm_head = new_embeddings
|
995 |
+
|
996 |
+
def prepare_inputs_for_generation(
|
997 |
+
self, input_ids, past_key_values=None, inputs_embeds=None, **kwargs
|
998 |
+
):
|
999 |
+
if past_key_values:
|
1000 |
+
input_ids = input_ids[:, -1].unsqueeze(-1)
|
1001 |
+
|
1002 |
+
if input_ids.size(0) == 1:
|
1003 |
+
attention_mask = None
|
1004 |
+
else:
|
1005 |
+
attention_mask = kwargs.get("attention_mask", None)
|
1006 |
+
|
1007 |
+
if inputs_embeds is not None and past_key_values is None:
|
1008 |
+
model_inputs = {"inputs_embeds": inputs_embeds}
|
1009 |
+
else:
|
1010 |
+
model_inputs = {"input_ids": input_ids}
|
1011 |
+
|
1012 |
+
model_inputs.update(
|
1013 |
+
{
|
1014 |
+
"past_key_values": past_key_values,
|
1015 |
+
"use_cache": kwargs.get("use_cache"),
|
1016 |
+
"attention_mask": attention_mask,
|
1017 |
+
}
|
1018 |
+
)
|
1019 |
+
return model_inputs
|
1020 |
+
|
1021 |
+
def forward(
|
1022 |
+
self,
|
1023 |
+
input_ids: Optional[torch.LongTensor] = None,
|
1024 |
+
past_key_values: Optional[Tuple[Tuple[torch.Tensor]]] = None,
|
1025 |
+
attention_mask: Optional[torch.FloatTensor] = None,
|
1026 |
+
token_type_ids: Optional[torch.LongTensor] = None,
|
1027 |
+
position_ids: Optional[torch.LongTensor] = None,
|
1028 |
+
head_mask: Optional[torch.FloatTensor] = None,
|
1029 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
1030 |
+
encoder_hidden_states: Optional[torch.Tensor] = None,
|
1031 |
+
encoder_attention_mask: Optional[torch.FloatTensor] = None,
|
1032 |
+
labels: Optional[torch.LongTensor] = None,
|
1033 |
+
use_cache: Optional[bool] = None,
|
1034 |
+
output_attentions: Optional[bool] = None,
|
1035 |
+
output_hidden_states: Optional[bool] = None,
|
1036 |
+
return_dict: Optional[bool] = None,
|
1037 |
+
) -> Union[Tuple, CausalLMOutputWithPast]:
|
1038 |
+
|
1039 |
+
return_dict = (
|
1040 |
+
return_dict if return_dict is not None else self.config.use_return_dict
|
1041 |
+
)
|
1042 |
+
|
1043 |
+
transformer_outputs = self.transformer(
|
1044 |
+
input_ids,
|
1045 |
+
past_key_values=past_key_values,
|
1046 |
+
attention_mask=attention_mask,
|
1047 |
+
token_type_ids=token_type_ids,
|
1048 |
+
position_ids=position_ids,
|
1049 |
+
head_mask=head_mask,
|
1050 |
+
inputs_embeds=inputs_embeds,
|
1051 |
+
encoder_hidden_states=encoder_hidden_states,
|
1052 |
+
encoder_attention_mask=encoder_attention_mask,
|
1053 |
+
use_cache=use_cache,
|
1054 |
+
output_attentions=output_attentions,
|
1055 |
+
output_hidden_states=output_hidden_states,
|
1056 |
+
return_dict=return_dict,
|
1057 |
+
)
|
1058 |
+
hidden_states = transformer_outputs[0]
|
1059 |
+
|
1060 |
+
lm_logits = self.lm_head(hidden_states)
|
1061 |
+
|
1062 |
+
loss = None
|
1063 |
+
if labels is not None:
|
1064 |
+
labels = labels.to(lm_logits.device)
|
1065 |
+
shift_logits = lm_logits[..., :-1, :].contiguous()
|
1066 |
+
shift_labels = labels[..., 1:].contiguous()
|
1067 |
+
loss_fct = CrossEntropyLoss()
|
1068 |
+
loss = loss_fct(
|
1069 |
+
shift_logits.view(-1, shift_logits.size(-1)), shift_labels.view(-1)
|
1070 |
+
)
|
1071 |
+
|
1072 |
+
if not return_dict:
|
1073 |
+
output = (lm_logits,) + transformer_outputs[1:]
|
1074 |
+
return ((loss,) + output) if loss is not None else output
|
1075 |
+
|
1076 |
+
return CausalLMOutputWithPast(
|
1077 |
+
loss=loss,
|
1078 |
+
logits=lm_logits,
|
1079 |
+
past_key_values=transformer_outputs.past_key_values,
|
1080 |
+
hidden_states=transformer_outputs.hidden_states,
|
1081 |
+
attentions=transformer_outputs.attentions,
|
1082 |
+
)
|
1083 |
+
|
1084 |
+
@staticmethod
|
1085 |
+
def _reorder_cache(
|
1086 |
+
past_key_values: Tuple[Tuple[torch.Tensor]], beam_idx: torch.Tensor
|
1087 |
+
) -> Tuple[Tuple[torch.Tensor]]:
|
1088 |
+
|
1089 |
+
return tuple(
|
1090 |
+
tuple(
|
1091 |
+
past_state.index_select(0, beam_idx.to(past_state.device))
|
1092 |
+
for past_state in layer_past
|
1093 |
+
)
|
1094 |
+
for layer_past in past_key_values
|
1095 |
+
)
|
1096 |
+
|
1097 |
+
def chat(
|
1098 |
+
self,
|
1099 |
+
tokenizer: PreTrainedTokenizer,
|
1100 |
+
query: str,
|
1101 |
+
history: Optional[HistoryType],
|
1102 |
+
system: str = "You are a helpful assistant.",
|
1103 |
+
stream: Optional[bool] = _SENTINEL,
|
1104 |
+
stop_words_ids: Optional[List[List[int]]] = None,
|
1105 |
+
generation_config: Optional[GenerationConfig] = None,
|
1106 |
+
**kwargs,
|
1107 |
+
) -> Tuple[str, HistoryType]:
|
1108 |
+
generation_config = generation_config if generation_config is not None else self.generation_config
|
1109 |
+
|
1110 |
+
assert stream is _SENTINEL, _ERROR_STREAM_IN_CHAT
|
1111 |
+
assert generation_config.chat_format == 'chatml', _ERROR_BAD_CHAT_FORMAT
|
1112 |
+
if history is None:
|
1113 |
+
history = []
|
1114 |
+
else:
|
1115 |
+
# make a copy of the user's input such that is is left untouched
|
1116 |
+
history = copy.deepcopy(history)
|
1117 |
+
|
1118 |
+
if stop_words_ids is None:
|
1119 |
+
stop_words_ids = []
|
1120 |
+
|
1121 |
+
max_window_size = kwargs.get('max_window_size', None)
|
1122 |
+
if max_window_size is None:
|
1123 |
+
max_window_size = generation_config.max_window_size
|
1124 |
+
raw_text, context_tokens = make_context(
|
1125 |
+
tokenizer,
|
1126 |
+
query,
|
1127 |
+
history=history,
|
1128 |
+
system=system,
|
1129 |
+
max_window_size=max_window_size,
|
1130 |
+
chat_format=generation_config.chat_format,
|
1131 |
+
)
|
1132 |
+
|
1133 |
+
stop_words_ids.extend(get_stop_words_ids(
|
1134 |
+
generation_config.chat_format, tokenizer
|
1135 |
+
))
|
1136 |
+
input_ids = torch.tensor([context_tokens]).to(self.device)
|
1137 |
+
outputs = self.generate(
|
1138 |
+
input_ids,
|
1139 |
+
stop_words_ids=stop_words_ids,
|
1140 |
+
return_dict_in_generate=False,
|
1141 |
+
generation_config=generation_config,
|
1142 |
+
**kwargs,
|
1143 |
+
)
|
1144 |
+
|
1145 |
+
response = decode_tokens(
|
1146 |
+
outputs[0],
|
1147 |
+
tokenizer,
|
1148 |
+
raw_text_len=len(raw_text),
|
1149 |
+
context_length=len(context_tokens),
|
1150 |
+
chat_format=generation_config.chat_format,
|
1151 |
+
verbose=False,
|
1152 |
+
errors='replace'
|
1153 |
+
)
|
1154 |
+
|
1155 |
+
# as history is a copy of the user inputs,
|
1156 |
+
# we can always return the new turn to the user.
|
1157 |
+
# separating input history and output history also enables the user
|
1158 |
+
# to implement more complex history management
|
1159 |
+
history.append((query, response))
|
1160 |
+
|
1161 |
+
return response, history
|
1162 |
+
|
1163 |
+
def chat_stream(
|
1164 |
+
self,
|
1165 |
+
tokenizer: PreTrainedTokenizer,
|
1166 |
+
query: str,
|
1167 |
+
history: Optional[HistoryType],
|
1168 |
+
system: str = "You are a helpful assistant.",
|
1169 |
+
stop_words_ids: Optional[List[List[int]]] = None,
|
1170 |
+
logits_processor: Optional[LogitsProcessorList] = None,
|
1171 |
+
generation_config: Optional[GenerationConfig] = None,
|
1172 |
+
**kwargs,
|
1173 |
+
) -> Generator[str, Any, None]:
|
1174 |
+
generation_config = generation_config if generation_config is not None else self.generation_config
|
1175 |
+
assert generation_config.chat_format == 'chatml', _ERROR_BAD_CHAT_FORMAT
|
1176 |
+
if history is None:
|
1177 |
+
history = []
|
1178 |
+
if stop_words_ids is None:
|
1179 |
+
stop_words_ids = []
|
1180 |
+
|
1181 |
+
max_window_size = kwargs.get('max_window_size', None)
|
1182 |
+
if max_window_size is None:
|
1183 |
+
max_window_size = generation_config.max_window_size
|
1184 |
+
raw_text, context_tokens = make_context(
|
1185 |
+
tokenizer,
|
1186 |
+
query,
|
1187 |
+
history=history,
|
1188 |
+
system=system,
|
1189 |
+
max_window_size=max_window_size,
|
1190 |
+
chat_format=generation_config.chat_format,
|
1191 |
+
)
|
1192 |
+
|
1193 |
+
stop_words_ids.extend(get_stop_words_ids(
|
1194 |
+
generation_config.chat_format, tokenizer
|
1195 |
+
))
|
1196 |
+
if stop_words_ids is not None:
|
1197 |
+
stop_words_logits_processor = StopWordsLogitsProcessor(
|
1198 |
+
stop_words_ids=stop_words_ids,
|
1199 |
+
eos_token_id=generation_config.eos_token_id,
|
1200 |
+
)
|
1201 |
+
if logits_processor is None:
|
1202 |
+
logits_processor = LogitsProcessorList([stop_words_logits_processor])
|
1203 |
+
else:
|
1204 |
+
logits_processor.append(stop_words_logits_processor)
|
1205 |
+
input_ids = torch.tensor([context_tokens]).to(self.device)
|
1206 |
+
|
1207 |
+
from transformers_stream_generator.main import NewGenerationMixin, StreamGenerationConfig
|
1208 |
+
self.__class__.generate_stream = NewGenerationMixin.generate
|
1209 |
+
self.__class__.sample_stream = NewGenerationMixin.sample_stream
|
1210 |
+
stream_config = StreamGenerationConfig(**generation_config.to_dict(), do_stream=True)
|
1211 |
+
|
1212 |
+
def stream_generator():
|
1213 |
+
outputs = []
|
1214 |
+
for token in self.generate_stream(
|
1215 |
+
input_ids,
|
1216 |
+
return_dict_in_generate=False,
|
1217 |
+
generation_config=stream_config,
|
1218 |
+
logits_processor=logits_processor,
|
1219 |
+
seed=-1,
|
1220 |
+
**kwargs):
|
1221 |
+
outputs.append(token.item())
|
1222 |
+
yield tokenizer.decode(outputs, skip_special_tokens=True, errors='ignore')
|
1223 |
+
|
1224 |
+
return stream_generator()
|
1225 |
+
|
1226 |
+
def generate(
|
1227 |
+
self,
|
1228 |
+
inputs: Optional[torch.Tensor] = None,
|
1229 |
+
generation_config: Optional[GenerationConfig] = None,
|
1230 |
+
logits_processor: Optional[LogitsProcessorList] = None,
|
1231 |
+
stopping_criteria: Optional[StoppingCriteriaList] = None,
|
1232 |
+
prefix_allowed_tokens_fn: Optional[
|
1233 |
+
Callable[[int, torch.Tensor], List[int]]
|
1234 |
+
] = None,
|
1235 |
+
synced_gpus: Optional[bool] = None,
|
1236 |
+
assistant_model: Optional["PreTrainedModel"] = None,
|
1237 |
+
streamer: Optional["BaseStreamer"] = None,
|
1238 |
+
**kwargs,
|
1239 |
+
) -> Union[GenerateOutput, torch.LongTensor]:
|
1240 |
+
generation_config = generation_config if generation_config is not None else self.generation_config
|
1241 |
+
|
1242 |
+
# Process stop_words_ids.
|
1243 |
+
stop_words_ids = kwargs.pop("stop_words_ids", None)
|
1244 |
+
if stop_words_ids is None and generation_config is not None:
|
1245 |
+
stop_words_ids = getattr(generation_config, "stop_words_ids", None)
|
1246 |
+
if stop_words_ids is None:
|
1247 |
+
stop_words_ids = getattr(generation_config, "stop_words_ids", None)
|
1248 |
+
|
1249 |
+
if stop_words_ids is not None:
|
1250 |
+
stop_words_logits_processor = StopWordsLogitsProcessor(
|
1251 |
+
stop_words_ids=stop_words_ids,
|
1252 |
+
eos_token_id=generation_config.eos_token_id,
|
1253 |
+
)
|
1254 |
+
if logits_processor is None:
|
1255 |
+
logits_processor = LogitsProcessorList([stop_words_logits_processor])
|
1256 |
+
else:
|
1257 |
+
logits_processor.append(stop_words_logits_processor)
|
1258 |
+
|
1259 |
+
return super().generate(
|
1260 |
+
inputs,
|
1261 |
+
generation_config=generation_config,
|
1262 |
+
logits_processor=logits_processor,
|
1263 |
+
stopping_criteria=stopping_criteria,
|
1264 |
+
prefix_allowed_tokens_fn=prefix_allowed_tokens_fn,
|
1265 |
+
synced_gpus=synced_gpus,
|
1266 |
+
assistant_model=assistant_model,
|
1267 |
+
streamer=streamer,
|
1268 |
+
**kwargs,
|
1269 |
+
)
|
1270 |
+
|
1271 |
+
|
1272 |
+
class RotaryEmbedding(torch.nn.Module):
|
1273 |
+
def __init__(self, dim, base=10000):
|
1274 |
+
super().__init__()
|
1275 |
+
self.dim = dim
|
1276 |
+
self.base = base
|
1277 |
+
inv_freq = 1.0 / (base ** (torch.arange(0, dim, 2).float() / dim))
|
1278 |
+
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
1279 |
+
if importlib.util.find_spec("einops") is None:
|
1280 |
+
raise RuntimeError("einops is required for Rotary Embedding")
|
1281 |
+
|
1282 |
+
self._rotary_pos_emb_cache = None
|
1283 |
+
self._seq_len_cached = 0
|
1284 |
+
self._ntk_alpha_cached = 1.0
|
1285 |
+
self._ntk_alpha_cached_list = [1.0]
|
1286 |
+
|
1287 |
+
def update_rotary_pos_emb_cache(self, seqlen, ntk_alpha=1.0):
|
1288 |
+
if seqlen > self._seq_len_cached or ntk_alpha != self._ntk_alpha_cached:
|
1289 |
+
base = self.base * ntk_alpha ** (self.dim / (self.dim - 2))
|
1290 |
+
self.inv_freq = 1.0 / (
|
1291 |
+
base
|
1292 |
+
** (
|
1293 |
+
torch.arange(0, self.dim, 2, device=self.inv_freq.device).float()
|
1294 |
+
/ self.dim
|
1295 |
+
)
|
1296 |
+
)
|
1297 |
+
self._seq_len_cached = max(2 * seqlen, 16)
|
1298 |
+
self._ntk_alpha_cached = ntk_alpha
|
1299 |
+
seq = torch.arange(self._seq_len_cached, device=self.inv_freq.device)
|
1300 |
+
freqs = torch.outer(seq.type_as(self.inv_freq), self.inv_freq)
|
1301 |
+
|
1302 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
1303 |
+
from einops import rearrange
|
1304 |
+
|
1305 |
+
emb = rearrange(emb, "n d -> 1 n 1 d")
|
1306 |
+
|
1307 |
+
cos, sin = emb.cos(), emb.sin()
|
1308 |
+
self._rotary_pos_emb_cache = [cos, sin]
|
1309 |
+
|
1310 |
+
def forward(self, max_seq_len, ntk_alpha=1.0):
|
1311 |
+
self.update_rotary_pos_emb_cache(max_seq_len, ntk_alpha)
|
1312 |
+
cos, sin = self._rotary_pos_emb_cache
|
1313 |
+
return [cos[:, :max_seq_len], sin[:, :max_seq_len]]
|
1314 |
+
|
1315 |
+
|
1316 |
+
def _rotate_half(x):
|
1317 |
+
from einops import rearrange
|
1318 |
+
|
1319 |
+
x = rearrange(x, "... (j d) -> ... j d", j=2)
|
1320 |
+
x1, x2 = x.unbind(dim=-2)
|
1321 |
+
return torch.cat((-x2, x1), dim=-1)
|
1322 |
+
|
1323 |
+
|
1324 |
+
def apply_rotary_pos_emb(t, freqs):
|
1325 |
+
""" Apply rotary embedding to the first rotary_dim of the iput
|
1326 |
+
|
1327 |
+
Arguments:
|
1328 |
+
t (tensor(batch_size, seq_len, n_head, head_dim)):
|
1329 |
+
the input embedding/hidden states
|
1330 |
+
freqs (list[tensor(1, seq_len, 1, rotary_dim), tensor(1, seq_len, 1, rotary_dim)]):
|
1331 |
+
the cached cos/sin position embeddings
|
1332 |
+
"""
|
1333 |
+
rot_dim = freqs[0].shape[-1]
|
1334 |
+
cos, sin = freqs
|
1335 |
+
t_float = t.float()
|
1336 |
+
if apply_rotary_emb_func is not None and t.is_cuda:
|
1337 |
+
# apply_rotary_emb in flash_attn requires cos/sin to be of
|
1338 |
+
# shape (seqlen, rotary_dim / 2) and apply rotary embedding
|
1339 |
+
# to the first rotary_dim of the input
|
1340 |
+
cos = cos.squeeze(0).squeeze(1)[:, : rot_dim // 2]
|
1341 |
+
sin = sin.squeeze(0).squeeze(1)[:, : rot_dim // 2]
|
1342 |
+
return apply_rotary_emb_func(t_float, cos, sin).type_as(t)
|
1343 |
+
else:
|
1344 |
+
t_rot, t_pass = t_float[..., :rot_dim], t_float[..., rot_dim:]
|
1345 |
+
t_rot = (t_rot * cos) + (_rotate_half(t_rot) * sin)
|
1346 |
+
return torch.cat((t_rot, t_pass), dim=-1).type_as(t)
|
1347 |
+
|
1348 |
+
|
1349 |
+
class RMSNorm(torch.nn.Module):
|
1350 |
+
def __init__(self, dim: int, eps: float = 1e-6):
|
1351 |
+
super().__init__()
|
1352 |
+
self.eps = eps
|
1353 |
+
self.weight = nn.Parameter(torch.ones(dim))
|
1354 |
+
|
1355 |
+
def _norm(self, x):
|
1356 |
+
return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)
|
1357 |
+
|
1358 |
+
def forward(self, x):
|
1359 |
+
if rms_norm is not None and x.is_cuda:
|
1360 |
+
return rms_norm(x, self.weight, self.eps)
|
1361 |
+
else:
|
1362 |
+
output = self._norm(x.float()).type_as(x)
|
1363 |
+
return output * self.weight
|
pytorch_model.bin.index.json
ADDED
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"metadata": {
|
3 |
+
"total_size": 28334581760
|
4 |
+
},
|
5 |
+
"weight_map": {
|
6 |
+
"lm_head.weight": "pytorch_model-00003-of-00003.bin",
|
7 |
+
"transformer.h.0.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
|
8 |
+
"transformer.h.0.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
|
9 |
+
"transformer.h.0.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
10 |
+
"transformer.h.0.ln_1.weight": "pytorch_model-00001-of-00003.bin",
|
11 |
+
"transformer.h.0.ln_2.weight": "pytorch_model-00001-of-00003.bin",
|
12 |
+
"transformer.h.0.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
13 |
+
"transformer.h.0.mlp.w1.weight": "pytorch_model-00001-of-00003.bin",
|
14 |
+
"transformer.h.0.mlp.w2.weight": "pytorch_model-00001-of-00003.bin",
|
15 |
+
"transformer.h.1.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
|
16 |
+
"transformer.h.1.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
|
17 |
+
"transformer.h.1.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
18 |
+
"transformer.h.1.ln_1.weight": "pytorch_model-00001-of-00003.bin",
|
19 |
+
"transformer.h.1.ln_2.weight": "pytorch_model-00001-of-00003.bin",
|
20 |
+
"transformer.h.1.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
21 |
+
"transformer.h.1.mlp.w1.weight": "pytorch_model-00001-of-00003.bin",
|
22 |
+
"transformer.h.1.mlp.w2.weight": "pytorch_model-00001-of-00003.bin",
|
23 |
+
"transformer.h.10.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
|
24 |
+
"transformer.h.10.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
|
25 |
+
"transformer.h.10.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
26 |
+
"transformer.h.10.ln_1.weight": "pytorch_model-00001-of-00003.bin",
|
27 |
+
"transformer.h.10.ln_2.weight": "pytorch_model-00001-of-00003.bin",
|
28 |
+
"transformer.h.10.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
29 |
+
"transformer.h.10.mlp.w1.weight": "pytorch_model-00001-of-00003.bin",
|
30 |
+
"transformer.h.10.mlp.w2.weight": "pytorch_model-00001-of-00003.bin",
|
31 |
+
"transformer.h.11.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
|
32 |
+
"transformer.h.11.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
|
33 |
+
"transformer.h.11.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
34 |
+
"transformer.h.11.ln_1.weight": "pytorch_model-00001-of-00003.bin",
|
35 |
+
"transformer.h.11.ln_2.weight": "pytorch_model-00001-of-00003.bin",
|
36 |
+
"transformer.h.11.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
37 |
+
"transformer.h.11.mlp.w1.weight": "pytorch_model-00001-of-00003.bin",
|
38 |
+
"transformer.h.11.mlp.w2.weight": "pytorch_model-00001-of-00003.bin",
|
39 |
+
"transformer.h.12.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
|
40 |
+
"transformer.h.12.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
|
41 |
+
"transformer.h.12.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
42 |
+
"transformer.h.12.ln_1.weight": "pytorch_model-00001-of-00003.bin",
|
43 |
+
"transformer.h.12.ln_2.weight": "pytorch_model-00001-of-00003.bin",
|
44 |
+
"transformer.h.12.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
45 |
+
"transformer.h.12.mlp.w1.weight": "pytorch_model-00001-of-00003.bin",
|
46 |
+
"transformer.h.12.mlp.w2.weight": "pytorch_model-00001-of-00003.bin",
|
47 |
+
"transformer.h.13.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
|
48 |
+
"transformer.h.13.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
|
49 |
+
"transformer.h.13.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
50 |
+
"transformer.h.13.ln_1.weight": "pytorch_model-00001-of-00003.bin",
|
51 |
+
"transformer.h.13.ln_2.weight": "pytorch_model-00001-of-00003.bin",
|
52 |
+
"transformer.h.13.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
53 |
+
"transformer.h.13.mlp.w1.weight": "pytorch_model-00002-of-00003.bin",
|
54 |
+
"transformer.h.13.mlp.w2.weight": "pytorch_model-00002-of-00003.bin",
|
55 |
+
"transformer.h.14.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
|
56 |
+
"transformer.h.14.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
|
57 |
+
"transformer.h.14.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
58 |
+
"transformer.h.14.ln_1.weight": "pytorch_model-00002-of-00003.bin",
|
59 |
+
"transformer.h.14.ln_2.weight": "pytorch_model-00002-of-00003.bin",
|
60 |
+
"transformer.h.14.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
61 |
+
"transformer.h.14.mlp.w1.weight": "pytorch_model-00002-of-00003.bin",
|
62 |
+
"transformer.h.14.mlp.w2.weight": "pytorch_model-00002-of-00003.bin",
|
63 |
+
"transformer.h.15.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
|
64 |
+
"transformer.h.15.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
|
65 |
+
"transformer.h.15.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
66 |
+
"transformer.h.15.ln_1.weight": "pytorch_model-00002-of-00003.bin",
|
67 |
+
"transformer.h.15.ln_2.weight": "pytorch_model-00002-of-00003.bin",
|
68 |
+
"transformer.h.15.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
69 |
+
"transformer.h.15.mlp.w1.weight": "pytorch_model-00002-of-00003.bin",
|
70 |
+
"transformer.h.15.mlp.w2.weight": "pytorch_model-00002-of-00003.bin",
|
71 |
+
"transformer.h.16.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
|
72 |
+
"transformer.h.16.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
|
73 |
+
"transformer.h.16.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
74 |
+
"transformer.h.16.ln_1.weight": "pytorch_model-00002-of-00003.bin",
|
75 |
+
"transformer.h.16.ln_2.weight": "pytorch_model-00002-of-00003.bin",
|
76 |
+
"transformer.h.16.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
77 |
+
"transformer.h.16.mlp.w1.weight": "pytorch_model-00002-of-00003.bin",
|
78 |
+
"transformer.h.16.mlp.w2.weight": "pytorch_model-00002-of-00003.bin",
|
79 |
+
"transformer.h.17.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
|
80 |
+
"transformer.h.17.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
|
81 |
+
"transformer.h.17.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
82 |
+
"transformer.h.17.ln_1.weight": "pytorch_model-00002-of-00003.bin",
|
83 |
+
"transformer.h.17.ln_2.weight": "pytorch_model-00002-of-00003.bin",
|
84 |
+
"transformer.h.17.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
85 |
+
"transformer.h.17.mlp.w1.weight": "pytorch_model-00002-of-00003.bin",
|
86 |
+
"transformer.h.17.mlp.w2.weight": "pytorch_model-00002-of-00003.bin",
|
87 |
+
"transformer.h.18.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
|
88 |
+
"transformer.h.18.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
|
89 |
+
"transformer.h.18.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
90 |
+
"transformer.h.18.ln_1.weight": "pytorch_model-00002-of-00003.bin",
|
91 |
+
"transformer.h.18.ln_2.weight": "pytorch_model-00002-of-00003.bin",
|
92 |
+
"transformer.h.18.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
93 |
+
"transformer.h.18.mlp.w1.weight": "pytorch_model-00002-of-00003.bin",
|
94 |
+
"transformer.h.18.mlp.w2.weight": "pytorch_model-00002-of-00003.bin",
|
95 |
+
"transformer.h.19.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
|
96 |
+
"transformer.h.19.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
|
97 |
+
"transformer.h.19.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
98 |
+
"transformer.h.19.ln_1.weight": "pytorch_model-00002-of-00003.bin",
|
99 |
+
"transformer.h.19.ln_2.weight": "pytorch_model-00002-of-00003.bin",
|
100 |
+
"transformer.h.19.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
101 |
+
"transformer.h.19.mlp.w1.weight": "pytorch_model-00002-of-00003.bin",
|
102 |
+
"transformer.h.19.mlp.w2.weight": "pytorch_model-00002-of-00003.bin",
|
103 |
+
"transformer.h.2.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
|
104 |
+
"transformer.h.2.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
|
105 |
+
"transformer.h.2.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
106 |
+
"transformer.h.2.ln_1.weight": "pytorch_model-00001-of-00003.bin",
|
107 |
+
"transformer.h.2.ln_2.weight": "pytorch_model-00001-of-00003.bin",
|
108 |
+
"transformer.h.2.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
109 |
+
"transformer.h.2.mlp.w1.weight": "pytorch_model-00001-of-00003.bin",
|
110 |
+
"transformer.h.2.mlp.w2.weight": "pytorch_model-00001-of-00003.bin",
|
111 |
+
"transformer.h.20.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
|
112 |
+
"transformer.h.20.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
|
113 |
+
"transformer.h.20.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
114 |
+
"transformer.h.20.ln_1.weight": "pytorch_model-00002-of-00003.bin",
|
115 |
+
"transformer.h.20.ln_2.weight": "pytorch_model-00002-of-00003.bin",
|
116 |
+
"transformer.h.20.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
117 |
+
"transformer.h.20.mlp.w1.weight": "pytorch_model-00002-of-00003.bin",
|
118 |
+
"transformer.h.20.mlp.w2.weight": "pytorch_model-00002-of-00003.bin",
|
119 |
+
"transformer.h.21.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
|
120 |
+
"transformer.h.21.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
|
121 |
+
"transformer.h.21.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
122 |
+
"transformer.h.21.ln_1.weight": "pytorch_model-00002-of-00003.bin",
|
123 |
+
"transformer.h.21.ln_2.weight": "pytorch_model-00002-of-00003.bin",
|
124 |
+
"transformer.h.21.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
125 |
+
"transformer.h.21.mlp.w1.weight": "pytorch_model-00002-of-00003.bin",
|
126 |
+
"transformer.h.21.mlp.w2.weight": "pytorch_model-00002-of-00003.bin",
|
127 |
+
"transformer.h.22.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
|
128 |
+
"transformer.h.22.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
|
129 |
+
"transformer.h.22.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
130 |
+
"transformer.h.22.ln_1.weight": "pytorch_model-00002-of-00003.bin",
|
131 |
+
"transformer.h.22.ln_2.weight": "pytorch_model-00002-of-00003.bin",
|
132 |
+
"transformer.h.22.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
133 |
+
"transformer.h.22.mlp.w1.weight": "pytorch_model-00002-of-00003.bin",
|
134 |
+
"transformer.h.22.mlp.w2.weight": "pytorch_model-00002-of-00003.bin",
|
135 |
+
"transformer.h.23.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
|
136 |
+
"transformer.h.23.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
|
137 |
+
"transformer.h.23.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
138 |
+
"transformer.h.23.ln_1.weight": "pytorch_model-00002-of-00003.bin",
|
139 |
+
"transformer.h.23.ln_2.weight": "pytorch_model-00002-of-00003.bin",
|
140 |
+
"transformer.h.23.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
141 |
+
"transformer.h.23.mlp.w1.weight": "pytorch_model-00002-of-00003.bin",
|
142 |
+
"transformer.h.23.mlp.w2.weight": "pytorch_model-00002-of-00003.bin",
|
143 |
+
"transformer.h.24.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
|
144 |
+
"transformer.h.24.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
|
145 |
+
"transformer.h.24.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
146 |
+
"transformer.h.24.ln_1.weight": "pytorch_model-00002-of-00003.bin",
|
147 |
+
"transformer.h.24.ln_2.weight": "pytorch_model-00002-of-00003.bin",
|
148 |
+
"transformer.h.24.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
149 |
+
"transformer.h.24.mlp.w1.weight": "pytorch_model-00002-of-00003.bin",
|
150 |
+
"transformer.h.24.mlp.w2.weight": "pytorch_model-00002-of-00003.bin",
|
151 |
+
"transformer.h.25.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
|
152 |
+
"transformer.h.25.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
|
153 |
+
"transformer.h.25.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
154 |
+
"transformer.h.25.ln_1.weight": "pytorch_model-00002-of-00003.bin",
|
155 |
+
"transformer.h.25.ln_2.weight": "pytorch_model-00002-of-00003.bin",
|
156 |
+
"transformer.h.25.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
157 |
+
"transformer.h.25.mlp.w1.weight": "pytorch_model-00002-of-00003.bin",
|
158 |
+
"transformer.h.25.mlp.w2.weight": "pytorch_model-00002-of-00003.bin",
|
159 |
+
"transformer.h.26.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
|
160 |
+
"transformer.h.26.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
|
161 |
+
"transformer.h.26.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
162 |
+
"transformer.h.26.ln_1.weight": "pytorch_model-00002-of-00003.bin",
|
163 |
+
"transformer.h.26.ln_2.weight": "pytorch_model-00002-of-00003.bin",
|
164 |
+
"transformer.h.26.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
165 |
+
"transformer.h.26.mlp.w1.weight": "pytorch_model-00002-of-00003.bin",
|
166 |
+
"transformer.h.26.mlp.w2.weight": "pytorch_model-00002-of-00003.bin",
|
167 |
+
"transformer.h.27.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
|
168 |
+
"transformer.h.27.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
|
169 |
+
"transformer.h.27.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
170 |
+
"transformer.h.27.ln_1.weight": "pytorch_model-00002-of-00003.bin",
|
171 |
+
"transformer.h.27.ln_2.weight": "pytorch_model-00002-of-00003.bin",
|
172 |
+
"transformer.h.27.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
173 |
+
"transformer.h.27.mlp.w1.weight": "pytorch_model-00002-of-00003.bin",
|
174 |
+
"transformer.h.27.mlp.w2.weight": "pytorch_model-00002-of-00003.bin",
|
175 |
+
"transformer.h.28.attn.c_attn.bias": "pytorch_model-00002-of-00003.bin",
|
176 |
+
"transformer.h.28.attn.c_attn.weight": "pytorch_model-00002-of-00003.bin",
|
177 |
+
"transformer.h.28.attn.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
178 |
+
"transformer.h.28.ln_1.weight": "pytorch_model-00002-of-00003.bin",
|
179 |
+
"transformer.h.28.ln_2.weight": "pytorch_model-00002-of-00003.bin",
|
180 |
+
"transformer.h.28.mlp.c_proj.weight": "pytorch_model-00002-of-00003.bin",
|
181 |
+
"transformer.h.28.mlp.w1.weight": "pytorch_model-00002-of-00003.bin",
|
182 |
+
"transformer.h.28.mlp.w2.weight": "pytorch_model-00002-of-00003.bin",
|
183 |
+
"transformer.h.29.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
|
184 |
+
"transformer.h.29.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
|
185 |
+
"transformer.h.29.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
186 |
+
"transformer.h.29.ln_1.weight": "pytorch_model-00002-of-00003.bin",
|
187 |
+
"transformer.h.29.ln_2.weight": "pytorch_model-00003-of-00003.bin",
|
188 |
+
"transformer.h.29.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
189 |
+
"transformer.h.29.mlp.w1.weight": "pytorch_model-00003-of-00003.bin",
|
190 |
+
"transformer.h.29.mlp.w2.weight": "pytorch_model-00003-of-00003.bin",
|
191 |
+
"transformer.h.3.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
|
192 |
+
"transformer.h.3.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
|
193 |
+
"transformer.h.3.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
194 |
+
"transformer.h.3.ln_1.weight": "pytorch_model-00001-of-00003.bin",
|
195 |
+
"transformer.h.3.ln_2.weight": "pytorch_model-00001-of-00003.bin",
|
196 |
+
"transformer.h.3.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
197 |
+
"transformer.h.3.mlp.w1.weight": "pytorch_model-00001-of-00003.bin",
|
198 |
+
"transformer.h.3.mlp.w2.weight": "pytorch_model-00001-of-00003.bin",
|
199 |
+
"transformer.h.30.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
|
200 |
+
"transformer.h.30.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
|
201 |
+
"transformer.h.30.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
202 |
+
"transformer.h.30.ln_1.weight": "pytorch_model-00003-of-00003.bin",
|
203 |
+
"transformer.h.30.ln_2.weight": "pytorch_model-00003-of-00003.bin",
|
204 |
+
"transformer.h.30.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
205 |
+
"transformer.h.30.mlp.w1.weight": "pytorch_model-00003-of-00003.bin",
|
206 |
+
"transformer.h.30.mlp.w2.weight": "pytorch_model-00003-of-00003.bin",
|
207 |
+
"transformer.h.31.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
|
208 |
+
"transformer.h.31.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
|
209 |
+
"transformer.h.31.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
210 |
+
"transformer.h.31.ln_1.weight": "pytorch_model-00003-of-00003.bin",
|
211 |
+
"transformer.h.31.ln_2.weight": "pytorch_model-00003-of-00003.bin",
|
212 |
+
"transformer.h.31.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
213 |
+
"transformer.h.31.mlp.w1.weight": "pytorch_model-00003-of-00003.bin",
|
214 |
+
"transformer.h.31.mlp.w2.weight": "pytorch_model-00003-of-00003.bin",
|
215 |
+
"transformer.h.32.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
|
216 |
+
"transformer.h.32.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
|
217 |
+
"transformer.h.32.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
218 |
+
"transformer.h.32.ln_1.weight": "pytorch_model-00003-of-00003.bin",
|
219 |
+
"transformer.h.32.ln_2.weight": "pytorch_model-00003-of-00003.bin",
|
220 |
+
"transformer.h.32.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
221 |
+
"transformer.h.32.mlp.w1.weight": "pytorch_model-00003-of-00003.bin",
|
222 |
+
"transformer.h.32.mlp.w2.weight": "pytorch_model-00003-of-00003.bin",
|
223 |
+
"transformer.h.33.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
|
224 |
+
"transformer.h.33.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
|
225 |
+
"transformer.h.33.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
226 |
+
"transformer.h.33.ln_1.weight": "pytorch_model-00003-of-00003.bin",
|
227 |
+
"transformer.h.33.ln_2.weight": "pytorch_model-00003-of-00003.bin",
|
228 |
+
"transformer.h.33.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
229 |
+
"transformer.h.33.mlp.w1.weight": "pytorch_model-00003-of-00003.bin",
|
230 |
+
"transformer.h.33.mlp.w2.weight": "pytorch_model-00003-of-00003.bin",
|
231 |
+
"transformer.h.34.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
|
232 |
+
"transformer.h.34.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
|
233 |
+
"transformer.h.34.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
234 |
+
"transformer.h.34.ln_1.weight": "pytorch_model-00003-of-00003.bin",
|
235 |
+
"transformer.h.34.ln_2.weight": "pytorch_model-00003-of-00003.bin",
|
236 |
+
"transformer.h.34.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
237 |
+
"transformer.h.34.mlp.w1.weight": "pytorch_model-00003-of-00003.bin",
|
238 |
+
"transformer.h.34.mlp.w2.weight": "pytorch_model-00003-of-00003.bin",
|
239 |
+
"transformer.h.35.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
|
240 |
+
"transformer.h.35.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
|
241 |
+
"transformer.h.35.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
242 |
+
"transformer.h.35.ln_1.weight": "pytorch_model-00003-of-00003.bin",
|
243 |
+
"transformer.h.35.ln_2.weight": "pytorch_model-00003-of-00003.bin",
|
244 |
+
"transformer.h.35.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
245 |
+
"transformer.h.35.mlp.w1.weight": "pytorch_model-00003-of-00003.bin",
|
246 |
+
"transformer.h.35.mlp.w2.weight": "pytorch_model-00003-of-00003.bin",
|
247 |
+
"transformer.h.36.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
|
248 |
+
"transformer.h.36.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
|
249 |
+
"transformer.h.36.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
250 |
+
"transformer.h.36.ln_1.weight": "pytorch_model-00003-of-00003.bin",
|
251 |
+
"transformer.h.36.ln_2.weight": "pytorch_model-00003-of-00003.bin",
|
252 |
+
"transformer.h.36.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
253 |
+
"transformer.h.36.mlp.w1.weight": "pytorch_model-00003-of-00003.bin",
|
254 |
+
"transformer.h.36.mlp.w2.weight": "pytorch_model-00003-of-00003.bin",
|
255 |
+
"transformer.h.37.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
|
256 |
+
"transformer.h.37.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
|
257 |
+
"transformer.h.37.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
258 |
+
"transformer.h.37.ln_1.weight": "pytorch_model-00003-of-00003.bin",
|
259 |
+
"transformer.h.37.ln_2.weight": "pytorch_model-00003-of-00003.bin",
|
260 |
+
"transformer.h.37.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
261 |
+
"transformer.h.37.mlp.w1.weight": "pytorch_model-00003-of-00003.bin",
|
262 |
+
"transformer.h.37.mlp.w2.weight": "pytorch_model-00003-of-00003.bin",
|
263 |
+
"transformer.h.38.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
|
264 |
+
"transformer.h.38.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
|
265 |
+
"transformer.h.38.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
266 |
+
"transformer.h.38.ln_1.weight": "pytorch_model-00003-of-00003.bin",
|
267 |
+
"transformer.h.38.ln_2.weight": "pytorch_model-00003-of-00003.bin",
|
268 |
+
"transformer.h.38.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
269 |
+
"transformer.h.38.mlp.w1.weight": "pytorch_model-00003-of-00003.bin",
|
270 |
+
"transformer.h.38.mlp.w2.weight": "pytorch_model-00003-of-00003.bin",
|
271 |
+
"transformer.h.39.attn.c_attn.bias": "pytorch_model-00003-of-00003.bin",
|
272 |
+
"transformer.h.39.attn.c_attn.weight": "pytorch_model-00003-of-00003.bin",
|
273 |
+
"transformer.h.39.attn.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
274 |
+
"transformer.h.39.ln_1.weight": "pytorch_model-00003-of-00003.bin",
|
275 |
+
"transformer.h.39.ln_2.weight": "pytorch_model-00003-of-00003.bin",
|
276 |
+
"transformer.h.39.mlp.c_proj.weight": "pytorch_model-00003-of-00003.bin",
|
277 |
+
"transformer.h.39.mlp.w1.weight": "pytorch_model-00003-of-00003.bin",
|
278 |
+
"transformer.h.39.mlp.w2.weight": "pytorch_model-00003-of-00003.bin",
|
279 |
+
"transformer.h.4.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
|
280 |
+
"transformer.h.4.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
|
281 |
+
"transformer.h.4.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
282 |
+
"transformer.h.4.ln_1.weight": "pytorch_model-00001-of-00003.bin",
|
283 |
+
"transformer.h.4.ln_2.weight": "pytorch_model-00001-of-00003.bin",
|
284 |
+
"transformer.h.4.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
285 |
+
"transformer.h.4.mlp.w1.weight": "pytorch_model-00001-of-00003.bin",
|
286 |
+
"transformer.h.4.mlp.w2.weight": "pytorch_model-00001-of-00003.bin",
|
287 |
+
"transformer.h.5.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
|
288 |
+
"transformer.h.5.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
|
289 |
+
"transformer.h.5.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
290 |
+
"transformer.h.5.ln_1.weight": "pytorch_model-00001-of-00003.bin",
|
291 |
+
"transformer.h.5.ln_2.weight": "pytorch_model-00001-of-00003.bin",
|
292 |
+
"transformer.h.5.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
293 |
+
"transformer.h.5.mlp.w1.weight": "pytorch_model-00001-of-00003.bin",
|
294 |
+
"transformer.h.5.mlp.w2.weight": "pytorch_model-00001-of-00003.bin",
|
295 |
+
"transformer.h.6.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
|
296 |
+
"transformer.h.6.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
|
297 |
+
"transformer.h.6.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
298 |
+
"transformer.h.6.ln_1.weight": "pytorch_model-00001-of-00003.bin",
|
299 |
+
"transformer.h.6.ln_2.weight": "pytorch_model-00001-of-00003.bin",
|
300 |
+
"transformer.h.6.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
301 |
+
"transformer.h.6.mlp.w1.weight": "pytorch_model-00001-of-00003.bin",
|
302 |
+
"transformer.h.6.mlp.w2.weight": "pytorch_model-00001-of-00003.bin",
|
303 |
+
"transformer.h.7.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
|
304 |
+
"transformer.h.7.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
|
305 |
+
"transformer.h.7.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
306 |
+
"transformer.h.7.ln_1.weight": "pytorch_model-00001-of-00003.bin",
|
307 |
+
"transformer.h.7.ln_2.weight": "pytorch_model-00001-of-00003.bin",
|
308 |
+
"transformer.h.7.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
309 |
+
"transformer.h.7.mlp.w1.weight": "pytorch_model-00001-of-00003.bin",
|
310 |
+
"transformer.h.7.mlp.w2.weight": "pytorch_model-00001-of-00003.bin",
|
311 |
+
"transformer.h.8.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
|
312 |
+
"transformer.h.8.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
|
313 |
+
"transformer.h.8.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
314 |
+
"transformer.h.8.ln_1.weight": "pytorch_model-00001-of-00003.bin",
|
315 |
+
"transformer.h.8.ln_2.weight": "pytorch_model-00001-of-00003.bin",
|
316 |
+
"transformer.h.8.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
317 |
+
"transformer.h.8.mlp.w1.weight": "pytorch_model-00001-of-00003.bin",
|
318 |
+
"transformer.h.8.mlp.w2.weight": "pytorch_model-00001-of-00003.bin",
|
319 |
+
"transformer.h.9.attn.c_attn.bias": "pytorch_model-00001-of-00003.bin",
|
320 |
+
"transformer.h.9.attn.c_attn.weight": "pytorch_model-00001-of-00003.bin",
|
321 |
+
"transformer.h.9.attn.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
322 |
+
"transformer.h.9.ln_1.weight": "pytorch_model-00001-of-00003.bin",
|
323 |
+
"transformer.h.9.ln_2.weight": "pytorch_model-00001-of-00003.bin",
|
324 |
+
"transformer.h.9.mlp.c_proj.weight": "pytorch_model-00001-of-00003.bin",
|
325 |
+
"transformer.h.9.mlp.w1.weight": "pytorch_model-00001-of-00003.bin",
|
326 |
+
"transformer.h.9.mlp.w2.weight": "pytorch_model-00001-of-00003.bin",
|
327 |
+
"transformer.ln_f.weight": "pytorch_model-00003-of-00003.bin",
|
328 |
+
"transformer.wte.weight": "pytorch_model-00001-of-00003.bin"
|
329 |
+
}
|
330 |
+
}
|
qwen.tiktoken
ADDED
The di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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Alibaba Cloud.
|
2 |
+
#
|
3 |
+
# This source code is licensed under the license found in the
|
4 |
+
# LICENSE file in the root directory of this source tree.
|
5 |
+
|
6 |
+
"""Generation support."""
|
7 |
+
|
8 |
+
from typing import Tuple, List, Union, Iterable
|
9 |
+
|
10 |
+
import numpy as np
|
11 |
+
import torch
|
12 |
+
import torch.nn.functional as F
|
13 |
+
from transformers import PreTrainedTokenizer
|
14 |
+
from transformers import logging
|
15 |
+
from transformers.generation import LogitsProcessor
|
16 |
+
|
17 |
+
logger = logging.get_logger(__name__)
|
18 |
+
|
19 |
+
# Types.
|
20 |
+
HistoryType = List[Tuple[str, str]]
|
21 |
+
TokensType = List[int]
|
22 |
+
BatchTokensType = List[List[int]]
|
23 |
+
|
24 |
+
|
25 |
+
def pad_batch(batch: BatchTokensType, pad_id: int, seq_length: int) -> BatchTokensType:
|
26 |
+
for tokens in batch:
|
27 |
+
context_length = len(tokens)
|
28 |
+
if context_length < seq_length:
|
29 |
+
tokens.extend([pad_id] * (seq_length - context_length))
|
30 |
+
return batch
|
31 |
+
|
32 |
+
|
33 |
+
def get_ltor_masks_and_position_ids(
|
34 |
+
data,
|
35 |
+
eod_token,
|
36 |
+
reset_position_ids,
|
37 |
+
reset_attention_mask,
|
38 |
+
eod_mask_loss,
|
39 |
+
):
|
40 |
+
"""Build masks and position id for left to right model."""
|
41 |
+
|
42 |
+
# Extract batch size and sequence length.
|
43 |
+
micro_batch_size, seq_length = data.size()
|
44 |
+
|
45 |
+
# Attention mask (lower triangular).
|
46 |
+
if reset_attention_mask:
|
47 |
+
att_mask_batch = micro_batch_size
|
48 |
+
else:
|
49 |
+
att_mask_batch = 1
|
50 |
+
attention_mask = torch.tril(
|
51 |
+
torch.ones((att_mask_batch, seq_length, seq_length), device=data.device)
|
52 |
+
).view(att_mask_batch, 1, seq_length, seq_length)
|
53 |
+
|
54 |
+
# Loss mask.
|
55 |
+
loss_mask = torch.ones(data.size(), dtype=torch.float, device=data.device)
|
56 |
+
if eod_mask_loss:
|
57 |
+
loss_mask[data == eod_token] = 0.0
|
58 |
+
|
59 |
+
# Position ids.
|
60 |
+
position_ids = torch.arange(seq_length, dtype=torch.long, device=data.device)
|
61 |
+
position_ids = position_ids.unsqueeze(0).expand_as(data)
|
62 |
+
# We need to clone as the ids will be modifed based on batch index.
|
63 |
+
if reset_position_ids:
|
64 |
+
position_ids = position_ids.clone()
|
65 |
+
|
66 |
+
if reset_position_ids or reset_attention_mask:
|
67 |
+
# Loop through the batches:
|
68 |
+
for b in range(micro_batch_size):
|
69 |
+
|
70 |
+
# Find indecies where EOD token is.
|
71 |
+
eod_index = position_ids[b, data[b] == eod_token]
|
72 |
+
# Detach indecies from positions if going to modify positions.
|
73 |
+
if reset_position_ids:
|
74 |
+
eod_index = eod_index.clone()
|
75 |
+
|
76 |
+
# Loop through EOD indecies:
|
77 |
+
prev_index = 0
|
78 |
+
for j in range(eod_index.size()[0]):
|
79 |
+
i = eod_index[j]
|
80 |
+
# Mask attention loss.
|
81 |
+
if reset_attention_mask:
|
82 |
+
attention_mask[b, 0, (i + 1) :, : (i + 1)] = 0
|
83 |
+
# Reset positions.
|
84 |
+
if reset_position_ids:
|
85 |
+
position_ids[b, (i + 1) :] -= i + 1 - prev_index
|
86 |
+
prev_index = i + 1
|
87 |
+
|
88 |
+
# Convert attention mask to binary:
|
89 |
+
attention_mask = attention_mask < 0.5
|
90 |
+
|
91 |
+
return attention_mask, loss_mask, position_ids
|
92 |
+
|
93 |
+
|
94 |
+
def get_batch(context_tokens: torch.LongTensor, eod_id: int):
|
95 |
+
"""Generate batch from context tokens."""
|
96 |
+
# Move to GPU.
|
97 |
+
tokens = context_tokens.contiguous().to(context_tokens.device)
|
98 |
+
# Get the attention mask and postition ids.
|
99 |
+
attention_mask, _, position_ids = get_ltor_masks_and_position_ids(
|
100 |
+
tokens,
|
101 |
+
eod_id,
|
102 |
+
reset_position_ids=False,
|
103 |
+
reset_attention_mask=False,
|
104 |
+
eod_mask_loss=False,
|
105 |
+
)
|
106 |
+
return tokens, attention_mask, position_ids
|
107 |
+
|
108 |
+
|
109 |
+
def get_stop_words_ids(chat_format, tokenizer):
|
110 |
+
if chat_format == "raw":
|
111 |
+
stop_words_ids = [tokenizer.encode("Human:"), [tokenizer.eod_id]]
|
112 |
+
elif chat_format == "chatml":
|
113 |
+
stop_words_ids = [[tokenizer.im_end_id], [tokenizer.im_start_id]]
|
114 |
+
else:
|
115 |
+
raise NotImplementedError(f"Unknown chat format {chat_format!r}")
|
116 |
+
return stop_words_ids
|
117 |
+
|
118 |
+
|
119 |
+
def make_context(
|
120 |
+
tokenizer: PreTrainedTokenizer,
|
121 |
+
query: str,
|
122 |
+
history: List[Tuple[str, str]] = None,
|
123 |
+
system: str = "",
|
124 |
+
max_window_size: int = 6144,
|
125 |
+
chat_format: str = "chatml",
|
126 |
+
):
|
127 |
+
if history is None:
|
128 |
+
history = []
|
129 |
+
|
130 |
+
if chat_format == "chatml":
|
131 |
+
im_start, im_end = "<|im_start|>", "<|im_end|>"
|
132 |
+
im_start_tokens = [tokenizer.im_start_id]
|
133 |
+
im_end_tokens = [tokenizer.im_end_id]
|
134 |
+
nl_tokens = tokenizer.encode("\n")
|
135 |
+
|
136 |
+
def _tokenize_str(role, content):
|
137 |
+
return f"{role}\n{content}", tokenizer.encode(
|
138 |
+
role, allowed_special=set()
|
139 |
+
) + nl_tokens + tokenizer.encode(content, allowed_special=set())
|
140 |
+
|
141 |
+
system_text, system_tokens_part = _tokenize_str("system", system)
|
142 |
+
system_tokens = im_start_tokens + system_tokens_part + im_end_tokens
|
143 |
+
|
144 |
+
raw_text = ""
|
145 |
+
context_tokens = []
|
146 |
+
|
147 |
+
for turn_query, turn_response in reversed(history):
|
148 |
+
query_text, query_tokens_part = _tokenize_str("user", turn_query)
|
149 |
+
query_tokens = im_start_tokens + query_tokens_part + im_end_tokens
|
150 |
+
response_text, response_tokens_part = _tokenize_str(
|
151 |
+
"assistant", turn_response
|
152 |
+
)
|
153 |
+
response_tokens = im_start_tokens + response_tokens_part + im_end_tokens
|
154 |
+
|
155 |
+
next_context_tokens = nl_tokens + query_tokens + nl_tokens + response_tokens
|
156 |
+
prev_chat = (
|
157 |
+
f"\n{im_start}{query_text}{im_end}\n{im_start}{response_text}{im_end}"
|
158 |
+
)
|
159 |
+
|
160 |
+
current_context_size = (
|
161 |
+
len(system_tokens) + len(next_context_tokens) + len(context_tokens)
|
162 |
+
)
|
163 |
+
if current_context_size < max_window_size:
|
164 |
+
context_tokens = next_context_tokens + context_tokens
|
165 |
+
raw_text = prev_chat + raw_text
|
166 |
+
else:
|
167 |
+
break
|
168 |
+
|
169 |
+
context_tokens = system_tokens + context_tokens
|
170 |
+
raw_text = f"{im_start}{system_text}{im_end}" + raw_text
|
171 |
+
context_tokens += (
|
172 |
+
nl_tokens
|
173 |
+
+ im_start_tokens
|
174 |
+
+ _tokenize_str("user", query)[1]
|
175 |
+
+ im_end_tokens
|
176 |
+
+ nl_tokens
|
177 |
+
+ im_start_tokens
|
178 |
+
+ tokenizer.encode("assistant")
|
179 |
+
+ nl_tokens
|
180 |
+
)
|
181 |
+
raw_text += f"\n{im_start}user\n{query}{im_end}\n{im_start}assistant\n"
|
182 |
+
|
183 |
+
elif chat_format == "raw":
|
184 |
+
raw_text = query
|
185 |
+
context_tokens = tokenizer.encode(raw_text)
|
186 |
+
else:
|
187 |
+
raise NotImplementedError(f"Unknown chat format {chat_format!r}")
|
188 |
+
|
189 |
+
return raw_text, context_tokens
|
190 |
+
|
191 |
+
|
192 |
+
def _decode_default(
|
193 |
+
tokens: List[int],
|
194 |
+
*,
|
195 |
+
stop_words: List[str],
|
196 |
+
eod_words: List[str],
|
197 |
+
tokenizer: PreTrainedTokenizer,
|
198 |
+
raw_text_len: int,
|
199 |
+
verbose: bool = False,
|
200 |
+
return_end_reason: bool = False,
|
201 |
+
errors: str='replace',
|
202 |
+
):
|
203 |
+
trim_decode_tokens = tokenizer.decode(tokens, errors=errors)[raw_text_len:]
|
204 |
+
if verbose:
|
205 |
+
print("\nRaw Generate: ", trim_decode_tokens)
|
206 |
+
|
207 |
+
end_reason = f"Gen length {len(tokens)}"
|
208 |
+
for stop_word in stop_words:
|
209 |
+
trim_decode_tokens = trim_decode_tokens.replace(stop_word, "").strip()
|
210 |
+
for eod_word in eod_words:
|
211 |
+
if eod_word in trim_decode_tokens:
|
212 |
+
end_reason = f"Gen {eod_word!r}"
|
213 |
+
trim_decode_tokens = trim_decode_tokens.split(eod_word)[0]
|
214 |
+
trim_decode_tokens = trim_decode_tokens.strip()
|
215 |
+
if verbose:
|
216 |
+
print("\nEnd Reason:", end_reason)
|
217 |
+
print("\nGenerate: ", trim_decode_tokens)
|
218 |
+
|
219 |
+
if return_end_reason:
|
220 |
+
return trim_decode_tokens, end_reason
|
221 |
+
else:
|
222 |
+
return trim_decode_tokens
|
223 |
+
|
224 |
+
|
225 |
+
def _decode_chatml(
|
226 |
+
tokens: List[int],
|
227 |
+
*,
|
228 |
+
stop_words: List[str],
|
229 |
+
eod_token_ids: List[int],
|
230 |
+
tokenizer: PreTrainedTokenizer,
|
231 |
+
raw_text_len: int,
|
232 |
+
context_length: int,
|
233 |
+
verbose: bool = False,
|
234 |
+
return_end_reason: bool = False,
|
235 |
+
errors: str='replace'
|
236 |
+
):
|
237 |
+
end_reason = f"Gen length {len(tokens)}"
|
238 |
+
eod_token_idx = context_length
|
239 |
+
for eod_token_idx in range(context_length, len(tokens)):
|
240 |
+
if tokens[eod_token_idx] in eod_token_ids:
|
241 |
+
end_reason = f"Gen {tokenizer.decode([tokens[eod_token_idx]])!r}"
|
242 |
+
break
|
243 |
+
|
244 |
+
trim_decode_tokens = tokenizer.decode(tokens[:eod_token_idx], errors=errors)[raw_text_len:]
|
245 |
+
if verbose:
|
246 |
+
print("\nRaw Generate w/o EOD:", tokenizer.decode(tokens, errors=errors)[raw_text_len:])
|
247 |
+
print("\nRaw Generate:", trim_decode_tokens)
|
248 |
+
print("\nEnd Reason:", end_reason)
|
249 |
+
for stop_word in stop_words:
|
250 |
+
trim_decode_tokens = trim_decode_tokens.replace(stop_word, "").strip()
|
251 |
+
trim_decode_tokens = trim_decode_tokens.strip()
|
252 |
+
if verbose:
|
253 |
+
print("\nGenerate:", trim_decode_tokens)
|
254 |
+
|
255 |
+
if return_end_reason:
|
256 |
+
return trim_decode_tokens, end_reason
|
257 |
+
else:
|
258 |
+
return trim_decode_tokens
|
259 |
+
|
260 |
+
|
261 |
+
def decode_tokens(
|
262 |
+
tokens: Union[torch.LongTensor, TokensType],
|
263 |
+
tokenizer: PreTrainedTokenizer,
|
264 |
+
raw_text_len: int,
|
265 |
+
context_length: int,
|
266 |
+
chat_format: str,
|
267 |
+
verbose: bool = False,
|
268 |
+
return_end_reason: bool = False,
|
269 |
+
errors: str="replace",
|
270 |
+
) -> str:
|
271 |
+
if torch.is_tensor(tokens):
|
272 |
+
tokens = tokens.cpu().numpy().tolist()
|
273 |
+
|
274 |
+
if chat_format == "chatml":
|
275 |
+
return _decode_chatml(
|
276 |
+
tokens,
|
277 |
+
stop_words=[],
|
278 |
+
eod_token_ids=[tokenizer.im_start_id, tokenizer.im_end_id],
|
279 |
+
tokenizer=tokenizer,
|
280 |
+
raw_text_len=raw_text_len,
|
281 |
+
context_length=context_length,
|
282 |
+
verbose=verbose,
|
283 |
+
return_end_reason=return_end_reason,
|
284 |
+
errors=errors,
|
285 |
+
)
|
286 |
+
elif chat_format == "raw":
|
287 |
+
return _decode_default(
|
288 |
+
tokens,
|
289 |
+
stop_words=["<|endoftext|>"],
|
290 |
+
eod_words=["<|endoftext|>"],
|
291 |
+
tokenizer=tokenizer,
|
292 |
+
raw_text_len=raw_text_len,
|
293 |
+
verbose=verbose,
|
294 |
+
return_end_reason=return_end_reason,
|
295 |
+
errors=errors,
|
296 |
+
)
|
297 |
+
else:
|
298 |
+
raise NotImplementedError(f"Unknown chat format {chat_format!r}")
|
299 |
+
|
300 |
+
|
301 |
+
class StopWordsLogitsProcessor(LogitsProcessor):
|
302 |
+
"""
|
303 |
+
:class:`transformers.LogitsProcessor` that enforces that when specified sequences appear, stop geration.
|
304 |
+
|
305 |
+
Args:
|
306 |
+
stop_words_ids (:obj:`List[List[int]]`):
|
307 |
+
List of list of token ids of stop ids. In order to get the tokens of the words
|
308 |
+
that should not appear in the generated text, use :obj:`tokenizer(bad_word,
|
309 |
+
add_prefix_space=True).input_ids`.
|
310 |
+
eos_token_id (:obj:`int`):
|
311 |
+
The id of the `end-of-sequence` token.
|
312 |
+
"""
|
313 |
+
|
314 |
+
def __init__(self, stop_words_ids: Iterable[Iterable[int]], eos_token_id: int):
|
315 |
+
|
316 |
+
if not isinstance(stop_words_ids, List) or len(stop_words_ids) == 0:
|
317 |
+
raise ValueError(
|
318 |
+
f"`stop_words_ids` has to be a non-emtpy list, but is {stop_words_ids}."
|
319 |
+
)
|
320 |
+
if any(not isinstance(bad_word_ids, list) for bad_word_ids in stop_words_ids):
|
321 |
+
raise ValueError(
|
322 |
+
f"`stop_words_ids` has to be a list of lists, but is {stop_words_ids}."
|
323 |
+
)
|
324 |
+
if any(
|
325 |
+
any(
|
326 |
+
(not isinstance(token_id, (int, np.integer)) or token_id < 0)
|
327 |
+
for token_id in stop_word_ids
|
328 |
+
)
|
329 |
+
for stop_word_ids in stop_words_ids
|
330 |
+
):
|
331 |
+
raise ValueError(
|
332 |
+
f"Each list in `stop_words_ids` has to be a list of positive integers, but is {stop_words_ids}."
|
333 |
+
)
|
334 |
+
|
335 |
+
self.stop_words_ids = list(
|
336 |
+
filter(
|
337 |
+
lambda bad_token_seq: bad_token_seq != [eos_token_id], stop_words_ids
|
338 |
+
)
|
339 |
+
)
|
340 |
+
self.eos_token_id = eos_token_id
|
341 |
+
for stop_token_seq in self.stop_words_ids:
|
342 |
+
assert (
|
343 |
+
len(stop_token_seq) > 0
|
344 |
+
), "Stop words token sequences {} cannot have an empty list".format(
|
345 |
+
stop_words_ids
|
346 |
+
)
|
347 |
+
|
348 |
+
def __call__(
|
349 |
+
self, input_ids: torch.LongTensor, scores: torch.FloatTensor
|
350 |
+
) -> torch.FloatTensor:
|
351 |
+
stopped_samples = self._calc_stopped_samples(input_ids)
|
352 |
+
for i, should_stop in enumerate(stopped_samples):
|
353 |
+
if should_stop:
|
354 |
+
scores[i, self.eos_token_id] = float(2**15)
|
355 |
+
return scores
|
356 |
+
|
357 |
+
def _tokens_match(self, prev_tokens: torch.LongTensor, tokens: List[int]) -> bool:
|
358 |
+
if len(tokens) == 0:
|
359 |
+
# if bad word tokens is just one token always ban it
|
360 |
+
return True
|
361 |
+
elif len(tokens) > len(prev_tokens):
|
362 |
+
# if bad word tokens are longer then prev input_ids they can't be equal
|
363 |
+
return False
|
364 |
+
elif prev_tokens[-len(tokens) :].tolist() == tokens:
|
365 |
+
# if tokens match
|
366 |
+
return True
|
367 |
+
else:
|
368 |
+
return False
|
369 |
+
|
370 |
+
def _calc_stopped_samples(self, prev_input_ids: Iterable[int]) -> Iterable[int]:
|
371 |
+
stopped_samples = []
|
372 |
+
for prev_input_ids_slice in prev_input_ids:
|
373 |
+
match = False
|
374 |
+
for stop_token_seq in self.stop_words_ids:
|
375 |
+
if self._tokens_match(prev_input_ids_slice, stop_token_seq):
|
376 |
+
# if tokens do not match continue
|
377 |
+
match = True
|
378 |
+
break
|
379 |
+
stopped_samples.append(match)
|
380 |
+
|
381 |
+
return stopped_samples
|
382 |
+
|
383 |
+
|
384 |
+
def top_k_logits(logits, top_k=0, top_p=0.0, filter_value=-float("Inf")):
|
385 |
+
"""This function has been mostly taken from huggingface conversational
|
386 |
+
ai code at
|
387 |
+
https://medium.com/huggingface/how-to-build-a-state-of-the-art-
|
388 |
+
conversational-ai-with-transfer-learning-2d818ac26313"""
|
389 |
+
|
390 |
+
if top_k > 0:
|
391 |
+
# Remove all tokens with a probability less than the
|
392 |
+
# last token of the top-k
|
393 |
+
indices_to_remove = logits < torch.topk(logits, top_k)[0][..., -1, None]
|
394 |
+
logits[indices_to_remove] = filter_value
|
395 |
+
|
396 |
+
if top_p > 0.0:
|
397 |
+
# Cconvert to 1D
|
398 |
+
sorted_logits, sorted_indices = torch.sort(logits, descending=True, dim=-1)
|
399 |
+
cumulative_probs = torch.cumsum(F.softmax(sorted_logits, dim=-1), dim=-1)
|
400 |
+
|
401 |
+
# Remove tokens with cumulative probability above the threshold
|
402 |
+
sorted_indices_to_remove = cumulative_probs > top_p
|
403 |
+
# Shift the indices to the right to keep also the first token
|
404 |
+
# above the threshold
|
405 |
+
sorted_indices_to_remove[..., 1:] = sorted_indices_to_remove[..., :-1].clone()
|
406 |
+
sorted_indices_to_remove[..., 0] = 0
|
407 |
+
for i in range(sorted_indices.size(0)):
|
408 |
+
indices_to_remove = sorted_indices[i][sorted_indices_to_remove[i]]
|
409 |
+
logits[i][indices_to_remove] = filter_value
|
410 |
+
|
411 |
+
return logits
|
412 |
+
|
413 |
+
|
414 |
+
def switch(val1, val2, boolean):
|
415 |
+
boolean = boolean.type_as(val1)
|
416 |
+
return (1 - boolean) * val1 + boolean * val2
|
special_tokens_map.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"pad_token": "<|endoftext|>"
|
3 |
+
}
|
tokenization_qwen.py
ADDED
@@ -0,0 +1,276 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Alibaba Cloud.
|
2 |
+
#
|
3 |
+
# This source code is licensed under the license found in the
|
4 |
+
# LICENSE file in the root directory of this source tree.
|
5 |
+
|
6 |
+
"""Tokenization classes for QWen."""
|
7 |
+
|
8 |
+
import base64
|
9 |
+
import logging
|
10 |
+
import os
|
11 |
+
import unicodedata
|
12 |
+
from typing import Collection, Dict, List, Set, Tuple, Union
|
13 |
+
|
14 |
+
import tiktoken
|
15 |
+
from transformers import PreTrainedTokenizer, AddedToken
|
16 |
+
|
17 |
+
logger = logging.getLogger(__name__)
|
18 |
+
|
19 |
+
|
20 |
+
VOCAB_FILES_NAMES = {"vocab_file": "qwen.tiktoken"}
|
21 |
+
|
22 |
+
PAT_STR = r"""(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+"""
|
23 |
+
ENDOFTEXT = "<|endoftext|>"
|
24 |
+
IMSTART = "<|im_start|>"
|
25 |
+
IMEND = "<|im_end|>"
|
26 |
+
# as the default behavior is changed to allow special tokens in
|
27 |
+
# regular texts, the surface forms of special tokens need to be
|
28 |
+
# as different as possible to minimize the impact
|
29 |
+
EXTRAS = tuple((f"<|extra_{i}|>" for i in range(205)))
|
30 |
+
# changed to use actual index to avoid misconfiguration with vocabulary expansion
|
31 |
+
SPECIAL_START_ID = 151643
|
32 |
+
SPECIAL_TOKENS = tuple(
|
33 |
+
enumerate(
|
34 |
+
(
|
35 |
+
(
|
36 |
+
ENDOFTEXT,
|
37 |
+
IMSTART,
|
38 |
+
IMEND,
|
39 |
+
)
|
40 |
+
+ EXTRAS
|
41 |
+
),
|
42 |
+
start=SPECIAL_START_ID,
|
43 |
+
)
|
44 |
+
)
|
45 |
+
SPECIAL_TOKENS_SET = set(t for i, t in SPECIAL_TOKENS)
|
46 |
+
|
47 |
+
|
48 |
+
def _load_tiktoken_bpe(tiktoken_bpe_file: str) -> Dict[bytes, int]:
|
49 |
+
with open(tiktoken_bpe_file, "rb") as f:
|
50 |
+
contents = f.read()
|
51 |
+
return {
|
52 |
+
base64.b64decode(token): int(rank)
|
53 |
+
for token, rank in (line.split() for line in contents.splitlines() if line)
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
class QWenTokenizer(PreTrainedTokenizer):
|
58 |
+
"""QWen tokenizer."""
|
59 |
+
|
60 |
+
vocab_files_names = VOCAB_FILES_NAMES
|
61 |
+
|
62 |
+
def __init__(
|
63 |
+
self,
|
64 |
+
vocab_file,
|
65 |
+
errors="replace",
|
66 |
+
extra_vocab_file=None,
|
67 |
+
**kwargs,
|
68 |
+
):
|
69 |
+
super().__init__(**kwargs)
|
70 |
+
|
71 |
+
# how to handle errors in decoding UTF-8 byte sequences
|
72 |
+
# use ignore if you are in streaming inference
|
73 |
+
self.errors = errors
|
74 |
+
|
75 |
+
self.mergeable_ranks = _load_tiktoken_bpe(vocab_file) # type: Dict[bytes, int]
|
76 |
+
self.special_tokens = {
|
77 |
+
token: index
|
78 |
+
for index, token in SPECIAL_TOKENS
|
79 |
+
}
|
80 |
+
|
81 |
+
# try load extra vocab from file
|
82 |
+
if extra_vocab_file is not None:
|
83 |
+
used_ids = set(self.mergeable_ranks.values()) | set(self.special_tokens.values())
|
84 |
+
extra_mergeable_ranks = _load_tiktoken_bpe(extra_vocab_file)
|
85 |
+
for token, index in extra_mergeable_ranks.items():
|
86 |
+
if token in self.mergeable_ranks:
|
87 |
+
logger.info(f"extra token {token} exists, skipping")
|
88 |
+
continue
|
89 |
+
if index in used_ids:
|
90 |
+
logger.info(f'the index {index} for extra token {token} exists, skipping')
|
91 |
+
continue
|
92 |
+
self.mergeable_ranks[token] = index
|
93 |
+
# the index may be sparse after this, but don't worry tiktoken.Encoding will handle this
|
94 |
+
|
95 |
+
enc = tiktoken.Encoding(
|
96 |
+
"Qwen",
|
97 |
+
pat_str=PAT_STR,
|
98 |
+
mergeable_ranks=self.mergeable_ranks,
|
99 |
+
special_tokens=self.special_tokens,
|
100 |
+
)
|
101 |
+
assert (
|
102 |
+
len(self.mergeable_ranks) + len(self.special_tokens) == enc.n_vocab
|
103 |
+
), f"{len(self.mergeable_ranks) + len(self.special_tokens)} != {enc.n_vocab} in encoding"
|
104 |
+
|
105 |
+
self.decoder = {
|
106 |
+
v: k for k, v in self.mergeable_ranks.items()
|
107 |
+
} # type: dict[int, bytes|str]
|
108 |
+
self.decoder.update({v: k for k, v in self.special_tokens.items()})
|
109 |
+
|
110 |
+
self.tokenizer = enc # type: tiktoken.Encoding
|
111 |
+
|
112 |
+
self.eod_id = self.tokenizer.eot_token
|
113 |
+
self.im_start_id = self.special_tokens[IMSTART]
|
114 |
+
self.im_end_id = self.special_tokens[IMEND]
|
115 |
+
|
116 |
+
def __getstate__(self):
|
117 |
+
# for pickle lovers
|
118 |
+
state = self.__dict__.copy()
|
119 |
+
del state["tokenizer"]
|
120 |
+
return state
|
121 |
+
|
122 |
+
def __setstate__(self, state):
|
123 |
+
# tokenizer is not python native; don't pass it; rebuild it
|
124 |
+
self.__dict__.update(state)
|
125 |
+
enc = tiktoken.Encoding(
|
126 |
+
"Qwen",
|
127 |
+
pat_str=PAT_STR,
|
128 |
+
mergeable_ranks=self.mergeable_ranks,
|
129 |
+
special_tokens=self.special_tokens,
|
130 |
+
)
|
131 |
+
self.tokenizer = enc
|
132 |
+
|
133 |
+
def __len__(self) -> int:
|
134 |
+
return self.tokenizer.n_vocab
|
135 |
+
|
136 |
+
def get_vocab(self) -> Dict[bytes, int]:
|
137 |
+
return self.mergeable_ranks
|
138 |
+
|
139 |
+
def convert_tokens_to_ids(
|
140 |
+
self, tokens: Union[bytes, str, List[Union[bytes, str]]]
|
141 |
+
) -> List[int]:
|
142 |
+
ids = []
|
143 |
+
if isinstance(tokens, (str, bytes)):
|
144 |
+
if tokens in self.special_tokens:
|
145 |
+
return self.special_tokens[tokens]
|
146 |
+
else:
|
147 |
+
return self.mergeable_ranks.get(tokens)
|
148 |
+
for token in tokens:
|
149 |
+
if token in self.special_tokens:
|
150 |
+
ids.append(self.special_tokens[token])
|
151 |
+
else:
|
152 |
+
ids.append(self.mergeable_ranks.get(token))
|
153 |
+
return ids
|
154 |
+
|
155 |
+
def _add_tokens(
|
156 |
+
self,
|
157 |
+
new_tokens: Union[List[str], List[AddedToken]],
|
158 |
+
special_tokens: bool = False,
|
159 |
+
) -> int:
|
160 |
+
if not special_tokens and new_tokens:
|
161 |
+
raise ValueError("Adding regular tokens is not supported")
|
162 |
+
for token in new_tokens:
|
163 |
+
surface_form = token.content if isinstance(token, AddedToken) else token
|
164 |
+
if surface_form not in SPECIAL_TOKENS_SET:
|
165 |
+
raise ValueError("Adding unknown special tokens is not supported")
|
166 |
+
return 0
|
167 |
+
|
168 |
+
def save_vocabulary(self, save_directory: str, **kwargs) -> Tuple[str]:
|
169 |
+
"""
|
170 |
+
Save only the vocabulary of the tokenizer (vocabulary).
|
171 |
+
|
172 |
+
Returns:
|
173 |
+
`Tuple(str)`: Paths to the files saved.
|
174 |
+
"""
|
175 |
+
file_path = os.path.join(save_directory, "qwen.tiktoken")
|
176 |
+
with open(file_path, "w", encoding="utf8") as w:
|
177 |
+
for k, v in self.mergeable_ranks.items():
|
178 |
+
line = base64.b64encode(k).decode("utf8") + " " + str(v) + "\n"
|
179 |
+
w.write(line)
|
180 |
+
return (file_path,)
|
181 |
+
|
182 |
+
def tokenize(
|
183 |
+
self,
|
184 |
+
text: str,
|
185 |
+
allowed_special: Union[Set, str] = "all",
|
186 |
+
disallowed_special: Union[Collection, str] = (),
|
187 |
+
**kwargs,
|
188 |
+
) -> List[Union[bytes, str]]:
|
189 |
+
"""
|
190 |
+
Converts a string in a sequence of tokens.
|
191 |
+
|
192 |
+
Args:
|
193 |
+
text (`str`):
|
194 |
+
The sequence to be encoded.
|
195 |
+
allowed_special (`Literal["all"]` or `set`):
|
196 |
+
The surface forms of the tokens to be encoded as special tokens in regular texts.
|
197 |
+
Default to "all".
|
198 |
+
disallowed_special (`Literal["all"]` or `Collection`):
|
199 |
+
The surface forms of the tokens that should not be in regular texts and trigger errors.
|
200 |
+
Default to an empty tuple.
|
201 |
+
|
202 |
+
kwargs (additional keyword arguments, *optional*):
|
203 |
+
Will be passed to the underlying model specific encode method.
|
204 |
+
|
205 |
+
Returns:
|
206 |
+
`List[bytes|str]`: The list of tokens.
|
207 |
+
"""
|
208 |
+
tokens = []
|
209 |
+
text = unicodedata.normalize("NFC", text)
|
210 |
+
|
211 |
+
# this implementation takes a detour: text -> token id -> token surface forms
|
212 |
+
for t in self.tokenizer.encode(
|
213 |
+
text, allowed_special=allowed_special, disallowed_special=disallowed_special
|
214 |
+
):
|
215 |
+
tokens.append(self.decoder[t])
|
216 |
+
return tokens
|
217 |
+
|
218 |
+
def convert_tokens_to_string(self, tokens: List[Union[bytes, str]]) -> str:
|
219 |
+
"""
|
220 |
+
Converts a sequence of tokens in a single string.
|
221 |
+
"""
|
222 |
+
text = ""
|
223 |
+
temp = b""
|
224 |
+
for t in tokens:
|
225 |
+
if isinstance(t, str):
|
226 |
+
if temp:
|
227 |
+
text += temp.decode("utf-8", errors=self.errors)
|
228 |
+
temp = b""
|
229 |
+
text += t
|
230 |
+
elif isinstance(t, bytes):
|
231 |
+
temp += t
|
232 |
+
else:
|
233 |
+
raise TypeError("token should only be of type types or str")
|
234 |
+
if temp:
|
235 |
+
text += temp.decode("utf-8", errors=self.errors)
|
236 |
+
return text
|
237 |
+
|
238 |
+
@property
|
239 |
+
def vocab_size(self):
|
240 |
+
return self.tokenizer.n_vocab
|
241 |
+
|
242 |
+
def _convert_id_to_token(self, index: int) -> Union[bytes, str]:
|
243 |
+
"""Converts an id to a token, special tokens included"""
|
244 |
+
if index in self.decoder:
|
245 |
+
return self.decoder[index]
|
246 |
+
raise ValueError("unknown ids")
|
247 |
+
|
248 |
+
def _convert_token_to_id(self, token: Union[bytes, str]) -> int:
|
249 |
+
"""Converts a token to an id using the vocab, special tokens included"""
|
250 |
+
if token in self.special_tokens:
|
251 |
+
return self.special_tokens[token]
|
252 |
+
if token in self.mergeable_ranks:
|
253 |
+
return self.mergeable_ranks[token]
|
254 |
+
raise ValueError("unknown token")
|
255 |
+
|
256 |
+
def _tokenize(self, text: str, **kwargs):
|
257 |
+
"""
|
258 |
+
Converts a string in a sequence of tokens (string), using the tokenizer. Split in words for word-based
|
259 |
+
vocabulary or sub-words for sub-word-based vocabularies (BPE/SentencePieces/WordPieces).
|
260 |
+
|
261 |
+
Do NOT take care of added tokens.
|
262 |
+
"""
|
263 |
+
raise NotImplementedError
|
264 |
+
|
265 |
+
def _decode(
|
266 |
+
self,
|
267 |
+
token_ids: Union[int, List[int]],
|
268 |
+
skip_special_tokens: bool = False,
|
269 |
+
errors: str = None,
|
270 |
+
**kwargs,
|
271 |
+
) -> str:
|
272 |
+
if isinstance(token_ids, int):
|
273 |
+
token_ids = [token_ids]
|
274 |
+
if skip_special_tokens:
|
275 |
+
token_ids = [i for i in token_ids if i < self.eod_id]
|
276 |
+
return self.tokenizer.decode(token_ids, errors=errors or self.errors)
|
tokenizer_config.json
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"auto_map": {
|
3 |
+
"AutoTokenizer": [
|
4 |
+
"tokenization_qwen.QWenTokenizer",
|
5 |
+
null
|
6 |
+
]
|
7 |
+
},
|
8 |
+
"clean_up_tokenization_spaces": true,
|
9 |
+
"model_max_length": 4096,
|
10 |
+
"padding_side": "right",
|
11 |
+
"tokenizer_class": "QWenTokenizer"
|
12 |
+
}
|
trainer_state.json
ADDED
@@ -0,0 +1,4597 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"best_metric": null,
|
3 |
+
"best_model_checkpoint": null,
|
4 |
+
"epoch": 0.9998361998361999,
|
5 |
+
"eval_steps": 500,
|
6 |
+
"global_step": 763,
|
7 |
+
"is_hyper_param_search": false,
|
8 |
+
"is_local_process_zero": true,
|
9 |
+
"is_world_process_zero": true,
|
10 |
+
"log_history": [
|
11 |
+
{
|
12 |
+
"epoch": 0.0,
|
13 |
+
"learning_rate": 0.0,
|
14 |
+
"loss": 1.419,
|
15 |
+
"step": 1
|
16 |
+
},
|
17 |
+
{
|
18 |
+
"epoch": 0.0,
|
19 |
+
"learning_rate": 2.5e-06,
|
20 |
+
"loss": 1.4286,
|
21 |
+
"step": 2
|
22 |
+
},
|
23 |
+
{
|
24 |
+
"epoch": 0.0,
|
25 |
+
"learning_rate": 3.962406251802891e-06,
|
26 |
+
"loss": 1.3769,
|
27 |
+
"step": 3
|
28 |
+
},
|
29 |
+
{
|
30 |
+
"epoch": 0.01,
|
31 |
+
"learning_rate": 5e-06,
|
32 |
+
"loss": 1.3143,
|
33 |
+
"step": 4
|
34 |
+
},
|
35 |
+
{
|
36 |
+
"epoch": 0.01,
|
37 |
+
"learning_rate": 5.804820237218406e-06,
|
38 |
+
"loss": 1.3021,
|
39 |
+
"step": 5
|
40 |
+
},
|
41 |
+
{
|
42 |
+
"epoch": 0.01,
|
43 |
+
"learning_rate": 6.462406251802891e-06,
|
44 |
+
"loss": 1.3504,
|
45 |
+
"step": 6
|
46 |
+
},
|
47 |
+
{
|
48 |
+
"epoch": 0.01,
|
49 |
+
"learning_rate": 7.018387305144011e-06,
|
50 |
+
"loss": 1.322,
|
51 |
+
"step": 7
|
52 |
+
},
|
53 |
+
{
|
54 |
+
"epoch": 0.01,
|
55 |
+
"learning_rate": 7.499999999999999e-06,
|
56 |
+
"loss": 1.3809,
|
57 |
+
"step": 8
|
58 |
+
},
|
59 |
+
{
|
60 |
+
"epoch": 0.01,
|
61 |
+
"learning_rate": 7.924812503605782e-06,
|
62 |
+
"loss": 1.3668,
|
63 |
+
"step": 9
|
64 |
+
},
|
65 |
+
{
|
66 |
+
"epoch": 0.01,
|
67 |
+
"learning_rate": 8.304820237218408e-06,
|
68 |
+
"loss": 1.3955,
|
69 |
+
"step": 10
|
70 |
+
},
|
71 |
+
{
|
72 |
+
"epoch": 0.01,
|
73 |
+
"learning_rate": 8.648579046593244e-06,
|
74 |
+
"loss": 1.3302,
|
75 |
+
"step": 11
|
76 |
+
},
|
77 |
+
{
|
78 |
+
"epoch": 0.02,
|
79 |
+
"learning_rate": 8.96240625180289e-06,
|
80 |
+
"loss": 1.2661,
|
81 |
+
"step": 12
|
82 |
+
},
|
83 |
+
{
|
84 |
+
"epoch": 0.02,
|
85 |
+
"learning_rate": 9.25109929535273e-06,
|
86 |
+
"loss": 1.4107,
|
87 |
+
"step": 13
|
88 |
+
},
|
89 |
+
{
|
90 |
+
"epoch": 0.02,
|
91 |
+
"learning_rate": 9.51838730514401e-06,
|
92 |
+
"loss": 1.2451,
|
93 |
+
"step": 14
|
94 |
+
},
|
95 |
+
{
|
96 |
+
"epoch": 0.02,
|
97 |
+
"learning_rate": 9.767226489021297e-06,
|
98 |
+
"loss": 1.3415,
|
99 |
+
"step": 15
|
100 |
+
},
|
101 |
+
{
|
102 |
+
"epoch": 0.02,
|
103 |
+
"learning_rate": 1e-05,
|
104 |
+
"loss": 1.2943,
|
105 |
+
"step": 16
|
106 |
+
},
|
107 |
+
{
|
108 |
+
"epoch": 0.02,
|
109 |
+
"learning_rate": 1e-05,
|
110 |
+
"loss": 1.2522,
|
111 |
+
"step": 17
|
112 |
+
},
|
113 |
+
{
|
114 |
+
"epoch": 0.02,
|
115 |
+
"learning_rate": 1e-05,
|
116 |
+
"loss": 1.2224,
|
117 |
+
"step": 18
|
118 |
+
},
|
119 |
+
{
|
120 |
+
"epoch": 0.02,
|
121 |
+
"learning_rate": 1e-05,
|
122 |
+
"loss": 1.3191,
|
123 |
+
"step": 19
|
124 |
+
},
|
125 |
+
{
|
126 |
+
"epoch": 0.03,
|
127 |
+
"learning_rate": 1e-05,
|
128 |
+
"loss": 1.2476,
|
129 |
+
"step": 20
|
130 |
+
},
|
131 |
+
{
|
132 |
+
"epoch": 0.03,
|
133 |
+
"learning_rate": 1e-05,
|
134 |
+
"loss": 1.2646,
|
135 |
+
"step": 21
|
136 |
+
},
|
137 |
+
{
|
138 |
+
"epoch": 0.03,
|
139 |
+
"learning_rate": 1e-05,
|
140 |
+
"loss": 1.3427,
|
141 |
+
"step": 22
|
142 |
+
},
|
143 |
+
{
|
144 |
+
"epoch": 0.03,
|
145 |
+
"learning_rate": 1e-05,
|
146 |
+
"loss": 1.2767,
|
147 |
+
"step": 23
|
148 |
+
},
|
149 |
+
{
|
150 |
+
"epoch": 0.03,
|
151 |
+
"learning_rate": 1e-05,
|
152 |
+
"loss": 1.3247,
|
153 |
+
"step": 24
|
154 |
+
},
|
155 |
+
{
|
156 |
+
"epoch": 0.03,
|
157 |
+
"learning_rate": 1e-05,
|
158 |
+
"loss": 1.2376,
|
159 |
+
"step": 25
|
160 |
+
},
|
161 |
+
{
|
162 |
+
"epoch": 0.03,
|
163 |
+
"learning_rate": 1e-05,
|
164 |
+
"loss": 1.3091,
|
165 |
+
"step": 26
|
166 |
+
},
|
167 |
+
{
|
168 |
+
"epoch": 0.04,
|
169 |
+
"learning_rate": 1e-05,
|
170 |
+
"loss": 1.3247,
|
171 |
+
"step": 27
|
172 |
+
},
|
173 |
+
{
|
174 |
+
"epoch": 0.04,
|
175 |
+
"learning_rate": 1e-05,
|
176 |
+
"loss": 1.2891,
|
177 |
+
"step": 28
|
178 |
+
},
|
179 |
+
{
|
180 |
+
"epoch": 0.04,
|
181 |
+
"learning_rate": 1e-05,
|
182 |
+
"loss": 1.2212,
|
183 |
+
"step": 29
|
184 |
+
},
|
185 |
+
{
|
186 |
+
"epoch": 0.04,
|
187 |
+
"learning_rate": 1e-05,
|
188 |
+
"loss": 1.1395,
|
189 |
+
"step": 30
|
190 |
+
},
|
191 |
+
{
|
192 |
+
"epoch": 0.04,
|
193 |
+
"learning_rate": 1e-05,
|
194 |
+
"loss": 1.3225,
|
195 |
+
"step": 31
|
196 |
+
},
|
197 |
+
{
|
198 |
+
"epoch": 0.04,
|
199 |
+
"learning_rate": 1e-05,
|
200 |
+
"loss": 1.2411,
|
201 |
+
"step": 32
|
202 |
+
},
|
203 |
+
{
|
204 |
+
"epoch": 0.04,
|
205 |
+
"learning_rate": 1e-05,
|
206 |
+
"loss": 1.2646,
|
207 |
+
"step": 33
|
208 |
+
},
|
209 |
+
{
|
210 |
+
"epoch": 0.04,
|
211 |
+
"learning_rate": 1e-05,
|
212 |
+
"loss": 1.247,
|
213 |
+
"step": 34
|
214 |
+
},
|
215 |
+
{
|
216 |
+
"epoch": 0.05,
|
217 |
+
"learning_rate": 1e-05,
|
218 |
+
"loss": 1.2742,
|
219 |
+
"step": 35
|
220 |
+
},
|
221 |
+
{
|
222 |
+
"epoch": 0.05,
|
223 |
+
"learning_rate": 1e-05,
|
224 |
+
"loss": 1.3276,
|
225 |
+
"step": 36
|
226 |
+
},
|
227 |
+
{
|
228 |
+
"epoch": 0.05,
|
229 |
+
"learning_rate": 1e-05,
|
230 |
+
"loss": 1.3118,
|
231 |
+
"step": 37
|
232 |
+
},
|
233 |
+
{
|
234 |
+
"epoch": 0.05,
|
235 |
+
"learning_rate": 1e-05,
|
236 |
+
"loss": 1.2362,
|
237 |
+
"step": 38
|
238 |
+
},
|
239 |
+
{
|
240 |
+
"epoch": 0.05,
|
241 |
+
"learning_rate": 1e-05,
|
242 |
+
"loss": 1.2002,
|
243 |
+
"step": 39
|
244 |
+
},
|
245 |
+
{
|
246 |
+
"epoch": 0.05,
|
247 |
+
"learning_rate": 1e-05,
|
248 |
+
"loss": 1.2544,
|
249 |
+
"step": 40
|
250 |
+
},
|
251 |
+
{
|
252 |
+
"epoch": 0.05,
|
253 |
+
"learning_rate": 1e-05,
|
254 |
+
"loss": 1.2586,
|
255 |
+
"step": 41
|
256 |
+
},
|
257 |
+
{
|
258 |
+
"epoch": 0.06,
|
259 |
+
"learning_rate": 1e-05,
|
260 |
+
"loss": 1.2219,
|
261 |
+
"step": 42
|
262 |
+
},
|
263 |
+
{
|
264 |
+
"epoch": 0.06,
|
265 |
+
"learning_rate": 1e-05,
|
266 |
+
"loss": 1.1487,
|
267 |
+
"step": 43
|
268 |
+
},
|
269 |
+
{
|
270 |
+
"epoch": 0.06,
|
271 |
+
"learning_rate": 1e-05,
|
272 |
+
"loss": 1.2374,
|
273 |
+
"step": 44
|
274 |
+
},
|
275 |
+
{
|
276 |
+
"epoch": 0.06,
|
277 |
+
"learning_rate": 1e-05,
|
278 |
+
"loss": 1.1346,
|
279 |
+
"step": 45
|
280 |
+
},
|
281 |
+
{
|
282 |
+
"epoch": 0.06,
|
283 |
+
"learning_rate": 1e-05,
|
284 |
+
"loss": 1.1702,
|
285 |
+
"step": 46
|
286 |
+
},
|
287 |
+
{
|
288 |
+
"epoch": 0.06,
|
289 |
+
"learning_rate": 1e-05,
|
290 |
+
"loss": 1.2095,
|
291 |
+
"step": 47
|
292 |
+
},
|
293 |
+
{
|
294 |
+
"epoch": 0.06,
|
295 |
+
"learning_rate": 1e-05,
|
296 |
+
"loss": 1.2731,
|
297 |
+
"step": 48
|
298 |
+
},
|
299 |
+
{
|
300 |
+
"epoch": 0.06,
|
301 |
+
"learning_rate": 1e-05,
|
302 |
+
"loss": 1.2282,
|
303 |
+
"step": 49
|
304 |
+
},
|
305 |
+
{
|
306 |
+
"epoch": 0.07,
|
307 |
+
"learning_rate": 1e-05,
|
308 |
+
"loss": 1.1828,
|
309 |
+
"step": 50
|
310 |
+
},
|
311 |
+
{
|
312 |
+
"epoch": 0.07,
|
313 |
+
"learning_rate": 1e-05,
|
314 |
+
"loss": 1.2041,
|
315 |
+
"step": 51
|
316 |
+
},
|
317 |
+
{
|
318 |
+
"epoch": 0.07,
|
319 |
+
"learning_rate": 1e-05,
|
320 |
+
"loss": 1.1929,
|
321 |
+
"step": 52
|
322 |
+
},
|
323 |
+
{
|
324 |
+
"epoch": 0.07,
|
325 |
+
"learning_rate": 1e-05,
|
326 |
+
"loss": 1.1721,
|
327 |
+
"step": 53
|
328 |
+
},
|
329 |
+
{
|
330 |
+
"epoch": 0.07,
|
331 |
+
"learning_rate": 1e-05,
|
332 |
+
"loss": 1.1842,
|
333 |
+
"step": 54
|
334 |
+
},
|
335 |
+
{
|
336 |
+
"epoch": 0.07,
|
337 |
+
"learning_rate": 1e-05,
|
338 |
+
"loss": 1.2166,
|
339 |
+
"step": 55
|
340 |
+
},
|
341 |
+
{
|
342 |
+
"epoch": 0.07,
|
343 |
+
"learning_rate": 1e-05,
|
344 |
+
"loss": 1.1807,
|
345 |
+
"step": 56
|
346 |
+
},
|
347 |
+
{
|
348 |
+
"epoch": 0.07,
|
349 |
+
"learning_rate": 1e-05,
|
350 |
+
"loss": 1.1112,
|
351 |
+
"step": 57
|
352 |
+
},
|
353 |
+
{
|
354 |
+
"epoch": 0.08,
|
355 |
+
"learning_rate": 1e-05,
|
356 |
+
"loss": 1.2922,
|
357 |
+
"step": 58
|
358 |
+
},
|
359 |
+
{
|
360 |
+
"epoch": 0.08,
|
361 |
+
"learning_rate": 1e-05,
|
362 |
+
"loss": 1.1809,
|
363 |
+
"step": 59
|
364 |
+
},
|
365 |
+
{
|
366 |
+
"epoch": 0.08,
|
367 |
+
"learning_rate": 1e-05,
|
368 |
+
"loss": 1.1841,
|
369 |
+
"step": 60
|
370 |
+
},
|
371 |
+
{
|
372 |
+
"epoch": 0.08,
|
373 |
+
"learning_rate": 1e-05,
|
374 |
+
"loss": 1.2236,
|
375 |
+
"step": 61
|
376 |
+
},
|
377 |
+
{
|
378 |
+
"epoch": 0.08,
|
379 |
+
"learning_rate": 1e-05,
|
380 |
+
"loss": 1.2644,
|
381 |
+
"step": 62
|
382 |
+
},
|
383 |
+
{
|
384 |
+
"epoch": 0.08,
|
385 |
+
"learning_rate": 1e-05,
|
386 |
+
"loss": 1.223,
|
387 |
+
"step": 63
|
388 |
+
},
|
389 |
+
{
|
390 |
+
"epoch": 0.08,
|
391 |
+
"learning_rate": 1e-05,
|
392 |
+
"loss": 1.1729,
|
393 |
+
"step": 64
|
394 |
+
},
|
395 |
+
{
|
396 |
+
"epoch": 0.09,
|
397 |
+
"learning_rate": 1e-05,
|
398 |
+
"loss": 1.2133,
|
399 |
+
"step": 65
|
400 |
+
},
|
401 |
+
{
|
402 |
+
"epoch": 0.09,
|
403 |
+
"learning_rate": 1e-05,
|
404 |
+
"loss": 1.2487,
|
405 |
+
"step": 66
|
406 |
+
},
|
407 |
+
{
|
408 |
+
"epoch": 0.09,
|
409 |
+
"learning_rate": 1e-05,
|
410 |
+
"loss": 1.2464,
|
411 |
+
"step": 67
|
412 |
+
},
|
413 |
+
{
|
414 |
+
"epoch": 0.09,
|
415 |
+
"learning_rate": 1e-05,
|
416 |
+
"loss": 1.2267,
|
417 |
+
"step": 68
|
418 |
+
},
|
419 |
+
{
|
420 |
+
"epoch": 0.09,
|
421 |
+
"learning_rate": 1e-05,
|
422 |
+
"loss": 1.1504,
|
423 |
+
"step": 69
|
424 |
+
},
|
425 |
+
{
|
426 |
+
"epoch": 0.09,
|
427 |
+
"learning_rate": 1e-05,
|
428 |
+
"loss": 1.2984,
|
429 |
+
"step": 70
|
430 |
+
},
|
431 |
+
{
|
432 |
+
"epoch": 0.09,
|
433 |
+
"learning_rate": 1e-05,
|
434 |
+
"loss": 1.2635,
|
435 |
+
"step": 71
|
436 |
+
},
|
437 |
+
{
|
438 |
+
"epoch": 0.09,
|
439 |
+
"learning_rate": 1e-05,
|
440 |
+
"loss": 1.1728,
|
441 |
+
"step": 72
|
442 |
+
},
|
443 |
+
{
|
444 |
+
"epoch": 0.1,
|
445 |
+
"learning_rate": 1e-05,
|
446 |
+
"loss": 1.1855,
|
447 |
+
"step": 73
|
448 |
+
},
|
449 |
+
{
|
450 |
+
"epoch": 0.1,
|
451 |
+
"learning_rate": 1e-05,
|
452 |
+
"loss": 1.2193,
|
453 |
+
"step": 74
|
454 |
+
},
|
455 |
+
{
|
456 |
+
"epoch": 0.1,
|
457 |
+
"learning_rate": 1e-05,
|
458 |
+
"loss": 1.1411,
|
459 |
+
"step": 75
|
460 |
+
},
|
461 |
+
{
|
462 |
+
"epoch": 0.1,
|
463 |
+
"learning_rate": 1e-05,
|
464 |
+
"loss": 1.2151,
|
465 |
+
"step": 76
|
466 |
+
},
|
467 |
+
{
|
468 |
+
"epoch": 0.1,
|
469 |
+
"learning_rate": 1e-05,
|
470 |
+
"loss": 1.1246,
|
471 |
+
"step": 77
|
472 |
+
},
|
473 |
+
{
|
474 |
+
"epoch": 0.1,
|
475 |
+
"learning_rate": 1e-05,
|
476 |
+
"loss": 1.2639,
|
477 |
+
"step": 78
|
478 |
+
},
|
479 |
+
{
|
480 |
+
"epoch": 0.1,
|
481 |
+
"learning_rate": 1e-05,
|
482 |
+
"loss": 1.1682,
|
483 |
+
"step": 79
|
484 |
+
},
|
485 |
+
{
|
486 |
+
"epoch": 0.1,
|
487 |
+
"learning_rate": 1e-05,
|
488 |
+
"loss": 1.2273,
|
489 |
+
"step": 80
|
490 |
+
},
|
491 |
+
{
|
492 |
+
"epoch": 0.11,
|
493 |
+
"learning_rate": 1e-05,
|
494 |
+
"loss": 1.2022,
|
495 |
+
"step": 81
|
496 |
+
},
|
497 |
+
{
|
498 |
+
"epoch": 0.11,
|
499 |
+
"learning_rate": 1e-05,
|
500 |
+
"loss": 1.2625,
|
501 |
+
"step": 82
|
502 |
+
},
|
503 |
+
{
|
504 |
+
"epoch": 0.11,
|
505 |
+
"learning_rate": 1e-05,
|
506 |
+
"loss": 1.2314,
|
507 |
+
"step": 83
|
508 |
+
},
|
509 |
+
{
|
510 |
+
"epoch": 0.11,
|
511 |
+
"learning_rate": 1e-05,
|
512 |
+
"loss": 1.1618,
|
513 |
+
"step": 84
|
514 |
+
},
|
515 |
+
{
|
516 |
+
"epoch": 0.11,
|
517 |
+
"learning_rate": 1e-05,
|
518 |
+
"loss": 1.2443,
|
519 |
+
"step": 85
|
520 |
+
},
|
521 |
+
{
|
522 |
+
"epoch": 0.11,
|
523 |
+
"learning_rate": 1e-05,
|
524 |
+
"loss": 1.3048,
|
525 |
+
"step": 86
|
526 |
+
},
|
527 |
+
{
|
528 |
+
"epoch": 0.11,
|
529 |
+
"learning_rate": 1e-05,
|
530 |
+
"loss": 1.198,
|
531 |
+
"step": 87
|
532 |
+
},
|
533 |
+
{
|
534 |
+
"epoch": 0.12,
|
535 |
+
"learning_rate": 1e-05,
|
536 |
+
"loss": 1.1832,
|
537 |
+
"step": 88
|
538 |
+
},
|
539 |
+
{
|
540 |
+
"epoch": 0.12,
|
541 |
+
"learning_rate": 1e-05,
|
542 |
+
"loss": 1.3059,
|
543 |
+
"step": 89
|
544 |
+
},
|
545 |
+
{
|
546 |
+
"epoch": 0.12,
|
547 |
+
"learning_rate": 1e-05,
|
548 |
+
"loss": 1.1264,
|
549 |
+
"step": 90
|
550 |
+
},
|
551 |
+
{
|
552 |
+
"epoch": 0.12,
|
553 |
+
"learning_rate": 1e-05,
|
554 |
+
"loss": 1.1925,
|
555 |
+
"step": 91
|
556 |
+
},
|
557 |
+
{
|
558 |
+
"epoch": 0.12,
|
559 |
+
"learning_rate": 1e-05,
|
560 |
+
"loss": 1.2281,
|
561 |
+
"step": 92
|
562 |
+
},
|
563 |
+
{
|
564 |
+
"epoch": 0.12,
|
565 |
+
"learning_rate": 1e-05,
|
566 |
+
"loss": 1.1263,
|
567 |
+
"step": 93
|
568 |
+
},
|
569 |
+
{
|
570 |
+
"epoch": 0.12,
|
571 |
+
"learning_rate": 1e-05,
|
572 |
+
"loss": 1.1842,
|
573 |
+
"step": 94
|
574 |
+
},
|
575 |
+
{
|
576 |
+
"epoch": 0.12,
|
577 |
+
"learning_rate": 1e-05,
|
578 |
+
"loss": 1.1317,
|
579 |
+
"step": 95
|
580 |
+
},
|
581 |
+
{
|
582 |
+
"epoch": 0.13,
|
583 |
+
"learning_rate": 1e-05,
|
584 |
+
"loss": 1.3189,
|
585 |
+
"step": 96
|
586 |
+
},
|
587 |
+
{
|
588 |
+
"epoch": 0.13,
|
589 |
+
"learning_rate": 1e-05,
|
590 |
+
"loss": 1.1733,
|
591 |
+
"step": 97
|
592 |
+
},
|
593 |
+
{
|
594 |
+
"epoch": 0.13,
|
595 |
+
"learning_rate": 1e-05,
|
596 |
+
"loss": 1.2364,
|
597 |
+
"step": 98
|
598 |
+
},
|
599 |
+
{
|
600 |
+
"epoch": 0.13,
|
601 |
+
"learning_rate": 1e-05,
|
602 |
+
"loss": 1.191,
|
603 |
+
"step": 99
|
604 |
+
},
|
605 |
+
{
|
606 |
+
"epoch": 0.13,
|
607 |
+
"learning_rate": 1e-05,
|
608 |
+
"loss": 1.1974,
|
609 |
+
"step": 100
|
610 |
+
},
|
611 |
+
{
|
612 |
+
"epoch": 0.13,
|
613 |
+
"learning_rate": 1e-05,
|
614 |
+
"loss": 1.2286,
|
615 |
+
"step": 101
|
616 |
+
},
|
617 |
+
{
|
618 |
+
"epoch": 0.13,
|
619 |
+
"learning_rate": 1e-05,
|
620 |
+
"loss": 1.1647,
|
621 |
+
"step": 102
|
622 |
+
},
|
623 |
+
{
|
624 |
+
"epoch": 0.13,
|
625 |
+
"learning_rate": 1e-05,
|
626 |
+
"loss": 1.2806,
|
627 |
+
"step": 103
|
628 |
+
},
|
629 |
+
{
|
630 |
+
"epoch": 0.14,
|
631 |
+
"learning_rate": 1e-05,
|
632 |
+
"loss": 1.1928,
|
633 |
+
"step": 104
|
634 |
+
},
|
635 |
+
{
|
636 |
+
"epoch": 0.14,
|
637 |
+
"learning_rate": 1e-05,
|
638 |
+
"loss": 1.1728,
|
639 |
+
"step": 105
|
640 |
+
},
|
641 |
+
{
|
642 |
+
"epoch": 0.14,
|
643 |
+
"learning_rate": 1e-05,
|
644 |
+
"loss": 1.1455,
|
645 |
+
"step": 106
|
646 |
+
},
|
647 |
+
{
|
648 |
+
"epoch": 0.14,
|
649 |
+
"learning_rate": 1e-05,
|
650 |
+
"loss": 1.1748,
|
651 |
+
"step": 107
|
652 |
+
},
|
653 |
+
{
|
654 |
+
"epoch": 0.14,
|
655 |
+
"learning_rate": 1e-05,
|
656 |
+
"loss": 1.2779,
|
657 |
+
"step": 108
|
658 |
+
},
|
659 |
+
{
|
660 |
+
"epoch": 0.14,
|
661 |
+
"learning_rate": 1e-05,
|
662 |
+
"loss": 1.1871,
|
663 |
+
"step": 109
|
664 |
+
},
|
665 |
+
{
|
666 |
+
"epoch": 0.14,
|
667 |
+
"learning_rate": 1e-05,
|
668 |
+
"loss": 1.2795,
|
669 |
+
"step": 110
|
670 |
+
},
|
671 |
+
{
|
672 |
+
"epoch": 0.15,
|
673 |
+
"learning_rate": 1e-05,
|
674 |
+
"loss": 1.2084,
|
675 |
+
"step": 111
|
676 |
+
},
|
677 |
+
{
|
678 |
+
"epoch": 0.15,
|
679 |
+
"learning_rate": 1e-05,
|
680 |
+
"loss": 1.1314,
|
681 |
+
"step": 112
|
682 |
+
},
|
683 |
+
{
|
684 |
+
"epoch": 0.15,
|
685 |
+
"learning_rate": 1e-05,
|
686 |
+
"loss": 1.2351,
|
687 |
+
"step": 113
|
688 |
+
},
|
689 |
+
{
|
690 |
+
"epoch": 0.15,
|
691 |
+
"learning_rate": 1e-05,
|
692 |
+
"loss": 1.1762,
|
693 |
+
"step": 114
|
694 |
+
},
|
695 |
+
{
|
696 |
+
"epoch": 0.15,
|
697 |
+
"learning_rate": 1e-05,
|
698 |
+
"loss": 1.1904,
|
699 |
+
"step": 115
|
700 |
+
},
|
701 |
+
{
|
702 |
+
"epoch": 0.15,
|
703 |
+
"learning_rate": 1e-05,
|
704 |
+
"loss": 1.1552,
|
705 |
+
"step": 116
|
706 |
+
},
|
707 |
+
{
|
708 |
+
"epoch": 0.15,
|
709 |
+
"learning_rate": 1e-05,
|
710 |
+
"loss": 1.0961,
|
711 |
+
"step": 117
|
712 |
+
},
|
713 |
+
{
|
714 |
+
"epoch": 0.15,
|
715 |
+
"learning_rate": 1e-05,
|
716 |
+
"loss": 1.195,
|
717 |
+
"step": 118
|
718 |
+
},
|
719 |
+
{
|
720 |
+
"epoch": 0.16,
|
721 |
+
"learning_rate": 1e-05,
|
722 |
+
"loss": 1.1728,
|
723 |
+
"step": 119
|
724 |
+
},
|
725 |
+
{
|
726 |
+
"epoch": 0.16,
|
727 |
+
"learning_rate": 1e-05,
|
728 |
+
"loss": 1.125,
|
729 |
+
"step": 120
|
730 |
+
},
|
731 |
+
{
|
732 |
+
"epoch": 0.16,
|
733 |
+
"learning_rate": 1e-05,
|
734 |
+
"loss": 1.1861,
|
735 |
+
"step": 121
|
736 |
+
},
|
737 |
+
{
|
738 |
+
"epoch": 0.16,
|
739 |
+
"learning_rate": 1e-05,
|
740 |
+
"loss": 1.1536,
|
741 |
+
"step": 122
|
742 |
+
},
|
743 |
+
{
|
744 |
+
"epoch": 0.16,
|
745 |
+
"learning_rate": 1e-05,
|
746 |
+
"loss": 1.1977,
|
747 |
+
"step": 123
|
748 |
+
},
|
749 |
+
{
|
750 |
+
"epoch": 0.16,
|
751 |
+
"learning_rate": 1e-05,
|
752 |
+
"loss": 1.0763,
|
753 |
+
"step": 124
|
754 |
+
},
|
755 |
+
{
|
756 |
+
"epoch": 0.16,
|
757 |
+
"learning_rate": 1e-05,
|
758 |
+
"loss": 1.2132,
|
759 |
+
"step": 125
|
760 |
+
},
|
761 |
+
{
|
762 |
+
"epoch": 0.17,
|
763 |
+
"learning_rate": 1e-05,
|
764 |
+
"loss": 1.2042,
|
765 |
+
"step": 126
|
766 |
+
},
|
767 |
+
{
|
768 |
+
"epoch": 0.17,
|
769 |
+
"learning_rate": 1e-05,
|
770 |
+
"loss": 1.2516,
|
771 |
+
"step": 127
|
772 |
+
},
|
773 |
+
{
|
774 |
+
"epoch": 0.17,
|
775 |
+
"learning_rate": 1e-05,
|
776 |
+
"loss": 1.1579,
|
777 |
+
"step": 128
|
778 |
+
},
|
779 |
+
{
|
780 |
+
"epoch": 0.17,
|
781 |
+
"learning_rate": 1e-05,
|
782 |
+
"loss": 1.2348,
|
783 |
+
"step": 129
|
784 |
+
},
|
785 |
+
{
|
786 |
+
"epoch": 0.17,
|
787 |
+
"learning_rate": 1e-05,
|
788 |
+
"loss": 1.1223,
|
789 |
+
"step": 130
|
790 |
+
},
|
791 |
+
{
|
792 |
+
"epoch": 0.17,
|
793 |
+
"learning_rate": 1e-05,
|
794 |
+
"loss": 1.1664,
|
795 |
+
"step": 131
|
796 |
+
},
|
797 |
+
{
|
798 |
+
"epoch": 0.17,
|
799 |
+
"learning_rate": 1e-05,
|
800 |
+
"loss": 1.1369,
|
801 |
+
"step": 132
|
802 |
+
},
|
803 |
+
{
|
804 |
+
"epoch": 0.17,
|
805 |
+
"learning_rate": 1e-05,
|
806 |
+
"loss": 1.198,
|
807 |
+
"step": 133
|
808 |
+
},
|
809 |
+
{
|
810 |
+
"epoch": 0.18,
|
811 |
+
"learning_rate": 1e-05,
|
812 |
+
"loss": 1.1469,
|
813 |
+
"step": 134
|
814 |
+
},
|
815 |
+
{
|
816 |
+
"epoch": 0.18,
|
817 |
+
"learning_rate": 1e-05,
|
818 |
+
"loss": 1.1773,
|
819 |
+
"step": 135
|
820 |
+
},
|
821 |
+
{
|
822 |
+
"epoch": 0.18,
|
823 |
+
"learning_rate": 1e-05,
|
824 |
+
"loss": 1.1434,
|
825 |
+
"step": 136
|
826 |
+
},
|
827 |
+
{
|
828 |
+
"epoch": 0.18,
|
829 |
+
"learning_rate": 1e-05,
|
830 |
+
"loss": 1.0885,
|
831 |
+
"step": 137
|
832 |
+
},
|
833 |
+
{
|
834 |
+
"epoch": 0.18,
|
835 |
+
"learning_rate": 1e-05,
|
836 |
+
"loss": 1.2256,
|
837 |
+
"step": 138
|
838 |
+
},
|
839 |
+
{
|
840 |
+
"epoch": 0.18,
|
841 |
+
"learning_rate": 1e-05,
|
842 |
+
"loss": 1.1535,
|
843 |
+
"step": 139
|
844 |
+
},
|
845 |
+
{
|
846 |
+
"epoch": 0.18,
|
847 |
+
"learning_rate": 1e-05,
|
848 |
+
"loss": 1.1785,
|
849 |
+
"step": 140
|
850 |
+
},
|
851 |
+
{
|
852 |
+
"epoch": 0.18,
|
853 |
+
"learning_rate": 1e-05,
|
854 |
+
"loss": 1.1864,
|
855 |
+
"step": 141
|
856 |
+
},
|
857 |
+
{
|
858 |
+
"epoch": 0.19,
|
859 |
+
"learning_rate": 1e-05,
|
860 |
+
"loss": 1.1661,
|
861 |
+
"step": 142
|
862 |
+
},
|
863 |
+
{
|
864 |
+
"epoch": 0.19,
|
865 |
+
"learning_rate": 1e-05,
|
866 |
+
"loss": 1.167,
|
867 |
+
"step": 143
|
868 |
+
},
|
869 |
+
{
|
870 |
+
"epoch": 0.19,
|
871 |
+
"learning_rate": 1e-05,
|
872 |
+
"loss": 1.081,
|
873 |
+
"step": 144
|
874 |
+
},
|
875 |
+
{
|
876 |
+
"epoch": 0.19,
|
877 |
+
"learning_rate": 1e-05,
|
878 |
+
"loss": 1.168,
|
879 |
+
"step": 145
|
880 |
+
},
|
881 |
+
{
|
882 |
+
"epoch": 0.19,
|
883 |
+
"learning_rate": 1e-05,
|
884 |
+
"loss": 1.1371,
|
885 |
+
"step": 146
|
886 |
+
},
|
887 |
+
{
|
888 |
+
"epoch": 0.19,
|
889 |
+
"learning_rate": 1e-05,
|
890 |
+
"loss": 1.1839,
|
891 |
+
"step": 147
|
892 |
+
},
|
893 |
+
{
|
894 |
+
"epoch": 0.19,
|
895 |
+
"learning_rate": 1e-05,
|
896 |
+
"loss": 1.2448,
|
897 |
+
"step": 148
|
898 |
+
},
|
899 |
+
{
|
900 |
+
"epoch": 0.2,
|
901 |
+
"learning_rate": 1e-05,
|
902 |
+
"loss": 1.2198,
|
903 |
+
"step": 149
|
904 |
+
},
|
905 |
+
{
|
906 |
+
"epoch": 0.2,
|
907 |
+
"learning_rate": 1e-05,
|
908 |
+
"loss": 1.2014,
|
909 |
+
"step": 150
|
910 |
+
},
|
911 |
+
{
|
912 |
+
"epoch": 0.2,
|
913 |
+
"learning_rate": 1e-05,
|
914 |
+
"loss": 1.255,
|
915 |
+
"step": 151
|
916 |
+
},
|
917 |
+
{
|
918 |
+
"epoch": 0.2,
|
919 |
+
"learning_rate": 1e-05,
|
920 |
+
"loss": 1.1093,
|
921 |
+
"step": 152
|
922 |
+
},
|
923 |
+
{
|
924 |
+
"epoch": 0.2,
|
925 |
+
"learning_rate": 1e-05,
|
926 |
+
"loss": 1.1917,
|
927 |
+
"step": 153
|
928 |
+
},
|
929 |
+
{
|
930 |
+
"epoch": 0.2,
|
931 |
+
"learning_rate": 1e-05,
|
932 |
+
"loss": 1.1719,
|
933 |
+
"step": 154
|
934 |
+
},
|
935 |
+
{
|
936 |
+
"epoch": 0.2,
|
937 |
+
"learning_rate": 1e-05,
|
938 |
+
"loss": 1.1785,
|
939 |
+
"step": 155
|
940 |
+
},
|
941 |
+
{
|
942 |
+
"epoch": 0.2,
|
943 |
+
"learning_rate": 1e-05,
|
944 |
+
"loss": 1.2196,
|
945 |
+
"step": 156
|
946 |
+
},
|
947 |
+
{
|
948 |
+
"epoch": 0.21,
|
949 |
+
"learning_rate": 1e-05,
|
950 |
+
"loss": 1.2153,
|
951 |
+
"step": 157
|
952 |
+
},
|
953 |
+
{
|
954 |
+
"epoch": 0.21,
|
955 |
+
"learning_rate": 1e-05,
|
956 |
+
"loss": 1.1483,
|
957 |
+
"step": 158
|
958 |
+
},
|
959 |
+
{
|
960 |
+
"epoch": 0.21,
|
961 |
+
"learning_rate": 1e-05,
|
962 |
+
"loss": 1.2352,
|
963 |
+
"step": 159
|
964 |
+
},
|
965 |
+
{
|
966 |
+
"epoch": 0.21,
|
967 |
+
"learning_rate": 1e-05,
|
968 |
+
"loss": 1.1639,
|
969 |
+
"step": 160
|
970 |
+
},
|
971 |
+
{
|
972 |
+
"epoch": 0.21,
|
973 |
+
"learning_rate": 1e-05,
|
974 |
+
"loss": 1.1467,
|
975 |
+
"step": 161
|
976 |
+
},
|
977 |
+
{
|
978 |
+
"epoch": 0.21,
|
979 |
+
"learning_rate": 1e-05,
|
980 |
+
"loss": 1.0377,
|
981 |
+
"step": 162
|
982 |
+
},
|
983 |
+
{
|
984 |
+
"epoch": 0.21,
|
985 |
+
"learning_rate": 1e-05,
|
986 |
+
"loss": 1.1915,
|
987 |
+
"step": 163
|
988 |
+
},
|
989 |
+
{
|
990 |
+
"epoch": 0.21,
|
991 |
+
"learning_rate": 1e-05,
|
992 |
+
"loss": 1.171,
|
993 |
+
"step": 164
|
994 |
+
},
|
995 |
+
{
|
996 |
+
"epoch": 0.22,
|
997 |
+
"learning_rate": 1e-05,
|
998 |
+
"loss": 1.1325,
|
999 |
+
"step": 165
|
1000 |
+
},
|
1001 |
+
{
|
1002 |
+
"epoch": 0.22,
|
1003 |
+
"learning_rate": 1e-05,
|
1004 |
+
"loss": 1.1899,
|
1005 |
+
"step": 166
|
1006 |
+
},
|
1007 |
+
{
|
1008 |
+
"epoch": 0.22,
|
1009 |
+
"learning_rate": 1e-05,
|
1010 |
+
"loss": 1.1738,
|
1011 |
+
"step": 167
|
1012 |
+
},
|
1013 |
+
{
|
1014 |
+
"epoch": 0.22,
|
1015 |
+
"learning_rate": 1e-05,
|
1016 |
+
"loss": 1.1637,
|
1017 |
+
"step": 168
|
1018 |
+
},
|
1019 |
+
{
|
1020 |
+
"epoch": 0.22,
|
1021 |
+
"learning_rate": 1e-05,
|
1022 |
+
"loss": 1.2024,
|
1023 |
+
"step": 169
|
1024 |
+
},
|
1025 |
+
{
|
1026 |
+
"epoch": 0.22,
|
1027 |
+
"learning_rate": 1e-05,
|
1028 |
+
"loss": 1.1296,
|
1029 |
+
"step": 170
|
1030 |
+
},
|
1031 |
+
{
|
1032 |
+
"epoch": 0.22,
|
1033 |
+
"learning_rate": 1e-05,
|
1034 |
+
"loss": 1.2399,
|
1035 |
+
"step": 171
|
1036 |
+
},
|
1037 |
+
{
|
1038 |
+
"epoch": 0.23,
|
1039 |
+
"learning_rate": 1e-05,
|
1040 |
+
"loss": 1.0746,
|
1041 |
+
"step": 172
|
1042 |
+
},
|
1043 |
+
{
|
1044 |
+
"epoch": 0.23,
|
1045 |
+
"learning_rate": 1e-05,
|
1046 |
+
"loss": 1.198,
|
1047 |
+
"step": 173
|
1048 |
+
},
|
1049 |
+
{
|
1050 |
+
"epoch": 0.23,
|
1051 |
+
"learning_rate": 1e-05,
|
1052 |
+
"loss": 1.2413,
|
1053 |
+
"step": 174
|
1054 |
+
},
|
1055 |
+
{
|
1056 |
+
"epoch": 0.23,
|
1057 |
+
"learning_rate": 1e-05,
|
1058 |
+
"loss": 1.2342,
|
1059 |
+
"step": 175
|
1060 |
+
},
|
1061 |
+
{
|
1062 |
+
"epoch": 0.23,
|
1063 |
+
"learning_rate": 1e-05,
|
1064 |
+
"loss": 1.2357,
|
1065 |
+
"step": 176
|
1066 |
+
},
|
1067 |
+
{
|
1068 |
+
"epoch": 0.23,
|
1069 |
+
"learning_rate": 1e-05,
|
1070 |
+
"loss": 1.159,
|
1071 |
+
"step": 177
|
1072 |
+
},
|
1073 |
+
{
|
1074 |
+
"epoch": 0.23,
|
1075 |
+
"learning_rate": 1e-05,
|
1076 |
+
"loss": 1.2127,
|
1077 |
+
"step": 178
|
1078 |
+
},
|
1079 |
+
{
|
1080 |
+
"epoch": 0.23,
|
1081 |
+
"learning_rate": 1e-05,
|
1082 |
+
"loss": 1.1189,
|
1083 |
+
"step": 179
|
1084 |
+
},
|
1085 |
+
{
|
1086 |
+
"epoch": 0.24,
|
1087 |
+
"learning_rate": 1e-05,
|
1088 |
+
"loss": 1.1645,
|
1089 |
+
"step": 180
|
1090 |
+
},
|
1091 |
+
{
|
1092 |
+
"epoch": 0.24,
|
1093 |
+
"learning_rate": 1e-05,
|
1094 |
+
"loss": 1.172,
|
1095 |
+
"step": 181
|
1096 |
+
},
|
1097 |
+
{
|
1098 |
+
"epoch": 0.24,
|
1099 |
+
"learning_rate": 1e-05,
|
1100 |
+
"loss": 1.1497,
|
1101 |
+
"step": 182
|
1102 |
+
},
|
1103 |
+
{
|
1104 |
+
"epoch": 0.24,
|
1105 |
+
"learning_rate": 1e-05,
|
1106 |
+
"loss": 1.0676,
|
1107 |
+
"step": 183
|
1108 |
+
},
|
1109 |
+
{
|
1110 |
+
"epoch": 0.24,
|
1111 |
+
"learning_rate": 1e-05,
|
1112 |
+
"loss": 1.1294,
|
1113 |
+
"step": 184
|
1114 |
+
},
|
1115 |
+
{
|
1116 |
+
"epoch": 0.24,
|
1117 |
+
"learning_rate": 1e-05,
|
1118 |
+
"loss": 1.187,
|
1119 |
+
"step": 185
|
1120 |
+
},
|
1121 |
+
{
|
1122 |
+
"epoch": 0.24,
|
1123 |
+
"learning_rate": 1e-05,
|
1124 |
+
"loss": 1.1007,
|
1125 |
+
"step": 186
|
1126 |
+
},
|
1127 |
+
{
|
1128 |
+
"epoch": 0.25,
|
1129 |
+
"learning_rate": 1e-05,
|
1130 |
+
"loss": 1.2878,
|
1131 |
+
"step": 187
|
1132 |
+
},
|
1133 |
+
{
|
1134 |
+
"epoch": 0.25,
|
1135 |
+
"learning_rate": 1e-05,
|
1136 |
+
"loss": 1.2019,
|
1137 |
+
"step": 188
|
1138 |
+
},
|
1139 |
+
{
|
1140 |
+
"epoch": 0.25,
|
1141 |
+
"learning_rate": 1e-05,
|
1142 |
+
"loss": 1.2057,
|
1143 |
+
"step": 189
|
1144 |
+
},
|
1145 |
+
{
|
1146 |
+
"epoch": 0.25,
|
1147 |
+
"learning_rate": 1e-05,
|
1148 |
+
"loss": 1.1091,
|
1149 |
+
"step": 190
|
1150 |
+
},
|
1151 |
+
{
|
1152 |
+
"epoch": 0.25,
|
1153 |
+
"learning_rate": 1e-05,
|
1154 |
+
"loss": 1.1311,
|
1155 |
+
"step": 191
|
1156 |
+
},
|
1157 |
+
{
|
1158 |
+
"epoch": 0.25,
|
1159 |
+
"learning_rate": 1e-05,
|
1160 |
+
"loss": 1.057,
|
1161 |
+
"step": 192
|
1162 |
+
},
|
1163 |
+
{
|
1164 |
+
"epoch": 0.25,
|
1165 |
+
"learning_rate": 1e-05,
|
1166 |
+
"loss": 1.2647,
|
1167 |
+
"step": 193
|
1168 |
+
},
|
1169 |
+
{
|
1170 |
+
"epoch": 0.25,
|
1171 |
+
"learning_rate": 1e-05,
|
1172 |
+
"loss": 1.1708,
|
1173 |
+
"step": 194
|
1174 |
+
},
|
1175 |
+
{
|
1176 |
+
"epoch": 0.26,
|
1177 |
+
"learning_rate": 1e-05,
|
1178 |
+
"loss": 1.1876,
|
1179 |
+
"step": 195
|
1180 |
+
},
|
1181 |
+
{
|
1182 |
+
"epoch": 0.26,
|
1183 |
+
"learning_rate": 1e-05,
|
1184 |
+
"loss": 1.2016,
|
1185 |
+
"step": 196
|
1186 |
+
},
|
1187 |
+
{
|
1188 |
+
"epoch": 0.26,
|
1189 |
+
"learning_rate": 1e-05,
|
1190 |
+
"loss": 1.1602,
|
1191 |
+
"step": 197
|
1192 |
+
},
|
1193 |
+
{
|
1194 |
+
"epoch": 0.26,
|
1195 |
+
"learning_rate": 1e-05,
|
1196 |
+
"loss": 1.0654,
|
1197 |
+
"step": 198
|
1198 |
+
},
|
1199 |
+
{
|
1200 |
+
"epoch": 0.26,
|
1201 |
+
"learning_rate": 1e-05,
|
1202 |
+
"loss": 1.2093,
|
1203 |
+
"step": 199
|
1204 |
+
},
|
1205 |
+
{
|
1206 |
+
"epoch": 0.26,
|
1207 |
+
"learning_rate": 1e-05,
|
1208 |
+
"loss": 1.2223,
|
1209 |
+
"step": 200
|
1210 |
+
},
|
1211 |
+
{
|
1212 |
+
"epoch": 0.26,
|
1213 |
+
"learning_rate": 1e-05,
|
1214 |
+
"loss": 1.2057,
|
1215 |
+
"step": 201
|
1216 |
+
},
|
1217 |
+
{
|
1218 |
+
"epoch": 0.26,
|
1219 |
+
"learning_rate": 1e-05,
|
1220 |
+
"loss": 1.1704,
|
1221 |
+
"step": 202
|
1222 |
+
},
|
1223 |
+
{
|
1224 |
+
"epoch": 0.27,
|
1225 |
+
"learning_rate": 1e-05,
|
1226 |
+
"loss": 1.1818,
|
1227 |
+
"step": 203
|
1228 |
+
},
|
1229 |
+
{
|
1230 |
+
"epoch": 0.27,
|
1231 |
+
"learning_rate": 1e-05,
|
1232 |
+
"loss": 1.1632,
|
1233 |
+
"step": 204
|
1234 |
+
},
|
1235 |
+
{
|
1236 |
+
"epoch": 0.27,
|
1237 |
+
"learning_rate": 1e-05,
|
1238 |
+
"loss": 1.1938,
|
1239 |
+
"step": 205
|
1240 |
+
},
|
1241 |
+
{
|
1242 |
+
"epoch": 0.27,
|
1243 |
+
"learning_rate": 1e-05,
|
1244 |
+
"loss": 1.2035,
|
1245 |
+
"step": 206
|
1246 |
+
},
|
1247 |
+
{
|
1248 |
+
"epoch": 0.27,
|
1249 |
+
"learning_rate": 1e-05,
|
1250 |
+
"loss": 1.1826,
|
1251 |
+
"step": 207
|
1252 |
+
},
|
1253 |
+
{
|
1254 |
+
"epoch": 0.27,
|
1255 |
+
"learning_rate": 1e-05,
|
1256 |
+
"loss": 1.1667,
|
1257 |
+
"step": 208
|
1258 |
+
},
|
1259 |
+
{
|
1260 |
+
"epoch": 0.27,
|
1261 |
+
"learning_rate": 1e-05,
|
1262 |
+
"loss": 1.1591,
|
1263 |
+
"step": 209
|
1264 |
+
},
|
1265 |
+
{
|
1266 |
+
"epoch": 0.28,
|
1267 |
+
"learning_rate": 1e-05,
|
1268 |
+
"loss": 1.1854,
|
1269 |
+
"step": 210
|
1270 |
+
},
|
1271 |
+
{
|
1272 |
+
"epoch": 0.28,
|
1273 |
+
"learning_rate": 1e-05,
|
1274 |
+
"loss": 1.1122,
|
1275 |
+
"step": 211
|
1276 |
+
},
|
1277 |
+
{
|
1278 |
+
"epoch": 0.28,
|
1279 |
+
"learning_rate": 1e-05,
|
1280 |
+
"loss": 1.0791,
|
1281 |
+
"step": 212
|
1282 |
+
},
|
1283 |
+
{
|
1284 |
+
"epoch": 0.28,
|
1285 |
+
"learning_rate": 1e-05,
|
1286 |
+
"loss": 1.1404,
|
1287 |
+
"step": 213
|
1288 |
+
},
|
1289 |
+
{
|
1290 |
+
"epoch": 0.28,
|
1291 |
+
"learning_rate": 1e-05,
|
1292 |
+
"loss": 1.0595,
|
1293 |
+
"step": 214
|
1294 |
+
},
|
1295 |
+
{
|
1296 |
+
"epoch": 0.28,
|
1297 |
+
"learning_rate": 1e-05,
|
1298 |
+
"loss": 1.1264,
|
1299 |
+
"step": 215
|
1300 |
+
},
|
1301 |
+
{
|
1302 |
+
"epoch": 0.28,
|
1303 |
+
"learning_rate": 1e-05,
|
1304 |
+
"loss": 1.2122,
|
1305 |
+
"step": 216
|
1306 |
+
},
|
1307 |
+
{
|
1308 |
+
"epoch": 0.28,
|
1309 |
+
"learning_rate": 1e-05,
|
1310 |
+
"loss": 1.1667,
|
1311 |
+
"step": 217
|
1312 |
+
},
|
1313 |
+
{
|
1314 |
+
"epoch": 0.29,
|
1315 |
+
"learning_rate": 1e-05,
|
1316 |
+
"loss": 1.17,
|
1317 |
+
"step": 218
|
1318 |
+
},
|
1319 |
+
{
|
1320 |
+
"epoch": 0.29,
|
1321 |
+
"learning_rate": 1e-05,
|
1322 |
+
"loss": 1.1275,
|
1323 |
+
"step": 219
|
1324 |
+
},
|
1325 |
+
{
|
1326 |
+
"epoch": 0.29,
|
1327 |
+
"learning_rate": 1e-05,
|
1328 |
+
"loss": 1.1915,
|
1329 |
+
"step": 220
|
1330 |
+
},
|
1331 |
+
{
|
1332 |
+
"epoch": 0.29,
|
1333 |
+
"learning_rate": 1e-05,
|
1334 |
+
"loss": 1.1317,
|
1335 |
+
"step": 221
|
1336 |
+
},
|
1337 |
+
{
|
1338 |
+
"epoch": 0.29,
|
1339 |
+
"learning_rate": 1e-05,
|
1340 |
+
"loss": 1.1482,
|
1341 |
+
"step": 222
|
1342 |
+
},
|
1343 |
+
{
|
1344 |
+
"epoch": 0.29,
|
1345 |
+
"learning_rate": 1e-05,
|
1346 |
+
"loss": 1.1738,
|
1347 |
+
"step": 223
|
1348 |
+
},
|
1349 |
+
{
|
1350 |
+
"epoch": 0.29,
|
1351 |
+
"learning_rate": 1e-05,
|
1352 |
+
"loss": 1.1369,
|
1353 |
+
"step": 224
|
1354 |
+
},
|
1355 |
+
{
|
1356 |
+
"epoch": 0.29,
|
1357 |
+
"learning_rate": 1e-05,
|
1358 |
+
"loss": 1.1274,
|
1359 |
+
"step": 225
|
1360 |
+
},
|
1361 |
+
{
|
1362 |
+
"epoch": 0.3,
|
1363 |
+
"learning_rate": 1e-05,
|
1364 |
+
"loss": 1.098,
|
1365 |
+
"step": 226
|
1366 |
+
},
|
1367 |
+
{
|
1368 |
+
"epoch": 0.3,
|
1369 |
+
"learning_rate": 1e-05,
|
1370 |
+
"loss": 1.1118,
|
1371 |
+
"step": 227
|
1372 |
+
},
|
1373 |
+
{
|
1374 |
+
"epoch": 0.3,
|
1375 |
+
"learning_rate": 1e-05,
|
1376 |
+
"loss": 1.1298,
|
1377 |
+
"step": 228
|
1378 |
+
},
|
1379 |
+
{
|
1380 |
+
"epoch": 0.3,
|
1381 |
+
"learning_rate": 1e-05,
|
1382 |
+
"loss": 1.1451,
|
1383 |
+
"step": 229
|
1384 |
+
},
|
1385 |
+
{
|
1386 |
+
"epoch": 0.3,
|
1387 |
+
"learning_rate": 1e-05,
|
1388 |
+
"loss": 1.1106,
|
1389 |
+
"step": 230
|
1390 |
+
},
|
1391 |
+
{
|
1392 |
+
"epoch": 0.3,
|
1393 |
+
"learning_rate": 1e-05,
|
1394 |
+
"loss": 1.2434,
|
1395 |
+
"step": 231
|
1396 |
+
},
|
1397 |
+
{
|
1398 |
+
"epoch": 0.3,
|
1399 |
+
"learning_rate": 1e-05,
|
1400 |
+
"loss": 1.2448,
|
1401 |
+
"step": 232
|
1402 |
+
},
|
1403 |
+
{
|
1404 |
+
"epoch": 0.31,
|
1405 |
+
"learning_rate": 1e-05,
|
1406 |
+
"loss": 1.2178,
|
1407 |
+
"step": 233
|
1408 |
+
},
|
1409 |
+
{
|
1410 |
+
"epoch": 0.31,
|
1411 |
+
"learning_rate": 1e-05,
|
1412 |
+
"loss": 1.2108,
|
1413 |
+
"step": 234
|
1414 |
+
},
|
1415 |
+
{
|
1416 |
+
"epoch": 0.31,
|
1417 |
+
"learning_rate": 1e-05,
|
1418 |
+
"loss": 1.144,
|
1419 |
+
"step": 235
|
1420 |
+
},
|
1421 |
+
{
|
1422 |
+
"epoch": 0.31,
|
1423 |
+
"learning_rate": 1e-05,
|
1424 |
+
"loss": 1.207,
|
1425 |
+
"step": 236
|
1426 |
+
},
|
1427 |
+
{
|
1428 |
+
"epoch": 0.31,
|
1429 |
+
"learning_rate": 1e-05,
|
1430 |
+
"loss": 1.1764,
|
1431 |
+
"step": 237
|
1432 |
+
},
|
1433 |
+
{
|
1434 |
+
"epoch": 0.31,
|
1435 |
+
"learning_rate": 1e-05,
|
1436 |
+
"loss": 1.1789,
|
1437 |
+
"step": 238
|
1438 |
+
},
|
1439 |
+
{
|
1440 |
+
"epoch": 0.31,
|
1441 |
+
"learning_rate": 1e-05,
|
1442 |
+
"loss": 1.1937,
|
1443 |
+
"step": 239
|
1444 |
+
},
|
1445 |
+
{
|
1446 |
+
"epoch": 0.31,
|
1447 |
+
"learning_rate": 1e-05,
|
1448 |
+
"loss": 1.165,
|
1449 |
+
"step": 240
|
1450 |
+
},
|
1451 |
+
{
|
1452 |
+
"epoch": 0.32,
|
1453 |
+
"learning_rate": 1e-05,
|
1454 |
+
"loss": 1.0736,
|
1455 |
+
"step": 241
|
1456 |
+
},
|
1457 |
+
{
|
1458 |
+
"epoch": 0.32,
|
1459 |
+
"learning_rate": 1e-05,
|
1460 |
+
"loss": 1.122,
|
1461 |
+
"step": 242
|
1462 |
+
},
|
1463 |
+
{
|
1464 |
+
"epoch": 0.32,
|
1465 |
+
"learning_rate": 1e-05,
|
1466 |
+
"loss": 1.195,
|
1467 |
+
"step": 243
|
1468 |
+
},
|
1469 |
+
{
|
1470 |
+
"epoch": 0.32,
|
1471 |
+
"learning_rate": 1e-05,
|
1472 |
+
"loss": 1.1534,
|
1473 |
+
"step": 244
|
1474 |
+
},
|
1475 |
+
{
|
1476 |
+
"epoch": 0.32,
|
1477 |
+
"learning_rate": 1e-05,
|
1478 |
+
"loss": 1.0497,
|
1479 |
+
"step": 245
|
1480 |
+
},
|
1481 |
+
{
|
1482 |
+
"epoch": 0.32,
|
1483 |
+
"learning_rate": 1e-05,
|
1484 |
+
"loss": 1.22,
|
1485 |
+
"step": 246
|
1486 |
+
},
|
1487 |
+
{
|
1488 |
+
"epoch": 0.32,
|
1489 |
+
"learning_rate": 1e-05,
|
1490 |
+
"loss": 1.105,
|
1491 |
+
"step": 247
|
1492 |
+
},
|
1493 |
+
{
|
1494 |
+
"epoch": 0.32,
|
1495 |
+
"learning_rate": 1e-05,
|
1496 |
+
"loss": 1.1331,
|
1497 |
+
"step": 248
|
1498 |
+
},
|
1499 |
+
{
|
1500 |
+
"epoch": 0.33,
|
1501 |
+
"learning_rate": 1e-05,
|
1502 |
+
"loss": 1.1233,
|
1503 |
+
"step": 249
|
1504 |
+
},
|
1505 |
+
{
|
1506 |
+
"epoch": 0.33,
|
1507 |
+
"learning_rate": 1e-05,
|
1508 |
+
"loss": 1.1533,
|
1509 |
+
"step": 250
|
1510 |
+
},
|
1511 |
+
{
|
1512 |
+
"epoch": 0.33,
|
1513 |
+
"learning_rate": 1e-05,
|
1514 |
+
"loss": 1.0814,
|
1515 |
+
"step": 251
|
1516 |
+
},
|
1517 |
+
{
|
1518 |
+
"epoch": 0.33,
|
1519 |
+
"learning_rate": 1e-05,
|
1520 |
+
"loss": 1.1771,
|
1521 |
+
"step": 252
|
1522 |
+
},
|
1523 |
+
{
|
1524 |
+
"epoch": 0.33,
|
1525 |
+
"learning_rate": 1e-05,
|
1526 |
+
"loss": 1.1722,
|
1527 |
+
"step": 253
|
1528 |
+
},
|
1529 |
+
{
|
1530 |
+
"epoch": 0.33,
|
1531 |
+
"learning_rate": 1e-05,
|
1532 |
+
"loss": 1.1772,
|
1533 |
+
"step": 254
|
1534 |
+
},
|
1535 |
+
{
|
1536 |
+
"epoch": 0.33,
|
1537 |
+
"learning_rate": 1e-05,
|
1538 |
+
"loss": 1.1644,
|
1539 |
+
"step": 255
|
1540 |
+
},
|
1541 |
+
{
|
1542 |
+
"epoch": 0.34,
|
1543 |
+
"learning_rate": 1e-05,
|
1544 |
+
"loss": 1.0746,
|
1545 |
+
"step": 256
|
1546 |
+
},
|
1547 |
+
{
|
1548 |
+
"epoch": 0.34,
|
1549 |
+
"learning_rate": 1e-05,
|
1550 |
+
"loss": 1.1853,
|
1551 |
+
"step": 257
|
1552 |
+
},
|
1553 |
+
{
|
1554 |
+
"epoch": 0.34,
|
1555 |
+
"learning_rate": 1e-05,
|
1556 |
+
"loss": 1.1081,
|
1557 |
+
"step": 258
|
1558 |
+
},
|
1559 |
+
{
|
1560 |
+
"epoch": 0.34,
|
1561 |
+
"learning_rate": 1e-05,
|
1562 |
+
"loss": 1.2228,
|
1563 |
+
"step": 259
|
1564 |
+
},
|
1565 |
+
{
|
1566 |
+
"epoch": 0.34,
|
1567 |
+
"learning_rate": 1e-05,
|
1568 |
+
"loss": 1.1414,
|
1569 |
+
"step": 260
|
1570 |
+
},
|
1571 |
+
{
|
1572 |
+
"epoch": 0.34,
|
1573 |
+
"learning_rate": 1e-05,
|
1574 |
+
"loss": 1.1071,
|
1575 |
+
"step": 261
|
1576 |
+
},
|
1577 |
+
{
|
1578 |
+
"epoch": 0.34,
|
1579 |
+
"learning_rate": 1e-05,
|
1580 |
+
"loss": 1.1327,
|
1581 |
+
"step": 262
|
1582 |
+
},
|
1583 |
+
{
|
1584 |
+
"epoch": 0.34,
|
1585 |
+
"learning_rate": 1e-05,
|
1586 |
+
"loss": 1.0866,
|
1587 |
+
"step": 263
|
1588 |
+
},
|
1589 |
+
{
|
1590 |
+
"epoch": 0.35,
|
1591 |
+
"learning_rate": 1e-05,
|
1592 |
+
"loss": 1.1377,
|
1593 |
+
"step": 264
|
1594 |
+
},
|
1595 |
+
{
|
1596 |
+
"epoch": 0.35,
|
1597 |
+
"learning_rate": 1e-05,
|
1598 |
+
"loss": 1.1854,
|
1599 |
+
"step": 265
|
1600 |
+
},
|
1601 |
+
{
|
1602 |
+
"epoch": 0.35,
|
1603 |
+
"learning_rate": 1e-05,
|
1604 |
+
"loss": 1.1462,
|
1605 |
+
"step": 266
|
1606 |
+
},
|
1607 |
+
{
|
1608 |
+
"epoch": 0.35,
|
1609 |
+
"learning_rate": 1e-05,
|
1610 |
+
"loss": 1.0672,
|
1611 |
+
"step": 267
|
1612 |
+
},
|
1613 |
+
{
|
1614 |
+
"epoch": 0.35,
|
1615 |
+
"learning_rate": 1e-05,
|
1616 |
+
"loss": 1.2539,
|
1617 |
+
"step": 268
|
1618 |
+
},
|
1619 |
+
{
|
1620 |
+
"epoch": 0.35,
|
1621 |
+
"learning_rate": 1e-05,
|
1622 |
+
"loss": 1.2115,
|
1623 |
+
"step": 269
|
1624 |
+
},
|
1625 |
+
{
|
1626 |
+
"epoch": 0.35,
|
1627 |
+
"learning_rate": 1e-05,
|
1628 |
+
"loss": 1.1712,
|
1629 |
+
"step": 270
|
1630 |
+
},
|
1631 |
+
{
|
1632 |
+
"epoch": 0.36,
|
1633 |
+
"learning_rate": 1e-05,
|
1634 |
+
"loss": 1.1874,
|
1635 |
+
"step": 271
|
1636 |
+
},
|
1637 |
+
{
|
1638 |
+
"epoch": 0.36,
|
1639 |
+
"learning_rate": 1e-05,
|
1640 |
+
"loss": 1.2199,
|
1641 |
+
"step": 272
|
1642 |
+
},
|
1643 |
+
{
|
1644 |
+
"epoch": 0.36,
|
1645 |
+
"learning_rate": 1e-05,
|
1646 |
+
"loss": 1.1905,
|
1647 |
+
"step": 273
|
1648 |
+
},
|
1649 |
+
{
|
1650 |
+
"epoch": 0.36,
|
1651 |
+
"learning_rate": 1e-05,
|
1652 |
+
"loss": 1.1675,
|
1653 |
+
"step": 274
|
1654 |
+
},
|
1655 |
+
{
|
1656 |
+
"epoch": 0.36,
|
1657 |
+
"learning_rate": 1e-05,
|
1658 |
+
"loss": 1.2049,
|
1659 |
+
"step": 275
|
1660 |
+
},
|
1661 |
+
{
|
1662 |
+
"epoch": 0.36,
|
1663 |
+
"learning_rate": 1e-05,
|
1664 |
+
"loss": 1.0632,
|
1665 |
+
"step": 276
|
1666 |
+
},
|
1667 |
+
{
|
1668 |
+
"epoch": 0.36,
|
1669 |
+
"learning_rate": 1e-05,
|
1670 |
+
"loss": 1.2113,
|
1671 |
+
"step": 277
|
1672 |
+
},
|
1673 |
+
{
|
1674 |
+
"epoch": 0.36,
|
1675 |
+
"learning_rate": 1e-05,
|
1676 |
+
"loss": 1.1781,
|
1677 |
+
"step": 278
|
1678 |
+
},
|
1679 |
+
{
|
1680 |
+
"epoch": 0.37,
|
1681 |
+
"learning_rate": 1e-05,
|
1682 |
+
"loss": 1.1979,
|
1683 |
+
"step": 279
|
1684 |
+
},
|
1685 |
+
{
|
1686 |
+
"epoch": 0.37,
|
1687 |
+
"learning_rate": 1e-05,
|
1688 |
+
"loss": 1.0251,
|
1689 |
+
"step": 280
|
1690 |
+
},
|
1691 |
+
{
|
1692 |
+
"epoch": 0.37,
|
1693 |
+
"learning_rate": 1e-05,
|
1694 |
+
"loss": 1.0963,
|
1695 |
+
"step": 281
|
1696 |
+
},
|
1697 |
+
{
|
1698 |
+
"epoch": 0.37,
|
1699 |
+
"learning_rate": 1e-05,
|
1700 |
+
"loss": 1.2862,
|
1701 |
+
"step": 282
|
1702 |
+
},
|
1703 |
+
{
|
1704 |
+
"epoch": 0.37,
|
1705 |
+
"learning_rate": 1e-05,
|
1706 |
+
"loss": 1.2339,
|
1707 |
+
"step": 283
|
1708 |
+
},
|
1709 |
+
{
|
1710 |
+
"epoch": 0.37,
|
1711 |
+
"learning_rate": 1e-05,
|
1712 |
+
"loss": 1.1541,
|
1713 |
+
"step": 284
|
1714 |
+
},
|
1715 |
+
{
|
1716 |
+
"epoch": 0.37,
|
1717 |
+
"learning_rate": 1e-05,
|
1718 |
+
"loss": 1.2246,
|
1719 |
+
"step": 285
|
1720 |
+
},
|
1721 |
+
{
|
1722 |
+
"epoch": 0.37,
|
1723 |
+
"learning_rate": 1e-05,
|
1724 |
+
"loss": 1.1562,
|
1725 |
+
"step": 286
|
1726 |
+
},
|
1727 |
+
{
|
1728 |
+
"epoch": 0.38,
|
1729 |
+
"learning_rate": 1e-05,
|
1730 |
+
"loss": 1.1304,
|
1731 |
+
"step": 287
|
1732 |
+
},
|
1733 |
+
{
|
1734 |
+
"epoch": 0.38,
|
1735 |
+
"learning_rate": 1e-05,
|
1736 |
+
"loss": 1.1691,
|
1737 |
+
"step": 288
|
1738 |
+
},
|
1739 |
+
{
|
1740 |
+
"epoch": 0.38,
|
1741 |
+
"learning_rate": 1e-05,
|
1742 |
+
"loss": 1.1246,
|
1743 |
+
"step": 289
|
1744 |
+
},
|
1745 |
+
{
|
1746 |
+
"epoch": 0.38,
|
1747 |
+
"learning_rate": 1e-05,
|
1748 |
+
"loss": 1.0747,
|
1749 |
+
"step": 290
|
1750 |
+
},
|
1751 |
+
{
|
1752 |
+
"epoch": 0.38,
|
1753 |
+
"learning_rate": 1e-05,
|
1754 |
+
"loss": 1.101,
|
1755 |
+
"step": 291
|
1756 |
+
},
|
1757 |
+
{
|
1758 |
+
"epoch": 0.38,
|
1759 |
+
"learning_rate": 1e-05,
|
1760 |
+
"loss": 1.1435,
|
1761 |
+
"step": 292
|
1762 |
+
},
|
1763 |
+
{
|
1764 |
+
"epoch": 0.38,
|
1765 |
+
"learning_rate": 1e-05,
|
1766 |
+
"loss": 1.1791,
|
1767 |
+
"step": 293
|
1768 |
+
},
|
1769 |
+
{
|
1770 |
+
"epoch": 0.39,
|
1771 |
+
"learning_rate": 1e-05,
|
1772 |
+
"loss": 1.1166,
|
1773 |
+
"step": 294
|
1774 |
+
},
|
1775 |
+
{
|
1776 |
+
"epoch": 0.39,
|
1777 |
+
"learning_rate": 1e-05,
|
1778 |
+
"loss": 1.1448,
|
1779 |
+
"step": 295
|
1780 |
+
},
|
1781 |
+
{
|
1782 |
+
"epoch": 0.39,
|
1783 |
+
"learning_rate": 1e-05,
|
1784 |
+
"loss": 1.1363,
|
1785 |
+
"step": 296
|
1786 |
+
},
|
1787 |
+
{
|
1788 |
+
"epoch": 0.39,
|
1789 |
+
"learning_rate": 1e-05,
|
1790 |
+
"loss": 1.1725,
|
1791 |
+
"step": 297
|
1792 |
+
},
|
1793 |
+
{
|
1794 |
+
"epoch": 0.39,
|
1795 |
+
"learning_rate": 1e-05,
|
1796 |
+
"loss": 1.0774,
|
1797 |
+
"step": 298
|
1798 |
+
},
|
1799 |
+
{
|
1800 |
+
"epoch": 0.39,
|
1801 |
+
"learning_rate": 1e-05,
|
1802 |
+
"loss": 1.1569,
|
1803 |
+
"step": 299
|
1804 |
+
},
|
1805 |
+
{
|
1806 |
+
"epoch": 0.39,
|
1807 |
+
"learning_rate": 1e-05,
|
1808 |
+
"loss": 1.0678,
|
1809 |
+
"step": 300
|
1810 |
+
},
|
1811 |
+
{
|
1812 |
+
"epoch": 0.39,
|
1813 |
+
"learning_rate": 1e-05,
|
1814 |
+
"loss": 1.1603,
|
1815 |
+
"step": 301
|
1816 |
+
},
|
1817 |
+
{
|
1818 |
+
"epoch": 0.4,
|
1819 |
+
"learning_rate": 1e-05,
|
1820 |
+
"loss": 1.0945,
|
1821 |
+
"step": 302
|
1822 |
+
},
|
1823 |
+
{
|
1824 |
+
"epoch": 0.4,
|
1825 |
+
"learning_rate": 1e-05,
|
1826 |
+
"loss": 1.1447,
|
1827 |
+
"step": 303
|
1828 |
+
},
|
1829 |
+
{
|
1830 |
+
"epoch": 0.4,
|
1831 |
+
"learning_rate": 1e-05,
|
1832 |
+
"loss": 1.213,
|
1833 |
+
"step": 304
|
1834 |
+
},
|
1835 |
+
{
|
1836 |
+
"epoch": 0.4,
|
1837 |
+
"learning_rate": 1e-05,
|
1838 |
+
"loss": 1.1232,
|
1839 |
+
"step": 305
|
1840 |
+
},
|
1841 |
+
{
|
1842 |
+
"epoch": 0.4,
|
1843 |
+
"learning_rate": 1e-05,
|
1844 |
+
"loss": 1.0816,
|
1845 |
+
"step": 306
|
1846 |
+
},
|
1847 |
+
{
|
1848 |
+
"epoch": 0.4,
|
1849 |
+
"learning_rate": 1e-05,
|
1850 |
+
"loss": 1.1605,
|
1851 |
+
"step": 307
|
1852 |
+
},
|
1853 |
+
{
|
1854 |
+
"epoch": 0.4,
|
1855 |
+
"learning_rate": 1e-05,
|
1856 |
+
"loss": 1.1522,
|
1857 |
+
"step": 308
|
1858 |
+
},
|
1859 |
+
{
|
1860 |
+
"epoch": 0.4,
|
1861 |
+
"learning_rate": 1e-05,
|
1862 |
+
"loss": 1.106,
|
1863 |
+
"step": 309
|
1864 |
+
},
|
1865 |
+
{
|
1866 |
+
"epoch": 0.41,
|
1867 |
+
"learning_rate": 1e-05,
|
1868 |
+
"loss": 1.0764,
|
1869 |
+
"step": 310
|
1870 |
+
},
|
1871 |
+
{
|
1872 |
+
"epoch": 0.41,
|
1873 |
+
"learning_rate": 1e-05,
|
1874 |
+
"loss": 1.1571,
|
1875 |
+
"step": 311
|
1876 |
+
},
|
1877 |
+
{
|
1878 |
+
"epoch": 0.41,
|
1879 |
+
"learning_rate": 1e-05,
|
1880 |
+
"loss": 1.0537,
|
1881 |
+
"step": 312
|
1882 |
+
},
|
1883 |
+
{
|
1884 |
+
"epoch": 0.41,
|
1885 |
+
"learning_rate": 1e-05,
|
1886 |
+
"loss": 1.1303,
|
1887 |
+
"step": 313
|
1888 |
+
},
|
1889 |
+
{
|
1890 |
+
"epoch": 0.41,
|
1891 |
+
"learning_rate": 1e-05,
|
1892 |
+
"loss": 1.1422,
|
1893 |
+
"step": 314
|
1894 |
+
},
|
1895 |
+
{
|
1896 |
+
"epoch": 0.41,
|
1897 |
+
"learning_rate": 1e-05,
|
1898 |
+
"loss": 1.2062,
|
1899 |
+
"step": 315
|
1900 |
+
},
|
1901 |
+
{
|
1902 |
+
"epoch": 0.41,
|
1903 |
+
"learning_rate": 1e-05,
|
1904 |
+
"loss": 1.2219,
|
1905 |
+
"step": 316
|
1906 |
+
},
|
1907 |
+
{
|
1908 |
+
"epoch": 0.42,
|
1909 |
+
"learning_rate": 1e-05,
|
1910 |
+
"loss": 1.1497,
|
1911 |
+
"step": 317
|
1912 |
+
},
|
1913 |
+
{
|
1914 |
+
"epoch": 0.42,
|
1915 |
+
"learning_rate": 1e-05,
|
1916 |
+
"loss": 1.1758,
|
1917 |
+
"step": 318
|
1918 |
+
},
|
1919 |
+
{
|
1920 |
+
"epoch": 0.42,
|
1921 |
+
"learning_rate": 1e-05,
|
1922 |
+
"loss": 1.0641,
|
1923 |
+
"step": 319
|
1924 |
+
},
|
1925 |
+
{
|
1926 |
+
"epoch": 0.42,
|
1927 |
+
"learning_rate": 1e-05,
|
1928 |
+
"loss": 1.137,
|
1929 |
+
"step": 320
|
1930 |
+
},
|
1931 |
+
{
|
1932 |
+
"epoch": 0.42,
|
1933 |
+
"learning_rate": 1e-05,
|
1934 |
+
"loss": 1.2398,
|
1935 |
+
"step": 321
|
1936 |
+
},
|
1937 |
+
{
|
1938 |
+
"epoch": 0.42,
|
1939 |
+
"learning_rate": 1e-05,
|
1940 |
+
"loss": 1.1259,
|
1941 |
+
"step": 322
|
1942 |
+
},
|
1943 |
+
{
|
1944 |
+
"epoch": 0.42,
|
1945 |
+
"learning_rate": 1e-05,
|
1946 |
+
"loss": 1.1144,
|
1947 |
+
"step": 323
|
1948 |
+
},
|
1949 |
+
{
|
1950 |
+
"epoch": 0.42,
|
1951 |
+
"learning_rate": 1e-05,
|
1952 |
+
"loss": 1.1751,
|
1953 |
+
"step": 324
|
1954 |
+
},
|
1955 |
+
{
|
1956 |
+
"epoch": 0.43,
|
1957 |
+
"learning_rate": 1e-05,
|
1958 |
+
"loss": 1.1245,
|
1959 |
+
"step": 325
|
1960 |
+
},
|
1961 |
+
{
|
1962 |
+
"epoch": 0.43,
|
1963 |
+
"learning_rate": 1e-05,
|
1964 |
+
"loss": 1.17,
|
1965 |
+
"step": 326
|
1966 |
+
},
|
1967 |
+
{
|
1968 |
+
"epoch": 0.43,
|
1969 |
+
"learning_rate": 1e-05,
|
1970 |
+
"loss": 1.0883,
|
1971 |
+
"step": 327
|
1972 |
+
},
|
1973 |
+
{
|
1974 |
+
"epoch": 0.43,
|
1975 |
+
"learning_rate": 1e-05,
|
1976 |
+
"loss": 1.0721,
|
1977 |
+
"step": 328
|
1978 |
+
},
|
1979 |
+
{
|
1980 |
+
"epoch": 0.43,
|
1981 |
+
"learning_rate": 1e-05,
|
1982 |
+
"loss": 1.2494,
|
1983 |
+
"step": 329
|
1984 |
+
},
|
1985 |
+
{
|
1986 |
+
"epoch": 0.43,
|
1987 |
+
"learning_rate": 1e-05,
|
1988 |
+
"loss": 1.1764,
|
1989 |
+
"step": 330
|
1990 |
+
},
|
1991 |
+
{
|
1992 |
+
"epoch": 0.43,
|
1993 |
+
"learning_rate": 1e-05,
|
1994 |
+
"loss": 1.1573,
|
1995 |
+
"step": 331
|
1996 |
+
},
|
1997 |
+
{
|
1998 |
+
"epoch": 0.44,
|
1999 |
+
"learning_rate": 1e-05,
|
2000 |
+
"loss": 1.1673,
|
2001 |
+
"step": 332
|
2002 |
+
},
|
2003 |
+
{
|
2004 |
+
"epoch": 0.44,
|
2005 |
+
"learning_rate": 1e-05,
|
2006 |
+
"loss": 1.1486,
|
2007 |
+
"step": 333
|
2008 |
+
},
|
2009 |
+
{
|
2010 |
+
"epoch": 0.44,
|
2011 |
+
"learning_rate": 1e-05,
|
2012 |
+
"loss": 1.1519,
|
2013 |
+
"step": 334
|
2014 |
+
},
|
2015 |
+
{
|
2016 |
+
"epoch": 0.44,
|
2017 |
+
"learning_rate": 1e-05,
|
2018 |
+
"loss": 1.0729,
|
2019 |
+
"step": 335
|
2020 |
+
},
|
2021 |
+
{
|
2022 |
+
"epoch": 0.44,
|
2023 |
+
"learning_rate": 1e-05,
|
2024 |
+
"loss": 1.1353,
|
2025 |
+
"step": 336
|
2026 |
+
},
|
2027 |
+
{
|
2028 |
+
"epoch": 0.44,
|
2029 |
+
"learning_rate": 1e-05,
|
2030 |
+
"loss": 1.1501,
|
2031 |
+
"step": 337
|
2032 |
+
},
|
2033 |
+
{
|
2034 |
+
"epoch": 0.44,
|
2035 |
+
"learning_rate": 1e-05,
|
2036 |
+
"loss": 1.1535,
|
2037 |
+
"step": 338
|
2038 |
+
},
|
2039 |
+
{
|
2040 |
+
"epoch": 0.44,
|
2041 |
+
"learning_rate": 1e-05,
|
2042 |
+
"loss": 1.1697,
|
2043 |
+
"step": 339
|
2044 |
+
},
|
2045 |
+
{
|
2046 |
+
"epoch": 0.45,
|
2047 |
+
"learning_rate": 1e-05,
|
2048 |
+
"loss": 1.0906,
|
2049 |
+
"step": 340
|
2050 |
+
},
|
2051 |
+
{
|
2052 |
+
"epoch": 0.45,
|
2053 |
+
"learning_rate": 1e-05,
|
2054 |
+
"loss": 1.1993,
|
2055 |
+
"step": 341
|
2056 |
+
},
|
2057 |
+
{
|
2058 |
+
"epoch": 0.45,
|
2059 |
+
"learning_rate": 1e-05,
|
2060 |
+
"loss": 1.1824,
|
2061 |
+
"step": 342
|
2062 |
+
},
|
2063 |
+
{
|
2064 |
+
"epoch": 0.45,
|
2065 |
+
"learning_rate": 1e-05,
|
2066 |
+
"loss": 1.1422,
|
2067 |
+
"step": 343
|
2068 |
+
},
|
2069 |
+
{
|
2070 |
+
"epoch": 0.45,
|
2071 |
+
"learning_rate": 1e-05,
|
2072 |
+
"loss": 1.093,
|
2073 |
+
"step": 344
|
2074 |
+
},
|
2075 |
+
{
|
2076 |
+
"epoch": 0.45,
|
2077 |
+
"learning_rate": 1e-05,
|
2078 |
+
"loss": 1.1148,
|
2079 |
+
"step": 345
|
2080 |
+
},
|
2081 |
+
{
|
2082 |
+
"epoch": 0.45,
|
2083 |
+
"learning_rate": 1e-05,
|
2084 |
+
"loss": 1.1025,
|
2085 |
+
"step": 346
|
2086 |
+
},
|
2087 |
+
{
|
2088 |
+
"epoch": 0.45,
|
2089 |
+
"learning_rate": 1e-05,
|
2090 |
+
"loss": 1.1931,
|
2091 |
+
"step": 347
|
2092 |
+
},
|
2093 |
+
{
|
2094 |
+
"epoch": 0.46,
|
2095 |
+
"learning_rate": 1e-05,
|
2096 |
+
"loss": 1.0956,
|
2097 |
+
"step": 348
|
2098 |
+
},
|
2099 |
+
{
|
2100 |
+
"epoch": 0.46,
|
2101 |
+
"learning_rate": 1e-05,
|
2102 |
+
"loss": 1.1995,
|
2103 |
+
"step": 349
|
2104 |
+
},
|
2105 |
+
{
|
2106 |
+
"epoch": 0.46,
|
2107 |
+
"learning_rate": 1e-05,
|
2108 |
+
"loss": 1.1928,
|
2109 |
+
"step": 350
|
2110 |
+
},
|
2111 |
+
{
|
2112 |
+
"epoch": 0.46,
|
2113 |
+
"learning_rate": 1e-05,
|
2114 |
+
"loss": 1.1257,
|
2115 |
+
"step": 351
|
2116 |
+
},
|
2117 |
+
{
|
2118 |
+
"epoch": 0.46,
|
2119 |
+
"learning_rate": 1e-05,
|
2120 |
+
"loss": 1.2489,
|
2121 |
+
"step": 352
|
2122 |
+
},
|
2123 |
+
{
|
2124 |
+
"epoch": 0.46,
|
2125 |
+
"learning_rate": 1e-05,
|
2126 |
+
"loss": 1.0889,
|
2127 |
+
"step": 353
|
2128 |
+
},
|
2129 |
+
{
|
2130 |
+
"epoch": 0.46,
|
2131 |
+
"learning_rate": 1e-05,
|
2132 |
+
"loss": 1.0701,
|
2133 |
+
"step": 354
|
2134 |
+
},
|
2135 |
+
{
|
2136 |
+
"epoch": 0.47,
|
2137 |
+
"learning_rate": 1e-05,
|
2138 |
+
"loss": 1.153,
|
2139 |
+
"step": 355
|
2140 |
+
},
|
2141 |
+
{
|
2142 |
+
"epoch": 0.47,
|
2143 |
+
"learning_rate": 1e-05,
|
2144 |
+
"loss": 1.1475,
|
2145 |
+
"step": 356
|
2146 |
+
},
|
2147 |
+
{
|
2148 |
+
"epoch": 0.47,
|
2149 |
+
"learning_rate": 1e-05,
|
2150 |
+
"loss": 1.1151,
|
2151 |
+
"step": 357
|
2152 |
+
},
|
2153 |
+
{
|
2154 |
+
"epoch": 0.47,
|
2155 |
+
"learning_rate": 1e-05,
|
2156 |
+
"loss": 1.1558,
|
2157 |
+
"step": 358
|
2158 |
+
},
|
2159 |
+
{
|
2160 |
+
"epoch": 0.47,
|
2161 |
+
"learning_rate": 1e-05,
|
2162 |
+
"loss": 1.1728,
|
2163 |
+
"step": 359
|
2164 |
+
},
|
2165 |
+
{
|
2166 |
+
"epoch": 0.47,
|
2167 |
+
"learning_rate": 1e-05,
|
2168 |
+
"loss": 1.1082,
|
2169 |
+
"step": 360
|
2170 |
+
},
|
2171 |
+
{
|
2172 |
+
"epoch": 0.47,
|
2173 |
+
"learning_rate": 1e-05,
|
2174 |
+
"loss": 1.0717,
|
2175 |
+
"step": 361
|
2176 |
+
},
|
2177 |
+
{
|
2178 |
+
"epoch": 0.47,
|
2179 |
+
"learning_rate": 1e-05,
|
2180 |
+
"loss": 1.0998,
|
2181 |
+
"step": 362
|
2182 |
+
},
|
2183 |
+
{
|
2184 |
+
"epoch": 0.48,
|
2185 |
+
"learning_rate": 1e-05,
|
2186 |
+
"loss": 1.0868,
|
2187 |
+
"step": 363
|
2188 |
+
},
|
2189 |
+
{
|
2190 |
+
"epoch": 0.48,
|
2191 |
+
"learning_rate": 1e-05,
|
2192 |
+
"loss": 1.2157,
|
2193 |
+
"step": 364
|
2194 |
+
},
|
2195 |
+
{
|
2196 |
+
"epoch": 0.48,
|
2197 |
+
"learning_rate": 1e-05,
|
2198 |
+
"loss": 1.023,
|
2199 |
+
"step": 365
|
2200 |
+
},
|
2201 |
+
{
|
2202 |
+
"epoch": 0.48,
|
2203 |
+
"learning_rate": 1e-05,
|
2204 |
+
"loss": 1.0781,
|
2205 |
+
"step": 366
|
2206 |
+
},
|
2207 |
+
{
|
2208 |
+
"epoch": 0.48,
|
2209 |
+
"learning_rate": 1e-05,
|
2210 |
+
"loss": 1.1602,
|
2211 |
+
"step": 367
|
2212 |
+
},
|
2213 |
+
{
|
2214 |
+
"epoch": 0.48,
|
2215 |
+
"learning_rate": 1e-05,
|
2216 |
+
"loss": 1.1489,
|
2217 |
+
"step": 368
|
2218 |
+
},
|
2219 |
+
{
|
2220 |
+
"epoch": 0.48,
|
2221 |
+
"learning_rate": 1e-05,
|
2222 |
+
"loss": 1.2046,
|
2223 |
+
"step": 369
|
2224 |
+
},
|
2225 |
+
{
|
2226 |
+
"epoch": 0.48,
|
2227 |
+
"learning_rate": 1e-05,
|
2228 |
+
"loss": 1.0684,
|
2229 |
+
"step": 370
|
2230 |
+
},
|
2231 |
+
{
|
2232 |
+
"epoch": 0.49,
|
2233 |
+
"learning_rate": 1e-05,
|
2234 |
+
"loss": 1.1471,
|
2235 |
+
"step": 371
|
2236 |
+
},
|
2237 |
+
{
|
2238 |
+
"epoch": 0.49,
|
2239 |
+
"learning_rate": 1e-05,
|
2240 |
+
"loss": 1.0886,
|
2241 |
+
"step": 372
|
2242 |
+
},
|
2243 |
+
{
|
2244 |
+
"epoch": 0.49,
|
2245 |
+
"learning_rate": 1e-05,
|
2246 |
+
"loss": 1.1701,
|
2247 |
+
"step": 373
|
2248 |
+
},
|
2249 |
+
{
|
2250 |
+
"epoch": 0.49,
|
2251 |
+
"learning_rate": 1e-05,
|
2252 |
+
"loss": 1.0904,
|
2253 |
+
"step": 374
|
2254 |
+
},
|
2255 |
+
{
|
2256 |
+
"epoch": 0.49,
|
2257 |
+
"learning_rate": 1e-05,
|
2258 |
+
"loss": 1.2215,
|
2259 |
+
"step": 375
|
2260 |
+
},
|
2261 |
+
{
|
2262 |
+
"epoch": 0.49,
|
2263 |
+
"learning_rate": 1e-05,
|
2264 |
+
"loss": 1.134,
|
2265 |
+
"step": 376
|
2266 |
+
},
|
2267 |
+
{
|
2268 |
+
"epoch": 0.49,
|
2269 |
+
"learning_rate": 1e-05,
|
2270 |
+
"loss": 1.1026,
|
2271 |
+
"step": 377
|
2272 |
+
},
|
2273 |
+
{
|
2274 |
+
"epoch": 0.5,
|
2275 |
+
"learning_rate": 1e-05,
|
2276 |
+
"loss": 1.1797,
|
2277 |
+
"step": 378
|
2278 |
+
},
|
2279 |
+
{
|
2280 |
+
"epoch": 0.5,
|
2281 |
+
"learning_rate": 1e-05,
|
2282 |
+
"loss": 1.1449,
|
2283 |
+
"step": 379
|
2284 |
+
},
|
2285 |
+
{
|
2286 |
+
"epoch": 0.5,
|
2287 |
+
"learning_rate": 1e-05,
|
2288 |
+
"loss": 1.1996,
|
2289 |
+
"step": 380
|
2290 |
+
},
|
2291 |
+
{
|
2292 |
+
"epoch": 0.5,
|
2293 |
+
"learning_rate": 1e-05,
|
2294 |
+
"loss": 1.0852,
|
2295 |
+
"step": 381
|
2296 |
+
},
|
2297 |
+
{
|
2298 |
+
"epoch": 0.5,
|
2299 |
+
"learning_rate": 1e-05,
|
2300 |
+
"loss": 1.0662,
|
2301 |
+
"step": 382
|
2302 |
+
},
|
2303 |
+
{
|
2304 |
+
"epoch": 0.5,
|
2305 |
+
"learning_rate": 1e-05,
|
2306 |
+
"loss": 1.1134,
|
2307 |
+
"step": 383
|
2308 |
+
},
|
2309 |
+
{
|
2310 |
+
"epoch": 0.5,
|
2311 |
+
"learning_rate": 1e-05,
|
2312 |
+
"loss": 1.1746,
|
2313 |
+
"step": 384
|
2314 |
+
},
|
2315 |
+
{
|
2316 |
+
"epoch": 0.5,
|
2317 |
+
"learning_rate": 1e-05,
|
2318 |
+
"loss": 1.0978,
|
2319 |
+
"step": 385
|
2320 |
+
},
|
2321 |
+
{
|
2322 |
+
"epoch": 0.51,
|
2323 |
+
"learning_rate": 1e-05,
|
2324 |
+
"loss": 1.1253,
|
2325 |
+
"step": 386
|
2326 |
+
},
|
2327 |
+
{
|
2328 |
+
"epoch": 0.51,
|
2329 |
+
"learning_rate": 1e-05,
|
2330 |
+
"loss": 1.1481,
|
2331 |
+
"step": 387
|
2332 |
+
},
|
2333 |
+
{
|
2334 |
+
"epoch": 0.51,
|
2335 |
+
"learning_rate": 1e-05,
|
2336 |
+
"loss": 1.151,
|
2337 |
+
"step": 388
|
2338 |
+
},
|
2339 |
+
{
|
2340 |
+
"epoch": 0.51,
|
2341 |
+
"learning_rate": 1e-05,
|
2342 |
+
"loss": 1.2107,
|
2343 |
+
"step": 389
|
2344 |
+
},
|
2345 |
+
{
|
2346 |
+
"epoch": 0.51,
|
2347 |
+
"learning_rate": 1e-05,
|
2348 |
+
"loss": 1.1108,
|
2349 |
+
"step": 390
|
2350 |
+
},
|
2351 |
+
{
|
2352 |
+
"epoch": 0.51,
|
2353 |
+
"learning_rate": 1e-05,
|
2354 |
+
"loss": 1.1166,
|
2355 |
+
"step": 391
|
2356 |
+
},
|
2357 |
+
{
|
2358 |
+
"epoch": 0.51,
|
2359 |
+
"learning_rate": 1e-05,
|
2360 |
+
"loss": 1.1116,
|
2361 |
+
"step": 392
|
2362 |
+
},
|
2363 |
+
{
|
2364 |
+
"epoch": 0.51,
|
2365 |
+
"learning_rate": 1e-05,
|
2366 |
+
"loss": 1.0886,
|
2367 |
+
"step": 393
|
2368 |
+
},
|
2369 |
+
{
|
2370 |
+
"epoch": 0.52,
|
2371 |
+
"learning_rate": 1e-05,
|
2372 |
+
"loss": 1.1247,
|
2373 |
+
"step": 394
|
2374 |
+
},
|
2375 |
+
{
|
2376 |
+
"epoch": 0.52,
|
2377 |
+
"learning_rate": 1e-05,
|
2378 |
+
"loss": 1.0827,
|
2379 |
+
"step": 395
|
2380 |
+
},
|
2381 |
+
{
|
2382 |
+
"epoch": 0.52,
|
2383 |
+
"learning_rate": 1e-05,
|
2384 |
+
"loss": 1.1228,
|
2385 |
+
"step": 396
|
2386 |
+
},
|
2387 |
+
{
|
2388 |
+
"epoch": 0.52,
|
2389 |
+
"learning_rate": 1e-05,
|
2390 |
+
"loss": 1.1126,
|
2391 |
+
"step": 397
|
2392 |
+
},
|
2393 |
+
{
|
2394 |
+
"epoch": 0.52,
|
2395 |
+
"learning_rate": 1e-05,
|
2396 |
+
"loss": 1.1113,
|
2397 |
+
"step": 398
|
2398 |
+
},
|
2399 |
+
{
|
2400 |
+
"epoch": 0.52,
|
2401 |
+
"learning_rate": 1e-05,
|
2402 |
+
"loss": 1.178,
|
2403 |
+
"step": 399
|
2404 |
+
},
|
2405 |
+
{
|
2406 |
+
"epoch": 0.52,
|
2407 |
+
"learning_rate": 1e-05,
|
2408 |
+
"loss": 1.06,
|
2409 |
+
"step": 400
|
2410 |
+
},
|
2411 |
+
{
|
2412 |
+
"epoch": 0.53,
|
2413 |
+
"learning_rate": 1e-05,
|
2414 |
+
"loss": 1.103,
|
2415 |
+
"step": 401
|
2416 |
+
},
|
2417 |
+
{
|
2418 |
+
"epoch": 0.53,
|
2419 |
+
"learning_rate": 1e-05,
|
2420 |
+
"loss": 1.0766,
|
2421 |
+
"step": 402
|
2422 |
+
},
|
2423 |
+
{
|
2424 |
+
"epoch": 0.53,
|
2425 |
+
"learning_rate": 1e-05,
|
2426 |
+
"loss": 1.1355,
|
2427 |
+
"step": 403
|
2428 |
+
},
|
2429 |
+
{
|
2430 |
+
"epoch": 0.53,
|
2431 |
+
"learning_rate": 1e-05,
|
2432 |
+
"loss": 1.1401,
|
2433 |
+
"step": 404
|
2434 |
+
},
|
2435 |
+
{
|
2436 |
+
"epoch": 0.53,
|
2437 |
+
"learning_rate": 1e-05,
|
2438 |
+
"loss": 1.0833,
|
2439 |
+
"step": 405
|
2440 |
+
},
|
2441 |
+
{
|
2442 |
+
"epoch": 0.53,
|
2443 |
+
"learning_rate": 1e-05,
|
2444 |
+
"loss": 1.1447,
|
2445 |
+
"step": 406
|
2446 |
+
},
|
2447 |
+
{
|
2448 |
+
"epoch": 0.53,
|
2449 |
+
"learning_rate": 1e-05,
|
2450 |
+
"loss": 1.0815,
|
2451 |
+
"step": 407
|
2452 |
+
},
|
2453 |
+
{
|
2454 |
+
"epoch": 0.53,
|
2455 |
+
"learning_rate": 1e-05,
|
2456 |
+
"loss": 1.1848,
|
2457 |
+
"step": 408
|
2458 |
+
},
|
2459 |
+
{
|
2460 |
+
"epoch": 0.54,
|
2461 |
+
"learning_rate": 1e-05,
|
2462 |
+
"loss": 1.0736,
|
2463 |
+
"step": 409
|
2464 |
+
},
|
2465 |
+
{
|
2466 |
+
"epoch": 0.54,
|
2467 |
+
"learning_rate": 1e-05,
|
2468 |
+
"loss": 1.0575,
|
2469 |
+
"step": 410
|
2470 |
+
},
|
2471 |
+
{
|
2472 |
+
"epoch": 0.54,
|
2473 |
+
"learning_rate": 1e-05,
|
2474 |
+
"loss": 1.0649,
|
2475 |
+
"step": 411
|
2476 |
+
},
|
2477 |
+
{
|
2478 |
+
"epoch": 0.54,
|
2479 |
+
"learning_rate": 1e-05,
|
2480 |
+
"loss": 1.1615,
|
2481 |
+
"step": 412
|
2482 |
+
},
|
2483 |
+
{
|
2484 |
+
"epoch": 0.54,
|
2485 |
+
"learning_rate": 1e-05,
|
2486 |
+
"loss": 1.1314,
|
2487 |
+
"step": 413
|
2488 |
+
},
|
2489 |
+
{
|
2490 |
+
"epoch": 0.54,
|
2491 |
+
"learning_rate": 1e-05,
|
2492 |
+
"loss": 1.1541,
|
2493 |
+
"step": 414
|
2494 |
+
},
|
2495 |
+
{
|
2496 |
+
"epoch": 0.54,
|
2497 |
+
"learning_rate": 1e-05,
|
2498 |
+
"loss": 1.0086,
|
2499 |
+
"step": 415
|
2500 |
+
},
|
2501 |
+
{
|
2502 |
+
"epoch": 0.55,
|
2503 |
+
"learning_rate": 1e-05,
|
2504 |
+
"loss": 1.0593,
|
2505 |
+
"step": 416
|
2506 |
+
},
|
2507 |
+
{
|
2508 |
+
"epoch": 0.55,
|
2509 |
+
"learning_rate": 1e-05,
|
2510 |
+
"loss": 1.0813,
|
2511 |
+
"step": 417
|
2512 |
+
},
|
2513 |
+
{
|
2514 |
+
"epoch": 0.55,
|
2515 |
+
"learning_rate": 1e-05,
|
2516 |
+
"loss": 1.1627,
|
2517 |
+
"step": 418
|
2518 |
+
},
|
2519 |
+
{
|
2520 |
+
"epoch": 0.55,
|
2521 |
+
"learning_rate": 1e-05,
|
2522 |
+
"loss": 1.0808,
|
2523 |
+
"step": 419
|
2524 |
+
},
|
2525 |
+
{
|
2526 |
+
"epoch": 0.55,
|
2527 |
+
"learning_rate": 1e-05,
|
2528 |
+
"loss": 1.1235,
|
2529 |
+
"step": 420
|
2530 |
+
},
|
2531 |
+
{
|
2532 |
+
"epoch": 0.55,
|
2533 |
+
"learning_rate": 1e-05,
|
2534 |
+
"loss": 1.1251,
|
2535 |
+
"step": 421
|
2536 |
+
},
|
2537 |
+
{
|
2538 |
+
"epoch": 0.55,
|
2539 |
+
"learning_rate": 1e-05,
|
2540 |
+
"loss": 1.1513,
|
2541 |
+
"step": 422
|
2542 |
+
},
|
2543 |
+
{
|
2544 |
+
"epoch": 0.55,
|
2545 |
+
"learning_rate": 1e-05,
|
2546 |
+
"loss": 1.1522,
|
2547 |
+
"step": 423
|
2548 |
+
},
|
2549 |
+
{
|
2550 |
+
"epoch": 0.56,
|
2551 |
+
"learning_rate": 1e-05,
|
2552 |
+
"loss": 1.058,
|
2553 |
+
"step": 424
|
2554 |
+
},
|
2555 |
+
{
|
2556 |
+
"epoch": 0.56,
|
2557 |
+
"learning_rate": 1e-05,
|
2558 |
+
"loss": 1.0659,
|
2559 |
+
"step": 425
|
2560 |
+
},
|
2561 |
+
{
|
2562 |
+
"epoch": 0.56,
|
2563 |
+
"learning_rate": 1e-05,
|
2564 |
+
"loss": 1.1449,
|
2565 |
+
"step": 426
|
2566 |
+
},
|
2567 |
+
{
|
2568 |
+
"epoch": 0.56,
|
2569 |
+
"learning_rate": 1e-05,
|
2570 |
+
"loss": 1.056,
|
2571 |
+
"step": 427
|
2572 |
+
},
|
2573 |
+
{
|
2574 |
+
"epoch": 0.56,
|
2575 |
+
"learning_rate": 1e-05,
|
2576 |
+
"loss": 1.0727,
|
2577 |
+
"step": 428
|
2578 |
+
},
|
2579 |
+
{
|
2580 |
+
"epoch": 0.56,
|
2581 |
+
"learning_rate": 1e-05,
|
2582 |
+
"loss": 1.1939,
|
2583 |
+
"step": 429
|
2584 |
+
},
|
2585 |
+
{
|
2586 |
+
"epoch": 0.56,
|
2587 |
+
"learning_rate": 1e-05,
|
2588 |
+
"loss": 1.097,
|
2589 |
+
"step": 430
|
2590 |
+
},
|
2591 |
+
{
|
2592 |
+
"epoch": 0.56,
|
2593 |
+
"learning_rate": 1e-05,
|
2594 |
+
"loss": 1.1245,
|
2595 |
+
"step": 431
|
2596 |
+
},
|
2597 |
+
{
|
2598 |
+
"epoch": 0.57,
|
2599 |
+
"learning_rate": 1e-05,
|
2600 |
+
"loss": 1.1875,
|
2601 |
+
"step": 432
|
2602 |
+
},
|
2603 |
+
{
|
2604 |
+
"epoch": 0.57,
|
2605 |
+
"learning_rate": 1e-05,
|
2606 |
+
"loss": 1.1237,
|
2607 |
+
"step": 433
|
2608 |
+
},
|
2609 |
+
{
|
2610 |
+
"epoch": 0.57,
|
2611 |
+
"learning_rate": 1e-05,
|
2612 |
+
"loss": 1.13,
|
2613 |
+
"step": 434
|
2614 |
+
},
|
2615 |
+
{
|
2616 |
+
"epoch": 0.57,
|
2617 |
+
"learning_rate": 1e-05,
|
2618 |
+
"loss": 1.1384,
|
2619 |
+
"step": 435
|
2620 |
+
},
|
2621 |
+
{
|
2622 |
+
"epoch": 0.57,
|
2623 |
+
"learning_rate": 1e-05,
|
2624 |
+
"loss": 1.0954,
|
2625 |
+
"step": 436
|
2626 |
+
},
|
2627 |
+
{
|
2628 |
+
"epoch": 0.57,
|
2629 |
+
"learning_rate": 1e-05,
|
2630 |
+
"loss": 1.1308,
|
2631 |
+
"step": 437
|
2632 |
+
},
|
2633 |
+
{
|
2634 |
+
"epoch": 0.57,
|
2635 |
+
"learning_rate": 1e-05,
|
2636 |
+
"loss": 1.177,
|
2637 |
+
"step": 438
|
2638 |
+
},
|
2639 |
+
{
|
2640 |
+
"epoch": 0.58,
|
2641 |
+
"learning_rate": 1e-05,
|
2642 |
+
"loss": 1.042,
|
2643 |
+
"step": 439
|
2644 |
+
},
|
2645 |
+
{
|
2646 |
+
"epoch": 0.58,
|
2647 |
+
"learning_rate": 1e-05,
|
2648 |
+
"loss": 1.249,
|
2649 |
+
"step": 440
|
2650 |
+
},
|
2651 |
+
{
|
2652 |
+
"epoch": 0.58,
|
2653 |
+
"learning_rate": 1e-05,
|
2654 |
+
"loss": 1.098,
|
2655 |
+
"step": 441
|
2656 |
+
},
|
2657 |
+
{
|
2658 |
+
"epoch": 0.58,
|
2659 |
+
"learning_rate": 1e-05,
|
2660 |
+
"loss": 1.0932,
|
2661 |
+
"step": 442
|
2662 |
+
},
|
2663 |
+
{
|
2664 |
+
"epoch": 0.58,
|
2665 |
+
"learning_rate": 1e-05,
|
2666 |
+
"loss": 1.2008,
|
2667 |
+
"step": 443
|
2668 |
+
},
|
2669 |
+
{
|
2670 |
+
"epoch": 0.58,
|
2671 |
+
"learning_rate": 1e-05,
|
2672 |
+
"loss": 1.1205,
|
2673 |
+
"step": 444
|
2674 |
+
},
|
2675 |
+
{
|
2676 |
+
"epoch": 0.58,
|
2677 |
+
"learning_rate": 1e-05,
|
2678 |
+
"loss": 1.1739,
|
2679 |
+
"step": 445
|
2680 |
+
},
|
2681 |
+
{
|
2682 |
+
"epoch": 0.58,
|
2683 |
+
"learning_rate": 1e-05,
|
2684 |
+
"loss": 1.0802,
|
2685 |
+
"step": 446
|
2686 |
+
},
|
2687 |
+
{
|
2688 |
+
"epoch": 0.59,
|
2689 |
+
"learning_rate": 1e-05,
|
2690 |
+
"loss": 1.1007,
|
2691 |
+
"step": 447
|
2692 |
+
},
|
2693 |
+
{
|
2694 |
+
"epoch": 0.59,
|
2695 |
+
"learning_rate": 1e-05,
|
2696 |
+
"loss": 1.2105,
|
2697 |
+
"step": 448
|
2698 |
+
},
|
2699 |
+
{
|
2700 |
+
"epoch": 0.59,
|
2701 |
+
"learning_rate": 1e-05,
|
2702 |
+
"loss": 1.1455,
|
2703 |
+
"step": 449
|
2704 |
+
},
|
2705 |
+
{
|
2706 |
+
"epoch": 0.59,
|
2707 |
+
"learning_rate": 1e-05,
|
2708 |
+
"loss": 1.1078,
|
2709 |
+
"step": 450
|
2710 |
+
},
|
2711 |
+
{
|
2712 |
+
"epoch": 0.59,
|
2713 |
+
"learning_rate": 1e-05,
|
2714 |
+
"loss": 1.1312,
|
2715 |
+
"step": 451
|
2716 |
+
},
|
2717 |
+
{
|
2718 |
+
"epoch": 0.59,
|
2719 |
+
"learning_rate": 1e-05,
|
2720 |
+
"loss": 1.1642,
|
2721 |
+
"step": 452
|
2722 |
+
},
|
2723 |
+
{
|
2724 |
+
"epoch": 0.59,
|
2725 |
+
"learning_rate": 1e-05,
|
2726 |
+
"loss": 1.1129,
|
2727 |
+
"step": 453
|
2728 |
+
},
|
2729 |
+
{
|
2730 |
+
"epoch": 0.59,
|
2731 |
+
"learning_rate": 1e-05,
|
2732 |
+
"loss": 1.121,
|
2733 |
+
"step": 454
|
2734 |
+
},
|
2735 |
+
{
|
2736 |
+
"epoch": 0.6,
|
2737 |
+
"learning_rate": 1e-05,
|
2738 |
+
"loss": 1.1408,
|
2739 |
+
"step": 455
|
2740 |
+
},
|
2741 |
+
{
|
2742 |
+
"epoch": 0.6,
|
2743 |
+
"learning_rate": 1e-05,
|
2744 |
+
"loss": 1.0623,
|
2745 |
+
"step": 456
|
2746 |
+
},
|
2747 |
+
{
|
2748 |
+
"epoch": 0.6,
|
2749 |
+
"learning_rate": 1e-05,
|
2750 |
+
"loss": 1.1354,
|
2751 |
+
"step": 457
|
2752 |
+
},
|
2753 |
+
{
|
2754 |
+
"epoch": 0.6,
|
2755 |
+
"learning_rate": 1e-05,
|
2756 |
+
"loss": 1.0905,
|
2757 |
+
"step": 458
|
2758 |
+
},
|
2759 |
+
{
|
2760 |
+
"epoch": 0.6,
|
2761 |
+
"learning_rate": 1e-05,
|
2762 |
+
"loss": 1.1315,
|
2763 |
+
"step": 459
|
2764 |
+
},
|
2765 |
+
{
|
2766 |
+
"epoch": 0.6,
|
2767 |
+
"learning_rate": 1e-05,
|
2768 |
+
"loss": 1.1072,
|
2769 |
+
"step": 460
|
2770 |
+
},
|
2771 |
+
{
|
2772 |
+
"epoch": 0.6,
|
2773 |
+
"learning_rate": 1e-05,
|
2774 |
+
"loss": 1.059,
|
2775 |
+
"step": 461
|
2776 |
+
},
|
2777 |
+
{
|
2778 |
+
"epoch": 0.61,
|
2779 |
+
"learning_rate": 1e-05,
|
2780 |
+
"loss": 1.1307,
|
2781 |
+
"step": 462
|
2782 |
+
},
|
2783 |
+
{
|
2784 |
+
"epoch": 0.61,
|
2785 |
+
"learning_rate": 1e-05,
|
2786 |
+
"loss": 1.2169,
|
2787 |
+
"step": 463
|
2788 |
+
},
|
2789 |
+
{
|
2790 |
+
"epoch": 0.61,
|
2791 |
+
"learning_rate": 1e-05,
|
2792 |
+
"loss": 1.0693,
|
2793 |
+
"step": 464
|
2794 |
+
},
|
2795 |
+
{
|
2796 |
+
"epoch": 0.61,
|
2797 |
+
"learning_rate": 1e-05,
|
2798 |
+
"loss": 1.0933,
|
2799 |
+
"step": 465
|
2800 |
+
},
|
2801 |
+
{
|
2802 |
+
"epoch": 0.61,
|
2803 |
+
"learning_rate": 1e-05,
|
2804 |
+
"loss": 1.1493,
|
2805 |
+
"step": 466
|
2806 |
+
},
|
2807 |
+
{
|
2808 |
+
"epoch": 0.61,
|
2809 |
+
"learning_rate": 1e-05,
|
2810 |
+
"loss": 1.076,
|
2811 |
+
"step": 467
|
2812 |
+
},
|
2813 |
+
{
|
2814 |
+
"epoch": 0.61,
|
2815 |
+
"learning_rate": 1e-05,
|
2816 |
+
"loss": 1.1333,
|
2817 |
+
"step": 468
|
2818 |
+
},
|
2819 |
+
{
|
2820 |
+
"epoch": 0.61,
|
2821 |
+
"learning_rate": 1e-05,
|
2822 |
+
"loss": 1.1087,
|
2823 |
+
"step": 469
|
2824 |
+
},
|
2825 |
+
{
|
2826 |
+
"epoch": 0.62,
|
2827 |
+
"learning_rate": 1e-05,
|
2828 |
+
"loss": 1.2311,
|
2829 |
+
"step": 470
|
2830 |
+
},
|
2831 |
+
{
|
2832 |
+
"epoch": 0.62,
|
2833 |
+
"learning_rate": 1e-05,
|
2834 |
+
"loss": 1.1785,
|
2835 |
+
"step": 471
|
2836 |
+
},
|
2837 |
+
{
|
2838 |
+
"epoch": 0.62,
|
2839 |
+
"learning_rate": 1e-05,
|
2840 |
+
"loss": 1.147,
|
2841 |
+
"step": 472
|
2842 |
+
},
|
2843 |
+
{
|
2844 |
+
"epoch": 0.62,
|
2845 |
+
"learning_rate": 1e-05,
|
2846 |
+
"loss": 1.067,
|
2847 |
+
"step": 473
|
2848 |
+
},
|
2849 |
+
{
|
2850 |
+
"epoch": 0.62,
|
2851 |
+
"learning_rate": 1e-05,
|
2852 |
+
"loss": 1.1096,
|
2853 |
+
"step": 474
|
2854 |
+
},
|
2855 |
+
{
|
2856 |
+
"epoch": 0.62,
|
2857 |
+
"learning_rate": 1e-05,
|
2858 |
+
"loss": 1.1161,
|
2859 |
+
"step": 475
|
2860 |
+
},
|
2861 |
+
{
|
2862 |
+
"epoch": 0.62,
|
2863 |
+
"learning_rate": 1e-05,
|
2864 |
+
"loss": 1.0665,
|
2865 |
+
"step": 476
|
2866 |
+
},
|
2867 |
+
{
|
2868 |
+
"epoch": 0.63,
|
2869 |
+
"learning_rate": 1e-05,
|
2870 |
+
"loss": 1.2197,
|
2871 |
+
"step": 477
|
2872 |
+
},
|
2873 |
+
{
|
2874 |
+
"epoch": 0.63,
|
2875 |
+
"learning_rate": 1e-05,
|
2876 |
+
"loss": 1.1278,
|
2877 |
+
"step": 478
|
2878 |
+
},
|
2879 |
+
{
|
2880 |
+
"epoch": 0.63,
|
2881 |
+
"learning_rate": 1e-05,
|
2882 |
+
"loss": 1.1091,
|
2883 |
+
"step": 479
|
2884 |
+
},
|
2885 |
+
{
|
2886 |
+
"epoch": 0.63,
|
2887 |
+
"learning_rate": 1e-05,
|
2888 |
+
"loss": 1.0789,
|
2889 |
+
"step": 480
|
2890 |
+
},
|
2891 |
+
{
|
2892 |
+
"epoch": 0.63,
|
2893 |
+
"learning_rate": 1e-05,
|
2894 |
+
"loss": 1.0956,
|
2895 |
+
"step": 481
|
2896 |
+
},
|
2897 |
+
{
|
2898 |
+
"epoch": 0.63,
|
2899 |
+
"learning_rate": 1e-05,
|
2900 |
+
"loss": 1.1117,
|
2901 |
+
"step": 482
|
2902 |
+
},
|
2903 |
+
{
|
2904 |
+
"epoch": 0.63,
|
2905 |
+
"learning_rate": 1e-05,
|
2906 |
+
"loss": 1.1508,
|
2907 |
+
"step": 483
|
2908 |
+
},
|
2909 |
+
{
|
2910 |
+
"epoch": 0.63,
|
2911 |
+
"learning_rate": 1e-05,
|
2912 |
+
"loss": 1.1839,
|
2913 |
+
"step": 484
|
2914 |
+
},
|
2915 |
+
{
|
2916 |
+
"epoch": 0.64,
|
2917 |
+
"learning_rate": 1e-05,
|
2918 |
+
"loss": 1.052,
|
2919 |
+
"step": 485
|
2920 |
+
},
|
2921 |
+
{
|
2922 |
+
"epoch": 0.64,
|
2923 |
+
"learning_rate": 1e-05,
|
2924 |
+
"loss": 1.0973,
|
2925 |
+
"step": 486
|
2926 |
+
},
|
2927 |
+
{
|
2928 |
+
"epoch": 0.64,
|
2929 |
+
"learning_rate": 1e-05,
|
2930 |
+
"loss": 1.067,
|
2931 |
+
"step": 487
|
2932 |
+
},
|
2933 |
+
{
|
2934 |
+
"epoch": 0.64,
|
2935 |
+
"learning_rate": 1e-05,
|
2936 |
+
"loss": 1.1481,
|
2937 |
+
"step": 488
|
2938 |
+
},
|
2939 |
+
{
|
2940 |
+
"epoch": 0.64,
|
2941 |
+
"learning_rate": 1e-05,
|
2942 |
+
"loss": 1.1636,
|
2943 |
+
"step": 489
|
2944 |
+
},
|
2945 |
+
{
|
2946 |
+
"epoch": 0.64,
|
2947 |
+
"learning_rate": 1e-05,
|
2948 |
+
"loss": 1.0766,
|
2949 |
+
"step": 490
|
2950 |
+
},
|
2951 |
+
{
|
2952 |
+
"epoch": 0.64,
|
2953 |
+
"learning_rate": 1e-05,
|
2954 |
+
"loss": 1.2124,
|
2955 |
+
"step": 491
|
2956 |
+
},
|
2957 |
+
{
|
2958 |
+
"epoch": 0.64,
|
2959 |
+
"learning_rate": 1e-05,
|
2960 |
+
"loss": 1.1512,
|
2961 |
+
"step": 492
|
2962 |
+
},
|
2963 |
+
{
|
2964 |
+
"epoch": 0.65,
|
2965 |
+
"learning_rate": 1e-05,
|
2966 |
+
"loss": 1.0625,
|
2967 |
+
"step": 493
|
2968 |
+
},
|
2969 |
+
{
|
2970 |
+
"epoch": 0.65,
|
2971 |
+
"learning_rate": 1e-05,
|
2972 |
+
"loss": 1.0444,
|
2973 |
+
"step": 494
|
2974 |
+
},
|
2975 |
+
{
|
2976 |
+
"epoch": 0.65,
|
2977 |
+
"learning_rate": 1e-05,
|
2978 |
+
"loss": 1.0134,
|
2979 |
+
"step": 495
|
2980 |
+
},
|
2981 |
+
{
|
2982 |
+
"epoch": 0.65,
|
2983 |
+
"learning_rate": 1e-05,
|
2984 |
+
"loss": 1.0785,
|
2985 |
+
"step": 496
|
2986 |
+
},
|
2987 |
+
{
|
2988 |
+
"epoch": 0.65,
|
2989 |
+
"learning_rate": 1e-05,
|
2990 |
+
"loss": 1.1982,
|
2991 |
+
"step": 497
|
2992 |
+
},
|
2993 |
+
{
|
2994 |
+
"epoch": 0.65,
|
2995 |
+
"learning_rate": 1e-05,
|
2996 |
+
"loss": 1.2205,
|
2997 |
+
"step": 498
|
2998 |
+
},
|
2999 |
+
{
|
3000 |
+
"epoch": 0.65,
|
3001 |
+
"learning_rate": 1e-05,
|
3002 |
+
"loss": 1.1091,
|
3003 |
+
"step": 499
|
3004 |
+
},
|
3005 |
+
{
|
3006 |
+
"epoch": 0.66,
|
3007 |
+
"learning_rate": 1e-05,
|
3008 |
+
"loss": 1.1838,
|
3009 |
+
"step": 500
|
3010 |
+
},
|
3011 |
+
{
|
3012 |
+
"epoch": 0.66,
|
3013 |
+
"learning_rate": 1e-05,
|
3014 |
+
"loss": 1.1055,
|
3015 |
+
"step": 501
|
3016 |
+
},
|
3017 |
+
{
|
3018 |
+
"epoch": 0.66,
|
3019 |
+
"learning_rate": 1e-05,
|
3020 |
+
"loss": 1.1933,
|
3021 |
+
"step": 502
|
3022 |
+
},
|
3023 |
+
{
|
3024 |
+
"epoch": 0.66,
|
3025 |
+
"learning_rate": 1e-05,
|
3026 |
+
"loss": 1.0714,
|
3027 |
+
"step": 503
|
3028 |
+
},
|
3029 |
+
{
|
3030 |
+
"epoch": 0.66,
|
3031 |
+
"learning_rate": 1e-05,
|
3032 |
+
"loss": 1.1622,
|
3033 |
+
"step": 504
|
3034 |
+
},
|
3035 |
+
{
|
3036 |
+
"epoch": 0.66,
|
3037 |
+
"learning_rate": 1e-05,
|
3038 |
+
"loss": 1.1007,
|
3039 |
+
"step": 505
|
3040 |
+
},
|
3041 |
+
{
|
3042 |
+
"epoch": 0.66,
|
3043 |
+
"learning_rate": 1e-05,
|
3044 |
+
"loss": 1.071,
|
3045 |
+
"step": 506
|
3046 |
+
},
|
3047 |
+
{
|
3048 |
+
"epoch": 0.66,
|
3049 |
+
"learning_rate": 1e-05,
|
3050 |
+
"loss": 1.0644,
|
3051 |
+
"step": 507
|
3052 |
+
},
|
3053 |
+
{
|
3054 |
+
"epoch": 0.67,
|
3055 |
+
"learning_rate": 1e-05,
|
3056 |
+
"loss": 1.19,
|
3057 |
+
"step": 508
|
3058 |
+
},
|
3059 |
+
{
|
3060 |
+
"epoch": 0.67,
|
3061 |
+
"learning_rate": 1e-05,
|
3062 |
+
"loss": 1.196,
|
3063 |
+
"step": 509
|
3064 |
+
},
|
3065 |
+
{
|
3066 |
+
"epoch": 0.67,
|
3067 |
+
"learning_rate": 1e-05,
|
3068 |
+
"loss": 1.0908,
|
3069 |
+
"step": 510
|
3070 |
+
},
|
3071 |
+
{
|
3072 |
+
"epoch": 0.67,
|
3073 |
+
"learning_rate": 1e-05,
|
3074 |
+
"loss": 1.1363,
|
3075 |
+
"step": 511
|
3076 |
+
},
|
3077 |
+
{
|
3078 |
+
"epoch": 0.67,
|
3079 |
+
"learning_rate": 1e-05,
|
3080 |
+
"loss": 1.1237,
|
3081 |
+
"step": 512
|
3082 |
+
},
|
3083 |
+
{
|
3084 |
+
"epoch": 0.67,
|
3085 |
+
"learning_rate": 1e-05,
|
3086 |
+
"loss": 1.1044,
|
3087 |
+
"step": 513
|
3088 |
+
},
|
3089 |
+
{
|
3090 |
+
"epoch": 0.67,
|
3091 |
+
"learning_rate": 1e-05,
|
3092 |
+
"loss": 1.125,
|
3093 |
+
"step": 514
|
3094 |
+
},
|
3095 |
+
{
|
3096 |
+
"epoch": 0.67,
|
3097 |
+
"learning_rate": 1e-05,
|
3098 |
+
"loss": 1.0984,
|
3099 |
+
"step": 515
|
3100 |
+
},
|
3101 |
+
{
|
3102 |
+
"epoch": 0.68,
|
3103 |
+
"learning_rate": 1e-05,
|
3104 |
+
"loss": 1.069,
|
3105 |
+
"step": 516
|
3106 |
+
},
|
3107 |
+
{
|
3108 |
+
"epoch": 0.68,
|
3109 |
+
"learning_rate": 1e-05,
|
3110 |
+
"loss": 1.0531,
|
3111 |
+
"step": 517
|
3112 |
+
},
|
3113 |
+
{
|
3114 |
+
"epoch": 0.68,
|
3115 |
+
"learning_rate": 1e-05,
|
3116 |
+
"loss": 1.1698,
|
3117 |
+
"step": 518
|
3118 |
+
},
|
3119 |
+
{
|
3120 |
+
"epoch": 0.68,
|
3121 |
+
"learning_rate": 1e-05,
|
3122 |
+
"loss": 1.07,
|
3123 |
+
"step": 519
|
3124 |
+
},
|
3125 |
+
{
|
3126 |
+
"epoch": 0.68,
|
3127 |
+
"learning_rate": 1e-05,
|
3128 |
+
"loss": 1.1798,
|
3129 |
+
"step": 520
|
3130 |
+
},
|
3131 |
+
{
|
3132 |
+
"epoch": 0.68,
|
3133 |
+
"learning_rate": 1e-05,
|
3134 |
+
"loss": 1.0844,
|
3135 |
+
"step": 521
|
3136 |
+
},
|
3137 |
+
{
|
3138 |
+
"epoch": 0.68,
|
3139 |
+
"learning_rate": 1e-05,
|
3140 |
+
"loss": 1.0588,
|
3141 |
+
"step": 522
|
3142 |
+
},
|
3143 |
+
{
|
3144 |
+
"epoch": 0.69,
|
3145 |
+
"learning_rate": 1e-05,
|
3146 |
+
"loss": 1.0756,
|
3147 |
+
"step": 523
|
3148 |
+
},
|
3149 |
+
{
|
3150 |
+
"epoch": 0.69,
|
3151 |
+
"learning_rate": 1e-05,
|
3152 |
+
"loss": 1.0595,
|
3153 |
+
"step": 524
|
3154 |
+
},
|
3155 |
+
{
|
3156 |
+
"epoch": 0.69,
|
3157 |
+
"learning_rate": 1e-05,
|
3158 |
+
"loss": 0.9999,
|
3159 |
+
"step": 525
|
3160 |
+
},
|
3161 |
+
{
|
3162 |
+
"epoch": 0.69,
|
3163 |
+
"learning_rate": 1e-05,
|
3164 |
+
"loss": 1.132,
|
3165 |
+
"step": 526
|
3166 |
+
},
|
3167 |
+
{
|
3168 |
+
"epoch": 0.69,
|
3169 |
+
"learning_rate": 1e-05,
|
3170 |
+
"loss": 1.1498,
|
3171 |
+
"step": 527
|
3172 |
+
},
|
3173 |
+
{
|
3174 |
+
"epoch": 0.69,
|
3175 |
+
"learning_rate": 1e-05,
|
3176 |
+
"loss": 1.0824,
|
3177 |
+
"step": 528
|
3178 |
+
},
|
3179 |
+
{
|
3180 |
+
"epoch": 0.69,
|
3181 |
+
"learning_rate": 1e-05,
|
3182 |
+
"loss": 1.189,
|
3183 |
+
"step": 529
|
3184 |
+
},
|
3185 |
+
{
|
3186 |
+
"epoch": 0.69,
|
3187 |
+
"learning_rate": 1e-05,
|
3188 |
+
"loss": 1.1561,
|
3189 |
+
"step": 530
|
3190 |
+
},
|
3191 |
+
{
|
3192 |
+
"epoch": 0.7,
|
3193 |
+
"learning_rate": 1e-05,
|
3194 |
+
"loss": 1.0432,
|
3195 |
+
"step": 531
|
3196 |
+
},
|
3197 |
+
{
|
3198 |
+
"epoch": 0.7,
|
3199 |
+
"learning_rate": 1e-05,
|
3200 |
+
"loss": 1.0952,
|
3201 |
+
"step": 532
|
3202 |
+
},
|
3203 |
+
{
|
3204 |
+
"epoch": 0.7,
|
3205 |
+
"learning_rate": 1e-05,
|
3206 |
+
"loss": 1.1779,
|
3207 |
+
"step": 533
|
3208 |
+
},
|
3209 |
+
{
|
3210 |
+
"epoch": 0.7,
|
3211 |
+
"learning_rate": 1e-05,
|
3212 |
+
"loss": 1.1764,
|
3213 |
+
"step": 534
|
3214 |
+
},
|
3215 |
+
{
|
3216 |
+
"epoch": 0.7,
|
3217 |
+
"learning_rate": 1e-05,
|
3218 |
+
"loss": 1.165,
|
3219 |
+
"step": 535
|
3220 |
+
},
|
3221 |
+
{
|
3222 |
+
"epoch": 0.7,
|
3223 |
+
"learning_rate": 1e-05,
|
3224 |
+
"loss": 1.032,
|
3225 |
+
"step": 536
|
3226 |
+
},
|
3227 |
+
{
|
3228 |
+
"epoch": 0.7,
|
3229 |
+
"learning_rate": 1e-05,
|
3230 |
+
"loss": 1.007,
|
3231 |
+
"step": 537
|
3232 |
+
},
|
3233 |
+
{
|
3234 |
+
"epoch": 0.7,
|
3235 |
+
"learning_rate": 1e-05,
|
3236 |
+
"loss": 1.0795,
|
3237 |
+
"step": 538
|
3238 |
+
},
|
3239 |
+
{
|
3240 |
+
"epoch": 0.71,
|
3241 |
+
"learning_rate": 1e-05,
|
3242 |
+
"loss": 1.1393,
|
3243 |
+
"step": 539
|
3244 |
+
},
|
3245 |
+
{
|
3246 |
+
"epoch": 0.71,
|
3247 |
+
"learning_rate": 1e-05,
|
3248 |
+
"loss": 1.1268,
|
3249 |
+
"step": 540
|
3250 |
+
},
|
3251 |
+
{
|
3252 |
+
"epoch": 0.71,
|
3253 |
+
"learning_rate": 1e-05,
|
3254 |
+
"loss": 1.1671,
|
3255 |
+
"step": 541
|
3256 |
+
},
|
3257 |
+
{
|
3258 |
+
"epoch": 0.71,
|
3259 |
+
"learning_rate": 1e-05,
|
3260 |
+
"loss": 1.1344,
|
3261 |
+
"step": 542
|
3262 |
+
},
|
3263 |
+
{
|
3264 |
+
"epoch": 0.71,
|
3265 |
+
"learning_rate": 1e-05,
|
3266 |
+
"loss": 1.0526,
|
3267 |
+
"step": 543
|
3268 |
+
},
|
3269 |
+
{
|
3270 |
+
"epoch": 0.71,
|
3271 |
+
"learning_rate": 1e-05,
|
3272 |
+
"loss": 1.0475,
|
3273 |
+
"step": 544
|
3274 |
+
},
|
3275 |
+
{
|
3276 |
+
"epoch": 0.71,
|
3277 |
+
"learning_rate": 1e-05,
|
3278 |
+
"loss": 1.1136,
|
3279 |
+
"step": 545
|
3280 |
+
},
|
3281 |
+
{
|
3282 |
+
"epoch": 0.72,
|
3283 |
+
"learning_rate": 1e-05,
|
3284 |
+
"loss": 1.0917,
|
3285 |
+
"step": 546
|
3286 |
+
},
|
3287 |
+
{
|
3288 |
+
"epoch": 0.72,
|
3289 |
+
"learning_rate": 1e-05,
|
3290 |
+
"loss": 1.1304,
|
3291 |
+
"step": 547
|
3292 |
+
},
|
3293 |
+
{
|
3294 |
+
"epoch": 0.72,
|
3295 |
+
"learning_rate": 1e-05,
|
3296 |
+
"loss": 1.1713,
|
3297 |
+
"step": 548
|
3298 |
+
},
|
3299 |
+
{
|
3300 |
+
"epoch": 0.72,
|
3301 |
+
"learning_rate": 1e-05,
|
3302 |
+
"loss": 1.1075,
|
3303 |
+
"step": 549
|
3304 |
+
},
|
3305 |
+
{
|
3306 |
+
"epoch": 0.72,
|
3307 |
+
"learning_rate": 1e-05,
|
3308 |
+
"loss": 1.0433,
|
3309 |
+
"step": 550
|
3310 |
+
},
|
3311 |
+
{
|
3312 |
+
"epoch": 0.72,
|
3313 |
+
"learning_rate": 1e-05,
|
3314 |
+
"loss": 1.1413,
|
3315 |
+
"step": 551
|
3316 |
+
},
|
3317 |
+
{
|
3318 |
+
"epoch": 0.72,
|
3319 |
+
"learning_rate": 1e-05,
|
3320 |
+
"loss": 1.1287,
|
3321 |
+
"step": 552
|
3322 |
+
},
|
3323 |
+
{
|
3324 |
+
"epoch": 0.72,
|
3325 |
+
"learning_rate": 1e-05,
|
3326 |
+
"loss": 1.0544,
|
3327 |
+
"step": 553
|
3328 |
+
},
|
3329 |
+
{
|
3330 |
+
"epoch": 0.73,
|
3331 |
+
"learning_rate": 1e-05,
|
3332 |
+
"loss": 1.0948,
|
3333 |
+
"step": 554
|
3334 |
+
},
|
3335 |
+
{
|
3336 |
+
"epoch": 0.73,
|
3337 |
+
"learning_rate": 1e-05,
|
3338 |
+
"loss": 1.0486,
|
3339 |
+
"step": 555
|
3340 |
+
},
|
3341 |
+
{
|
3342 |
+
"epoch": 0.73,
|
3343 |
+
"learning_rate": 1e-05,
|
3344 |
+
"loss": 1.0294,
|
3345 |
+
"step": 556
|
3346 |
+
},
|
3347 |
+
{
|
3348 |
+
"epoch": 0.73,
|
3349 |
+
"learning_rate": 1e-05,
|
3350 |
+
"loss": 1.1342,
|
3351 |
+
"step": 557
|
3352 |
+
},
|
3353 |
+
{
|
3354 |
+
"epoch": 0.73,
|
3355 |
+
"learning_rate": 1e-05,
|
3356 |
+
"loss": 1.1311,
|
3357 |
+
"step": 558
|
3358 |
+
},
|
3359 |
+
{
|
3360 |
+
"epoch": 0.73,
|
3361 |
+
"learning_rate": 1e-05,
|
3362 |
+
"loss": 1.292,
|
3363 |
+
"step": 559
|
3364 |
+
},
|
3365 |
+
{
|
3366 |
+
"epoch": 0.73,
|
3367 |
+
"learning_rate": 1e-05,
|
3368 |
+
"loss": 1.0462,
|
3369 |
+
"step": 560
|
3370 |
+
},
|
3371 |
+
{
|
3372 |
+
"epoch": 0.74,
|
3373 |
+
"learning_rate": 1e-05,
|
3374 |
+
"loss": 1.1373,
|
3375 |
+
"step": 561
|
3376 |
+
},
|
3377 |
+
{
|
3378 |
+
"epoch": 0.74,
|
3379 |
+
"learning_rate": 1e-05,
|
3380 |
+
"loss": 1.0422,
|
3381 |
+
"step": 562
|
3382 |
+
},
|
3383 |
+
{
|
3384 |
+
"epoch": 0.74,
|
3385 |
+
"learning_rate": 1e-05,
|
3386 |
+
"loss": 1.1323,
|
3387 |
+
"step": 563
|
3388 |
+
},
|
3389 |
+
{
|
3390 |
+
"epoch": 0.74,
|
3391 |
+
"learning_rate": 1e-05,
|
3392 |
+
"loss": 1.1583,
|
3393 |
+
"step": 564
|
3394 |
+
},
|
3395 |
+
{
|
3396 |
+
"epoch": 0.74,
|
3397 |
+
"learning_rate": 1e-05,
|
3398 |
+
"loss": 1.0488,
|
3399 |
+
"step": 565
|
3400 |
+
},
|
3401 |
+
{
|
3402 |
+
"epoch": 0.74,
|
3403 |
+
"learning_rate": 1e-05,
|
3404 |
+
"loss": 1.1455,
|
3405 |
+
"step": 566
|
3406 |
+
},
|
3407 |
+
{
|
3408 |
+
"epoch": 0.74,
|
3409 |
+
"learning_rate": 1e-05,
|
3410 |
+
"loss": 1.1454,
|
3411 |
+
"step": 567
|
3412 |
+
},
|
3413 |
+
{
|
3414 |
+
"epoch": 0.74,
|
3415 |
+
"learning_rate": 1e-05,
|
3416 |
+
"loss": 1.1856,
|
3417 |
+
"step": 568
|
3418 |
+
},
|
3419 |
+
{
|
3420 |
+
"epoch": 0.75,
|
3421 |
+
"learning_rate": 1e-05,
|
3422 |
+
"loss": 1.164,
|
3423 |
+
"step": 569
|
3424 |
+
},
|
3425 |
+
{
|
3426 |
+
"epoch": 0.75,
|
3427 |
+
"learning_rate": 1e-05,
|
3428 |
+
"loss": 1.1338,
|
3429 |
+
"step": 570
|
3430 |
+
},
|
3431 |
+
{
|
3432 |
+
"epoch": 0.75,
|
3433 |
+
"learning_rate": 1e-05,
|
3434 |
+
"loss": 1.1452,
|
3435 |
+
"step": 571
|
3436 |
+
},
|
3437 |
+
{
|
3438 |
+
"epoch": 0.75,
|
3439 |
+
"learning_rate": 1e-05,
|
3440 |
+
"loss": 1.105,
|
3441 |
+
"step": 572
|
3442 |
+
},
|
3443 |
+
{
|
3444 |
+
"epoch": 0.75,
|
3445 |
+
"learning_rate": 1e-05,
|
3446 |
+
"loss": 1.1738,
|
3447 |
+
"step": 573
|
3448 |
+
},
|
3449 |
+
{
|
3450 |
+
"epoch": 0.75,
|
3451 |
+
"learning_rate": 1e-05,
|
3452 |
+
"loss": 1.1409,
|
3453 |
+
"step": 574
|
3454 |
+
},
|
3455 |
+
{
|
3456 |
+
"epoch": 0.75,
|
3457 |
+
"learning_rate": 1e-05,
|
3458 |
+
"loss": 1.2128,
|
3459 |
+
"step": 575
|
3460 |
+
},
|
3461 |
+
{
|
3462 |
+
"epoch": 0.75,
|
3463 |
+
"learning_rate": 1e-05,
|
3464 |
+
"loss": 1.0991,
|
3465 |
+
"step": 576
|
3466 |
+
},
|
3467 |
+
{
|
3468 |
+
"epoch": 0.76,
|
3469 |
+
"learning_rate": 1e-05,
|
3470 |
+
"loss": 0.9785,
|
3471 |
+
"step": 577
|
3472 |
+
},
|
3473 |
+
{
|
3474 |
+
"epoch": 0.76,
|
3475 |
+
"learning_rate": 1e-05,
|
3476 |
+
"loss": 1.0146,
|
3477 |
+
"step": 578
|
3478 |
+
},
|
3479 |
+
{
|
3480 |
+
"epoch": 0.76,
|
3481 |
+
"learning_rate": 1e-05,
|
3482 |
+
"loss": 1.1587,
|
3483 |
+
"step": 579
|
3484 |
+
},
|
3485 |
+
{
|
3486 |
+
"epoch": 0.76,
|
3487 |
+
"learning_rate": 1e-05,
|
3488 |
+
"loss": 1.1499,
|
3489 |
+
"step": 580
|
3490 |
+
},
|
3491 |
+
{
|
3492 |
+
"epoch": 0.76,
|
3493 |
+
"learning_rate": 1e-05,
|
3494 |
+
"loss": 1.1695,
|
3495 |
+
"step": 581
|
3496 |
+
},
|
3497 |
+
{
|
3498 |
+
"epoch": 0.76,
|
3499 |
+
"learning_rate": 1e-05,
|
3500 |
+
"loss": 1.0072,
|
3501 |
+
"step": 582
|
3502 |
+
},
|
3503 |
+
{
|
3504 |
+
"epoch": 0.76,
|
3505 |
+
"learning_rate": 1e-05,
|
3506 |
+
"loss": 1.1465,
|
3507 |
+
"step": 583
|
3508 |
+
},
|
3509 |
+
{
|
3510 |
+
"epoch": 0.77,
|
3511 |
+
"learning_rate": 1e-05,
|
3512 |
+
"loss": 1.0976,
|
3513 |
+
"step": 584
|
3514 |
+
},
|
3515 |
+
{
|
3516 |
+
"epoch": 0.77,
|
3517 |
+
"learning_rate": 1e-05,
|
3518 |
+
"loss": 1.1581,
|
3519 |
+
"step": 585
|
3520 |
+
},
|
3521 |
+
{
|
3522 |
+
"epoch": 0.77,
|
3523 |
+
"learning_rate": 1e-05,
|
3524 |
+
"loss": 1.0455,
|
3525 |
+
"step": 586
|
3526 |
+
},
|
3527 |
+
{
|
3528 |
+
"epoch": 0.77,
|
3529 |
+
"learning_rate": 1e-05,
|
3530 |
+
"loss": 1.0656,
|
3531 |
+
"step": 587
|
3532 |
+
},
|
3533 |
+
{
|
3534 |
+
"epoch": 0.77,
|
3535 |
+
"learning_rate": 1e-05,
|
3536 |
+
"loss": 1.1564,
|
3537 |
+
"step": 588
|
3538 |
+
},
|
3539 |
+
{
|
3540 |
+
"epoch": 0.77,
|
3541 |
+
"learning_rate": 1e-05,
|
3542 |
+
"loss": 1.1414,
|
3543 |
+
"step": 589
|
3544 |
+
},
|
3545 |
+
{
|
3546 |
+
"epoch": 0.77,
|
3547 |
+
"learning_rate": 1e-05,
|
3548 |
+
"loss": 1.1129,
|
3549 |
+
"step": 590
|
3550 |
+
},
|
3551 |
+
{
|
3552 |
+
"epoch": 0.77,
|
3553 |
+
"learning_rate": 1e-05,
|
3554 |
+
"loss": 1.1502,
|
3555 |
+
"step": 591
|
3556 |
+
},
|
3557 |
+
{
|
3558 |
+
"epoch": 0.78,
|
3559 |
+
"learning_rate": 1e-05,
|
3560 |
+
"loss": 1.1551,
|
3561 |
+
"step": 592
|
3562 |
+
},
|
3563 |
+
{
|
3564 |
+
"epoch": 0.78,
|
3565 |
+
"learning_rate": 1e-05,
|
3566 |
+
"loss": 1.1153,
|
3567 |
+
"step": 593
|
3568 |
+
},
|
3569 |
+
{
|
3570 |
+
"epoch": 0.78,
|
3571 |
+
"learning_rate": 1e-05,
|
3572 |
+
"loss": 1.085,
|
3573 |
+
"step": 594
|
3574 |
+
},
|
3575 |
+
{
|
3576 |
+
"epoch": 0.78,
|
3577 |
+
"learning_rate": 1e-05,
|
3578 |
+
"loss": 1.1891,
|
3579 |
+
"step": 595
|
3580 |
+
},
|
3581 |
+
{
|
3582 |
+
"epoch": 0.78,
|
3583 |
+
"learning_rate": 1e-05,
|
3584 |
+
"loss": 1.0715,
|
3585 |
+
"step": 596
|
3586 |
+
},
|
3587 |
+
{
|
3588 |
+
"epoch": 0.78,
|
3589 |
+
"learning_rate": 1e-05,
|
3590 |
+
"loss": 1.0935,
|
3591 |
+
"step": 597
|
3592 |
+
},
|
3593 |
+
{
|
3594 |
+
"epoch": 0.78,
|
3595 |
+
"learning_rate": 1e-05,
|
3596 |
+
"loss": 1.1682,
|
3597 |
+
"step": 598
|
3598 |
+
},
|
3599 |
+
{
|
3600 |
+
"epoch": 0.78,
|
3601 |
+
"learning_rate": 1e-05,
|
3602 |
+
"loss": 1.1473,
|
3603 |
+
"step": 599
|
3604 |
+
},
|
3605 |
+
{
|
3606 |
+
"epoch": 0.79,
|
3607 |
+
"learning_rate": 1e-05,
|
3608 |
+
"loss": 1.0672,
|
3609 |
+
"step": 600
|
3610 |
+
},
|
3611 |
+
{
|
3612 |
+
"epoch": 0.79,
|
3613 |
+
"learning_rate": 1e-05,
|
3614 |
+
"loss": 1.0535,
|
3615 |
+
"step": 601
|
3616 |
+
},
|
3617 |
+
{
|
3618 |
+
"epoch": 0.79,
|
3619 |
+
"learning_rate": 1e-05,
|
3620 |
+
"loss": 0.9803,
|
3621 |
+
"step": 602
|
3622 |
+
},
|
3623 |
+
{
|
3624 |
+
"epoch": 0.79,
|
3625 |
+
"learning_rate": 1e-05,
|
3626 |
+
"loss": 1.0637,
|
3627 |
+
"step": 603
|
3628 |
+
},
|
3629 |
+
{
|
3630 |
+
"epoch": 0.79,
|
3631 |
+
"learning_rate": 1e-05,
|
3632 |
+
"loss": 1.1107,
|
3633 |
+
"step": 604
|
3634 |
+
},
|
3635 |
+
{
|
3636 |
+
"epoch": 0.79,
|
3637 |
+
"learning_rate": 1e-05,
|
3638 |
+
"loss": 1.016,
|
3639 |
+
"step": 605
|
3640 |
+
},
|
3641 |
+
{
|
3642 |
+
"epoch": 0.79,
|
3643 |
+
"learning_rate": 1e-05,
|
3644 |
+
"loss": 1.224,
|
3645 |
+
"step": 606
|
3646 |
+
},
|
3647 |
+
{
|
3648 |
+
"epoch": 0.8,
|
3649 |
+
"learning_rate": 1e-05,
|
3650 |
+
"loss": 1.0501,
|
3651 |
+
"step": 607
|
3652 |
+
},
|
3653 |
+
{
|
3654 |
+
"epoch": 0.8,
|
3655 |
+
"learning_rate": 1e-05,
|
3656 |
+
"loss": 1.0059,
|
3657 |
+
"step": 608
|
3658 |
+
},
|
3659 |
+
{
|
3660 |
+
"epoch": 0.8,
|
3661 |
+
"learning_rate": 1e-05,
|
3662 |
+
"loss": 1.0131,
|
3663 |
+
"step": 609
|
3664 |
+
},
|
3665 |
+
{
|
3666 |
+
"epoch": 0.8,
|
3667 |
+
"learning_rate": 1e-05,
|
3668 |
+
"loss": 0.9832,
|
3669 |
+
"step": 610
|
3670 |
+
},
|
3671 |
+
{
|
3672 |
+
"epoch": 0.8,
|
3673 |
+
"learning_rate": 1e-05,
|
3674 |
+
"loss": 1.1435,
|
3675 |
+
"step": 611
|
3676 |
+
},
|
3677 |
+
{
|
3678 |
+
"epoch": 0.8,
|
3679 |
+
"learning_rate": 1e-05,
|
3680 |
+
"loss": 1.2086,
|
3681 |
+
"step": 612
|
3682 |
+
},
|
3683 |
+
{
|
3684 |
+
"epoch": 0.8,
|
3685 |
+
"learning_rate": 1e-05,
|
3686 |
+
"loss": 1.1031,
|
3687 |
+
"step": 613
|
3688 |
+
},
|
3689 |
+
{
|
3690 |
+
"epoch": 0.8,
|
3691 |
+
"learning_rate": 1e-05,
|
3692 |
+
"loss": 1.1176,
|
3693 |
+
"step": 614
|
3694 |
+
},
|
3695 |
+
{
|
3696 |
+
"epoch": 0.81,
|
3697 |
+
"learning_rate": 1e-05,
|
3698 |
+
"loss": 1.1637,
|
3699 |
+
"step": 615
|
3700 |
+
},
|
3701 |
+
{
|
3702 |
+
"epoch": 0.81,
|
3703 |
+
"learning_rate": 1e-05,
|
3704 |
+
"loss": 1.0336,
|
3705 |
+
"step": 616
|
3706 |
+
},
|
3707 |
+
{
|
3708 |
+
"epoch": 0.81,
|
3709 |
+
"learning_rate": 1e-05,
|
3710 |
+
"loss": 1.0694,
|
3711 |
+
"step": 617
|
3712 |
+
},
|
3713 |
+
{
|
3714 |
+
"epoch": 0.81,
|
3715 |
+
"learning_rate": 1e-05,
|
3716 |
+
"loss": 1.0587,
|
3717 |
+
"step": 618
|
3718 |
+
},
|
3719 |
+
{
|
3720 |
+
"epoch": 0.81,
|
3721 |
+
"learning_rate": 1e-05,
|
3722 |
+
"loss": 1.1138,
|
3723 |
+
"step": 619
|
3724 |
+
},
|
3725 |
+
{
|
3726 |
+
"epoch": 0.81,
|
3727 |
+
"learning_rate": 1e-05,
|
3728 |
+
"loss": 1.2348,
|
3729 |
+
"step": 620
|
3730 |
+
},
|
3731 |
+
{
|
3732 |
+
"epoch": 0.81,
|
3733 |
+
"learning_rate": 1e-05,
|
3734 |
+
"loss": 1.1394,
|
3735 |
+
"step": 621
|
3736 |
+
},
|
3737 |
+
{
|
3738 |
+
"epoch": 0.82,
|
3739 |
+
"learning_rate": 1e-05,
|
3740 |
+
"loss": 1.1978,
|
3741 |
+
"step": 622
|
3742 |
+
},
|
3743 |
+
{
|
3744 |
+
"epoch": 0.82,
|
3745 |
+
"learning_rate": 1e-05,
|
3746 |
+
"loss": 1.1113,
|
3747 |
+
"step": 623
|
3748 |
+
},
|
3749 |
+
{
|
3750 |
+
"epoch": 0.82,
|
3751 |
+
"learning_rate": 1e-05,
|
3752 |
+
"loss": 1.2453,
|
3753 |
+
"step": 624
|
3754 |
+
},
|
3755 |
+
{
|
3756 |
+
"epoch": 0.82,
|
3757 |
+
"learning_rate": 1e-05,
|
3758 |
+
"loss": 1.0189,
|
3759 |
+
"step": 625
|
3760 |
+
},
|
3761 |
+
{
|
3762 |
+
"epoch": 0.82,
|
3763 |
+
"learning_rate": 1e-05,
|
3764 |
+
"loss": 1.0194,
|
3765 |
+
"step": 626
|
3766 |
+
},
|
3767 |
+
{
|
3768 |
+
"epoch": 0.82,
|
3769 |
+
"learning_rate": 1e-05,
|
3770 |
+
"loss": 1.0692,
|
3771 |
+
"step": 627
|
3772 |
+
},
|
3773 |
+
{
|
3774 |
+
"epoch": 0.82,
|
3775 |
+
"learning_rate": 1e-05,
|
3776 |
+
"loss": 1.0821,
|
3777 |
+
"step": 628
|
3778 |
+
},
|
3779 |
+
{
|
3780 |
+
"epoch": 0.82,
|
3781 |
+
"learning_rate": 1e-05,
|
3782 |
+
"loss": 1.1102,
|
3783 |
+
"step": 629
|
3784 |
+
},
|
3785 |
+
{
|
3786 |
+
"epoch": 0.83,
|
3787 |
+
"learning_rate": 1e-05,
|
3788 |
+
"loss": 1.1246,
|
3789 |
+
"step": 630
|
3790 |
+
},
|
3791 |
+
{
|
3792 |
+
"epoch": 0.83,
|
3793 |
+
"learning_rate": 1e-05,
|
3794 |
+
"loss": 1.1086,
|
3795 |
+
"step": 631
|
3796 |
+
},
|
3797 |
+
{
|
3798 |
+
"epoch": 0.83,
|
3799 |
+
"learning_rate": 1e-05,
|
3800 |
+
"loss": 1.0267,
|
3801 |
+
"step": 632
|
3802 |
+
},
|
3803 |
+
{
|
3804 |
+
"epoch": 0.83,
|
3805 |
+
"learning_rate": 1e-05,
|
3806 |
+
"loss": 1.075,
|
3807 |
+
"step": 633
|
3808 |
+
},
|
3809 |
+
{
|
3810 |
+
"epoch": 0.83,
|
3811 |
+
"learning_rate": 1e-05,
|
3812 |
+
"loss": 1.209,
|
3813 |
+
"step": 634
|
3814 |
+
},
|
3815 |
+
{
|
3816 |
+
"epoch": 0.83,
|
3817 |
+
"learning_rate": 1e-05,
|
3818 |
+
"loss": 1.0182,
|
3819 |
+
"step": 635
|
3820 |
+
},
|
3821 |
+
{
|
3822 |
+
"epoch": 0.83,
|
3823 |
+
"learning_rate": 1e-05,
|
3824 |
+
"loss": 1.1436,
|
3825 |
+
"step": 636
|
3826 |
+
},
|
3827 |
+
{
|
3828 |
+
"epoch": 0.83,
|
3829 |
+
"learning_rate": 1e-05,
|
3830 |
+
"loss": 1.0958,
|
3831 |
+
"step": 637
|
3832 |
+
},
|
3833 |
+
{
|
3834 |
+
"epoch": 0.84,
|
3835 |
+
"learning_rate": 1e-05,
|
3836 |
+
"loss": 1.0123,
|
3837 |
+
"step": 638
|
3838 |
+
},
|
3839 |
+
{
|
3840 |
+
"epoch": 0.84,
|
3841 |
+
"learning_rate": 1e-05,
|
3842 |
+
"loss": 1.0992,
|
3843 |
+
"step": 639
|
3844 |
+
},
|
3845 |
+
{
|
3846 |
+
"epoch": 0.84,
|
3847 |
+
"learning_rate": 1e-05,
|
3848 |
+
"loss": 1.0386,
|
3849 |
+
"step": 640
|
3850 |
+
},
|
3851 |
+
{
|
3852 |
+
"epoch": 0.84,
|
3853 |
+
"learning_rate": 1e-05,
|
3854 |
+
"loss": 1.1307,
|
3855 |
+
"step": 641
|
3856 |
+
},
|
3857 |
+
{
|
3858 |
+
"epoch": 0.84,
|
3859 |
+
"learning_rate": 1e-05,
|
3860 |
+
"loss": 1.071,
|
3861 |
+
"step": 642
|
3862 |
+
},
|
3863 |
+
{
|
3864 |
+
"epoch": 0.84,
|
3865 |
+
"learning_rate": 1e-05,
|
3866 |
+
"loss": 1.1559,
|
3867 |
+
"step": 643
|
3868 |
+
},
|
3869 |
+
{
|
3870 |
+
"epoch": 0.84,
|
3871 |
+
"learning_rate": 1e-05,
|
3872 |
+
"loss": 1.1097,
|
3873 |
+
"step": 644
|
3874 |
+
},
|
3875 |
+
{
|
3876 |
+
"epoch": 0.85,
|
3877 |
+
"learning_rate": 1e-05,
|
3878 |
+
"loss": 1.1351,
|
3879 |
+
"step": 645
|
3880 |
+
},
|
3881 |
+
{
|
3882 |
+
"epoch": 0.85,
|
3883 |
+
"learning_rate": 1e-05,
|
3884 |
+
"loss": 1.1606,
|
3885 |
+
"step": 646
|
3886 |
+
},
|
3887 |
+
{
|
3888 |
+
"epoch": 0.85,
|
3889 |
+
"learning_rate": 1e-05,
|
3890 |
+
"loss": 1.1073,
|
3891 |
+
"step": 647
|
3892 |
+
},
|
3893 |
+
{
|
3894 |
+
"epoch": 0.85,
|
3895 |
+
"learning_rate": 1e-05,
|
3896 |
+
"loss": 1.1331,
|
3897 |
+
"step": 648
|
3898 |
+
},
|
3899 |
+
{
|
3900 |
+
"epoch": 0.85,
|
3901 |
+
"learning_rate": 1e-05,
|
3902 |
+
"loss": 1.0829,
|
3903 |
+
"step": 649
|
3904 |
+
},
|
3905 |
+
{
|
3906 |
+
"epoch": 0.85,
|
3907 |
+
"learning_rate": 1e-05,
|
3908 |
+
"loss": 1.0939,
|
3909 |
+
"step": 650
|
3910 |
+
},
|
3911 |
+
{
|
3912 |
+
"epoch": 0.85,
|
3913 |
+
"learning_rate": 1e-05,
|
3914 |
+
"loss": 1.0905,
|
3915 |
+
"step": 651
|
3916 |
+
},
|
3917 |
+
{
|
3918 |
+
"epoch": 0.85,
|
3919 |
+
"learning_rate": 1e-05,
|
3920 |
+
"loss": 1.2633,
|
3921 |
+
"step": 652
|
3922 |
+
},
|
3923 |
+
{
|
3924 |
+
"epoch": 0.86,
|
3925 |
+
"learning_rate": 1e-05,
|
3926 |
+
"loss": 1.098,
|
3927 |
+
"step": 653
|
3928 |
+
},
|
3929 |
+
{
|
3930 |
+
"epoch": 0.86,
|
3931 |
+
"learning_rate": 1e-05,
|
3932 |
+
"loss": 1.074,
|
3933 |
+
"step": 654
|
3934 |
+
},
|
3935 |
+
{
|
3936 |
+
"epoch": 0.86,
|
3937 |
+
"learning_rate": 1e-05,
|
3938 |
+
"loss": 1.1239,
|
3939 |
+
"step": 655
|
3940 |
+
},
|
3941 |
+
{
|
3942 |
+
"epoch": 0.86,
|
3943 |
+
"learning_rate": 1e-05,
|
3944 |
+
"loss": 1.1844,
|
3945 |
+
"step": 656
|
3946 |
+
},
|
3947 |
+
{
|
3948 |
+
"epoch": 0.86,
|
3949 |
+
"learning_rate": 1e-05,
|
3950 |
+
"loss": 1.0273,
|
3951 |
+
"step": 657
|
3952 |
+
},
|
3953 |
+
{
|
3954 |
+
"epoch": 0.86,
|
3955 |
+
"learning_rate": 1e-05,
|
3956 |
+
"loss": 1.1133,
|
3957 |
+
"step": 658
|
3958 |
+
},
|
3959 |
+
{
|
3960 |
+
"epoch": 0.86,
|
3961 |
+
"learning_rate": 1e-05,
|
3962 |
+
"loss": 1.1795,
|
3963 |
+
"step": 659
|
3964 |
+
},
|
3965 |
+
{
|
3966 |
+
"epoch": 0.86,
|
3967 |
+
"learning_rate": 1e-05,
|
3968 |
+
"loss": 1.159,
|
3969 |
+
"step": 660
|
3970 |
+
},
|
3971 |
+
{
|
3972 |
+
"epoch": 0.87,
|
3973 |
+
"learning_rate": 1e-05,
|
3974 |
+
"loss": 1.1022,
|
3975 |
+
"step": 661
|
3976 |
+
},
|
3977 |
+
{
|
3978 |
+
"epoch": 0.87,
|
3979 |
+
"learning_rate": 1e-05,
|
3980 |
+
"loss": 1.138,
|
3981 |
+
"step": 662
|
3982 |
+
},
|
3983 |
+
{
|
3984 |
+
"epoch": 0.87,
|
3985 |
+
"learning_rate": 1e-05,
|
3986 |
+
"loss": 1.1729,
|
3987 |
+
"step": 663
|
3988 |
+
},
|
3989 |
+
{
|
3990 |
+
"epoch": 0.87,
|
3991 |
+
"learning_rate": 1e-05,
|
3992 |
+
"loss": 1.1922,
|
3993 |
+
"step": 664
|
3994 |
+
},
|
3995 |
+
{
|
3996 |
+
"epoch": 0.87,
|
3997 |
+
"learning_rate": 1e-05,
|
3998 |
+
"loss": 1.1122,
|
3999 |
+
"step": 665
|
4000 |
+
},
|
4001 |
+
{
|
4002 |
+
"epoch": 0.87,
|
4003 |
+
"learning_rate": 1e-05,
|
4004 |
+
"loss": 1.1064,
|
4005 |
+
"step": 666
|
4006 |
+
},
|
4007 |
+
{
|
4008 |
+
"epoch": 0.87,
|
4009 |
+
"learning_rate": 1e-05,
|
4010 |
+
"loss": 1.1729,
|
4011 |
+
"step": 667
|
4012 |
+
},
|
4013 |
+
{
|
4014 |
+
"epoch": 0.88,
|
4015 |
+
"learning_rate": 1e-05,
|
4016 |
+
"loss": 1.2423,
|
4017 |
+
"step": 668
|
4018 |
+
},
|
4019 |
+
{
|
4020 |
+
"epoch": 0.88,
|
4021 |
+
"learning_rate": 1e-05,
|
4022 |
+
"loss": 1.1586,
|
4023 |
+
"step": 669
|
4024 |
+
},
|
4025 |
+
{
|
4026 |
+
"epoch": 0.88,
|
4027 |
+
"learning_rate": 1e-05,
|
4028 |
+
"loss": 1.1267,
|
4029 |
+
"step": 670
|
4030 |
+
},
|
4031 |
+
{
|
4032 |
+
"epoch": 0.88,
|
4033 |
+
"learning_rate": 1e-05,
|
4034 |
+
"loss": 1.1737,
|
4035 |
+
"step": 671
|
4036 |
+
},
|
4037 |
+
{
|
4038 |
+
"epoch": 0.88,
|
4039 |
+
"learning_rate": 1e-05,
|
4040 |
+
"loss": 1.1311,
|
4041 |
+
"step": 672
|
4042 |
+
},
|
4043 |
+
{
|
4044 |
+
"epoch": 0.88,
|
4045 |
+
"learning_rate": 1e-05,
|
4046 |
+
"loss": 1.0418,
|
4047 |
+
"step": 673
|
4048 |
+
},
|
4049 |
+
{
|
4050 |
+
"epoch": 0.88,
|
4051 |
+
"learning_rate": 1e-05,
|
4052 |
+
"loss": 1.1059,
|
4053 |
+
"step": 674
|
4054 |
+
},
|
4055 |
+
{
|
4056 |
+
"epoch": 0.88,
|
4057 |
+
"learning_rate": 1e-05,
|
4058 |
+
"loss": 1.0244,
|
4059 |
+
"step": 675
|
4060 |
+
},
|
4061 |
+
{
|
4062 |
+
"epoch": 0.89,
|
4063 |
+
"learning_rate": 1e-05,
|
4064 |
+
"loss": 1.0964,
|
4065 |
+
"step": 676
|
4066 |
+
},
|
4067 |
+
{
|
4068 |
+
"epoch": 0.89,
|
4069 |
+
"learning_rate": 1e-05,
|
4070 |
+
"loss": 1.0807,
|
4071 |
+
"step": 677
|
4072 |
+
},
|
4073 |
+
{
|
4074 |
+
"epoch": 0.89,
|
4075 |
+
"learning_rate": 1e-05,
|
4076 |
+
"loss": 1.109,
|
4077 |
+
"step": 678
|
4078 |
+
},
|
4079 |
+
{
|
4080 |
+
"epoch": 0.89,
|
4081 |
+
"learning_rate": 1e-05,
|
4082 |
+
"loss": 1.0575,
|
4083 |
+
"step": 679
|
4084 |
+
},
|
4085 |
+
{
|
4086 |
+
"epoch": 0.89,
|
4087 |
+
"learning_rate": 1e-05,
|
4088 |
+
"loss": 1.0783,
|
4089 |
+
"step": 680
|
4090 |
+
},
|
4091 |
+
{
|
4092 |
+
"epoch": 0.89,
|
4093 |
+
"learning_rate": 1e-05,
|
4094 |
+
"loss": 1.1035,
|
4095 |
+
"step": 681
|
4096 |
+
},
|
4097 |
+
{
|
4098 |
+
"epoch": 0.89,
|
4099 |
+
"learning_rate": 1e-05,
|
4100 |
+
"loss": 0.9895,
|
4101 |
+
"step": 682
|
4102 |
+
},
|
4103 |
+
{
|
4104 |
+
"epoch": 0.9,
|
4105 |
+
"learning_rate": 1e-05,
|
4106 |
+
"loss": 1.0588,
|
4107 |
+
"step": 683
|
4108 |
+
},
|
4109 |
+
{
|
4110 |
+
"epoch": 0.9,
|
4111 |
+
"learning_rate": 1e-05,
|
4112 |
+
"loss": 1.2132,
|
4113 |
+
"step": 684
|
4114 |
+
},
|
4115 |
+
{
|
4116 |
+
"epoch": 0.9,
|
4117 |
+
"learning_rate": 1e-05,
|
4118 |
+
"loss": 1.0925,
|
4119 |
+
"step": 685
|
4120 |
+
},
|
4121 |
+
{
|
4122 |
+
"epoch": 0.9,
|
4123 |
+
"learning_rate": 1e-05,
|
4124 |
+
"loss": 1.005,
|
4125 |
+
"step": 686
|
4126 |
+
},
|
4127 |
+
{
|
4128 |
+
"epoch": 0.9,
|
4129 |
+
"learning_rate": 1e-05,
|
4130 |
+
"loss": 1.0566,
|
4131 |
+
"step": 687
|
4132 |
+
},
|
4133 |
+
{
|
4134 |
+
"epoch": 0.9,
|
4135 |
+
"learning_rate": 1e-05,
|
4136 |
+
"loss": 1.1449,
|
4137 |
+
"step": 688
|
4138 |
+
},
|
4139 |
+
{
|
4140 |
+
"epoch": 0.9,
|
4141 |
+
"learning_rate": 1e-05,
|
4142 |
+
"loss": 1.1861,
|
4143 |
+
"step": 689
|
4144 |
+
},
|
4145 |
+
{
|
4146 |
+
"epoch": 0.9,
|
4147 |
+
"learning_rate": 1e-05,
|
4148 |
+
"loss": 1.1236,
|
4149 |
+
"step": 690
|
4150 |
+
},
|
4151 |
+
{
|
4152 |
+
"epoch": 0.91,
|
4153 |
+
"learning_rate": 1e-05,
|
4154 |
+
"loss": 1.1029,
|
4155 |
+
"step": 691
|
4156 |
+
},
|
4157 |
+
{
|
4158 |
+
"epoch": 0.91,
|
4159 |
+
"learning_rate": 1e-05,
|
4160 |
+
"loss": 1.1064,
|
4161 |
+
"step": 692
|
4162 |
+
},
|
4163 |
+
{
|
4164 |
+
"epoch": 0.91,
|
4165 |
+
"learning_rate": 1e-05,
|
4166 |
+
"loss": 1.1022,
|
4167 |
+
"step": 693
|
4168 |
+
},
|
4169 |
+
{
|
4170 |
+
"epoch": 0.91,
|
4171 |
+
"learning_rate": 1e-05,
|
4172 |
+
"loss": 1.0721,
|
4173 |
+
"step": 694
|
4174 |
+
},
|
4175 |
+
{
|
4176 |
+
"epoch": 0.91,
|
4177 |
+
"learning_rate": 1e-05,
|
4178 |
+
"loss": 1.0993,
|
4179 |
+
"step": 695
|
4180 |
+
},
|
4181 |
+
{
|
4182 |
+
"epoch": 0.91,
|
4183 |
+
"learning_rate": 1e-05,
|
4184 |
+
"loss": 1.232,
|
4185 |
+
"step": 696
|
4186 |
+
},
|
4187 |
+
{
|
4188 |
+
"epoch": 0.91,
|
4189 |
+
"learning_rate": 1e-05,
|
4190 |
+
"loss": 1.0639,
|
4191 |
+
"step": 697
|
4192 |
+
},
|
4193 |
+
{
|
4194 |
+
"epoch": 0.91,
|
4195 |
+
"learning_rate": 1e-05,
|
4196 |
+
"loss": 1.1605,
|
4197 |
+
"step": 698
|
4198 |
+
},
|
4199 |
+
{
|
4200 |
+
"epoch": 0.92,
|
4201 |
+
"learning_rate": 1e-05,
|
4202 |
+
"loss": 1.0583,
|
4203 |
+
"step": 699
|
4204 |
+
},
|
4205 |
+
{
|
4206 |
+
"epoch": 0.92,
|
4207 |
+
"learning_rate": 1e-05,
|
4208 |
+
"loss": 1.1495,
|
4209 |
+
"step": 700
|
4210 |
+
},
|
4211 |
+
{
|
4212 |
+
"epoch": 0.92,
|
4213 |
+
"learning_rate": 1e-05,
|
4214 |
+
"loss": 1.0219,
|
4215 |
+
"step": 701
|
4216 |
+
},
|
4217 |
+
{
|
4218 |
+
"epoch": 0.92,
|
4219 |
+
"learning_rate": 1e-05,
|
4220 |
+
"loss": 1.1221,
|
4221 |
+
"step": 702
|
4222 |
+
},
|
4223 |
+
{
|
4224 |
+
"epoch": 0.92,
|
4225 |
+
"learning_rate": 1e-05,
|
4226 |
+
"loss": 1.1241,
|
4227 |
+
"step": 703
|
4228 |
+
},
|
4229 |
+
{
|
4230 |
+
"epoch": 0.92,
|
4231 |
+
"learning_rate": 1e-05,
|
4232 |
+
"loss": 1.2033,
|
4233 |
+
"step": 704
|
4234 |
+
},
|
4235 |
+
{
|
4236 |
+
"epoch": 0.92,
|
4237 |
+
"learning_rate": 1e-05,
|
4238 |
+
"loss": 1.1577,
|
4239 |
+
"step": 705
|
4240 |
+
},
|
4241 |
+
{
|
4242 |
+
"epoch": 0.93,
|
4243 |
+
"learning_rate": 1e-05,
|
4244 |
+
"loss": 1.0877,
|
4245 |
+
"step": 706
|
4246 |
+
},
|
4247 |
+
{
|
4248 |
+
"epoch": 0.93,
|
4249 |
+
"learning_rate": 1e-05,
|
4250 |
+
"loss": 1.1729,
|
4251 |
+
"step": 707
|
4252 |
+
},
|
4253 |
+
{
|
4254 |
+
"epoch": 0.93,
|
4255 |
+
"learning_rate": 1e-05,
|
4256 |
+
"loss": 1.0328,
|
4257 |
+
"step": 708
|
4258 |
+
},
|
4259 |
+
{
|
4260 |
+
"epoch": 0.93,
|
4261 |
+
"learning_rate": 1e-05,
|
4262 |
+
"loss": 1.1185,
|
4263 |
+
"step": 709
|
4264 |
+
},
|
4265 |
+
{
|
4266 |
+
"epoch": 0.93,
|
4267 |
+
"learning_rate": 1e-05,
|
4268 |
+
"loss": 1.1177,
|
4269 |
+
"step": 710
|
4270 |
+
},
|
4271 |
+
{
|
4272 |
+
"epoch": 0.93,
|
4273 |
+
"learning_rate": 1e-05,
|
4274 |
+
"loss": 1.0357,
|
4275 |
+
"step": 711
|
4276 |
+
},
|
4277 |
+
{
|
4278 |
+
"epoch": 0.93,
|
4279 |
+
"learning_rate": 1e-05,
|
4280 |
+
"loss": 1.1044,
|
4281 |
+
"step": 712
|
4282 |
+
},
|
4283 |
+
{
|
4284 |
+
"epoch": 0.93,
|
4285 |
+
"learning_rate": 1e-05,
|
4286 |
+
"loss": 1.0242,
|
4287 |
+
"step": 713
|
4288 |
+
},
|
4289 |
+
{
|
4290 |
+
"epoch": 0.94,
|
4291 |
+
"learning_rate": 1e-05,
|
4292 |
+
"loss": 1.0319,
|
4293 |
+
"step": 714
|
4294 |
+
},
|
4295 |
+
{
|
4296 |
+
"epoch": 0.94,
|
4297 |
+
"learning_rate": 1e-05,
|
4298 |
+
"loss": 1.0402,
|
4299 |
+
"step": 715
|
4300 |
+
},
|
4301 |
+
{
|
4302 |
+
"epoch": 0.94,
|
4303 |
+
"learning_rate": 1e-05,
|
4304 |
+
"loss": 1.1038,
|
4305 |
+
"step": 716
|
4306 |
+
},
|
4307 |
+
{
|
4308 |
+
"epoch": 0.94,
|
4309 |
+
"learning_rate": 1e-05,
|
4310 |
+
"loss": 1.1568,
|
4311 |
+
"step": 717
|
4312 |
+
},
|
4313 |
+
{
|
4314 |
+
"epoch": 0.94,
|
4315 |
+
"learning_rate": 1e-05,
|
4316 |
+
"loss": 1.0341,
|
4317 |
+
"step": 718
|
4318 |
+
},
|
4319 |
+
{
|
4320 |
+
"epoch": 0.94,
|
4321 |
+
"learning_rate": 1e-05,
|
4322 |
+
"loss": 1.0592,
|
4323 |
+
"step": 719
|
4324 |
+
},
|
4325 |
+
{
|
4326 |
+
"epoch": 0.94,
|
4327 |
+
"learning_rate": 1e-05,
|
4328 |
+
"loss": 1.1089,
|
4329 |
+
"step": 720
|
4330 |
+
},
|
4331 |
+
{
|
4332 |
+
"epoch": 0.94,
|
4333 |
+
"learning_rate": 1e-05,
|
4334 |
+
"loss": 1.1582,
|
4335 |
+
"step": 721
|
4336 |
+
},
|
4337 |
+
{
|
4338 |
+
"epoch": 0.95,
|
4339 |
+
"learning_rate": 1e-05,
|
4340 |
+
"loss": 1.0815,
|
4341 |
+
"step": 722
|
4342 |
+
},
|
4343 |
+
{
|
4344 |
+
"epoch": 0.95,
|
4345 |
+
"learning_rate": 1e-05,
|
4346 |
+
"loss": 1.1986,
|
4347 |
+
"step": 723
|
4348 |
+
},
|
4349 |
+
{
|
4350 |
+
"epoch": 0.95,
|
4351 |
+
"learning_rate": 1e-05,
|
4352 |
+
"loss": 0.9891,
|
4353 |
+
"step": 724
|
4354 |
+
},
|
4355 |
+
{
|
4356 |
+
"epoch": 0.95,
|
4357 |
+
"learning_rate": 1e-05,
|
4358 |
+
"loss": 1.0625,
|
4359 |
+
"step": 725
|
4360 |
+
},
|
4361 |
+
{
|
4362 |
+
"epoch": 0.95,
|
4363 |
+
"learning_rate": 1e-05,
|
4364 |
+
"loss": 1.1619,
|
4365 |
+
"step": 726
|
4366 |
+
},
|
4367 |
+
{
|
4368 |
+
"epoch": 0.95,
|
4369 |
+
"learning_rate": 1e-05,
|
4370 |
+
"loss": 1.1473,
|
4371 |
+
"step": 727
|
4372 |
+
},
|
4373 |
+
{
|
4374 |
+
"epoch": 0.95,
|
4375 |
+
"learning_rate": 1e-05,
|
4376 |
+
"loss": 1.0042,
|
4377 |
+
"step": 728
|
4378 |
+
},
|
4379 |
+
{
|
4380 |
+
"epoch": 0.96,
|
4381 |
+
"learning_rate": 1e-05,
|
4382 |
+
"loss": 1.0952,
|
4383 |
+
"step": 729
|
4384 |
+
},
|
4385 |
+
{
|
4386 |
+
"epoch": 0.96,
|
4387 |
+
"learning_rate": 1e-05,
|
4388 |
+
"loss": 1.0996,
|
4389 |
+
"step": 730
|
4390 |
+
},
|
4391 |
+
{
|
4392 |
+
"epoch": 0.96,
|
4393 |
+
"learning_rate": 1e-05,
|
4394 |
+
"loss": 1.0994,
|
4395 |
+
"step": 731
|
4396 |
+
},
|
4397 |
+
{
|
4398 |
+
"epoch": 0.96,
|
4399 |
+
"learning_rate": 1e-05,
|
4400 |
+
"loss": 1.0666,
|
4401 |
+
"step": 732
|
4402 |
+
},
|
4403 |
+
{
|
4404 |
+
"epoch": 0.96,
|
4405 |
+
"learning_rate": 1e-05,
|
4406 |
+
"loss": 1.109,
|
4407 |
+
"step": 733
|
4408 |
+
},
|
4409 |
+
{
|
4410 |
+
"epoch": 0.96,
|
4411 |
+
"learning_rate": 1e-05,
|
4412 |
+
"loss": 1.1455,
|
4413 |
+
"step": 734
|
4414 |
+
},
|
4415 |
+
{
|
4416 |
+
"epoch": 0.96,
|
4417 |
+
"learning_rate": 1e-05,
|
4418 |
+
"loss": 1.0717,
|
4419 |
+
"step": 735
|
4420 |
+
},
|
4421 |
+
{
|
4422 |
+
"epoch": 0.96,
|
4423 |
+
"learning_rate": 1e-05,
|
4424 |
+
"loss": 1.0017,
|
4425 |
+
"step": 736
|
4426 |
+
},
|
4427 |
+
{
|
4428 |
+
"epoch": 0.97,
|
4429 |
+
"learning_rate": 1e-05,
|
4430 |
+
"loss": 1.0912,
|
4431 |
+
"step": 737
|
4432 |
+
},
|
4433 |
+
{
|
4434 |
+
"epoch": 0.97,
|
4435 |
+
"learning_rate": 1e-05,
|
4436 |
+
"loss": 1.0153,
|
4437 |
+
"step": 738
|
4438 |
+
},
|
4439 |
+
{
|
4440 |
+
"epoch": 0.97,
|
4441 |
+
"learning_rate": 1e-05,
|
4442 |
+
"loss": 1.1383,
|
4443 |
+
"step": 739
|
4444 |
+
},
|
4445 |
+
{
|
4446 |
+
"epoch": 0.97,
|
4447 |
+
"learning_rate": 1e-05,
|
4448 |
+
"loss": 1.0648,
|
4449 |
+
"step": 740
|
4450 |
+
},
|
4451 |
+
{
|
4452 |
+
"epoch": 0.97,
|
4453 |
+
"learning_rate": 1e-05,
|
4454 |
+
"loss": 1.0922,
|
4455 |
+
"step": 741
|
4456 |
+
},
|
4457 |
+
{
|
4458 |
+
"epoch": 0.97,
|
4459 |
+
"learning_rate": 1e-05,
|
4460 |
+
"loss": 1.2428,
|
4461 |
+
"step": 742
|
4462 |
+
},
|
4463 |
+
{
|
4464 |
+
"epoch": 0.97,
|
4465 |
+
"learning_rate": 1e-05,
|
4466 |
+
"loss": 1.0013,
|
4467 |
+
"step": 743
|
4468 |
+
},
|
4469 |
+
{
|
4470 |
+
"epoch": 0.97,
|
4471 |
+
"learning_rate": 1e-05,
|
4472 |
+
"loss": 1.0422,
|
4473 |
+
"step": 744
|
4474 |
+
},
|
4475 |
+
{
|
4476 |
+
"epoch": 0.98,
|
4477 |
+
"learning_rate": 1e-05,
|
4478 |
+
"loss": 1.0188,
|
4479 |
+
"step": 745
|
4480 |
+
},
|
4481 |
+
{
|
4482 |
+
"epoch": 0.98,
|
4483 |
+
"learning_rate": 1e-05,
|
4484 |
+
"loss": 1.0576,
|
4485 |
+
"step": 746
|
4486 |
+
},
|
4487 |
+
{
|
4488 |
+
"epoch": 0.98,
|
4489 |
+
"learning_rate": 1e-05,
|
4490 |
+
"loss": 1.0765,
|
4491 |
+
"step": 747
|
4492 |
+
},
|
4493 |
+
{
|
4494 |
+
"epoch": 0.98,
|
4495 |
+
"learning_rate": 1e-05,
|
4496 |
+
"loss": 1.1814,
|
4497 |
+
"step": 748
|
4498 |
+
},
|
4499 |
+
{
|
4500 |
+
"epoch": 0.98,
|
4501 |
+
"learning_rate": 1e-05,
|
4502 |
+
"loss": 1.0617,
|
4503 |
+
"step": 749
|
4504 |
+
},
|
4505 |
+
{
|
4506 |
+
"epoch": 0.98,
|
4507 |
+
"learning_rate": 1e-05,
|
4508 |
+
"loss": 1.0474,
|
4509 |
+
"step": 750
|
4510 |
+
},
|
4511 |
+
{
|
4512 |
+
"epoch": 0.98,
|
4513 |
+
"learning_rate": 1e-05,
|
4514 |
+
"loss": 1.005,
|
4515 |
+
"step": 751
|
4516 |
+
},
|
4517 |
+
{
|
4518 |
+
"epoch": 0.99,
|
4519 |
+
"learning_rate": 1e-05,
|
4520 |
+
"loss": 0.984,
|
4521 |
+
"step": 752
|
4522 |
+
},
|
4523 |
+
{
|
4524 |
+
"epoch": 0.99,
|
4525 |
+
"learning_rate": 1e-05,
|
4526 |
+
"loss": 1.0283,
|
4527 |
+
"step": 753
|
4528 |
+
},
|
4529 |
+
{
|
4530 |
+
"epoch": 0.99,
|
4531 |
+
"learning_rate": 1e-05,
|
4532 |
+
"loss": 1.0526,
|
4533 |
+
"step": 754
|
4534 |
+
},
|
4535 |
+
{
|
4536 |
+
"epoch": 0.99,
|
4537 |
+
"learning_rate": 1e-05,
|
4538 |
+
"loss": 1.0942,
|
4539 |
+
"step": 755
|
4540 |
+
},
|
4541 |
+
{
|
4542 |
+
"epoch": 0.99,
|
4543 |
+
"learning_rate": 1e-05,
|
4544 |
+
"loss": 1.1801,
|
4545 |
+
"step": 756
|
4546 |
+
},
|
4547 |
+
{
|
4548 |
+
"epoch": 0.99,
|
4549 |
+
"learning_rate": 1e-05,
|
4550 |
+
"loss": 1.1005,
|
4551 |
+
"step": 757
|
4552 |
+
},
|
4553 |
+
{
|
4554 |
+
"epoch": 0.99,
|
4555 |
+
"learning_rate": 1e-05,
|
4556 |
+
"loss": 1.1215,
|
4557 |
+
"step": 758
|
4558 |
+
},
|
4559 |
+
{
|
4560 |
+
"epoch": 0.99,
|
4561 |
+
"learning_rate": 1e-05,
|
4562 |
+
"loss": 1.0726,
|
4563 |
+
"step": 759
|
4564 |
+
},
|
4565 |
+
{
|
4566 |
+
"epoch": 1.0,
|
4567 |
+
"learning_rate": 1e-05,
|
4568 |
+
"loss": 1.1016,
|
4569 |
+
"step": 760
|
4570 |
+
},
|
4571 |
+
{
|
4572 |
+
"epoch": 1.0,
|
4573 |
+
"learning_rate": 1e-05,
|
4574 |
+
"loss": 1.0931,
|
4575 |
+
"step": 761
|
4576 |
+
},
|
4577 |
+
{
|
4578 |
+
"epoch": 1.0,
|
4579 |
+
"learning_rate": 1e-05,
|
4580 |
+
"loss": 1.1488,
|
4581 |
+
"step": 762
|
4582 |
+
},
|
4583 |
+
{
|
4584 |
+
"epoch": 1.0,
|
4585 |
+
"learning_rate": 1e-05,
|
4586 |
+
"loss": 1.069,
|
4587 |
+
"step": 763
|
4588 |
+
}
|
4589 |
+
],
|
4590 |
+
"logging_steps": 1.0,
|
4591 |
+
"max_steps": 1526,
|
4592 |
+
"num_train_epochs": 2,
|
4593 |
+
"save_steps": 500,
|
4594 |
+
"total_flos": 1662874904510464.0,
|
4595 |
+
"trial_name": null,
|
4596 |
+
"trial_params": null
|
4597 |
+
}
|
training_args.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dd01a804781e810b01e391b5d7d7a3bbad008ebf206068d80ad20209053d447f
|
3 |
+
size 6776
|
zero_to_fp32.py
ADDED
@@ -0,0 +1,587 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|