RZ412 commited on
Commit
549711d
·
verified ·
1 Parent(s): 410f751

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. README.md +61 -0
  2. added_tokens.json +24 -0
  3. all_results.json +8 -0
  4. chat_template.jinja +54 -0
  5. checkpoint-1042/config.json +28 -0
  6. checkpoint-1042/generation_config.json +14 -0
  7. checkpoint-1042/latest +1 -0
  8. checkpoint-1042/trainer_state.json +0 -0
  9. checkpoint-1042/vocab.json +0 -0
  10. checkpoint-1042/zero_to_fp32.py +760 -0
  11. checkpoint-2084/added_tokens.json +24 -0
  12. checkpoint-2084/chat_template.jinja +54 -0
  13. checkpoint-2084/config.json +28 -0
  14. checkpoint-2084/generation_config.json +14 -0
  15. checkpoint-2084/latest +1 -0
  16. checkpoint-2084/merges.txt +0 -0
  17. checkpoint-2084/special_tokens_map.json +31 -0
  18. checkpoint-2084/tokenizer_config.json +208 -0
  19. checkpoint-2084/trainer_state.json +0 -0
  20. checkpoint-2084/vocab.json +0 -0
  21. checkpoint-2084/zero_to_fp32.py +760 -0
  22. checkpoint-2605/added_tokens.json +24 -0
  23. checkpoint-2605/chat_template.jinja +54 -0
  24. checkpoint-2605/generation_config.json +14 -0
  25. checkpoint-2605/latest +1 -0
  26. checkpoint-2605/merges.txt +0 -0
  27. checkpoint-2605/special_tokens_map.json +31 -0
  28. checkpoint-2605/tokenizer_config.json +208 -0
  29. checkpoint-2605/trainer_state.json +0 -0
  30. checkpoint-521/added_tokens.json +24 -0
  31. checkpoint-521/chat_template.jinja +54 -0
  32. checkpoint-521/config.json +28 -0
  33. checkpoint-521/generation_config.json +14 -0
  34. checkpoint-521/latest +1 -0
  35. checkpoint-521/merges.txt +0 -0
  36. checkpoint-521/special_tokens_map.json +31 -0
  37. checkpoint-521/tokenizer_config.json +208 -0
  38. checkpoint-521/trainer_state.json +3681 -0
  39. checkpoint-521/vocab.json +0 -0
  40. checkpoint-521/zero_to_fp32.py +760 -0
  41. config.json +28 -0
  42. generation_config.json +14 -0
  43. merges.txt +0 -0
  44. special_tokens_map.json +31 -0
  45. tokenizer_config.json +208 -0
  46. train_results.json +8 -0
  47. trainer_log.jsonl +0 -0
  48. trainer_state.json +0 -0
  49. training_loss.png +0 -0
  50. vocab.json +0 -0
README.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: apache-2.0
4
+ base_model: Qwen/Qwen2.5-1.5B-Instruct
5
+ tags:
6
+ - llama-factory
7
+ - full
8
+ - generated_from_trainer
9
+ model-index:
10
+ - name: Qwen2.5-1.5B-Instruct-OT3-8K-QwQ
11
+ results: []
12
+ ---
13
+
14
+ <!-- This model card has been generated automatically according to the information the Trainer had access to. You
15
+ should probably proofread and complete it, then remove this comment. -->
16
+
17
+ # Qwen2.5-1.5B-Instruct-OT3-8K-QwQ
18
+
19
+ This model is a fine-tuned version of [Qwen/Qwen2.5-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct) on the ot3_8k_subset_qwq dataset.
20
+
21
+ ## Model description
22
+
23
+ More information needed
24
+
25
+ ## Intended uses & limitations
26
+
27
+ More information needed
28
+
29
+ ## Training and evaluation data
30
+
31
+ More information needed
32
+
33
+ ## Training procedure
34
+
35
+ ### Training hyperparameters
36
+
37
+ The following hyperparameters were used during training:
38
+ - learning_rate: 1e-05
39
+ - train_batch_size: 1
40
+ - eval_batch_size: 8
41
+ - seed: 42
42
+ - distributed_type: multi-GPU
43
+ - num_devices: 2
44
+ - gradient_accumulation_steps: 8
45
+ - total_train_batch_size: 16
46
+ - total_eval_batch_size: 16
47
+ - optimizer: Use OptimizerNames.ADAMW_TORCH with betas=(0.9,0.95) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
48
+ - lr_scheduler_type: cosine
49
+ - lr_scheduler_warmup_ratio: 0.1
50
+ - num_epochs: 5.0
51
+
52
+ ### Training results
53
+
54
+
55
+
56
+ ### Framework versions
57
+
58
+ - Transformers 4.52.4
59
+ - Pytorch 2.7.1+cu126
60
+ - Datasets 3.6.0
61
+ - Tokenizers 0.21.1
added_tokens.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</tool_call>": 151658,
3
+ "<tool_call>": 151657,
4
+ "<|box_end|>": 151649,
5
+ "<|box_start|>": 151648,
6
+ "<|endoftext|>": 151643,
7
+ "<|file_sep|>": 151664,
8
+ "<|fim_middle|>": 151660,
9
+ "<|fim_pad|>": 151662,
10
+ "<|fim_prefix|>": 151659,
11
+ "<|fim_suffix|>": 151661,
12
+ "<|im_end|>": 151645,
13
+ "<|im_start|>": 151644,
14
+ "<|image_pad|>": 151655,
15
+ "<|object_ref_end|>": 151647,
16
+ "<|object_ref_start|>": 151646,
17
+ "<|quad_end|>": 151651,
18
+ "<|quad_start|>": 151650,
19
+ "<|repo_name|>": 151663,
20
+ "<|video_pad|>": 151656,
21
+ "<|vision_end|>": 151653,
22
+ "<|vision_pad|>": 151654,
23
+ "<|vision_start|>": 151652
24
+ }
all_results.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 5.0,
3
+ "total_flos": 451881746563072.0,
4
+ "train_loss": 1.2663256504714147,
5
+ "train_runtime": 105590.0324,
6
+ "train_samples_per_second": 0.394,
7
+ "train_steps_per_second": 0.025
8
+ }
chat_template.jinja ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0]['role'] == 'system' %}
4
+ {{- messages[0]['content'] }}
5
+ {%- else %}
6
+ {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
7
+ {%- endif %}
8
+ {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
9
+ {%- for tool in tools %}
10
+ {{- "\n" }}
11
+ {{- tool | tojson }}
12
+ {%- endfor %}
13
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
14
+ {%- else %}
15
+ {%- if messages[0]['role'] == 'system' %}
16
+ {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
17
+ {%- else %}
18
+ {{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
19
+ {%- endif %}
20
+ {%- endif %}
21
+ {%- for message in messages %}
22
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
23
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
24
+ {%- elif message.role == "assistant" %}
25
+ {{- '<|im_start|>' + message.role }}
26
+ {%- if message.content %}
27
+ {{- '\n' + message.content }}
28
+ {%- endif %}
29
+ {%- for tool_call in message.tool_calls %}
30
+ {%- if tool_call.function is defined %}
31
+ {%- set tool_call = tool_call.function %}
32
+ {%- endif %}
33
+ {{- '\n<tool_call>\n{"name": "' }}
34
+ {{- tool_call.name }}
35
+ {{- '", "arguments": ' }}
36
+ {{- tool_call.arguments | tojson }}
37
+ {{- '}\n</tool_call>' }}
38
+ {%- endfor %}
39
+ {{- '<|im_end|>\n' }}
40
+ {%- elif message.role == "tool" %}
41
+ {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
42
+ {{- '<|im_start|>user' }}
43
+ {%- endif %}
44
+ {{- '\n<tool_response>\n' }}
45
+ {{- message.content }}
46
+ {{- '\n</tool_response>' }}
47
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
48
+ {{- '<|im_end|>\n' }}
49
+ {%- endif %}
50
+ {%- endif %}
51
+ {%- endfor %}
52
+ {%- if add_generation_prompt %}
53
+ {{- '<|im_start|>assistant\n' }}
54
+ {%- endif %}
checkpoint-1042/config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen2ForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "bos_token_id": 151643,
7
+ "eos_token_id": 151645,
8
+ "hidden_act": "silu",
9
+ "hidden_size": 1536,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 8960,
12
+ "max_position_embeddings": 32768,
13
+ "max_window_layers": 21,
14
+ "model_type": "qwen2",
15
+ "num_attention_heads": 12,
16
+ "num_hidden_layers": 28,
17
+ "num_key_value_heads": 2,
18
+ "rms_norm_eps": 1e-06,
19
+ "rope_scaling": null,
20
+ "rope_theta": 1000000.0,
21
+ "sliding_window": 32768,
22
+ "tie_word_embeddings": true,
23
+ "torch_dtype": "bfloat16",
24
+ "transformers_version": "4.52.4",
25
+ "use_cache": false,
26
+ "use_sliding_window": false,
27
+ "vocab_size": 151936
28
+ }
checkpoint-1042/generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "repetition_penalty": 1.1,
10
+ "temperature": 0.7,
11
+ "top_k": 20,
12
+ "top_p": 0.8,
13
+ "transformers_version": "4.52.4"
14
+ }
checkpoint-1042/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step1041
checkpoint-1042/trainer_state.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-1042/vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-1042/zero_to_fp32.py ADDED
@@ -0,0 +1,760 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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:
14
+ # python zero_to_fp32.py . output_dir/
15
+ # or
16
+ # python zero_to_fp32.py . output_dir/ --safe_serialization
17
+
18
+ import argparse
19
+ import torch
20
+ import glob
21
+ import math
22
+ import os
23
+ import re
24
+ import gc
25
+ import json
26
+ import numpy as np
27
+ from tqdm import tqdm
28
+ from collections import OrderedDict
29
+ from dataclasses import dataclass
30
+
31
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
32
+ # DeepSpeed data structures it has to be available in the current python environment.
33
+ from deepspeed.utils import logger
34
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
35
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
36
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
37
+
38
+
39
+ @dataclass
40
+ class zero_model_state:
41
+ buffers: dict()
42
+ param_shapes: dict()
43
+ shared_params: list
44
+ ds_version: int
45
+ frozen_param_shapes: dict()
46
+ frozen_param_fragments: dict()
47
+
48
+
49
+ debug = 0
50
+
51
+ # load to cpu
52
+ device = torch.device('cpu')
53
+
54
+
55
+ def atoi(text):
56
+ return int(text) if text.isdigit() else text
57
+
58
+
59
+ def natural_keys(text):
60
+ '''
61
+ alist.sort(key=natural_keys) sorts in human order
62
+ http://nedbatchelder.com/blog/200712/human_sorting.html
63
+ (See Toothy's implementation in the comments)
64
+ '''
65
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
66
+
67
+
68
+ def get_model_state_file(checkpoint_dir, zero_stage):
69
+ if not os.path.isdir(checkpoint_dir):
70
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
71
+
72
+ # there should be only one file
73
+ if zero_stage <= 2:
74
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
75
+ elif zero_stage == 3:
76
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
77
+
78
+ if not os.path.exists(file):
79
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
80
+
81
+ return file
82
+
83
+
84
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
85
+ # XXX: need to test that this simple glob rule works for multi-node setup too
86
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
87
+
88
+ if len(ckpt_files) == 0:
89
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
90
+
91
+ return ckpt_files
92
+
93
+
94
+ def get_optim_files(checkpoint_dir):
95
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
96
+
97
+
98
+ def get_model_state_files(checkpoint_dir):
99
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
100
+
101
+
102
+ def parse_model_states(files):
103
+ zero_model_states = []
104
+ for file in files:
105
+ state_dict = torch.load(file, map_location=device, weights_only=False)
106
+
107
+ if BUFFER_NAMES not in state_dict:
108
+ raise ValueError(f"{file} is not a model state checkpoint")
109
+ buffer_names = state_dict[BUFFER_NAMES]
110
+ if debug:
111
+ print("Found buffers:", buffer_names)
112
+
113
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
114
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
115
+ param_shapes = state_dict[PARAM_SHAPES]
116
+
117
+ # collect parameters that are included in param_shapes
118
+ param_names = []
119
+ for s in param_shapes:
120
+ for name in s.keys():
121
+ param_names.append(name)
122
+
123
+ # update with frozen parameters
124
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
125
+ if frozen_param_shapes is not None:
126
+ if debug:
127
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
128
+ param_names += list(frozen_param_shapes.keys())
129
+
130
+ # handle shared params
131
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
132
+
133
+ ds_version = state_dict.get(DS_VERSION, None)
134
+
135
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
136
+
137
+ z_model_state = zero_model_state(buffers=buffers,
138
+ param_shapes=param_shapes,
139
+ shared_params=shared_params,
140
+ ds_version=ds_version,
141
+ frozen_param_shapes=frozen_param_shapes,
142
+ frozen_param_fragments=frozen_param_fragments)
143
+ zero_model_states.append(z_model_state)
144
+
145
+ return zero_model_states
146
+
147
+
148
+ def parse_optim_states(files, ds_checkpoint_dir):
149
+ total_files = len(files)
150
+ state_dicts = []
151
+ for f in tqdm(files, desc='Loading checkpoint shards'):
152
+ state_dict = torch.load(f, map_location=device, mmap=True, weights_only=False)
153
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
154
+ # and also handle the case where it was already removed by another helper script
155
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
156
+ state_dicts.append(state_dict)
157
+
158
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
159
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
160
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
161
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
162
+
163
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
164
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
165
+ # use the max of the partition_count to get the dp world_size.
166
+
167
+ if type(world_size) is list:
168
+ world_size = max(world_size)
169
+
170
+ if world_size != total_files:
171
+ raise ValueError(
172
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
173
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
174
+ )
175
+
176
+ # the groups are named differently in each stage
177
+ if zero_stage <= 2:
178
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
179
+ elif zero_stage == 3:
180
+ fp32_groups_key = FP32_FLAT_GROUPS
181
+ else:
182
+ raise ValueError(f"unknown zero stage {zero_stage}")
183
+
184
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
185
+ return zero_stage, world_size, fp32_flat_groups
186
+
187
+
188
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
189
+ """
190
+ Returns fp32 state_dict reconstructed from ds checkpoint
191
+
192
+ Args:
193
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
194
+
195
+ """
196
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
197
+
198
+ optim_files = get_optim_files(ds_checkpoint_dir)
199
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
200
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
201
+
202
+ model_files = get_model_state_files(ds_checkpoint_dir)
203
+
204
+ zero_model_states = parse_model_states(model_files)
205
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
206
+
207
+ if zero_stage <= 2:
208
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
209
+ exclude_frozen_parameters)
210
+ elif zero_stage == 3:
211
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
212
+ exclude_frozen_parameters)
213
+
214
+
215
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
216
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
217
+ return
218
+
219
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
220
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
221
+
222
+ if debug:
223
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
224
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
225
+
226
+ wanted_params = len(frozen_param_shapes)
227
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
228
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
229
+ print(f'Frozen params: Have {avail_numel} numels to process.')
230
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
231
+
232
+ total_params = 0
233
+ total_numel = 0
234
+ for name, shape in frozen_param_shapes.items():
235
+ total_params += 1
236
+ unpartitioned_numel = shape.numel()
237
+ total_numel += unpartitioned_numel
238
+
239
+ state_dict[name] = frozen_param_fragments[name]
240
+
241
+ if debug:
242
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
243
+
244
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
245
+
246
+
247
+ def _has_callable(obj, fn):
248
+ attr = getattr(obj, fn, None)
249
+ return callable(attr)
250
+
251
+
252
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
253
+ param_shapes = zero_model_states[0].param_shapes
254
+
255
+ # Reconstruction protocol:
256
+ #
257
+ # XXX: document this
258
+
259
+ if debug:
260
+ for i in range(world_size):
261
+ for j in range(len(fp32_flat_groups[0])):
262
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
263
+
264
+ # XXX: memory usage doubles here (zero2)
265
+ num_param_groups = len(fp32_flat_groups[0])
266
+ merged_single_partition_of_fp32_groups = []
267
+ for i in range(num_param_groups):
268
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
269
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
270
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
271
+ avail_numel = sum(
272
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
273
+
274
+ if debug:
275
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
276
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
277
+ # not asserting if there is a mismatch due to possible padding
278
+ print(f"Have {avail_numel} numels to process.")
279
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
280
+
281
+ # params
282
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
283
+ # out-of-core computing solution
284
+ total_numel = 0
285
+ total_params = 0
286
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
287
+ offset = 0
288
+ avail_numel = full_single_fp32_vector.numel()
289
+ for name, shape in shapes.items():
290
+
291
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
292
+ total_numel += unpartitioned_numel
293
+ total_params += 1
294
+
295
+ if debug:
296
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
297
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
298
+ offset += unpartitioned_numel
299
+
300
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
301
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
302
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
303
+ # live optimizer object, so we are checking that the numbers are within the right range
304
+ align_to = 2 * world_size
305
+
306
+ def zero2_align(x):
307
+ return align_to * math.ceil(x / align_to)
308
+
309
+ if debug:
310
+ print(f"original offset={offset}, avail_numel={avail_numel}")
311
+
312
+ offset = zero2_align(offset)
313
+ avail_numel = zero2_align(avail_numel)
314
+
315
+ if debug:
316
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
317
+
318
+ # Sanity check
319
+ if offset != avail_numel:
320
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
321
+
322
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
323
+
324
+
325
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
326
+ exclude_frozen_parameters):
327
+ state_dict = OrderedDict()
328
+
329
+ # buffers
330
+ buffers = zero_model_states[0].buffers
331
+ state_dict.update(buffers)
332
+ if debug:
333
+ print(f"added {len(buffers)} buffers")
334
+
335
+ if not exclude_frozen_parameters:
336
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
337
+
338
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
339
+
340
+ # recover shared parameters
341
+ for pair in zero_model_states[0].shared_params:
342
+ if pair[1] in state_dict:
343
+ state_dict[pair[0]] = state_dict[pair[1]]
344
+
345
+ return state_dict
346
+
347
+
348
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
349
+ remainder = unpartitioned_numel % world_size
350
+ padding_numel = (world_size - remainder) if remainder else 0
351
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
352
+ return partitioned_numel, padding_numel
353
+
354
+
355
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
356
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
357
+ return
358
+
359
+ if debug:
360
+ for i in range(world_size):
361
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
362
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
363
+
364
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
365
+ wanted_params = len(frozen_param_shapes)
366
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
367
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
368
+ print(f'Frozen params: Have {avail_numel} numels to process.')
369
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
370
+
371
+ total_params = 0
372
+ total_numel = 0
373
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
374
+ total_params += 1
375
+ unpartitioned_numel = shape.numel()
376
+ total_numel += unpartitioned_numel
377
+
378
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
379
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
380
+
381
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
382
+
383
+ if debug:
384
+ print(
385
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
386
+ )
387
+
388
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
389
+
390
+
391
+ class GatheredTensor:
392
+ """
393
+ A pseudo tensor that collects partitioned weights.
394
+ It is more memory efficient when there are multiple groups.
395
+ """
396
+
397
+ def __init__(self, flat_groups, flat_groups_offset, offset, partitioned_numel, shape):
398
+ self.flat_groups = flat_groups
399
+ self.flat_groups_offset = flat_groups_offset
400
+ self.offset = offset
401
+ self.partitioned_numel = partitioned_numel
402
+ self.shape = shape
403
+ self.dtype = self.flat_groups[0][0].dtype
404
+
405
+ def contiguous(self):
406
+ """
407
+ Merge partitioned weights from flat_groups into a single tensor.
408
+ """
409
+ end_idx = self.offset + self.partitioned_numel
410
+ world_size = len(self.flat_groups)
411
+ pad_flat_param_chunks = []
412
+
413
+ for rank_i in range(world_size):
414
+ # for each rank, we need to collect weights from related group/groups
415
+ flat_groups_at_rank_i = self.flat_groups[rank_i]
416
+ start_group_id = None
417
+ end_group_id = None
418
+ for group_id in range(len(self.flat_groups_offset)):
419
+ if self.flat_groups_offset[group_id] <= self.offset < self.flat_groups_offset[group_id + 1]:
420
+ start_group_id = group_id
421
+ if self.flat_groups_offset[group_id] < end_idx <= self.flat_groups_offset[group_id + 1]:
422
+ end_group_id = group_id
423
+ break
424
+ # collect weights from related group/groups
425
+ for group_id in range(start_group_id, end_group_id + 1):
426
+ flat_tensor = flat_groups_at_rank_i[group_id]
427
+ start_offset = self.offset - self.flat_groups_offset[group_id]
428
+ end_offset = min(end_idx, self.flat_groups_offset[group_id + 1]) - self.flat_groups_offset[group_id]
429
+ pad_flat_param_chunks.append(flat_tensor[start_offset:end_offset])
430
+
431
+ # collect weights from all ranks
432
+ pad_flat_param = torch.cat(pad_flat_param_chunks, dim=0)
433
+ param = pad_flat_param[:self.shape.numel()].view(self.shape).contiguous()
434
+ return param
435
+
436
+
437
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
438
+ param_shapes = zero_model_states[0].param_shapes
439
+ avail_numel = sum([flat_group.numel() for flat_group in fp32_flat_groups[0]]) * world_size
440
+
441
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
442
+ # param, re-consolidating each param, while dealing with padding if any
443
+
444
+ # merge list of dicts, preserving order
445
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
446
+
447
+ if debug:
448
+ for i in range(world_size):
449
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
450
+
451
+ wanted_params = len(param_shapes)
452
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
453
+ # not asserting if there is a mismatch due to possible padding
454
+ avail_numel = fp32_flat_groups[0].numel() * world_size
455
+ print(f"Trainable params: Have {avail_numel} numels to process.")
456
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
457
+
458
+ # params
459
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
460
+ # out-of-core computing solution
461
+ offset = 0
462
+ total_numel = 0
463
+ total_params = 0
464
+ flat_groups_offset = [0] + list(np.cumsum([flat_tensor.numel() for flat_tensor in fp32_flat_groups[0]]))
465
+ for name, shape in tqdm(param_shapes.items(), desc='Gathering sharded weights'):
466
+ unpartitioned_numel = shape.numel()
467
+ total_numel += unpartitioned_numel
468
+ total_params += 1
469
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
470
+
471
+ if debug:
472
+ print(
473
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
474
+ )
475
+
476
+ # memory efficient tensor
477
+ tensor = GatheredTensor(fp32_flat_groups, flat_groups_offset, offset, partitioned_numel, shape)
478
+ state_dict[name] = tensor
479
+ offset += partitioned_numel
480
+
481
+ offset *= world_size
482
+
483
+ # Sanity check
484
+ if offset != avail_numel:
485
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
486
+
487
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
488
+
489
+
490
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
491
+ exclude_frozen_parameters):
492
+ state_dict = OrderedDict()
493
+
494
+ # buffers
495
+ buffers = zero_model_states[0].buffers
496
+ state_dict.update(buffers)
497
+ if debug:
498
+ print(f"added {len(buffers)} buffers")
499
+
500
+ if not exclude_frozen_parameters:
501
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
502
+
503
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
504
+
505
+ # recover shared parameters
506
+ for pair in zero_model_states[0].shared_params:
507
+ if pair[1] in state_dict:
508
+ state_dict[pair[0]] = state_dict[pair[1]]
509
+
510
+ return state_dict
511
+
512
+
513
+ def to_torch_tensor(state_dict, return_empty_tensor=False):
514
+ """
515
+ Convert state_dict of GatheredTensor to torch tensor
516
+ """
517
+ torch_state_dict = {}
518
+ converted_tensors = {}
519
+ for name, tensor in state_dict.items():
520
+ tensor_id = id(tensor)
521
+ if tensor_id in converted_tensors: # shared tensors
522
+ shared_tensor = torch_state_dict[converted_tensors[tensor_id]]
523
+ torch_state_dict[name] = shared_tensor
524
+ else:
525
+ converted_tensors[tensor_id] = name
526
+ if return_empty_tensor:
527
+ torch_state_dict[name] = torch.empty(tensor.shape, dtype=tensor.dtype)
528
+ else:
529
+ torch_state_dict[name] = tensor.contiguous()
530
+ return torch_state_dict
531
+
532
+
533
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
534
+ tag=None,
535
+ exclude_frozen_parameters=False,
536
+ lazy_mode=False):
537
+ """
538
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
539
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
540
+ via a model hub.
541
+
542
+ Args:
543
+ - ``checkpoint_dir``: path to the desired checkpoint folder
544
+ - ``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``
545
+ - ``exclude_frozen_parameters``: exclude frozen parameters
546
+ - ``lazy_mode``: get state_dict in lazy mode. It returns a dict of pesduo tensor instead of torch tensor, which is more memory efficient.
547
+ Convert the pesduo tensor to torch tensor by ``.contiguous()``
548
+
549
+ Returns:
550
+ - pytorch ``state_dict``
551
+
552
+ A typical usage might be ::
553
+
554
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
555
+ # do the training and checkpoint saving
556
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
557
+ model = model.cpu() # move to cpu
558
+ model.load_state_dict(state_dict)
559
+ # submit to model hub or save the model to share with others
560
+
561
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
562
+ application. i.e. you will need to re-initialize the deepspeed engine, since
563
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
564
+
565
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
566
+
567
+ Note: the above usage may not work if your application doesn't have sufficient free CPU memory.
568
+ You may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
569
+ the checkpoint. Or you can load state_dict in lazy mode ::
570
+
571
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
572
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, lazy_mode=True) # not on cpu
573
+ for name, lazy_tensor in state_dict.item():
574
+ tensor = lazy_tensor.contiguous() # to cpu
575
+ print(name, tensor)
576
+ # del tensor to release memory if it no longer in use
577
+ """
578
+ if tag is None:
579
+ latest_path = os.path.join(checkpoint_dir, 'latest')
580
+ if os.path.isfile(latest_path):
581
+ with open(latest_path, 'r') as fd:
582
+ tag = fd.read().strip()
583
+ else:
584
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
585
+
586
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
587
+
588
+ if not os.path.isdir(ds_checkpoint_dir):
589
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
590
+
591
+ state_dict = _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
592
+ if lazy_mode:
593
+ return state_dict
594
+ else:
595
+ return to_torch_tensor(state_dict)
596
+
597
+
598
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
599
+ output_dir,
600
+ max_shard_size="5GB",
601
+ safe_serialization=False,
602
+ tag=None,
603
+ exclude_frozen_parameters=False):
604
+ """
605
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
606
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
607
+
608
+ Args:
609
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
610
+ - ``output_dir``: directory to the pytorch fp32 state_dict output files
611
+ - ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
612
+ - ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
613
+ - ``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``
614
+ - ``exclude_frozen_parameters``: exclude frozen parameters
615
+ """
616
+
617
+ # Dependency pre-check
618
+ if safe_serialization:
619
+ try:
620
+ from safetensors.torch import save_file
621
+ except ImportError:
622
+ print('If you want to use `safe_serialization`, please `pip install safetensors`')
623
+ raise
624
+ if max_shard_size is not None:
625
+ try:
626
+ from huggingface_hub import split_torch_state_dict_into_shards
627
+ except ImportError:
628
+ print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
629
+ raise
630
+
631
+ # Convert zero checkpoint to state_dict
632
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
633
+ tag,
634
+ exclude_frozen_parameters,
635
+ lazy_mode=True)
636
+
637
+ # Shard the model if it is too big.
638
+ weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
639
+ if max_shard_size is not None:
640
+ filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
641
+ # an memory-efficient approach for sharding
642
+ empty_state_dict = to_torch_tensor(state_dict, return_empty_tensor=True)
643
+ state_dict_split = split_torch_state_dict_into_shards(empty_state_dict,
644
+ filename_pattern=filename_pattern,
645
+ max_shard_size=max_shard_size)
646
+ else:
647
+ from collections import namedtuple
648
+ StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
649
+ state_dict_split = StateDictSplit(is_sharded=False,
650
+ filename_to_tensors={weights_name: list(state_dict.keys())})
651
+
652
+ # Save the model by shard
653
+ os.makedirs(output_dir, exist_ok=True)
654
+ filename_to_tensors = state_dict_split.filename_to_tensors.items()
655
+ for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
656
+ shard_state_dict = {tensor_name: state_dict[tensor_name] for tensor_name in tensors}
657
+ shard_state_dict = to_torch_tensor(shard_state_dict)
658
+ output_path = os.path.join(output_dir, shard_file)
659
+ if safe_serialization:
660
+ save_file(shard_state_dict, output_path, metadata={"format": "pt"})
661
+ else:
662
+ torch.save(shard_state_dict, output_path)
663
+ # release the memory of current shard
664
+ for tensor_name in list(shard_state_dict.keys()):
665
+ del state_dict[tensor_name]
666
+ del shard_state_dict[tensor_name]
667
+ del shard_state_dict
668
+ gc.collect()
669
+
670
+ # Save index if sharded
671
+ if state_dict_split.is_sharded:
672
+ index = {
673
+ "metadata": state_dict_split.metadata,
674
+ "weight_map": state_dict_split.tensor_to_filename,
675
+ }
676
+ save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
677
+ save_index_file = os.path.join(output_dir, save_index_file)
678
+ with open(save_index_file, "w", encoding="utf-8") as f:
679
+ content = json.dumps(index, indent=2, sort_keys=True) + "\n"
680
+ f.write(content)
681
+
682
+
683
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
684
+ """
685
+ 1. Put the provided model to cpu
686
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
687
+ 3. Load it into the provided model
688
+
689
+ Args:
690
+ - ``model``: the model object to update
691
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
692
+ - ``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``
693
+
694
+ Returns:
695
+ - ``model`: modified model
696
+
697
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
698
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
699
+ conveniently placed for you in the checkpoint folder.
700
+
701
+ A typical usage might be ::
702
+
703
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
704
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
705
+ # submit to model hub or save the model to share with others
706
+
707
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
708
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
709
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
710
+
711
+ """
712
+ logger.info(f"Extracting fp32 weights")
713
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
714
+
715
+ logger.info(f"Overwriting model with fp32 weights")
716
+ model = model.cpu()
717
+ model.load_state_dict(state_dict, strict=False)
718
+
719
+ return model
720
+
721
+
722
+ if __name__ == "__main__":
723
+ parser = argparse.ArgumentParser()
724
+ parser.add_argument("checkpoint_dir",
725
+ type=str,
726
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
727
+ parser.add_argument("output_dir",
728
+ type=str,
729
+ help="directory to the pytorch fp32 state_dict output files"
730
+ "(e.g. path/checkpoint-12-output/)")
731
+ parser.add_argument(
732
+ "--max_shard_size",
733
+ type=str,
734
+ default="5GB",
735
+ help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
736
+ "lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
737
+ "We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
738
+ "without CPU OOM issues.")
739
+ parser.add_argument(
740
+ "--safe_serialization",
741
+ default=False,
742
+ action='store_true',
743
+ help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
744
+ parser.add_argument("-t",
745
+ "--tag",
746
+ type=str,
747
+ default=None,
748
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
749
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
750
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
751
+ args = parser.parse_args()
752
+
753
+ debug = args.debug
754
+
755
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
756
+ args.output_dir,
757
+ max_shard_size=args.max_shard_size,
758
+ safe_serialization=args.safe_serialization,
759
+ tag=args.tag,
760
+ exclude_frozen_parameters=args.exclude_frozen_parameters)
checkpoint-2084/added_tokens.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</tool_call>": 151658,
3
+ "<tool_call>": 151657,
4
+ "<|box_end|>": 151649,
5
+ "<|box_start|>": 151648,
6
+ "<|endoftext|>": 151643,
7
+ "<|file_sep|>": 151664,
8
+ "<|fim_middle|>": 151660,
9
+ "<|fim_pad|>": 151662,
10
+ "<|fim_prefix|>": 151659,
11
+ "<|fim_suffix|>": 151661,
12
+ "<|im_end|>": 151645,
13
+ "<|im_start|>": 151644,
14
+ "<|image_pad|>": 151655,
15
+ "<|object_ref_end|>": 151647,
16
+ "<|object_ref_start|>": 151646,
17
+ "<|quad_end|>": 151651,
18
+ "<|quad_start|>": 151650,
19
+ "<|repo_name|>": 151663,
20
+ "<|video_pad|>": 151656,
21
+ "<|vision_end|>": 151653,
22
+ "<|vision_pad|>": 151654,
23
+ "<|vision_start|>": 151652
24
+ }
checkpoint-2084/chat_template.jinja ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0]['role'] == 'system' %}
4
+ {{- messages[0]['content'] }}
5
+ {%- else %}
6
+ {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
7
+ {%- endif %}
8
+ {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
9
+ {%- for tool in tools %}
10
+ {{- "\n" }}
11
+ {{- tool | tojson }}
12
+ {%- endfor %}
13
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
14
+ {%- else %}
15
+ {%- if messages[0]['role'] == 'system' %}
16
+ {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
17
+ {%- else %}
18
+ {{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
19
+ {%- endif %}
20
+ {%- endif %}
21
+ {%- for message in messages %}
22
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
23
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
24
+ {%- elif message.role == "assistant" %}
25
+ {{- '<|im_start|>' + message.role }}
26
+ {%- if message.content %}
27
+ {{- '\n' + message.content }}
28
+ {%- endif %}
29
+ {%- for tool_call in message.tool_calls %}
30
+ {%- if tool_call.function is defined %}
31
+ {%- set tool_call = tool_call.function %}
32
+ {%- endif %}
33
+ {{- '\n<tool_call>\n{"name": "' }}
34
+ {{- tool_call.name }}
35
+ {{- '", "arguments": ' }}
36
+ {{- tool_call.arguments | tojson }}
37
+ {{- '}\n</tool_call>' }}
38
+ {%- endfor %}
39
+ {{- '<|im_end|>\n' }}
40
+ {%- elif message.role == "tool" %}
41
+ {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
42
+ {{- '<|im_start|>user' }}
43
+ {%- endif %}
44
+ {{- '\n<tool_response>\n' }}
45
+ {{- message.content }}
46
+ {{- '\n</tool_response>' }}
47
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
48
+ {{- '<|im_end|>\n' }}
49
+ {%- endif %}
50
+ {%- endif %}
51
+ {%- endfor %}
52
+ {%- if add_generation_prompt %}
53
+ {{- '<|im_start|>assistant\n' }}
54
+ {%- endif %}
checkpoint-2084/config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen2ForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "bos_token_id": 151643,
7
+ "eos_token_id": 151645,
8
+ "hidden_act": "silu",
9
+ "hidden_size": 1536,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 8960,
12
+ "max_position_embeddings": 32768,
13
+ "max_window_layers": 21,
14
+ "model_type": "qwen2",
15
+ "num_attention_heads": 12,
16
+ "num_hidden_layers": 28,
17
+ "num_key_value_heads": 2,
18
+ "rms_norm_eps": 1e-06,
19
+ "rope_scaling": null,
20
+ "rope_theta": 1000000.0,
21
+ "sliding_window": 32768,
22
+ "tie_word_embeddings": true,
23
+ "torch_dtype": "bfloat16",
24
+ "transformers_version": "4.52.4",
25
+ "use_cache": false,
26
+ "use_sliding_window": false,
27
+ "vocab_size": 151936
28
+ }
checkpoint-2084/generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "repetition_penalty": 1.1,
10
+ "temperature": 0.7,
11
+ "top_k": 20,
12
+ "top_p": 0.8,
13
+ "transformers_version": "4.52.4"
14
+ }
checkpoint-2084/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step2083
checkpoint-2084/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-2084/special_tokens_map.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|im_end|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": {
25
+ "content": "<|endoftext|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ }
31
+ }
checkpoint-2084/tokenizer_config.json ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ }
181
+ },
182
+ "additional_special_tokens": [
183
+ "<|im_start|>",
184
+ "<|im_end|>",
185
+ "<|object_ref_start|>",
186
+ "<|object_ref_end|>",
187
+ "<|box_start|>",
188
+ "<|box_end|>",
189
+ "<|quad_start|>",
190
+ "<|quad_end|>",
191
+ "<|vision_start|>",
192
+ "<|vision_end|>",
193
+ "<|vision_pad|>",
194
+ "<|image_pad|>",
195
+ "<|video_pad|>"
196
+ ],
197
+ "bos_token": null,
198
+ "clean_up_tokenization_spaces": false,
199
+ "eos_token": "<|im_end|>",
200
+ "errors": "replace",
201
+ "extra_special_tokens": {},
202
+ "model_max_length": 131072,
203
+ "pad_token": "<|endoftext|>",
204
+ "padding_side": "right",
205
+ "split_special_tokens": false,
206
+ "tokenizer_class": "Qwen2Tokenizer",
207
+ "unk_token": null
208
+ }
checkpoint-2084/trainer_state.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-2084/vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-2084/zero_to_fp32.py ADDED
@@ -0,0 +1,760 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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:
14
+ # python zero_to_fp32.py . output_dir/
15
+ # or
16
+ # python zero_to_fp32.py . output_dir/ --safe_serialization
17
+
18
+ import argparse
19
+ import torch
20
+ import glob
21
+ import math
22
+ import os
23
+ import re
24
+ import gc
25
+ import json
26
+ import numpy as np
27
+ from tqdm import tqdm
28
+ from collections import OrderedDict
29
+ from dataclasses import dataclass
30
+
31
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
32
+ # DeepSpeed data structures it has to be available in the current python environment.
33
+ from deepspeed.utils import logger
34
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
35
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
36
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
37
+
38
+
39
+ @dataclass
40
+ class zero_model_state:
41
+ buffers: dict()
42
+ param_shapes: dict()
43
+ shared_params: list
44
+ ds_version: int
45
+ frozen_param_shapes: dict()
46
+ frozen_param_fragments: dict()
47
+
48
+
49
+ debug = 0
50
+
51
+ # load to cpu
52
+ device = torch.device('cpu')
53
+
54
+
55
+ def atoi(text):
56
+ return int(text) if text.isdigit() else text
57
+
58
+
59
+ def natural_keys(text):
60
+ '''
61
+ alist.sort(key=natural_keys) sorts in human order
62
+ http://nedbatchelder.com/blog/200712/human_sorting.html
63
+ (See Toothy's implementation in the comments)
64
+ '''
65
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
66
+
67
+
68
+ def get_model_state_file(checkpoint_dir, zero_stage):
69
+ if not os.path.isdir(checkpoint_dir):
70
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
71
+
72
+ # there should be only one file
73
+ if zero_stage <= 2:
74
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
75
+ elif zero_stage == 3:
76
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
77
+
78
+ if not os.path.exists(file):
79
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
80
+
81
+ return file
82
+
83
+
84
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
85
+ # XXX: need to test that this simple glob rule works for multi-node setup too
86
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
87
+
88
+ if len(ckpt_files) == 0:
89
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
90
+
91
+ return ckpt_files
92
+
93
+
94
+ def get_optim_files(checkpoint_dir):
95
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
96
+
97
+
98
+ def get_model_state_files(checkpoint_dir):
99
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
100
+
101
+
102
+ def parse_model_states(files):
103
+ zero_model_states = []
104
+ for file in files:
105
+ state_dict = torch.load(file, map_location=device, weights_only=False)
106
+
107
+ if BUFFER_NAMES not in state_dict:
108
+ raise ValueError(f"{file} is not a model state checkpoint")
109
+ buffer_names = state_dict[BUFFER_NAMES]
110
+ if debug:
111
+ print("Found buffers:", buffer_names)
112
+
113
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
114
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
115
+ param_shapes = state_dict[PARAM_SHAPES]
116
+
117
+ # collect parameters that are included in param_shapes
118
+ param_names = []
119
+ for s in param_shapes:
120
+ for name in s.keys():
121
+ param_names.append(name)
122
+
123
+ # update with frozen parameters
124
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
125
+ if frozen_param_shapes is not None:
126
+ if debug:
127
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
128
+ param_names += list(frozen_param_shapes.keys())
129
+
130
+ # handle shared params
131
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
132
+
133
+ ds_version = state_dict.get(DS_VERSION, None)
134
+
135
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
136
+
137
+ z_model_state = zero_model_state(buffers=buffers,
138
+ param_shapes=param_shapes,
139
+ shared_params=shared_params,
140
+ ds_version=ds_version,
141
+ frozen_param_shapes=frozen_param_shapes,
142
+ frozen_param_fragments=frozen_param_fragments)
143
+ zero_model_states.append(z_model_state)
144
+
145
+ return zero_model_states
146
+
147
+
148
+ def parse_optim_states(files, ds_checkpoint_dir):
149
+ total_files = len(files)
150
+ state_dicts = []
151
+ for f in tqdm(files, desc='Loading checkpoint shards'):
152
+ state_dict = torch.load(f, map_location=device, mmap=True, weights_only=False)
153
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
154
+ # and also handle the case where it was already removed by another helper script
155
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
156
+ state_dicts.append(state_dict)
157
+
158
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
159
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
160
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
161
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
162
+
163
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
164
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
165
+ # use the max of the partition_count to get the dp world_size.
166
+
167
+ if type(world_size) is list:
168
+ world_size = max(world_size)
169
+
170
+ if world_size != total_files:
171
+ raise ValueError(
172
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
173
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
174
+ )
175
+
176
+ # the groups are named differently in each stage
177
+ if zero_stage <= 2:
178
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
179
+ elif zero_stage == 3:
180
+ fp32_groups_key = FP32_FLAT_GROUPS
181
+ else:
182
+ raise ValueError(f"unknown zero stage {zero_stage}")
183
+
184
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
185
+ return zero_stage, world_size, fp32_flat_groups
186
+
187
+
188
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
189
+ """
190
+ Returns fp32 state_dict reconstructed from ds checkpoint
191
+
192
+ Args:
193
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
194
+
195
+ """
196
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
197
+
198
+ optim_files = get_optim_files(ds_checkpoint_dir)
199
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
200
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
201
+
202
+ model_files = get_model_state_files(ds_checkpoint_dir)
203
+
204
+ zero_model_states = parse_model_states(model_files)
205
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
206
+
207
+ if zero_stage <= 2:
208
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
209
+ exclude_frozen_parameters)
210
+ elif zero_stage == 3:
211
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
212
+ exclude_frozen_parameters)
213
+
214
+
215
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
216
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
217
+ return
218
+
219
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
220
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
221
+
222
+ if debug:
223
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
224
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
225
+
226
+ wanted_params = len(frozen_param_shapes)
227
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
228
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
229
+ print(f'Frozen params: Have {avail_numel} numels to process.')
230
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
231
+
232
+ total_params = 0
233
+ total_numel = 0
234
+ for name, shape in frozen_param_shapes.items():
235
+ total_params += 1
236
+ unpartitioned_numel = shape.numel()
237
+ total_numel += unpartitioned_numel
238
+
239
+ state_dict[name] = frozen_param_fragments[name]
240
+
241
+ if debug:
242
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
243
+
244
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
245
+
246
+
247
+ def _has_callable(obj, fn):
248
+ attr = getattr(obj, fn, None)
249
+ return callable(attr)
250
+
251
+
252
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
253
+ param_shapes = zero_model_states[0].param_shapes
254
+
255
+ # Reconstruction protocol:
256
+ #
257
+ # XXX: document this
258
+
259
+ if debug:
260
+ for i in range(world_size):
261
+ for j in range(len(fp32_flat_groups[0])):
262
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
263
+
264
+ # XXX: memory usage doubles here (zero2)
265
+ num_param_groups = len(fp32_flat_groups[0])
266
+ merged_single_partition_of_fp32_groups = []
267
+ for i in range(num_param_groups):
268
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
269
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
270
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
271
+ avail_numel = sum(
272
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
273
+
274
+ if debug:
275
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
276
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
277
+ # not asserting if there is a mismatch due to possible padding
278
+ print(f"Have {avail_numel} numels to process.")
279
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
280
+
281
+ # params
282
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
283
+ # out-of-core computing solution
284
+ total_numel = 0
285
+ total_params = 0
286
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
287
+ offset = 0
288
+ avail_numel = full_single_fp32_vector.numel()
289
+ for name, shape in shapes.items():
290
+
291
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
292
+ total_numel += unpartitioned_numel
293
+ total_params += 1
294
+
295
+ if debug:
296
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
297
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
298
+ offset += unpartitioned_numel
299
+
300
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
301
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
302
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
303
+ # live optimizer object, so we are checking that the numbers are within the right range
304
+ align_to = 2 * world_size
305
+
306
+ def zero2_align(x):
307
+ return align_to * math.ceil(x / align_to)
308
+
309
+ if debug:
310
+ print(f"original offset={offset}, avail_numel={avail_numel}")
311
+
312
+ offset = zero2_align(offset)
313
+ avail_numel = zero2_align(avail_numel)
314
+
315
+ if debug:
316
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
317
+
318
+ # Sanity check
319
+ if offset != avail_numel:
320
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
321
+
322
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
323
+
324
+
325
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
326
+ exclude_frozen_parameters):
327
+ state_dict = OrderedDict()
328
+
329
+ # buffers
330
+ buffers = zero_model_states[0].buffers
331
+ state_dict.update(buffers)
332
+ if debug:
333
+ print(f"added {len(buffers)} buffers")
334
+
335
+ if not exclude_frozen_parameters:
336
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
337
+
338
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
339
+
340
+ # recover shared parameters
341
+ for pair in zero_model_states[0].shared_params:
342
+ if pair[1] in state_dict:
343
+ state_dict[pair[0]] = state_dict[pair[1]]
344
+
345
+ return state_dict
346
+
347
+
348
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
349
+ remainder = unpartitioned_numel % world_size
350
+ padding_numel = (world_size - remainder) if remainder else 0
351
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
352
+ return partitioned_numel, padding_numel
353
+
354
+
355
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
356
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
357
+ return
358
+
359
+ if debug:
360
+ for i in range(world_size):
361
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
362
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
363
+
364
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
365
+ wanted_params = len(frozen_param_shapes)
366
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
367
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
368
+ print(f'Frozen params: Have {avail_numel} numels to process.')
369
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
370
+
371
+ total_params = 0
372
+ total_numel = 0
373
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
374
+ total_params += 1
375
+ unpartitioned_numel = shape.numel()
376
+ total_numel += unpartitioned_numel
377
+
378
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
379
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
380
+
381
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
382
+
383
+ if debug:
384
+ print(
385
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
386
+ )
387
+
388
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
389
+
390
+
391
+ class GatheredTensor:
392
+ """
393
+ A pseudo tensor that collects partitioned weights.
394
+ It is more memory efficient when there are multiple groups.
395
+ """
396
+
397
+ def __init__(self, flat_groups, flat_groups_offset, offset, partitioned_numel, shape):
398
+ self.flat_groups = flat_groups
399
+ self.flat_groups_offset = flat_groups_offset
400
+ self.offset = offset
401
+ self.partitioned_numel = partitioned_numel
402
+ self.shape = shape
403
+ self.dtype = self.flat_groups[0][0].dtype
404
+
405
+ def contiguous(self):
406
+ """
407
+ Merge partitioned weights from flat_groups into a single tensor.
408
+ """
409
+ end_idx = self.offset + self.partitioned_numel
410
+ world_size = len(self.flat_groups)
411
+ pad_flat_param_chunks = []
412
+
413
+ for rank_i in range(world_size):
414
+ # for each rank, we need to collect weights from related group/groups
415
+ flat_groups_at_rank_i = self.flat_groups[rank_i]
416
+ start_group_id = None
417
+ end_group_id = None
418
+ for group_id in range(len(self.flat_groups_offset)):
419
+ if self.flat_groups_offset[group_id] <= self.offset < self.flat_groups_offset[group_id + 1]:
420
+ start_group_id = group_id
421
+ if self.flat_groups_offset[group_id] < end_idx <= self.flat_groups_offset[group_id + 1]:
422
+ end_group_id = group_id
423
+ break
424
+ # collect weights from related group/groups
425
+ for group_id in range(start_group_id, end_group_id + 1):
426
+ flat_tensor = flat_groups_at_rank_i[group_id]
427
+ start_offset = self.offset - self.flat_groups_offset[group_id]
428
+ end_offset = min(end_idx, self.flat_groups_offset[group_id + 1]) - self.flat_groups_offset[group_id]
429
+ pad_flat_param_chunks.append(flat_tensor[start_offset:end_offset])
430
+
431
+ # collect weights from all ranks
432
+ pad_flat_param = torch.cat(pad_flat_param_chunks, dim=0)
433
+ param = pad_flat_param[:self.shape.numel()].view(self.shape).contiguous()
434
+ return param
435
+
436
+
437
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
438
+ param_shapes = zero_model_states[0].param_shapes
439
+ avail_numel = sum([flat_group.numel() for flat_group in fp32_flat_groups[0]]) * world_size
440
+
441
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
442
+ # param, re-consolidating each param, while dealing with padding if any
443
+
444
+ # merge list of dicts, preserving order
445
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
446
+
447
+ if debug:
448
+ for i in range(world_size):
449
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
450
+
451
+ wanted_params = len(param_shapes)
452
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
453
+ # not asserting if there is a mismatch due to possible padding
454
+ avail_numel = fp32_flat_groups[0].numel() * world_size
455
+ print(f"Trainable params: Have {avail_numel} numels to process.")
456
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
457
+
458
+ # params
459
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
460
+ # out-of-core computing solution
461
+ offset = 0
462
+ total_numel = 0
463
+ total_params = 0
464
+ flat_groups_offset = [0] + list(np.cumsum([flat_tensor.numel() for flat_tensor in fp32_flat_groups[0]]))
465
+ for name, shape in tqdm(param_shapes.items(), desc='Gathering sharded weights'):
466
+ unpartitioned_numel = shape.numel()
467
+ total_numel += unpartitioned_numel
468
+ total_params += 1
469
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
470
+
471
+ if debug:
472
+ print(
473
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
474
+ )
475
+
476
+ # memory efficient tensor
477
+ tensor = GatheredTensor(fp32_flat_groups, flat_groups_offset, offset, partitioned_numel, shape)
478
+ state_dict[name] = tensor
479
+ offset += partitioned_numel
480
+
481
+ offset *= world_size
482
+
483
+ # Sanity check
484
+ if offset != avail_numel:
485
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
486
+
487
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
488
+
489
+
490
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
491
+ exclude_frozen_parameters):
492
+ state_dict = OrderedDict()
493
+
494
+ # buffers
495
+ buffers = zero_model_states[0].buffers
496
+ state_dict.update(buffers)
497
+ if debug:
498
+ print(f"added {len(buffers)} buffers")
499
+
500
+ if not exclude_frozen_parameters:
501
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
502
+
503
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
504
+
505
+ # recover shared parameters
506
+ for pair in zero_model_states[0].shared_params:
507
+ if pair[1] in state_dict:
508
+ state_dict[pair[0]] = state_dict[pair[1]]
509
+
510
+ return state_dict
511
+
512
+
513
+ def to_torch_tensor(state_dict, return_empty_tensor=False):
514
+ """
515
+ Convert state_dict of GatheredTensor to torch tensor
516
+ """
517
+ torch_state_dict = {}
518
+ converted_tensors = {}
519
+ for name, tensor in state_dict.items():
520
+ tensor_id = id(tensor)
521
+ if tensor_id in converted_tensors: # shared tensors
522
+ shared_tensor = torch_state_dict[converted_tensors[tensor_id]]
523
+ torch_state_dict[name] = shared_tensor
524
+ else:
525
+ converted_tensors[tensor_id] = name
526
+ if return_empty_tensor:
527
+ torch_state_dict[name] = torch.empty(tensor.shape, dtype=tensor.dtype)
528
+ else:
529
+ torch_state_dict[name] = tensor.contiguous()
530
+ return torch_state_dict
531
+
532
+
533
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
534
+ tag=None,
535
+ exclude_frozen_parameters=False,
536
+ lazy_mode=False):
537
+ """
538
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
539
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
540
+ via a model hub.
541
+
542
+ Args:
543
+ - ``checkpoint_dir``: path to the desired checkpoint folder
544
+ - ``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``
545
+ - ``exclude_frozen_parameters``: exclude frozen parameters
546
+ - ``lazy_mode``: get state_dict in lazy mode. It returns a dict of pesduo tensor instead of torch tensor, which is more memory efficient.
547
+ Convert the pesduo tensor to torch tensor by ``.contiguous()``
548
+
549
+ Returns:
550
+ - pytorch ``state_dict``
551
+
552
+ A typical usage might be ::
553
+
554
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
555
+ # do the training and checkpoint saving
556
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
557
+ model = model.cpu() # move to cpu
558
+ model.load_state_dict(state_dict)
559
+ # submit to model hub or save the model to share with others
560
+
561
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
562
+ application. i.e. you will need to re-initialize the deepspeed engine, since
563
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
564
+
565
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
566
+
567
+ Note: the above usage may not work if your application doesn't have sufficient free CPU memory.
568
+ You may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
569
+ the checkpoint. Or you can load state_dict in lazy mode ::
570
+
571
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
572
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, lazy_mode=True) # not on cpu
573
+ for name, lazy_tensor in state_dict.item():
574
+ tensor = lazy_tensor.contiguous() # to cpu
575
+ print(name, tensor)
576
+ # del tensor to release memory if it no longer in use
577
+ """
578
+ if tag is None:
579
+ latest_path = os.path.join(checkpoint_dir, 'latest')
580
+ if os.path.isfile(latest_path):
581
+ with open(latest_path, 'r') as fd:
582
+ tag = fd.read().strip()
583
+ else:
584
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
585
+
586
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
587
+
588
+ if not os.path.isdir(ds_checkpoint_dir):
589
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
590
+
591
+ state_dict = _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
592
+ if lazy_mode:
593
+ return state_dict
594
+ else:
595
+ return to_torch_tensor(state_dict)
596
+
597
+
598
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
599
+ output_dir,
600
+ max_shard_size="5GB",
601
+ safe_serialization=False,
602
+ tag=None,
603
+ exclude_frozen_parameters=False):
604
+ """
605
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
606
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
607
+
608
+ Args:
609
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
610
+ - ``output_dir``: directory to the pytorch fp32 state_dict output files
611
+ - ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
612
+ - ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
613
+ - ``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``
614
+ - ``exclude_frozen_parameters``: exclude frozen parameters
615
+ """
616
+
617
+ # Dependency pre-check
618
+ if safe_serialization:
619
+ try:
620
+ from safetensors.torch import save_file
621
+ except ImportError:
622
+ print('If you want to use `safe_serialization`, please `pip install safetensors`')
623
+ raise
624
+ if max_shard_size is not None:
625
+ try:
626
+ from huggingface_hub import split_torch_state_dict_into_shards
627
+ except ImportError:
628
+ print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
629
+ raise
630
+
631
+ # Convert zero checkpoint to state_dict
632
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
633
+ tag,
634
+ exclude_frozen_parameters,
635
+ lazy_mode=True)
636
+
637
+ # Shard the model if it is too big.
638
+ weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
639
+ if max_shard_size is not None:
640
+ filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
641
+ # an memory-efficient approach for sharding
642
+ empty_state_dict = to_torch_tensor(state_dict, return_empty_tensor=True)
643
+ state_dict_split = split_torch_state_dict_into_shards(empty_state_dict,
644
+ filename_pattern=filename_pattern,
645
+ max_shard_size=max_shard_size)
646
+ else:
647
+ from collections import namedtuple
648
+ StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
649
+ state_dict_split = StateDictSplit(is_sharded=False,
650
+ filename_to_tensors={weights_name: list(state_dict.keys())})
651
+
652
+ # Save the model by shard
653
+ os.makedirs(output_dir, exist_ok=True)
654
+ filename_to_tensors = state_dict_split.filename_to_tensors.items()
655
+ for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
656
+ shard_state_dict = {tensor_name: state_dict[tensor_name] for tensor_name in tensors}
657
+ shard_state_dict = to_torch_tensor(shard_state_dict)
658
+ output_path = os.path.join(output_dir, shard_file)
659
+ if safe_serialization:
660
+ save_file(shard_state_dict, output_path, metadata={"format": "pt"})
661
+ else:
662
+ torch.save(shard_state_dict, output_path)
663
+ # release the memory of current shard
664
+ for tensor_name in list(shard_state_dict.keys()):
665
+ del state_dict[tensor_name]
666
+ del shard_state_dict[tensor_name]
667
+ del shard_state_dict
668
+ gc.collect()
669
+
670
+ # Save index if sharded
671
+ if state_dict_split.is_sharded:
672
+ index = {
673
+ "metadata": state_dict_split.metadata,
674
+ "weight_map": state_dict_split.tensor_to_filename,
675
+ }
676
+ save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
677
+ save_index_file = os.path.join(output_dir, save_index_file)
678
+ with open(save_index_file, "w", encoding="utf-8") as f:
679
+ content = json.dumps(index, indent=2, sort_keys=True) + "\n"
680
+ f.write(content)
681
+
682
+
683
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
684
+ """
685
+ 1. Put the provided model to cpu
686
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
687
+ 3. Load it into the provided model
688
+
689
+ Args:
690
+ - ``model``: the model object to update
691
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
692
+ - ``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``
693
+
694
+ Returns:
695
+ - ``model`: modified model
696
+
697
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
698
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
699
+ conveniently placed for you in the checkpoint folder.
700
+
701
+ A typical usage might be ::
702
+
703
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
704
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
705
+ # submit to model hub or save the model to share with others
706
+
707
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
708
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
709
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
710
+
711
+ """
712
+ logger.info(f"Extracting fp32 weights")
713
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
714
+
715
+ logger.info(f"Overwriting model with fp32 weights")
716
+ model = model.cpu()
717
+ model.load_state_dict(state_dict, strict=False)
718
+
719
+ return model
720
+
721
+
722
+ if __name__ == "__main__":
723
+ parser = argparse.ArgumentParser()
724
+ parser.add_argument("checkpoint_dir",
725
+ type=str,
726
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
727
+ parser.add_argument("output_dir",
728
+ type=str,
729
+ help="directory to the pytorch fp32 state_dict output files"
730
+ "(e.g. path/checkpoint-12-output/)")
731
+ parser.add_argument(
732
+ "--max_shard_size",
733
+ type=str,
734
+ default="5GB",
735
+ help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
736
+ "lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
737
+ "We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
738
+ "without CPU OOM issues.")
739
+ parser.add_argument(
740
+ "--safe_serialization",
741
+ default=False,
742
+ action='store_true',
743
+ help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
744
+ parser.add_argument("-t",
745
+ "--tag",
746
+ type=str,
747
+ default=None,
748
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
749
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
750
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
751
+ args = parser.parse_args()
752
+
753
+ debug = args.debug
754
+
755
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
756
+ args.output_dir,
757
+ max_shard_size=args.max_shard_size,
758
+ safe_serialization=args.safe_serialization,
759
+ tag=args.tag,
760
+ exclude_frozen_parameters=args.exclude_frozen_parameters)
checkpoint-2605/added_tokens.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</tool_call>": 151658,
3
+ "<tool_call>": 151657,
4
+ "<|box_end|>": 151649,
5
+ "<|box_start|>": 151648,
6
+ "<|endoftext|>": 151643,
7
+ "<|file_sep|>": 151664,
8
+ "<|fim_middle|>": 151660,
9
+ "<|fim_pad|>": 151662,
10
+ "<|fim_prefix|>": 151659,
11
+ "<|fim_suffix|>": 151661,
12
+ "<|im_end|>": 151645,
13
+ "<|im_start|>": 151644,
14
+ "<|image_pad|>": 151655,
15
+ "<|object_ref_end|>": 151647,
16
+ "<|object_ref_start|>": 151646,
17
+ "<|quad_end|>": 151651,
18
+ "<|quad_start|>": 151650,
19
+ "<|repo_name|>": 151663,
20
+ "<|video_pad|>": 151656,
21
+ "<|vision_end|>": 151653,
22
+ "<|vision_pad|>": 151654,
23
+ "<|vision_start|>": 151652
24
+ }
checkpoint-2605/chat_template.jinja ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0]['role'] == 'system' %}
4
+ {{- messages[0]['content'] }}
5
+ {%- else %}
6
+ {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
7
+ {%- endif %}
8
+ {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
9
+ {%- for tool in tools %}
10
+ {{- "\n" }}
11
+ {{- tool | tojson }}
12
+ {%- endfor %}
13
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
14
+ {%- else %}
15
+ {%- if messages[0]['role'] == 'system' %}
16
+ {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
17
+ {%- else %}
18
+ {{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
19
+ {%- endif %}
20
+ {%- endif %}
21
+ {%- for message in messages %}
22
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
23
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
24
+ {%- elif message.role == "assistant" %}
25
+ {{- '<|im_start|>' + message.role }}
26
+ {%- if message.content %}
27
+ {{- '\n' + message.content }}
28
+ {%- endif %}
29
+ {%- for tool_call in message.tool_calls %}
30
+ {%- if tool_call.function is defined %}
31
+ {%- set tool_call = tool_call.function %}
32
+ {%- endif %}
33
+ {{- '\n<tool_call>\n{"name": "' }}
34
+ {{- tool_call.name }}
35
+ {{- '", "arguments": ' }}
36
+ {{- tool_call.arguments | tojson }}
37
+ {{- '}\n</tool_call>' }}
38
+ {%- endfor %}
39
+ {{- '<|im_end|>\n' }}
40
+ {%- elif message.role == "tool" %}
41
+ {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
42
+ {{- '<|im_start|>user' }}
43
+ {%- endif %}
44
+ {{- '\n<tool_response>\n' }}
45
+ {{- message.content }}
46
+ {{- '\n</tool_response>' }}
47
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
48
+ {{- '<|im_end|>\n' }}
49
+ {%- endif %}
50
+ {%- endif %}
51
+ {%- endfor %}
52
+ {%- if add_generation_prompt %}
53
+ {{- '<|im_start|>assistant\n' }}
54
+ {%- endif %}
checkpoint-2605/generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "repetition_penalty": 1.1,
10
+ "temperature": 0.7,
11
+ "top_k": 20,
12
+ "top_p": 0.8,
13
+ "transformers_version": "4.52.4"
14
+ }
checkpoint-2605/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step2603
checkpoint-2605/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-2605/special_tokens_map.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|im_end|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": {
25
+ "content": "<|endoftext|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ }
31
+ }
checkpoint-2605/tokenizer_config.json ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ }
181
+ },
182
+ "additional_special_tokens": [
183
+ "<|im_start|>",
184
+ "<|im_end|>",
185
+ "<|object_ref_start|>",
186
+ "<|object_ref_end|>",
187
+ "<|box_start|>",
188
+ "<|box_end|>",
189
+ "<|quad_start|>",
190
+ "<|quad_end|>",
191
+ "<|vision_start|>",
192
+ "<|vision_end|>",
193
+ "<|vision_pad|>",
194
+ "<|image_pad|>",
195
+ "<|video_pad|>"
196
+ ],
197
+ "bos_token": null,
198
+ "clean_up_tokenization_spaces": false,
199
+ "eos_token": "<|im_end|>",
200
+ "errors": "replace",
201
+ "extra_special_tokens": {},
202
+ "model_max_length": 131072,
203
+ "pad_token": "<|endoftext|>",
204
+ "padding_side": "right",
205
+ "split_special_tokens": false,
206
+ "tokenizer_class": "Qwen2Tokenizer",
207
+ "unk_token": null
208
+ }
checkpoint-2605/trainer_state.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-521/added_tokens.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</tool_call>": 151658,
3
+ "<tool_call>": 151657,
4
+ "<|box_end|>": 151649,
5
+ "<|box_start|>": 151648,
6
+ "<|endoftext|>": 151643,
7
+ "<|file_sep|>": 151664,
8
+ "<|fim_middle|>": 151660,
9
+ "<|fim_pad|>": 151662,
10
+ "<|fim_prefix|>": 151659,
11
+ "<|fim_suffix|>": 151661,
12
+ "<|im_end|>": 151645,
13
+ "<|im_start|>": 151644,
14
+ "<|image_pad|>": 151655,
15
+ "<|object_ref_end|>": 151647,
16
+ "<|object_ref_start|>": 151646,
17
+ "<|quad_end|>": 151651,
18
+ "<|quad_start|>": 151650,
19
+ "<|repo_name|>": 151663,
20
+ "<|video_pad|>": 151656,
21
+ "<|vision_end|>": 151653,
22
+ "<|vision_pad|>": 151654,
23
+ "<|vision_start|>": 151652
24
+ }
checkpoint-521/chat_template.jinja ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0]['role'] == 'system' %}
4
+ {{- messages[0]['content'] }}
5
+ {%- else %}
6
+ {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
7
+ {%- endif %}
8
+ {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
9
+ {%- for tool in tools %}
10
+ {{- "\n" }}
11
+ {{- tool | tojson }}
12
+ {%- endfor %}
13
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
14
+ {%- else %}
15
+ {%- if messages[0]['role'] == 'system' %}
16
+ {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
17
+ {%- else %}
18
+ {{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
19
+ {%- endif %}
20
+ {%- endif %}
21
+ {%- for message in messages %}
22
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
23
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
24
+ {%- elif message.role == "assistant" %}
25
+ {{- '<|im_start|>' + message.role }}
26
+ {%- if message.content %}
27
+ {{- '\n' + message.content }}
28
+ {%- endif %}
29
+ {%- for tool_call in message.tool_calls %}
30
+ {%- if tool_call.function is defined %}
31
+ {%- set tool_call = tool_call.function %}
32
+ {%- endif %}
33
+ {{- '\n<tool_call>\n{"name": "' }}
34
+ {{- tool_call.name }}
35
+ {{- '", "arguments": ' }}
36
+ {{- tool_call.arguments | tojson }}
37
+ {{- '}\n</tool_call>' }}
38
+ {%- endfor %}
39
+ {{- '<|im_end|>\n' }}
40
+ {%- elif message.role == "tool" %}
41
+ {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
42
+ {{- '<|im_start|>user' }}
43
+ {%- endif %}
44
+ {{- '\n<tool_response>\n' }}
45
+ {{- message.content }}
46
+ {{- '\n</tool_response>' }}
47
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
48
+ {{- '<|im_end|>\n' }}
49
+ {%- endif %}
50
+ {%- endif %}
51
+ {%- endfor %}
52
+ {%- if add_generation_prompt %}
53
+ {{- '<|im_start|>assistant\n' }}
54
+ {%- endif %}
checkpoint-521/config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen2ForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "bos_token_id": 151643,
7
+ "eos_token_id": 151645,
8
+ "hidden_act": "silu",
9
+ "hidden_size": 1536,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 8960,
12
+ "max_position_embeddings": 32768,
13
+ "max_window_layers": 21,
14
+ "model_type": "qwen2",
15
+ "num_attention_heads": 12,
16
+ "num_hidden_layers": 28,
17
+ "num_key_value_heads": 2,
18
+ "rms_norm_eps": 1e-06,
19
+ "rope_scaling": null,
20
+ "rope_theta": 1000000.0,
21
+ "sliding_window": 32768,
22
+ "tie_word_embeddings": true,
23
+ "torch_dtype": "bfloat16",
24
+ "transformers_version": "4.52.4",
25
+ "use_cache": false,
26
+ "use_sliding_window": false,
27
+ "vocab_size": 151936
28
+ }
checkpoint-521/generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "repetition_penalty": 1.1,
10
+ "temperature": 0.7,
11
+ "top_k": 20,
12
+ "top_p": 0.8,
13
+ "transformers_version": "4.52.4"
14
+ }
checkpoint-521/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step520
checkpoint-521/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-521/special_tokens_map.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|im_end|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": {
25
+ "content": "<|endoftext|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ }
31
+ }
checkpoint-521/tokenizer_config.json ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ }
181
+ },
182
+ "additional_special_tokens": [
183
+ "<|im_start|>",
184
+ "<|im_end|>",
185
+ "<|object_ref_start|>",
186
+ "<|object_ref_end|>",
187
+ "<|box_start|>",
188
+ "<|box_end|>",
189
+ "<|quad_start|>",
190
+ "<|quad_end|>",
191
+ "<|vision_start|>",
192
+ "<|vision_end|>",
193
+ "<|vision_pad|>",
194
+ "<|image_pad|>",
195
+ "<|video_pad|>"
196
+ ],
197
+ "bos_token": null,
198
+ "clean_up_tokenization_spaces": false,
199
+ "eos_token": "<|im_end|>",
200
+ "errors": "replace",
201
+ "extra_special_tokens": {},
202
+ "model_max_length": 131072,
203
+ "pad_token": "<|endoftext|>",
204
+ "padding_side": "right",
205
+ "split_special_tokens": false,
206
+ "tokenizer_class": "Qwen2Tokenizer",
207
+ "unk_token": null
208
+ }
checkpoint-521/trainer_state.json ADDED
@@ -0,0 +1,3681 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": null,
3
+ "best_metric": null,
4
+ "best_model_checkpoint": null,
5
+ "epoch": 1.0,
6
+ "eval_steps": 500,
7
+ "global_step": 521,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "epoch": 0.0019203072491598655,
14
+ "grad_norm": 3.050241640622783,
15
+ "learning_rate": 0.0,
16
+ "loss": 1.5054,
17
+ "step": 1
18
+ },
19
+ {
20
+ "epoch": 0.003840614498319731,
21
+ "grad_norm": 2.974162230197891,
22
+ "learning_rate": 3.831417624521073e-08,
23
+ "loss": 1.7399,
24
+ "step": 2
25
+ },
26
+ {
27
+ "epoch": 0.005760921747479597,
28
+ "grad_norm": 3.006494012208738,
29
+ "learning_rate": 7.662835249042146e-08,
30
+ "loss": 1.8793,
31
+ "step": 3
32
+ },
33
+ {
34
+ "epoch": 0.007681228996639462,
35
+ "grad_norm": 2.910641370990376,
36
+ "learning_rate": 1.1494252873563219e-07,
37
+ "loss": 1.7187,
38
+ "step": 4
39
+ },
40
+ {
41
+ "epoch": 0.009601536245799328,
42
+ "grad_norm": 2.6996013829444134,
43
+ "learning_rate": 1.5325670498084292e-07,
44
+ "loss": 1.6475,
45
+ "step": 5
46
+ },
47
+ {
48
+ "epoch": 0.011521843494959194,
49
+ "grad_norm": 3.0173297525530525,
50
+ "learning_rate": 1.9157088122605365e-07,
51
+ "loss": 1.6964,
52
+ "step": 6
53
+ },
54
+ {
55
+ "epoch": 0.01344215074411906,
56
+ "grad_norm": 3.0082364904112566,
57
+ "learning_rate": 2.2988505747126437e-07,
58
+ "loss": 1.6851,
59
+ "step": 7
60
+ },
61
+ {
62
+ "epoch": 0.015362457993278924,
63
+ "grad_norm": 2.880521601062656,
64
+ "learning_rate": 2.681992337164751e-07,
65
+ "loss": 1.557,
66
+ "step": 8
67
+ },
68
+ {
69
+ "epoch": 0.01728276524243879,
70
+ "grad_norm": 2.8379079611890896,
71
+ "learning_rate": 3.0651340996168583e-07,
72
+ "loss": 1.6569,
73
+ "step": 9
74
+ },
75
+ {
76
+ "epoch": 0.019203072491598656,
77
+ "grad_norm": 2.902207545955143,
78
+ "learning_rate": 3.4482758620689656e-07,
79
+ "loss": 1.637,
80
+ "step": 10
81
+ },
82
+ {
83
+ "epoch": 0.02112337974075852,
84
+ "grad_norm": 2.8146383036248883,
85
+ "learning_rate": 3.831417624521073e-07,
86
+ "loss": 1.7074,
87
+ "step": 11
88
+ },
89
+ {
90
+ "epoch": 0.023043686989918388,
91
+ "grad_norm": 2.7702439023075422,
92
+ "learning_rate": 4.2145593869731807e-07,
93
+ "loss": 1.6621,
94
+ "step": 12
95
+ },
96
+ {
97
+ "epoch": 0.024963994239078253,
98
+ "grad_norm": 2.948897328700205,
99
+ "learning_rate": 4.5977011494252875e-07,
100
+ "loss": 1.7141,
101
+ "step": 13
102
+ },
103
+ {
104
+ "epoch": 0.02688430148823812,
105
+ "grad_norm": 2.6155066202719666,
106
+ "learning_rate": 4.980842911877395e-07,
107
+ "loss": 1.6133,
108
+ "step": 14
109
+ },
110
+ {
111
+ "epoch": 0.028804608737397985,
112
+ "grad_norm": 2.7754744384918335,
113
+ "learning_rate": 5.363984674329502e-07,
114
+ "loss": 1.6922,
115
+ "step": 15
116
+ },
117
+ {
118
+ "epoch": 0.030724915986557848,
119
+ "grad_norm": 3.005540548334177,
120
+ "learning_rate": 5.747126436781609e-07,
121
+ "loss": 1.5753,
122
+ "step": 16
123
+ },
124
+ {
125
+ "epoch": 0.03264522323571772,
126
+ "grad_norm": 2.6675051377737486,
127
+ "learning_rate": 6.130268199233717e-07,
128
+ "loss": 1.6697,
129
+ "step": 17
130
+ },
131
+ {
132
+ "epoch": 0.03456553048487758,
133
+ "grad_norm": 2.7911452731594326,
134
+ "learning_rate": 6.513409961685824e-07,
135
+ "loss": 1.6166,
136
+ "step": 18
137
+ },
138
+ {
139
+ "epoch": 0.03648583773403745,
140
+ "grad_norm": 2.754640389635153,
141
+ "learning_rate": 6.896551724137931e-07,
142
+ "loss": 1.4773,
143
+ "step": 19
144
+ },
145
+ {
146
+ "epoch": 0.03840614498319731,
147
+ "grad_norm": 2.58056430792743,
148
+ "learning_rate": 7.27969348659004e-07,
149
+ "loss": 1.5533,
150
+ "step": 20
151
+ },
152
+ {
153
+ "epoch": 0.040326452232357174,
154
+ "grad_norm": 2.5780862888672047,
155
+ "learning_rate": 7.662835249042146e-07,
156
+ "loss": 1.5408,
157
+ "step": 21
158
+ },
159
+ {
160
+ "epoch": 0.04224675948151704,
161
+ "grad_norm": 2.2939155489081293,
162
+ "learning_rate": 8.045977011494253e-07,
163
+ "loss": 1.4477,
164
+ "step": 22
165
+ },
166
+ {
167
+ "epoch": 0.044167066730676906,
168
+ "grad_norm": 2.326783109749172,
169
+ "learning_rate": 8.429118773946361e-07,
170
+ "loss": 1.6446,
171
+ "step": 23
172
+ },
173
+ {
174
+ "epoch": 0.046087373979836775,
175
+ "grad_norm": 1.9784500676559427,
176
+ "learning_rate": 8.812260536398468e-07,
177
+ "loss": 1.4741,
178
+ "step": 24
179
+ },
180
+ {
181
+ "epoch": 0.04800768122899664,
182
+ "grad_norm": 2.158116045848602,
183
+ "learning_rate": 9.195402298850575e-07,
184
+ "loss": 1.8359,
185
+ "step": 25
186
+ },
187
+ {
188
+ "epoch": 0.04992798847815651,
189
+ "grad_norm": 2.035070253571019,
190
+ "learning_rate": 9.578544061302683e-07,
191
+ "loss": 1.6079,
192
+ "step": 26
193
+ },
194
+ {
195
+ "epoch": 0.05184829572731637,
196
+ "grad_norm": 1.9828772550714657,
197
+ "learning_rate": 9.96168582375479e-07,
198
+ "loss": 1.6275,
199
+ "step": 27
200
+ },
201
+ {
202
+ "epoch": 0.05376860297647624,
203
+ "grad_norm": 2.063763559262756,
204
+ "learning_rate": 1.0344827586206898e-06,
205
+ "loss": 1.6298,
206
+ "step": 28
207
+ },
208
+ {
209
+ "epoch": 0.0556889102256361,
210
+ "grad_norm": 1.9339129722646953,
211
+ "learning_rate": 1.0727969348659004e-06,
212
+ "loss": 1.5816,
213
+ "step": 29
214
+ },
215
+ {
216
+ "epoch": 0.05760921747479597,
217
+ "grad_norm": 1.916925980149754,
218
+ "learning_rate": 1.111111111111111e-06,
219
+ "loss": 1.6064,
220
+ "step": 30
221
+ },
222
+ {
223
+ "epoch": 0.05952952472395583,
224
+ "grad_norm": 1.6450444187274702,
225
+ "learning_rate": 1.1494252873563219e-06,
226
+ "loss": 1.5159,
227
+ "step": 31
228
+ },
229
+ {
230
+ "epoch": 0.061449831973115696,
231
+ "grad_norm": 1.6132237873302806,
232
+ "learning_rate": 1.1877394636015327e-06,
233
+ "loss": 1.5367,
234
+ "step": 32
235
+ },
236
+ {
237
+ "epoch": 0.06337013922227556,
238
+ "grad_norm": 1.818936433606168,
239
+ "learning_rate": 1.2260536398467433e-06,
240
+ "loss": 1.4623,
241
+ "step": 33
242
+ },
243
+ {
244
+ "epoch": 0.06529044647143543,
245
+ "grad_norm": 1.7241994573893415,
246
+ "learning_rate": 1.2643678160919542e-06,
247
+ "loss": 1.6151,
248
+ "step": 34
249
+ },
250
+ {
251
+ "epoch": 0.06721075372059529,
252
+ "grad_norm": 1.5649464939481088,
253
+ "learning_rate": 1.3026819923371648e-06,
254
+ "loss": 1.6588,
255
+ "step": 35
256
+ },
257
+ {
258
+ "epoch": 0.06913106096975516,
259
+ "grad_norm": 1.5636025180091495,
260
+ "learning_rate": 1.3409961685823756e-06,
261
+ "loss": 1.3946,
262
+ "step": 36
263
+ },
264
+ {
265
+ "epoch": 0.07105136821891503,
266
+ "grad_norm": 1.5461645880192942,
267
+ "learning_rate": 1.3793103448275862e-06,
268
+ "loss": 1.6768,
269
+ "step": 37
270
+ },
271
+ {
272
+ "epoch": 0.0729716754680749,
273
+ "grad_norm": 1.4344137662856442,
274
+ "learning_rate": 1.417624521072797e-06,
275
+ "loss": 1.4397,
276
+ "step": 38
277
+ },
278
+ {
279
+ "epoch": 0.07489198271723475,
280
+ "grad_norm": 1.3960130764357097,
281
+ "learning_rate": 1.455938697318008e-06,
282
+ "loss": 1.6793,
283
+ "step": 39
284
+ },
285
+ {
286
+ "epoch": 0.07681228996639462,
287
+ "grad_norm": 1.2396850770578887,
288
+ "learning_rate": 1.4942528735632185e-06,
289
+ "loss": 1.5595,
290
+ "step": 40
291
+ },
292
+ {
293
+ "epoch": 0.07873259721555449,
294
+ "grad_norm": 1.2226941074613882,
295
+ "learning_rate": 1.5325670498084292e-06,
296
+ "loss": 1.4513,
297
+ "step": 41
298
+ },
299
+ {
300
+ "epoch": 0.08065290446471435,
301
+ "grad_norm": 1.2420772331499856,
302
+ "learning_rate": 1.57088122605364e-06,
303
+ "loss": 1.5815,
304
+ "step": 42
305
+ },
306
+ {
307
+ "epoch": 0.08257321171387422,
308
+ "grad_norm": 1.1487654644464287,
309
+ "learning_rate": 1.6091954022988506e-06,
310
+ "loss": 1.5939,
311
+ "step": 43
312
+ },
313
+ {
314
+ "epoch": 0.08449351896303409,
315
+ "grad_norm": 1.2124391317795524,
316
+ "learning_rate": 1.6475095785440615e-06,
317
+ "loss": 1.3123,
318
+ "step": 44
319
+ },
320
+ {
321
+ "epoch": 0.08641382621219396,
322
+ "grad_norm": 1.2527034268005153,
323
+ "learning_rate": 1.6858237547892723e-06,
324
+ "loss": 1.6962,
325
+ "step": 45
326
+ },
327
+ {
328
+ "epoch": 0.08833413346135381,
329
+ "grad_norm": 1.22540150664902,
330
+ "learning_rate": 1.724137931034483e-06,
331
+ "loss": 1.5573,
332
+ "step": 46
333
+ },
334
+ {
335
+ "epoch": 0.09025444071051368,
336
+ "grad_norm": 1.0822330995590186,
337
+ "learning_rate": 1.7624521072796935e-06,
338
+ "loss": 1.6174,
339
+ "step": 47
340
+ },
341
+ {
342
+ "epoch": 0.09217474795967355,
343
+ "grad_norm": 1.3725369113494932,
344
+ "learning_rate": 1.8007662835249044e-06,
345
+ "loss": 1.5724,
346
+ "step": 48
347
+ },
348
+ {
349
+ "epoch": 0.09409505520883342,
350
+ "grad_norm": 1.1246522439222844,
351
+ "learning_rate": 1.839080459770115e-06,
352
+ "loss": 1.6577,
353
+ "step": 49
354
+ },
355
+ {
356
+ "epoch": 0.09601536245799328,
357
+ "grad_norm": 1.153435955007641,
358
+ "learning_rate": 1.8773946360153258e-06,
359
+ "loss": 1.6045,
360
+ "step": 50
361
+ },
362
+ {
363
+ "epoch": 0.09793566970715314,
364
+ "grad_norm": 1.1142741754051628,
365
+ "learning_rate": 1.9157088122605367e-06,
366
+ "loss": 1.6562,
367
+ "step": 51
368
+ },
369
+ {
370
+ "epoch": 0.09985597695631301,
371
+ "grad_norm": 1.0608003189926583,
372
+ "learning_rate": 1.9540229885057475e-06,
373
+ "loss": 1.4951,
374
+ "step": 52
375
+ },
376
+ {
377
+ "epoch": 0.10177628420547287,
378
+ "grad_norm": 1.0049278590265711,
379
+ "learning_rate": 1.992337164750958e-06,
380
+ "loss": 1.5432,
381
+ "step": 53
382
+ },
383
+ {
384
+ "epoch": 0.10369659145463274,
385
+ "grad_norm": 0.895715467779371,
386
+ "learning_rate": 2.0306513409961687e-06,
387
+ "loss": 1.4494,
388
+ "step": 54
389
+ },
390
+ {
391
+ "epoch": 0.10561689870379261,
392
+ "grad_norm": 0.948460307989256,
393
+ "learning_rate": 2.0689655172413796e-06,
394
+ "loss": 1.6377,
395
+ "step": 55
396
+ },
397
+ {
398
+ "epoch": 0.10753720595295248,
399
+ "grad_norm": 0.8960302855343928,
400
+ "learning_rate": 2.1072796934865904e-06,
401
+ "loss": 1.5476,
402
+ "step": 56
403
+ },
404
+ {
405
+ "epoch": 0.10945751320211233,
406
+ "grad_norm": 0.8555220673502346,
407
+ "learning_rate": 2.145593869731801e-06,
408
+ "loss": 1.2937,
409
+ "step": 57
410
+ },
411
+ {
412
+ "epoch": 0.1113778204512722,
413
+ "grad_norm": 0.9297918052847216,
414
+ "learning_rate": 2.1839080459770117e-06,
415
+ "loss": 1.5018,
416
+ "step": 58
417
+ },
418
+ {
419
+ "epoch": 0.11329812770043207,
420
+ "grad_norm": 0.8615767845690797,
421
+ "learning_rate": 2.222222222222222e-06,
422
+ "loss": 1.4411,
423
+ "step": 59
424
+ },
425
+ {
426
+ "epoch": 0.11521843494959194,
427
+ "grad_norm": 0.9800340953282465,
428
+ "learning_rate": 2.260536398467433e-06,
429
+ "loss": 1.6592,
430
+ "step": 60
431
+ },
432
+ {
433
+ "epoch": 0.1171387421987518,
434
+ "grad_norm": 0.8319044483038768,
435
+ "learning_rate": 2.2988505747126437e-06,
436
+ "loss": 1.4999,
437
+ "step": 61
438
+ },
439
+ {
440
+ "epoch": 0.11905904944791167,
441
+ "grad_norm": 0.8113904065691636,
442
+ "learning_rate": 2.3371647509578546e-06,
443
+ "loss": 1.4058,
444
+ "step": 62
445
+ },
446
+ {
447
+ "epoch": 0.12097935669707154,
448
+ "grad_norm": 0.7584474578599453,
449
+ "learning_rate": 2.3754789272030654e-06,
450
+ "loss": 1.1995,
451
+ "step": 63
452
+ },
453
+ {
454
+ "epoch": 0.12289966394623139,
455
+ "grad_norm": 0.8112593744821786,
456
+ "learning_rate": 2.4137931034482762e-06,
457
+ "loss": 1.622,
458
+ "step": 64
459
+ },
460
+ {
461
+ "epoch": 0.12481997119539126,
462
+ "grad_norm": 0.8465973433211744,
463
+ "learning_rate": 2.4521072796934867e-06,
464
+ "loss": 1.5474,
465
+ "step": 65
466
+ },
467
+ {
468
+ "epoch": 0.12674027844455113,
469
+ "grad_norm": 0.829645722256521,
470
+ "learning_rate": 2.4904214559386975e-06,
471
+ "loss": 1.485,
472
+ "step": 66
473
+ },
474
+ {
475
+ "epoch": 0.128660585693711,
476
+ "grad_norm": 0.8480123859041653,
477
+ "learning_rate": 2.5287356321839083e-06,
478
+ "loss": 1.5641,
479
+ "step": 67
480
+ },
481
+ {
482
+ "epoch": 0.13058089294287087,
483
+ "grad_norm": 0.7945937151249043,
484
+ "learning_rate": 2.567049808429119e-06,
485
+ "loss": 1.3511,
486
+ "step": 68
487
+ },
488
+ {
489
+ "epoch": 0.13250120019203074,
490
+ "grad_norm": 0.8452583555772669,
491
+ "learning_rate": 2.6053639846743296e-06,
492
+ "loss": 1.4936,
493
+ "step": 69
494
+ },
495
+ {
496
+ "epoch": 0.13442150744119058,
497
+ "grad_norm": 0.7913167472525273,
498
+ "learning_rate": 2.6436781609195404e-06,
499
+ "loss": 1.524,
500
+ "step": 70
501
+ },
502
+ {
503
+ "epoch": 0.13634181469035045,
504
+ "grad_norm": 0.7632883226077274,
505
+ "learning_rate": 2.6819923371647512e-06,
506
+ "loss": 1.4957,
507
+ "step": 71
508
+ },
509
+ {
510
+ "epoch": 0.13826212193951032,
511
+ "grad_norm": 0.8040467176753551,
512
+ "learning_rate": 2.720306513409962e-06,
513
+ "loss": 1.5472,
514
+ "step": 72
515
+ },
516
+ {
517
+ "epoch": 0.1401824291886702,
518
+ "grad_norm": 0.8063495654842968,
519
+ "learning_rate": 2.7586206896551725e-06,
520
+ "loss": 1.4355,
521
+ "step": 73
522
+ },
523
+ {
524
+ "epoch": 0.14210273643783006,
525
+ "grad_norm": 0.8632589003342163,
526
+ "learning_rate": 2.796934865900383e-06,
527
+ "loss": 1.6251,
528
+ "step": 74
529
+ },
530
+ {
531
+ "epoch": 0.14402304368698993,
532
+ "grad_norm": 0.9065110727033228,
533
+ "learning_rate": 2.835249042145594e-06,
534
+ "loss": 1.3482,
535
+ "step": 75
536
+ },
537
+ {
538
+ "epoch": 0.1459433509361498,
539
+ "grad_norm": 0.7358621824934779,
540
+ "learning_rate": 2.8735632183908046e-06,
541
+ "loss": 1.4579,
542
+ "step": 76
543
+ },
544
+ {
545
+ "epoch": 0.14786365818530964,
546
+ "grad_norm": 0.7882740690499183,
547
+ "learning_rate": 2.911877394636016e-06,
548
+ "loss": 1.584,
549
+ "step": 77
550
+ },
551
+ {
552
+ "epoch": 0.1497839654344695,
553
+ "grad_norm": 0.8028390602285591,
554
+ "learning_rate": 2.9501915708812262e-06,
555
+ "loss": 1.5799,
556
+ "step": 78
557
+ },
558
+ {
559
+ "epoch": 0.15170427268362938,
560
+ "grad_norm": 0.7087212262202383,
561
+ "learning_rate": 2.988505747126437e-06,
562
+ "loss": 1.3796,
563
+ "step": 79
564
+ },
565
+ {
566
+ "epoch": 0.15362457993278925,
567
+ "grad_norm": 0.7477246745009772,
568
+ "learning_rate": 3.026819923371648e-06,
569
+ "loss": 1.4577,
570
+ "step": 80
571
+ },
572
+ {
573
+ "epoch": 0.15554488718194912,
574
+ "grad_norm": 0.7362367028641865,
575
+ "learning_rate": 3.0651340996168583e-06,
576
+ "loss": 1.3986,
577
+ "step": 81
578
+ },
579
+ {
580
+ "epoch": 0.15746519443110898,
581
+ "grad_norm": 0.7542749931181064,
582
+ "learning_rate": 3.103448275862069e-06,
583
+ "loss": 1.3923,
584
+ "step": 82
585
+ },
586
+ {
587
+ "epoch": 0.15938550168026885,
588
+ "grad_norm": 0.7591236429919996,
589
+ "learning_rate": 3.14176245210728e-06,
590
+ "loss": 1.468,
591
+ "step": 83
592
+ },
593
+ {
594
+ "epoch": 0.1613058089294287,
595
+ "grad_norm": 0.750073455610315,
596
+ "learning_rate": 3.180076628352491e-06,
597
+ "loss": 1.5728,
598
+ "step": 84
599
+ },
600
+ {
601
+ "epoch": 0.16322611617858857,
602
+ "grad_norm": 0.7463483577071213,
603
+ "learning_rate": 3.2183908045977012e-06,
604
+ "loss": 1.5751,
605
+ "step": 85
606
+ },
607
+ {
608
+ "epoch": 0.16514642342774843,
609
+ "grad_norm": 0.7459336348523459,
610
+ "learning_rate": 3.256704980842912e-06,
611
+ "loss": 1.5821,
612
+ "step": 86
613
+ },
614
+ {
615
+ "epoch": 0.1670667306769083,
616
+ "grad_norm": 0.7503745075545026,
617
+ "learning_rate": 3.295019157088123e-06,
618
+ "loss": 1.3811,
619
+ "step": 87
620
+ },
621
+ {
622
+ "epoch": 0.16898703792606817,
623
+ "grad_norm": 0.6781019129991772,
624
+ "learning_rate": 3.3333333333333333e-06,
625
+ "loss": 1.4967,
626
+ "step": 88
627
+ },
628
+ {
629
+ "epoch": 0.17090734517522804,
630
+ "grad_norm": 0.6772160890677477,
631
+ "learning_rate": 3.3716475095785446e-06,
632
+ "loss": 1.4602,
633
+ "step": 89
634
+ },
635
+ {
636
+ "epoch": 0.1728276524243879,
637
+ "grad_norm": 0.7414559131468873,
638
+ "learning_rate": 3.409961685823755e-06,
639
+ "loss": 1.5384,
640
+ "step": 90
641
+ },
642
+ {
643
+ "epoch": 0.17474795967354778,
644
+ "grad_norm": 0.7339713894607118,
645
+ "learning_rate": 3.448275862068966e-06,
646
+ "loss": 1.3478,
647
+ "step": 91
648
+ },
649
+ {
650
+ "epoch": 0.17666826692270762,
651
+ "grad_norm": 0.6741291120903733,
652
+ "learning_rate": 3.4865900383141767e-06,
653
+ "loss": 1.3051,
654
+ "step": 92
655
+ },
656
+ {
657
+ "epoch": 0.1785885741718675,
658
+ "grad_norm": 0.8466746593898973,
659
+ "learning_rate": 3.524904214559387e-06,
660
+ "loss": 1.6414,
661
+ "step": 93
662
+ },
663
+ {
664
+ "epoch": 0.18050888142102736,
665
+ "grad_norm": 0.6235998792480368,
666
+ "learning_rate": 3.563218390804598e-06,
667
+ "loss": 1.3774,
668
+ "step": 94
669
+ },
670
+ {
671
+ "epoch": 0.18242918867018723,
672
+ "grad_norm": 0.7888875616341429,
673
+ "learning_rate": 3.6015325670498087e-06,
674
+ "loss": 1.2273,
675
+ "step": 95
676
+ },
677
+ {
678
+ "epoch": 0.1843494959193471,
679
+ "grad_norm": 0.7184060206606023,
680
+ "learning_rate": 3.6398467432950196e-06,
681
+ "loss": 1.4414,
682
+ "step": 96
683
+ },
684
+ {
685
+ "epoch": 0.18626980316850697,
686
+ "grad_norm": 0.6931282624303644,
687
+ "learning_rate": 3.67816091954023e-06,
688
+ "loss": 1.1996,
689
+ "step": 97
690
+ },
691
+ {
692
+ "epoch": 0.18819011041766684,
693
+ "grad_norm": 0.6898899817332669,
694
+ "learning_rate": 3.7164750957854412e-06,
695
+ "loss": 1.153,
696
+ "step": 98
697
+ },
698
+ {
699
+ "epoch": 0.19011041766682668,
700
+ "grad_norm": 0.6706065855351341,
701
+ "learning_rate": 3.7547892720306517e-06,
702
+ "loss": 1.3219,
703
+ "step": 99
704
+ },
705
+ {
706
+ "epoch": 0.19203072491598655,
707
+ "grad_norm": 0.6618017863324709,
708
+ "learning_rate": 3.793103448275862e-06,
709
+ "loss": 1.3694,
710
+ "step": 100
711
+ },
712
+ {
713
+ "epoch": 0.19395103216514642,
714
+ "grad_norm": 0.7084267342732283,
715
+ "learning_rate": 3.831417624521073e-06,
716
+ "loss": 1.5242,
717
+ "step": 101
718
+ },
719
+ {
720
+ "epoch": 0.1958713394143063,
721
+ "grad_norm": 0.726545416016091,
722
+ "learning_rate": 3.869731800766283e-06,
723
+ "loss": 1.4521,
724
+ "step": 102
725
+ },
726
+ {
727
+ "epoch": 0.19779164666346616,
728
+ "grad_norm": 0.7462891561612502,
729
+ "learning_rate": 3.908045977011495e-06,
730
+ "loss": 1.4687,
731
+ "step": 103
732
+ },
733
+ {
734
+ "epoch": 0.19971195391262603,
735
+ "grad_norm": 0.7186363274122183,
736
+ "learning_rate": 3.946360153256705e-06,
737
+ "loss": 1.4222,
738
+ "step": 104
739
+ },
740
+ {
741
+ "epoch": 0.2016322611617859,
742
+ "grad_norm": 0.6562522942973675,
743
+ "learning_rate": 3.984674329501916e-06,
744
+ "loss": 1.3302,
745
+ "step": 105
746
+ },
747
+ {
748
+ "epoch": 0.20355256841094574,
749
+ "grad_norm": 0.7593764693035522,
750
+ "learning_rate": 4.022988505747127e-06,
751
+ "loss": 1.4029,
752
+ "step": 106
753
+ },
754
+ {
755
+ "epoch": 0.2054728756601056,
756
+ "grad_norm": 0.674187794860422,
757
+ "learning_rate": 4.0613026819923375e-06,
758
+ "loss": 1.2851,
759
+ "step": 107
760
+ },
761
+ {
762
+ "epoch": 0.20739318290926548,
763
+ "grad_norm": 0.6771453444719904,
764
+ "learning_rate": 4.099616858237548e-06,
765
+ "loss": 1.3873,
766
+ "step": 108
767
+ },
768
+ {
769
+ "epoch": 0.20931349015842535,
770
+ "grad_norm": 0.6904184501885661,
771
+ "learning_rate": 4.137931034482759e-06,
772
+ "loss": 1.4671,
773
+ "step": 109
774
+ },
775
+ {
776
+ "epoch": 0.21123379740758522,
777
+ "grad_norm": 0.7386010515763627,
778
+ "learning_rate": 4.17624521072797e-06,
779
+ "loss": 1.4114,
780
+ "step": 110
781
+ },
782
+ {
783
+ "epoch": 0.21315410465674509,
784
+ "grad_norm": 0.6330108602988729,
785
+ "learning_rate": 4.214559386973181e-06,
786
+ "loss": 1.5344,
787
+ "step": 111
788
+ },
789
+ {
790
+ "epoch": 0.21507441190590496,
791
+ "grad_norm": 0.6476316086673372,
792
+ "learning_rate": 4.252873563218391e-06,
793
+ "loss": 1.4134,
794
+ "step": 112
795
+ },
796
+ {
797
+ "epoch": 0.2169947191550648,
798
+ "grad_norm": 0.7369608607793586,
799
+ "learning_rate": 4.291187739463602e-06,
800
+ "loss": 1.4656,
801
+ "step": 113
802
+ },
803
+ {
804
+ "epoch": 0.21891502640422467,
805
+ "grad_norm": 0.6991819737178624,
806
+ "learning_rate": 4.3295019157088125e-06,
807
+ "loss": 1.3801,
808
+ "step": 114
809
+ },
810
+ {
811
+ "epoch": 0.22083533365338454,
812
+ "grad_norm": 0.6670879445681203,
813
+ "learning_rate": 4.367816091954023e-06,
814
+ "loss": 1.4012,
815
+ "step": 115
816
+ },
817
+ {
818
+ "epoch": 0.2227556409025444,
819
+ "grad_norm": 0.7091321651558993,
820
+ "learning_rate": 4.406130268199234e-06,
821
+ "loss": 1.369,
822
+ "step": 116
823
+ },
824
+ {
825
+ "epoch": 0.22467594815170427,
826
+ "grad_norm": 0.6538069130880931,
827
+ "learning_rate": 4.444444444444444e-06,
828
+ "loss": 1.207,
829
+ "step": 117
830
+ },
831
+ {
832
+ "epoch": 0.22659625540086414,
833
+ "grad_norm": 0.7414604205506811,
834
+ "learning_rate": 4.482758620689656e-06,
835
+ "loss": 1.4466,
836
+ "step": 118
837
+ },
838
+ {
839
+ "epoch": 0.228516562650024,
840
+ "grad_norm": 0.6754242592483168,
841
+ "learning_rate": 4.521072796934866e-06,
842
+ "loss": 1.345,
843
+ "step": 119
844
+ },
845
+ {
846
+ "epoch": 0.23043686989918388,
847
+ "grad_norm": 0.7890890418316723,
848
+ "learning_rate": 4.5593869731800775e-06,
849
+ "loss": 1.4887,
850
+ "step": 120
851
+ },
852
+ {
853
+ "epoch": 0.23235717714834372,
854
+ "grad_norm": 0.7142672200972927,
855
+ "learning_rate": 4.5977011494252875e-06,
856
+ "loss": 1.5663,
857
+ "step": 121
858
+ },
859
+ {
860
+ "epoch": 0.2342774843975036,
861
+ "grad_norm": 0.6607576396465201,
862
+ "learning_rate": 4.636015325670498e-06,
863
+ "loss": 1.5097,
864
+ "step": 122
865
+ },
866
+ {
867
+ "epoch": 0.23619779164666346,
868
+ "grad_norm": 0.7801245141924045,
869
+ "learning_rate": 4.674329501915709e-06,
870
+ "loss": 1.5577,
871
+ "step": 123
872
+ },
873
+ {
874
+ "epoch": 0.23811809889582333,
875
+ "grad_norm": 0.7853237789383211,
876
+ "learning_rate": 4.71264367816092e-06,
877
+ "loss": 1.5542,
878
+ "step": 124
879
+ },
880
+ {
881
+ "epoch": 0.2400384061449832,
882
+ "grad_norm": 0.6731916164633106,
883
+ "learning_rate": 4.750957854406131e-06,
884
+ "loss": 1.5991,
885
+ "step": 125
886
+ },
887
+ {
888
+ "epoch": 0.24195871339414307,
889
+ "grad_norm": 0.7081285505123779,
890
+ "learning_rate": 4.789272030651342e-06,
891
+ "loss": 1.4219,
892
+ "step": 126
893
+ },
894
+ {
895
+ "epoch": 0.24387902064330294,
896
+ "grad_norm": 0.6523124091427233,
897
+ "learning_rate": 4.8275862068965525e-06,
898
+ "loss": 1.3967,
899
+ "step": 127
900
+ },
901
+ {
902
+ "epoch": 0.24579932789246278,
903
+ "grad_norm": 0.7010318704056578,
904
+ "learning_rate": 4.8659003831417625e-06,
905
+ "loss": 1.4079,
906
+ "step": 128
907
+ },
908
+ {
909
+ "epoch": 0.24771963514162265,
910
+ "grad_norm": 0.7310188880844346,
911
+ "learning_rate": 4.904214559386973e-06,
912
+ "loss": 1.5645,
913
+ "step": 129
914
+ },
915
+ {
916
+ "epoch": 0.24963994239078252,
917
+ "grad_norm": 0.7370196750980766,
918
+ "learning_rate": 4.942528735632184e-06,
919
+ "loss": 1.3163,
920
+ "step": 130
921
+ },
922
+ {
923
+ "epoch": 0.2515602496399424,
924
+ "grad_norm": 0.5988613538056734,
925
+ "learning_rate": 4.980842911877395e-06,
926
+ "loss": 1.2164,
927
+ "step": 131
928
+ },
929
+ {
930
+ "epoch": 0.25348055688910226,
931
+ "grad_norm": 0.6686452758995931,
932
+ "learning_rate": 5.019157088122606e-06,
933
+ "loss": 1.3216,
934
+ "step": 132
935
+ },
936
+ {
937
+ "epoch": 0.25540086413826213,
938
+ "grad_norm": 0.6283032311907456,
939
+ "learning_rate": 5.057471264367817e-06,
940
+ "loss": 1.3004,
941
+ "step": 133
942
+ },
943
+ {
944
+ "epoch": 0.257321171387422,
945
+ "grad_norm": 0.7131274515928692,
946
+ "learning_rate": 5.095785440613027e-06,
947
+ "loss": 1.3574,
948
+ "step": 134
949
+ },
950
+ {
951
+ "epoch": 0.25924147863658187,
952
+ "grad_norm": 0.7562023685666645,
953
+ "learning_rate": 5.134099616858238e-06,
954
+ "loss": 1.4755,
955
+ "step": 135
956
+ },
957
+ {
958
+ "epoch": 0.26116178588574174,
959
+ "grad_norm": 0.7260126586378673,
960
+ "learning_rate": 5.172413793103449e-06,
961
+ "loss": 1.3512,
962
+ "step": 136
963
+ },
964
+ {
965
+ "epoch": 0.2630820931349016,
966
+ "grad_norm": 0.7027786093003081,
967
+ "learning_rate": 5.210727969348659e-06,
968
+ "loss": 1.3988,
969
+ "step": 137
970
+ },
971
+ {
972
+ "epoch": 0.2650024003840615,
973
+ "grad_norm": 0.6536542941035637,
974
+ "learning_rate": 5.24904214559387e-06,
975
+ "loss": 1.3403,
976
+ "step": 138
977
+ },
978
+ {
979
+ "epoch": 0.2669227076332213,
980
+ "grad_norm": 0.6887374540995002,
981
+ "learning_rate": 5.287356321839081e-06,
982
+ "loss": 1.4009,
983
+ "step": 139
984
+ },
985
+ {
986
+ "epoch": 0.26884301488238116,
987
+ "grad_norm": 0.6904650924816887,
988
+ "learning_rate": 5.3256704980842925e-06,
989
+ "loss": 1.3674,
990
+ "step": 140
991
+ },
992
+ {
993
+ "epoch": 0.27076332213154103,
994
+ "grad_norm": 0.7396766783545521,
995
+ "learning_rate": 5.3639846743295025e-06,
996
+ "loss": 1.2224,
997
+ "step": 141
998
+ },
999
+ {
1000
+ "epoch": 0.2726836293807009,
1001
+ "grad_norm": 0.6618698222762107,
1002
+ "learning_rate": 5.402298850574713e-06,
1003
+ "loss": 1.3261,
1004
+ "step": 142
1005
+ },
1006
+ {
1007
+ "epoch": 0.27460393662986077,
1008
+ "grad_norm": 0.7346869512327489,
1009
+ "learning_rate": 5.440613026819924e-06,
1010
+ "loss": 1.5539,
1011
+ "step": 143
1012
+ },
1013
+ {
1014
+ "epoch": 0.27652424387902064,
1015
+ "grad_norm": 0.6542272405748857,
1016
+ "learning_rate": 5.478927203065134e-06,
1017
+ "loss": 1.2301,
1018
+ "step": 144
1019
+ },
1020
+ {
1021
+ "epoch": 0.2784445511281805,
1022
+ "grad_norm": 0.652844033827654,
1023
+ "learning_rate": 5.517241379310345e-06,
1024
+ "loss": 1.3203,
1025
+ "step": 145
1026
+ },
1027
+ {
1028
+ "epoch": 0.2803648583773404,
1029
+ "grad_norm": 0.7093255205591261,
1030
+ "learning_rate": 5.555555555555557e-06,
1031
+ "loss": 1.4194,
1032
+ "step": 146
1033
+ },
1034
+ {
1035
+ "epoch": 0.28228516562650025,
1036
+ "grad_norm": 0.7713263587807493,
1037
+ "learning_rate": 5.593869731800766e-06,
1038
+ "loss": 1.3986,
1039
+ "step": 147
1040
+ },
1041
+ {
1042
+ "epoch": 0.2842054728756601,
1043
+ "grad_norm": 0.7273045777114594,
1044
+ "learning_rate": 5.6321839080459775e-06,
1045
+ "loss": 1.5226,
1046
+ "step": 148
1047
+ },
1048
+ {
1049
+ "epoch": 0.28612578012482,
1050
+ "grad_norm": 0.6416135588874926,
1051
+ "learning_rate": 5.670498084291188e-06,
1052
+ "loss": 1.4148,
1053
+ "step": 149
1054
+ },
1055
+ {
1056
+ "epoch": 0.28804608737397985,
1057
+ "grad_norm": 0.6767941047038493,
1058
+ "learning_rate": 5.708812260536399e-06,
1059
+ "loss": 1.4741,
1060
+ "step": 150
1061
+ },
1062
+ {
1063
+ "epoch": 0.2899663946231397,
1064
+ "grad_norm": 0.7125976753134923,
1065
+ "learning_rate": 5.747126436781609e-06,
1066
+ "loss": 1.4689,
1067
+ "step": 151
1068
+ },
1069
+ {
1070
+ "epoch": 0.2918867018722996,
1071
+ "grad_norm": 0.6848434615690435,
1072
+ "learning_rate": 5.78544061302682e-06,
1073
+ "loss": 1.3208,
1074
+ "step": 152
1075
+ },
1076
+ {
1077
+ "epoch": 0.2938070091214594,
1078
+ "grad_norm": 0.7637154008633908,
1079
+ "learning_rate": 5.823754789272032e-06,
1080
+ "loss": 1.5237,
1081
+ "step": 153
1082
+ },
1083
+ {
1084
+ "epoch": 0.2957273163706193,
1085
+ "grad_norm": 0.6483331857341429,
1086
+ "learning_rate": 5.862068965517242e-06,
1087
+ "loss": 1.3073,
1088
+ "step": 154
1089
+ },
1090
+ {
1091
+ "epoch": 0.29764762361977914,
1092
+ "grad_norm": 0.684818235289912,
1093
+ "learning_rate": 5.9003831417624525e-06,
1094
+ "loss": 1.4076,
1095
+ "step": 155
1096
+ },
1097
+ {
1098
+ "epoch": 0.299567930868939,
1099
+ "grad_norm": 0.6683114123494819,
1100
+ "learning_rate": 5.938697318007663e-06,
1101
+ "loss": 1.3518,
1102
+ "step": 156
1103
+ },
1104
+ {
1105
+ "epoch": 0.3014882381180989,
1106
+ "grad_norm": 0.8301668940114854,
1107
+ "learning_rate": 5.977011494252874e-06,
1108
+ "loss": 1.5087,
1109
+ "step": 157
1110
+ },
1111
+ {
1112
+ "epoch": 0.30340854536725875,
1113
+ "grad_norm": 0.7306107739349151,
1114
+ "learning_rate": 6.015325670498084e-06,
1115
+ "loss": 1.4187,
1116
+ "step": 158
1117
+ },
1118
+ {
1119
+ "epoch": 0.3053288526164186,
1120
+ "grad_norm": 0.692887187718929,
1121
+ "learning_rate": 6.053639846743296e-06,
1122
+ "loss": 1.5365,
1123
+ "step": 159
1124
+ },
1125
+ {
1126
+ "epoch": 0.3072491598655785,
1127
+ "grad_norm": 0.6502853635559999,
1128
+ "learning_rate": 6.091954022988507e-06,
1129
+ "loss": 1.3497,
1130
+ "step": 160
1131
+ },
1132
+ {
1133
+ "epoch": 0.30916946711473836,
1134
+ "grad_norm": 0.7309674020853324,
1135
+ "learning_rate": 6.130268199233717e-06,
1136
+ "loss": 1.4965,
1137
+ "step": 161
1138
+ },
1139
+ {
1140
+ "epoch": 0.31108977436389823,
1141
+ "grad_norm": 0.7124865800378807,
1142
+ "learning_rate": 6.1685823754789275e-06,
1143
+ "loss": 1.4449,
1144
+ "step": 162
1145
+ },
1146
+ {
1147
+ "epoch": 0.3130100816130581,
1148
+ "grad_norm": 0.692769353628125,
1149
+ "learning_rate": 6.206896551724138e-06,
1150
+ "loss": 1.2823,
1151
+ "step": 163
1152
+ },
1153
+ {
1154
+ "epoch": 0.31493038886221797,
1155
+ "grad_norm": 0.8120061941639997,
1156
+ "learning_rate": 6.24521072796935e-06,
1157
+ "loss": 1.5322,
1158
+ "step": 164
1159
+ },
1160
+ {
1161
+ "epoch": 0.31685069611137784,
1162
+ "grad_norm": 0.6506906315887734,
1163
+ "learning_rate": 6.28352490421456e-06,
1164
+ "loss": 1.4138,
1165
+ "step": 165
1166
+ },
1167
+ {
1168
+ "epoch": 0.3187710033605377,
1169
+ "grad_norm": 0.7021274588006857,
1170
+ "learning_rate": 6.321839080459771e-06,
1171
+ "loss": 1.5534,
1172
+ "step": 166
1173
+ },
1174
+ {
1175
+ "epoch": 0.3206913106096976,
1176
+ "grad_norm": 0.6965648094070332,
1177
+ "learning_rate": 6.360153256704982e-06,
1178
+ "loss": 1.3055,
1179
+ "step": 167
1180
+ },
1181
+ {
1182
+ "epoch": 0.3226116178588574,
1183
+ "grad_norm": 0.7498732720147595,
1184
+ "learning_rate": 6.398467432950192e-06,
1185
+ "loss": 1.2775,
1186
+ "step": 168
1187
+ },
1188
+ {
1189
+ "epoch": 0.32453192510801726,
1190
+ "grad_norm": 0.7097564261194121,
1191
+ "learning_rate": 6.4367816091954025e-06,
1192
+ "loss": 1.3029,
1193
+ "step": 169
1194
+ },
1195
+ {
1196
+ "epoch": 0.32645223235717713,
1197
+ "grad_norm": 0.6382917432482148,
1198
+ "learning_rate": 6.475095785440614e-06,
1199
+ "loss": 1.3569,
1200
+ "step": 170
1201
+ },
1202
+ {
1203
+ "epoch": 0.328372539606337,
1204
+ "grad_norm": 0.6745359700702276,
1205
+ "learning_rate": 6.513409961685824e-06,
1206
+ "loss": 1.3339,
1207
+ "step": 171
1208
+ },
1209
+ {
1210
+ "epoch": 0.33029284685549687,
1211
+ "grad_norm": 0.8056549461489378,
1212
+ "learning_rate": 6.551724137931035e-06,
1213
+ "loss": 1.4649,
1214
+ "step": 172
1215
+ },
1216
+ {
1217
+ "epoch": 0.33221315410465674,
1218
+ "grad_norm": 0.7305964712888819,
1219
+ "learning_rate": 6.590038314176246e-06,
1220
+ "loss": 1.4451,
1221
+ "step": 173
1222
+ },
1223
+ {
1224
+ "epoch": 0.3341334613538166,
1225
+ "grad_norm": 0.6201165387321146,
1226
+ "learning_rate": 6.628352490421457e-06,
1227
+ "loss": 1.3352,
1228
+ "step": 174
1229
+ },
1230
+ {
1231
+ "epoch": 0.3360537686029765,
1232
+ "grad_norm": 0.8265036713279577,
1233
+ "learning_rate": 6.666666666666667e-06,
1234
+ "loss": 1.4794,
1235
+ "step": 175
1236
+ },
1237
+ {
1238
+ "epoch": 0.33797407585213635,
1239
+ "grad_norm": 0.6893681404195715,
1240
+ "learning_rate": 6.7049808429118775e-06,
1241
+ "loss": 1.4419,
1242
+ "step": 176
1243
+ },
1244
+ {
1245
+ "epoch": 0.3398943831012962,
1246
+ "grad_norm": 0.7509743815259918,
1247
+ "learning_rate": 6.743295019157089e-06,
1248
+ "loss": 1.3666,
1249
+ "step": 177
1250
+ },
1251
+ {
1252
+ "epoch": 0.3418146903504561,
1253
+ "grad_norm": 0.7122960885573658,
1254
+ "learning_rate": 6.781609195402299e-06,
1255
+ "loss": 1.4108,
1256
+ "step": 178
1257
+ },
1258
+ {
1259
+ "epoch": 0.34373499759961595,
1260
+ "grad_norm": 0.848930385570575,
1261
+ "learning_rate": 6.81992337164751e-06,
1262
+ "loss": 1.4827,
1263
+ "step": 179
1264
+ },
1265
+ {
1266
+ "epoch": 0.3456553048487758,
1267
+ "grad_norm": 0.7602028733722221,
1268
+ "learning_rate": 6.858237547892721e-06,
1269
+ "loss": 1.3414,
1270
+ "step": 180
1271
+ },
1272
+ {
1273
+ "epoch": 0.3475756120979357,
1274
+ "grad_norm": 0.8288114979771807,
1275
+ "learning_rate": 6.896551724137932e-06,
1276
+ "loss": 1.2727,
1277
+ "step": 181
1278
+ },
1279
+ {
1280
+ "epoch": 0.34949591934709556,
1281
+ "grad_norm": 0.7693760683257455,
1282
+ "learning_rate": 6.934865900383142e-06,
1283
+ "loss": 1.3706,
1284
+ "step": 182
1285
+ },
1286
+ {
1287
+ "epoch": 0.3514162265962554,
1288
+ "grad_norm": 0.7808563776887848,
1289
+ "learning_rate": 6.973180076628353e-06,
1290
+ "loss": 1.4723,
1291
+ "step": 183
1292
+ },
1293
+ {
1294
+ "epoch": 0.35333653384541525,
1295
+ "grad_norm": 0.8734769267258163,
1296
+ "learning_rate": 7.011494252873564e-06,
1297
+ "loss": 1.2891,
1298
+ "step": 184
1299
+ },
1300
+ {
1301
+ "epoch": 0.3552568410945751,
1302
+ "grad_norm": 0.8867229876837837,
1303
+ "learning_rate": 7.049808429118774e-06,
1304
+ "loss": 1.4359,
1305
+ "step": 185
1306
+ },
1307
+ {
1308
+ "epoch": 0.357177148343735,
1309
+ "grad_norm": 0.8349083935516824,
1310
+ "learning_rate": 7.088122605363985e-06,
1311
+ "loss": 1.5565,
1312
+ "step": 186
1313
+ },
1314
+ {
1315
+ "epoch": 0.35909745559289485,
1316
+ "grad_norm": 0.7400284977493244,
1317
+ "learning_rate": 7.126436781609196e-06,
1318
+ "loss": 1.456,
1319
+ "step": 187
1320
+ },
1321
+ {
1322
+ "epoch": 0.3610177628420547,
1323
+ "grad_norm": 0.6439707610744461,
1324
+ "learning_rate": 7.1647509578544075e-06,
1325
+ "loss": 1.2718,
1326
+ "step": 188
1327
+ },
1328
+ {
1329
+ "epoch": 0.3629380700912146,
1330
+ "grad_norm": 0.757428349385491,
1331
+ "learning_rate": 7.2030651340996175e-06,
1332
+ "loss": 1.3176,
1333
+ "step": 189
1334
+ },
1335
+ {
1336
+ "epoch": 0.36485837734037446,
1337
+ "grad_norm": 0.6979336476743889,
1338
+ "learning_rate": 7.241379310344828e-06,
1339
+ "loss": 1.1578,
1340
+ "step": 190
1341
+ },
1342
+ {
1343
+ "epoch": 0.36677868458953433,
1344
+ "grad_norm": 0.7318936685975646,
1345
+ "learning_rate": 7.279693486590039e-06,
1346
+ "loss": 1.5306,
1347
+ "step": 191
1348
+ },
1349
+ {
1350
+ "epoch": 0.3686989918386942,
1351
+ "grad_norm": 0.6968684758048505,
1352
+ "learning_rate": 7.318007662835249e-06,
1353
+ "loss": 1.3176,
1354
+ "step": 192
1355
+ },
1356
+ {
1357
+ "epoch": 0.37061929908785407,
1358
+ "grad_norm": 0.8360636142316585,
1359
+ "learning_rate": 7.35632183908046e-06,
1360
+ "loss": 1.6162,
1361
+ "step": 193
1362
+ },
1363
+ {
1364
+ "epoch": 0.37253960633701394,
1365
+ "grad_norm": 0.6842163000752954,
1366
+ "learning_rate": 7.394636015325672e-06,
1367
+ "loss": 1.3775,
1368
+ "step": 194
1369
+ },
1370
+ {
1371
+ "epoch": 0.3744599135861738,
1372
+ "grad_norm": 0.7405931672623491,
1373
+ "learning_rate": 7.4329501915708825e-06,
1374
+ "loss": 1.4155,
1375
+ "step": 195
1376
+ },
1377
+ {
1378
+ "epoch": 0.3763802208353337,
1379
+ "grad_norm": 0.6724666872249973,
1380
+ "learning_rate": 7.4712643678160925e-06,
1381
+ "loss": 1.6041,
1382
+ "step": 196
1383
+ },
1384
+ {
1385
+ "epoch": 0.3783005280844935,
1386
+ "grad_norm": 0.6600816017352631,
1387
+ "learning_rate": 7.509578544061303e-06,
1388
+ "loss": 1.3836,
1389
+ "step": 197
1390
+ },
1391
+ {
1392
+ "epoch": 0.38022083533365336,
1393
+ "grad_norm": 0.7294649653837092,
1394
+ "learning_rate": 7.547892720306514e-06,
1395
+ "loss": 1.3381,
1396
+ "step": 198
1397
+ },
1398
+ {
1399
+ "epoch": 0.38214114258281323,
1400
+ "grad_norm": 0.6849006152291969,
1401
+ "learning_rate": 7.586206896551724e-06,
1402
+ "loss": 1.3448,
1403
+ "step": 199
1404
+ },
1405
+ {
1406
+ "epoch": 0.3840614498319731,
1407
+ "grad_norm": 0.6413698682933802,
1408
+ "learning_rate": 7.624521072796936e-06,
1409
+ "loss": 1.1691,
1410
+ "step": 200
1411
+ },
1412
+ {
1413
+ "epoch": 0.38598175708113297,
1414
+ "grad_norm": 0.6761946714227771,
1415
+ "learning_rate": 7.662835249042147e-06,
1416
+ "loss": 1.2401,
1417
+ "step": 201
1418
+ },
1419
+ {
1420
+ "epoch": 0.38790206433029284,
1421
+ "grad_norm": 0.6604987264007839,
1422
+ "learning_rate": 7.701149425287356e-06,
1423
+ "loss": 1.4297,
1424
+ "step": 202
1425
+ },
1426
+ {
1427
+ "epoch": 0.3898223715794527,
1428
+ "grad_norm": 0.6655444711020334,
1429
+ "learning_rate": 7.739463601532567e-06,
1430
+ "loss": 1.2069,
1431
+ "step": 203
1432
+ },
1433
+ {
1434
+ "epoch": 0.3917426788286126,
1435
+ "grad_norm": 0.716356344463303,
1436
+ "learning_rate": 7.77777777777778e-06,
1437
+ "loss": 1.3456,
1438
+ "step": 204
1439
+ },
1440
+ {
1441
+ "epoch": 0.39366298607777245,
1442
+ "grad_norm": 0.7371288713977551,
1443
+ "learning_rate": 7.81609195402299e-06,
1444
+ "loss": 1.3331,
1445
+ "step": 205
1446
+ },
1447
+ {
1448
+ "epoch": 0.3955832933269323,
1449
+ "grad_norm": 0.6679678204725035,
1450
+ "learning_rate": 7.854406130268199e-06,
1451
+ "loss": 1.4027,
1452
+ "step": 206
1453
+ },
1454
+ {
1455
+ "epoch": 0.3975036005760922,
1456
+ "grad_norm": 0.6255494545199866,
1457
+ "learning_rate": 7.89272030651341e-06,
1458
+ "loss": 1.4204,
1459
+ "step": 207
1460
+ },
1461
+ {
1462
+ "epoch": 0.39942390782525206,
1463
+ "grad_norm": 0.7776077277070255,
1464
+ "learning_rate": 7.93103448275862e-06,
1465
+ "loss": 1.4262,
1466
+ "step": 208
1467
+ },
1468
+ {
1469
+ "epoch": 0.4013442150744119,
1470
+ "grad_norm": 0.7495735486802019,
1471
+ "learning_rate": 7.969348659003832e-06,
1472
+ "loss": 1.3803,
1473
+ "step": 209
1474
+ },
1475
+ {
1476
+ "epoch": 0.4032645223235718,
1477
+ "grad_norm": 0.7359991087372613,
1478
+ "learning_rate": 8.007662835249042e-06,
1479
+ "loss": 1.3407,
1480
+ "step": 210
1481
+ },
1482
+ {
1483
+ "epoch": 0.40518482957273166,
1484
+ "grad_norm": 0.74502169700267,
1485
+ "learning_rate": 8.045977011494253e-06,
1486
+ "loss": 1.2109,
1487
+ "step": 211
1488
+ },
1489
+ {
1490
+ "epoch": 0.4071051368218915,
1491
+ "grad_norm": 0.672919730166899,
1492
+ "learning_rate": 8.084291187739464e-06,
1493
+ "loss": 1.4416,
1494
+ "step": 212
1495
+ },
1496
+ {
1497
+ "epoch": 0.40902544407105135,
1498
+ "grad_norm": 0.9039099669663537,
1499
+ "learning_rate": 8.122605363984675e-06,
1500
+ "loss": 1.5869,
1501
+ "step": 213
1502
+ },
1503
+ {
1504
+ "epoch": 0.4109457513202112,
1505
+ "grad_norm": 0.609809507238103,
1506
+ "learning_rate": 8.160919540229886e-06,
1507
+ "loss": 1.392,
1508
+ "step": 214
1509
+ },
1510
+ {
1511
+ "epoch": 0.4128660585693711,
1512
+ "grad_norm": 0.7209905089139385,
1513
+ "learning_rate": 8.199233716475097e-06,
1514
+ "loss": 1.5286,
1515
+ "step": 215
1516
+ },
1517
+ {
1518
+ "epoch": 0.41478636581853096,
1519
+ "grad_norm": 0.7641098257228572,
1520
+ "learning_rate": 8.237547892720307e-06,
1521
+ "loss": 1.4556,
1522
+ "step": 216
1523
+ },
1524
+ {
1525
+ "epoch": 0.4167066730676908,
1526
+ "grad_norm": 0.6671329519012665,
1527
+ "learning_rate": 8.275862068965518e-06,
1528
+ "loss": 1.4011,
1529
+ "step": 217
1530
+ },
1531
+ {
1532
+ "epoch": 0.4186269803168507,
1533
+ "grad_norm": 0.7571002797488336,
1534
+ "learning_rate": 8.31417624521073e-06,
1535
+ "loss": 1.3907,
1536
+ "step": 218
1537
+ },
1538
+ {
1539
+ "epoch": 0.42054728756601056,
1540
+ "grad_norm": 0.6765159050714699,
1541
+ "learning_rate": 8.35249042145594e-06,
1542
+ "loss": 1.411,
1543
+ "step": 219
1544
+ },
1545
+ {
1546
+ "epoch": 0.42246759481517043,
1547
+ "grad_norm": 0.7631812758174655,
1548
+ "learning_rate": 8.390804597701149e-06,
1549
+ "loss": 1.4568,
1550
+ "step": 220
1551
+ },
1552
+ {
1553
+ "epoch": 0.4243879020643303,
1554
+ "grad_norm": 0.819638920429698,
1555
+ "learning_rate": 8.429118773946362e-06,
1556
+ "loss": 1.2607,
1557
+ "step": 221
1558
+ },
1559
+ {
1560
+ "epoch": 0.42630820931349017,
1561
+ "grad_norm": 0.6856567916211197,
1562
+ "learning_rate": 8.467432950191573e-06,
1563
+ "loss": 1.3665,
1564
+ "step": 222
1565
+ },
1566
+ {
1567
+ "epoch": 0.42822851656265004,
1568
+ "grad_norm": 0.756851173923122,
1569
+ "learning_rate": 8.505747126436782e-06,
1570
+ "loss": 1.4053,
1571
+ "step": 223
1572
+ },
1573
+ {
1574
+ "epoch": 0.4301488238118099,
1575
+ "grad_norm": 0.7234111087737882,
1576
+ "learning_rate": 8.544061302681992e-06,
1577
+ "loss": 1.2986,
1578
+ "step": 224
1579
+ },
1580
+ {
1581
+ "epoch": 0.4320691310609698,
1582
+ "grad_norm": 0.7822272702322975,
1583
+ "learning_rate": 8.582375478927203e-06,
1584
+ "loss": 1.4298,
1585
+ "step": 225
1586
+ },
1587
+ {
1588
+ "epoch": 0.4339894383101296,
1589
+ "grad_norm": 0.6810248686630753,
1590
+ "learning_rate": 8.620689655172414e-06,
1591
+ "loss": 1.3399,
1592
+ "step": 226
1593
+ },
1594
+ {
1595
+ "epoch": 0.43590974555928946,
1596
+ "grad_norm": 0.8051128970700839,
1597
+ "learning_rate": 8.659003831417625e-06,
1598
+ "loss": 1.5267,
1599
+ "step": 227
1600
+ },
1601
+ {
1602
+ "epoch": 0.43783005280844933,
1603
+ "grad_norm": 0.732357170450308,
1604
+ "learning_rate": 8.697318007662836e-06,
1605
+ "loss": 1.4766,
1606
+ "step": 228
1607
+ },
1608
+ {
1609
+ "epoch": 0.4397503600576092,
1610
+ "grad_norm": 0.8096174835706853,
1611
+ "learning_rate": 8.735632183908047e-06,
1612
+ "loss": 1.5061,
1613
+ "step": 229
1614
+ },
1615
+ {
1616
+ "epoch": 0.44167066730676907,
1617
+ "grad_norm": 0.7498363788557091,
1618
+ "learning_rate": 8.773946360153257e-06,
1619
+ "loss": 1.5328,
1620
+ "step": 230
1621
+ },
1622
+ {
1623
+ "epoch": 0.44359097455592894,
1624
+ "grad_norm": 0.6639308793432624,
1625
+ "learning_rate": 8.812260536398468e-06,
1626
+ "loss": 1.5014,
1627
+ "step": 231
1628
+ },
1629
+ {
1630
+ "epoch": 0.4455112818050888,
1631
+ "grad_norm": 0.7955581619122697,
1632
+ "learning_rate": 8.85057471264368e-06,
1633
+ "loss": 1.4619,
1634
+ "step": 232
1635
+ },
1636
+ {
1637
+ "epoch": 0.4474315890542487,
1638
+ "grad_norm": 0.6665415125116451,
1639
+ "learning_rate": 8.888888888888888e-06,
1640
+ "loss": 1.4401,
1641
+ "step": 233
1642
+ },
1643
+ {
1644
+ "epoch": 0.44935189630340855,
1645
+ "grad_norm": 0.7497106975893845,
1646
+ "learning_rate": 8.9272030651341e-06,
1647
+ "loss": 1.4444,
1648
+ "step": 234
1649
+ },
1650
+ {
1651
+ "epoch": 0.4512722035525684,
1652
+ "grad_norm": 0.7655250611774667,
1653
+ "learning_rate": 8.965517241379312e-06,
1654
+ "loss": 1.4183,
1655
+ "step": 235
1656
+ },
1657
+ {
1658
+ "epoch": 0.4531925108017283,
1659
+ "grad_norm": 0.7069725743129521,
1660
+ "learning_rate": 9.003831417624522e-06,
1661
+ "loss": 1.4695,
1662
+ "step": 236
1663
+ },
1664
+ {
1665
+ "epoch": 0.45511281805088816,
1666
+ "grad_norm": 0.7033810098540295,
1667
+ "learning_rate": 9.042145593869732e-06,
1668
+ "loss": 1.432,
1669
+ "step": 237
1670
+ },
1671
+ {
1672
+ "epoch": 0.457033125300048,
1673
+ "grad_norm": 0.7657511117560273,
1674
+ "learning_rate": 9.080459770114942e-06,
1675
+ "loss": 1.3106,
1676
+ "step": 238
1677
+ },
1678
+ {
1679
+ "epoch": 0.4589534325492079,
1680
+ "grad_norm": 0.6734934664683107,
1681
+ "learning_rate": 9.118773946360155e-06,
1682
+ "loss": 1.2657,
1683
+ "step": 239
1684
+ },
1685
+ {
1686
+ "epoch": 0.46087373979836777,
1687
+ "grad_norm": 0.6793414583903499,
1688
+ "learning_rate": 9.157088122605364e-06,
1689
+ "loss": 1.2823,
1690
+ "step": 240
1691
+ },
1692
+ {
1693
+ "epoch": 0.4627940470475276,
1694
+ "grad_norm": 0.6868551209136969,
1695
+ "learning_rate": 9.195402298850575e-06,
1696
+ "loss": 1.1981,
1697
+ "step": 241
1698
+ },
1699
+ {
1700
+ "epoch": 0.46471435429668745,
1701
+ "grad_norm": 0.7999498220323118,
1702
+ "learning_rate": 9.233716475095786e-06,
1703
+ "loss": 1.3222,
1704
+ "step": 242
1705
+ },
1706
+ {
1707
+ "epoch": 0.4666346615458473,
1708
+ "grad_norm": 0.6765218175071678,
1709
+ "learning_rate": 9.272030651340997e-06,
1710
+ "loss": 1.3159,
1711
+ "step": 243
1712
+ },
1713
+ {
1714
+ "epoch": 0.4685549687950072,
1715
+ "grad_norm": 0.7633174577339077,
1716
+ "learning_rate": 9.310344827586207e-06,
1717
+ "loss": 1.4493,
1718
+ "step": 244
1719
+ },
1720
+ {
1721
+ "epoch": 0.47047527604416706,
1722
+ "grad_norm": 0.7434731700432043,
1723
+ "learning_rate": 9.348659003831418e-06,
1724
+ "loss": 1.3771,
1725
+ "step": 245
1726
+ },
1727
+ {
1728
+ "epoch": 0.4723955832933269,
1729
+ "grad_norm": 0.7887594763056447,
1730
+ "learning_rate": 9.386973180076629e-06,
1731
+ "loss": 1.2978,
1732
+ "step": 246
1733
+ },
1734
+ {
1735
+ "epoch": 0.4743158905424868,
1736
+ "grad_norm": 0.6816410513843812,
1737
+ "learning_rate": 9.42528735632184e-06,
1738
+ "loss": 1.3221,
1739
+ "step": 247
1740
+ },
1741
+ {
1742
+ "epoch": 0.47623619779164666,
1743
+ "grad_norm": 0.6726044542699641,
1744
+ "learning_rate": 9.46360153256705e-06,
1745
+ "loss": 1.3954,
1746
+ "step": 248
1747
+ },
1748
+ {
1749
+ "epoch": 0.47815650504080653,
1750
+ "grad_norm": 0.8209401718350966,
1751
+ "learning_rate": 9.501915708812262e-06,
1752
+ "loss": 1.2964,
1753
+ "step": 249
1754
+ },
1755
+ {
1756
+ "epoch": 0.4800768122899664,
1757
+ "grad_norm": 0.7150467022402414,
1758
+ "learning_rate": 9.54022988505747e-06,
1759
+ "loss": 1.2462,
1760
+ "step": 250
1761
+ },
1762
+ {
1763
+ "epoch": 0.4819971195391263,
1764
+ "grad_norm": 0.7473286809494867,
1765
+ "learning_rate": 9.578544061302683e-06,
1766
+ "loss": 1.3987,
1767
+ "step": 251
1768
+ },
1769
+ {
1770
+ "epoch": 0.48391742678828614,
1771
+ "grad_norm": 0.8919512518954593,
1772
+ "learning_rate": 9.616858237547894e-06,
1773
+ "loss": 1.3271,
1774
+ "step": 252
1775
+ },
1776
+ {
1777
+ "epoch": 0.485837734037446,
1778
+ "grad_norm": 0.7235436092130889,
1779
+ "learning_rate": 9.655172413793105e-06,
1780
+ "loss": 1.4006,
1781
+ "step": 253
1782
+ },
1783
+ {
1784
+ "epoch": 0.4877580412866059,
1785
+ "grad_norm": 0.7496985395380509,
1786
+ "learning_rate": 9.693486590038314e-06,
1787
+ "loss": 1.3485,
1788
+ "step": 254
1789
+ },
1790
+ {
1791
+ "epoch": 0.4896783485357657,
1792
+ "grad_norm": 0.7558104853132458,
1793
+ "learning_rate": 9.731800766283525e-06,
1794
+ "loss": 1.4354,
1795
+ "step": 255
1796
+ },
1797
+ {
1798
+ "epoch": 0.49159865578492556,
1799
+ "grad_norm": 0.8026084646949407,
1800
+ "learning_rate": 9.770114942528738e-06,
1801
+ "loss": 1.3458,
1802
+ "step": 256
1803
+ },
1804
+ {
1805
+ "epoch": 0.49351896303408543,
1806
+ "grad_norm": 0.6871351528584623,
1807
+ "learning_rate": 9.808429118773947e-06,
1808
+ "loss": 1.2849,
1809
+ "step": 257
1810
+ },
1811
+ {
1812
+ "epoch": 0.4954392702832453,
1813
+ "grad_norm": 0.6733156882936058,
1814
+ "learning_rate": 9.846743295019157e-06,
1815
+ "loss": 1.3416,
1816
+ "step": 258
1817
+ },
1818
+ {
1819
+ "epoch": 0.4973595775324052,
1820
+ "grad_norm": 0.8040078483269378,
1821
+ "learning_rate": 9.885057471264368e-06,
1822
+ "loss": 1.3933,
1823
+ "step": 259
1824
+ },
1825
+ {
1826
+ "epoch": 0.49927988478156504,
1827
+ "grad_norm": 0.7019620968242437,
1828
+ "learning_rate": 9.923371647509579e-06,
1829
+ "loss": 1.4092,
1830
+ "step": 260
1831
+ },
1832
+ {
1833
+ "epoch": 0.501200192030725,
1834
+ "grad_norm": 0.7993119421084648,
1835
+ "learning_rate": 9.96168582375479e-06,
1836
+ "loss": 1.4496,
1837
+ "step": 261
1838
+ },
1839
+ {
1840
+ "epoch": 0.5031204992798848,
1841
+ "grad_norm": 0.7500420731214819,
1842
+ "learning_rate": 1e-05,
1843
+ "loss": 1.275,
1844
+ "step": 262
1845
+ },
1846
+ {
1847
+ "epoch": 0.5050408065290446,
1848
+ "grad_norm": 0.7096092331830312,
1849
+ "learning_rate": 9.999995509192137e-06,
1850
+ "loss": 1.4075,
1851
+ "step": 263
1852
+ },
1853
+ {
1854
+ "epoch": 0.5069611137782045,
1855
+ "grad_norm": 0.6880277184241935,
1856
+ "learning_rate": 9.999982036776617e-06,
1857
+ "loss": 1.3853,
1858
+ "step": 264
1859
+ },
1860
+ {
1861
+ "epoch": 0.5088814210273643,
1862
+ "grad_norm": 0.6887794428820988,
1863
+ "learning_rate": 9.999959582777638e-06,
1864
+ "loss": 1.2526,
1865
+ "step": 265
1866
+ },
1867
+ {
1868
+ "epoch": 0.5108017282765243,
1869
+ "grad_norm": 0.6962486538004352,
1870
+ "learning_rate": 9.999928147235536e-06,
1871
+ "loss": 1.385,
1872
+ "step": 266
1873
+ },
1874
+ {
1875
+ "epoch": 0.5127220355256841,
1876
+ "grad_norm": 0.7314717827625464,
1877
+ "learning_rate": 9.99988773020678e-06,
1878
+ "loss": 1.5364,
1879
+ "step": 267
1880
+ },
1881
+ {
1882
+ "epoch": 0.514642342774844,
1883
+ "grad_norm": 0.6755436676174023,
1884
+ "learning_rate": 9.99983833176397e-06,
1885
+ "loss": 1.1625,
1886
+ "step": 268
1887
+ },
1888
+ {
1889
+ "epoch": 0.5165626500240038,
1890
+ "grad_norm": 0.6799257698916303,
1891
+ "learning_rate": 9.999779951995845e-06,
1892
+ "loss": 1.3743,
1893
+ "step": 269
1894
+ },
1895
+ {
1896
+ "epoch": 0.5184829572731637,
1897
+ "grad_norm": 0.6967760972692357,
1898
+ "learning_rate": 9.99971259100727e-06,
1899
+ "loss": 1.4619,
1900
+ "step": 270
1901
+ },
1902
+ {
1903
+ "epoch": 0.5204032645223235,
1904
+ "grad_norm": 0.6876004824004736,
1905
+ "learning_rate": 9.99963624891925e-06,
1906
+ "loss": 1.2302,
1907
+ "step": 271
1908
+ },
1909
+ {
1910
+ "epoch": 0.5223235717714835,
1911
+ "grad_norm": 0.741525025016876,
1912
+ "learning_rate": 9.999550925868919e-06,
1913
+ "loss": 1.4944,
1914
+ "step": 272
1915
+ },
1916
+ {
1917
+ "epoch": 0.5242438790206433,
1918
+ "grad_norm": 0.7044462970993084,
1919
+ "learning_rate": 9.999456622009545e-06,
1920
+ "loss": 1.3233,
1921
+ "step": 273
1922
+ },
1923
+ {
1924
+ "epoch": 0.5261641862698032,
1925
+ "grad_norm": 0.7147463675731596,
1926
+ "learning_rate": 9.999353337510526e-06,
1927
+ "loss": 1.4728,
1928
+ "step": 274
1929
+ },
1930
+ {
1931
+ "epoch": 0.528084493518963,
1932
+ "grad_norm": 0.7580689885973482,
1933
+ "learning_rate": 9.9992410725574e-06,
1934
+ "loss": 1.3894,
1935
+ "step": 275
1936
+ },
1937
+ {
1938
+ "epoch": 0.530004800768123,
1939
+ "grad_norm": 0.627159916011877,
1940
+ "learning_rate": 9.999119827351824e-06,
1941
+ "loss": 1.1499,
1942
+ "step": 276
1943
+ },
1944
+ {
1945
+ "epoch": 0.5319251080172828,
1946
+ "grad_norm": 0.7347721430138173,
1947
+ "learning_rate": 9.998989602111599e-06,
1948
+ "loss": 1.3863,
1949
+ "step": 277
1950
+ },
1951
+ {
1952
+ "epoch": 0.5338454152664426,
1953
+ "grad_norm": 0.7561542947388183,
1954
+ "learning_rate": 9.99885039707065e-06,
1955
+ "loss": 1.4094,
1956
+ "step": 278
1957
+ },
1958
+ {
1959
+ "epoch": 0.5357657225156025,
1960
+ "grad_norm": 0.7257428578657052,
1961
+ "learning_rate": 9.998702212479031e-06,
1962
+ "loss": 1.3558,
1963
+ "step": 279
1964
+ },
1965
+ {
1966
+ "epoch": 0.5376860297647623,
1967
+ "grad_norm": 0.7156710718415759,
1968
+ "learning_rate": 9.998545048602938e-06,
1969
+ "loss": 1.3932,
1970
+ "step": 280
1971
+ },
1972
+ {
1973
+ "epoch": 0.5396063370139222,
1974
+ "grad_norm": 0.8324536861856755,
1975
+ "learning_rate": 9.998378905724677e-06,
1976
+ "loss": 1.4631,
1977
+ "step": 281
1978
+ },
1979
+ {
1980
+ "epoch": 0.5415266442630821,
1981
+ "grad_norm": 0.769865333129953,
1982
+ "learning_rate": 9.998203784142701e-06,
1983
+ "loss": 1.4778,
1984
+ "step": 282
1985
+ },
1986
+ {
1987
+ "epoch": 0.543446951512242,
1988
+ "grad_norm": 0.7558894226395197,
1989
+ "learning_rate": 9.998019684171585e-06,
1990
+ "loss": 1.3401,
1991
+ "step": 283
1992
+ },
1993
+ {
1994
+ "epoch": 0.5453672587614018,
1995
+ "grad_norm": 0.745453902467428,
1996
+ "learning_rate": 9.997826606142031e-06,
1997
+ "loss": 1.376,
1998
+ "step": 284
1999
+ },
2000
+ {
2001
+ "epoch": 0.5472875660105617,
2002
+ "grad_norm": 0.8525307677948906,
2003
+ "learning_rate": 9.997624550400869e-06,
2004
+ "loss": 1.3269,
2005
+ "step": 285
2006
+ },
2007
+ {
2008
+ "epoch": 0.5492078732597215,
2009
+ "grad_norm": 0.8993675673573773,
2010
+ "learning_rate": 9.997413517311055e-06,
2011
+ "loss": 1.3973,
2012
+ "step": 286
2013
+ },
2014
+ {
2015
+ "epoch": 0.5511281805088815,
2016
+ "grad_norm": 0.7637767723846134,
2017
+ "learning_rate": 9.997193507251676e-06,
2018
+ "loss": 1.4107,
2019
+ "step": 287
2020
+ },
2021
+ {
2022
+ "epoch": 0.5530484877580413,
2023
+ "grad_norm": 0.7334145684503066,
2024
+ "learning_rate": 9.996964520617938e-06,
2025
+ "loss": 1.2548,
2026
+ "step": 288
2027
+ },
2028
+ {
2029
+ "epoch": 0.5549687950072012,
2030
+ "grad_norm": 0.8286763467838726,
2031
+ "learning_rate": 9.996726557821177e-06,
2032
+ "loss": 1.3915,
2033
+ "step": 289
2034
+ },
2035
+ {
2036
+ "epoch": 0.556889102256361,
2037
+ "grad_norm": 0.786223417485439,
2038
+ "learning_rate": 9.996479619288853e-06,
2039
+ "loss": 1.2113,
2040
+ "step": 290
2041
+ },
2042
+ {
2043
+ "epoch": 0.5588094095055209,
2044
+ "grad_norm": 0.6629161249458739,
2045
+ "learning_rate": 9.996223705464542e-06,
2046
+ "loss": 1.383,
2047
+ "step": 291
2048
+ },
2049
+ {
2050
+ "epoch": 0.5607297167546808,
2051
+ "grad_norm": 0.7763568743151492,
2052
+ "learning_rate": 9.995958816807951e-06,
2053
+ "loss": 1.511,
2054
+ "step": 292
2055
+ },
2056
+ {
2057
+ "epoch": 0.5626500240038406,
2058
+ "grad_norm": 0.8706771128343518,
2059
+ "learning_rate": 9.995684953794905e-06,
2060
+ "loss": 1.301,
2061
+ "step": 293
2062
+ },
2063
+ {
2064
+ "epoch": 0.5645703312530005,
2065
+ "grad_norm": 0.7186979734065922,
2066
+ "learning_rate": 9.995402116917353e-06,
2067
+ "loss": 1.3137,
2068
+ "step": 294
2069
+ },
2070
+ {
2071
+ "epoch": 0.5664906385021603,
2072
+ "grad_norm": 0.7197477949946243,
2073
+ "learning_rate": 9.995110306683358e-06,
2074
+ "loss": 1.3924,
2075
+ "step": 295
2076
+ },
2077
+ {
2078
+ "epoch": 0.5684109457513202,
2079
+ "grad_norm": 0.7990094094001562,
2080
+ "learning_rate": 9.994809523617109e-06,
2081
+ "loss": 1.3595,
2082
+ "step": 296
2083
+ },
2084
+ {
2085
+ "epoch": 0.57033125300048,
2086
+ "grad_norm": 0.7548256910113419,
2087
+ "learning_rate": 9.994499768258905e-06,
2088
+ "loss": 1.2627,
2089
+ "step": 297
2090
+ },
2091
+ {
2092
+ "epoch": 0.57225156024964,
2093
+ "grad_norm": 0.6080847660246027,
2094
+ "learning_rate": 9.994181041165169e-06,
2095
+ "loss": 1.233,
2096
+ "step": 298
2097
+ },
2098
+ {
2099
+ "epoch": 0.5741718674987998,
2100
+ "grad_norm": 0.7522747291038051,
2101
+ "learning_rate": 9.99385334290844e-06,
2102
+ "loss": 1.4473,
2103
+ "step": 299
2104
+ },
2105
+ {
2106
+ "epoch": 0.5760921747479597,
2107
+ "grad_norm": 0.693071662167599,
2108
+ "learning_rate": 9.993516674077367e-06,
2109
+ "loss": 1.3112,
2110
+ "step": 300
2111
+ },
2112
+ {
2113
+ "epoch": 0.5780124819971195,
2114
+ "grad_norm": 0.7289575683988432,
2115
+ "learning_rate": 9.993171035276717e-06,
2116
+ "loss": 1.4447,
2117
+ "step": 301
2118
+ },
2119
+ {
2120
+ "epoch": 0.5799327892462794,
2121
+ "grad_norm": 0.7219332107019164,
2122
+ "learning_rate": 9.992816427127367e-06,
2123
+ "loss": 1.3059,
2124
+ "step": 302
2125
+ },
2126
+ {
2127
+ "epoch": 0.5818530964954393,
2128
+ "grad_norm": 0.7884436507160677,
2129
+ "learning_rate": 9.992452850266313e-06,
2130
+ "loss": 1.4828,
2131
+ "step": 303
2132
+ },
2133
+ {
2134
+ "epoch": 0.5837734037445992,
2135
+ "grad_norm": 0.6835750513473184,
2136
+ "learning_rate": 9.992080305346652e-06,
2137
+ "loss": 1.3351,
2138
+ "step": 304
2139
+ },
2140
+ {
2141
+ "epoch": 0.585693710993759,
2142
+ "grad_norm": 0.7455682427352298,
2143
+ "learning_rate": 9.991698793037596e-06,
2144
+ "loss": 1.3393,
2145
+ "step": 305
2146
+ },
2147
+ {
2148
+ "epoch": 0.5876140182429188,
2149
+ "grad_norm": 0.6344234674402865,
2150
+ "learning_rate": 9.991308314024466e-06,
2151
+ "loss": 1.1186,
2152
+ "step": 306
2153
+ },
2154
+ {
2155
+ "epoch": 0.5895343254920787,
2156
+ "grad_norm": 0.6463680302231726,
2157
+ "learning_rate": 9.990908869008685e-06,
2158
+ "loss": 1.3536,
2159
+ "step": 307
2160
+ },
2161
+ {
2162
+ "epoch": 0.5914546327412386,
2163
+ "grad_norm": 0.7763640180054763,
2164
+ "learning_rate": 9.99050045870779e-06,
2165
+ "loss": 1.4034,
2166
+ "step": 308
2167
+ },
2168
+ {
2169
+ "epoch": 0.5933749399903985,
2170
+ "grad_norm": 0.7729679972786335,
2171
+ "learning_rate": 9.990083083855413e-06,
2172
+ "loss": 1.518,
2173
+ "step": 309
2174
+ },
2175
+ {
2176
+ "epoch": 0.5952952472395583,
2177
+ "grad_norm": 0.7293910429882318,
2178
+ "learning_rate": 9.9896567452013e-06,
2179
+ "loss": 1.4168,
2180
+ "step": 310
2181
+ },
2182
+ {
2183
+ "epoch": 0.5972155544887182,
2184
+ "grad_norm": 0.6938721572185663,
2185
+ "learning_rate": 9.989221443511286e-06,
2186
+ "loss": 1.5813,
2187
+ "step": 311
2188
+ },
2189
+ {
2190
+ "epoch": 0.599135861737878,
2191
+ "grad_norm": 0.6823348506968784,
2192
+ "learning_rate": 9.98877717956732e-06,
2193
+ "loss": 1.396,
2194
+ "step": 312
2195
+ },
2196
+ {
2197
+ "epoch": 0.601056168987038,
2198
+ "grad_norm": 0.6470598419144085,
2199
+ "learning_rate": 9.988323954167438e-06,
2200
+ "loss": 1.3138,
2201
+ "step": 313
2202
+ },
2203
+ {
2204
+ "epoch": 0.6029764762361978,
2205
+ "grad_norm": 0.6955870872672735,
2206
+ "learning_rate": 9.987861768125783e-06,
2207
+ "loss": 1.4043,
2208
+ "step": 314
2209
+ },
2210
+ {
2211
+ "epoch": 0.6048967834853577,
2212
+ "grad_norm": 0.7788214111440995,
2213
+ "learning_rate": 9.98739062227259e-06,
2214
+ "loss": 1.5305,
2215
+ "step": 315
2216
+ },
2217
+ {
2218
+ "epoch": 0.6068170907345175,
2219
+ "grad_norm": 0.6598071275711943,
2220
+ "learning_rate": 9.986910517454188e-06,
2221
+ "loss": 1.185,
2222
+ "step": 316
2223
+ },
2224
+ {
2225
+ "epoch": 0.6087373979836774,
2226
+ "grad_norm": 0.7478469808999688,
2227
+ "learning_rate": 9.986421454533001e-06,
2228
+ "loss": 1.2875,
2229
+ "step": 317
2230
+ },
2231
+ {
2232
+ "epoch": 0.6106577052328372,
2233
+ "grad_norm": 0.7102386979345604,
2234
+ "learning_rate": 9.985923434387545e-06,
2235
+ "loss": 1.2623,
2236
+ "step": 318
2237
+ },
2238
+ {
2239
+ "epoch": 0.6125780124819972,
2240
+ "grad_norm": 0.8159684281974479,
2241
+ "learning_rate": 9.985416457912423e-06,
2242
+ "loss": 1.3859,
2243
+ "step": 319
2244
+ },
2245
+ {
2246
+ "epoch": 0.614498319731157,
2247
+ "grad_norm": 0.7359831696017346,
2248
+ "learning_rate": 9.984900526018331e-06,
2249
+ "loss": 1.3127,
2250
+ "step": 320
2251
+ },
2252
+ {
2253
+ "epoch": 0.6164186269803168,
2254
+ "grad_norm": 0.7406050107164467,
2255
+ "learning_rate": 9.984375639632047e-06,
2256
+ "loss": 1.3526,
2257
+ "step": 321
2258
+ },
2259
+ {
2260
+ "epoch": 0.6183389342294767,
2261
+ "grad_norm": 0.7171563092825125,
2262
+ "learning_rate": 9.98384179969644e-06,
2263
+ "loss": 1.3718,
2264
+ "step": 322
2265
+ },
2266
+ {
2267
+ "epoch": 0.6202592414786365,
2268
+ "grad_norm": 0.7444992833186831,
2269
+ "learning_rate": 9.983299007170454e-06,
2270
+ "loss": 1.2605,
2271
+ "step": 323
2272
+ },
2273
+ {
2274
+ "epoch": 0.6221795487277965,
2275
+ "grad_norm": 0.6718703991955216,
2276
+ "learning_rate": 9.982747263029123e-06,
2277
+ "loss": 1.2696,
2278
+ "step": 324
2279
+ },
2280
+ {
2281
+ "epoch": 0.6240998559769563,
2282
+ "grad_norm": 0.6953480856589247,
2283
+ "learning_rate": 9.982186568263558e-06,
2284
+ "loss": 1.402,
2285
+ "step": 325
2286
+ },
2287
+ {
2288
+ "epoch": 0.6260201632261162,
2289
+ "grad_norm": 0.6814410132323387,
2290
+ "learning_rate": 9.981616923880948e-06,
2291
+ "loss": 1.357,
2292
+ "step": 326
2293
+ },
2294
+ {
2295
+ "epoch": 0.627940470475276,
2296
+ "grad_norm": 0.6789399695802566,
2297
+ "learning_rate": 9.981038330904556e-06,
2298
+ "loss": 1.3563,
2299
+ "step": 327
2300
+ },
2301
+ {
2302
+ "epoch": 0.6298607777244359,
2303
+ "grad_norm": 0.7084278817620212,
2304
+ "learning_rate": 9.980450790373724e-06,
2305
+ "loss": 1.3983,
2306
+ "step": 328
2307
+ },
2308
+ {
2309
+ "epoch": 0.6317810849735958,
2310
+ "grad_norm": 0.7561797459599714,
2311
+ "learning_rate": 9.979854303343866e-06,
2312
+ "loss": 1.3998,
2313
+ "step": 329
2314
+ },
2315
+ {
2316
+ "epoch": 0.6337013922227557,
2317
+ "grad_norm": 0.7063013474407709,
2318
+ "learning_rate": 9.979248870886463e-06,
2319
+ "loss": 1.4128,
2320
+ "step": 330
2321
+ },
2322
+ {
2323
+ "epoch": 0.6356216994719155,
2324
+ "grad_norm": 0.7285839877290075,
2325
+ "learning_rate": 9.978634494089066e-06,
2326
+ "loss": 1.5026,
2327
+ "step": 331
2328
+ },
2329
+ {
2330
+ "epoch": 0.6375420067210754,
2331
+ "grad_norm": 0.7631063764422019,
2332
+ "learning_rate": 9.9780111740553e-06,
2333
+ "loss": 1.3353,
2334
+ "step": 332
2335
+ },
2336
+ {
2337
+ "epoch": 0.6394623139702352,
2338
+ "grad_norm": 0.8022733412976211,
2339
+ "learning_rate": 9.977378911904843e-06,
2340
+ "loss": 1.3017,
2341
+ "step": 333
2342
+ },
2343
+ {
2344
+ "epoch": 0.6413826212193952,
2345
+ "grad_norm": 0.7397584519382538,
2346
+ "learning_rate": 9.976737708773445e-06,
2347
+ "loss": 1.4274,
2348
+ "step": 334
2349
+ },
2350
+ {
2351
+ "epoch": 0.643302928468555,
2352
+ "grad_norm": 0.7498254808267637,
2353
+ "learning_rate": 9.976087565812913e-06,
2354
+ "loss": 1.2821,
2355
+ "step": 335
2356
+ },
2357
+ {
2358
+ "epoch": 0.6452232357177148,
2359
+ "grad_norm": 0.8440233129581642,
2360
+ "learning_rate": 9.975428484191117e-06,
2361
+ "loss": 1.507,
2362
+ "step": 336
2363
+ },
2364
+ {
2365
+ "epoch": 0.6471435429668747,
2366
+ "grad_norm": 0.7140420729824992,
2367
+ "learning_rate": 9.974760465091975e-06,
2368
+ "loss": 1.3541,
2369
+ "step": 337
2370
+ },
2371
+ {
2372
+ "epoch": 0.6490638502160345,
2373
+ "grad_norm": 0.7935959679049022,
2374
+ "learning_rate": 9.974083509715471e-06,
2375
+ "loss": 1.3704,
2376
+ "step": 338
2377
+ },
2378
+ {
2379
+ "epoch": 0.6509841574651944,
2380
+ "grad_norm": 0.8128531878052235,
2381
+ "learning_rate": 9.973397619277631e-06,
2382
+ "loss": 1.3941,
2383
+ "step": 339
2384
+ },
2385
+ {
2386
+ "epoch": 0.6529044647143543,
2387
+ "grad_norm": 0.7087809281812139,
2388
+ "learning_rate": 9.972702795010539e-06,
2389
+ "loss": 1.3024,
2390
+ "step": 340
2391
+ },
2392
+ {
2393
+ "epoch": 0.6548247719635142,
2394
+ "grad_norm": 0.8779292688681924,
2395
+ "learning_rate": 9.971999038162322e-06,
2396
+ "loss": 1.275,
2397
+ "step": 341
2398
+ },
2399
+ {
2400
+ "epoch": 0.656745079212674,
2401
+ "grad_norm": 0.8321554450658822,
2402
+ "learning_rate": 9.971286349997155e-06,
2403
+ "loss": 1.4001,
2404
+ "step": 342
2405
+ },
2406
+ {
2407
+ "epoch": 0.6586653864618339,
2408
+ "grad_norm": 0.6785835670278665,
2409
+ "learning_rate": 9.970564731795259e-06,
2410
+ "loss": 1.3563,
2411
+ "step": 343
2412
+ },
2413
+ {
2414
+ "epoch": 0.6605856937109937,
2415
+ "grad_norm": 0.8154880274231641,
2416
+ "learning_rate": 9.96983418485289e-06,
2417
+ "loss": 1.2015,
2418
+ "step": 344
2419
+ },
2420
+ {
2421
+ "epoch": 0.6625060009601537,
2422
+ "grad_norm": 0.7877809686842095,
2423
+ "learning_rate": 9.969094710482345e-06,
2424
+ "loss": 1.3176,
2425
+ "step": 345
2426
+ },
2427
+ {
2428
+ "epoch": 0.6644263082093135,
2429
+ "grad_norm": 0.737869545031943,
2430
+ "learning_rate": 9.968346310011965e-06,
2431
+ "loss": 1.2681,
2432
+ "step": 346
2433
+ },
2434
+ {
2435
+ "epoch": 0.6663466154584734,
2436
+ "grad_norm": 0.8367016706595558,
2437
+ "learning_rate": 9.967588984786113e-06,
2438
+ "loss": 1.3146,
2439
+ "step": 347
2440
+ },
2441
+ {
2442
+ "epoch": 0.6682669227076332,
2443
+ "grad_norm": 0.7157484065111132,
2444
+ "learning_rate": 9.966822736165194e-06,
2445
+ "loss": 1.2279,
2446
+ "step": 348
2447
+ },
2448
+ {
2449
+ "epoch": 0.6701872299567931,
2450
+ "grad_norm": 0.8340115611171157,
2451
+ "learning_rate": 9.966047565525636e-06,
2452
+ "loss": 1.346,
2453
+ "step": 349
2454
+ },
2455
+ {
2456
+ "epoch": 0.672107537205953,
2457
+ "grad_norm": 0.7964501684625079,
2458
+ "learning_rate": 9.965263474259896e-06,
2459
+ "loss": 1.2604,
2460
+ "step": 350
2461
+ },
2462
+ {
2463
+ "epoch": 0.6740278444551128,
2464
+ "grad_norm": 0.7644952492186728,
2465
+ "learning_rate": 9.964470463776457e-06,
2466
+ "loss": 1.2808,
2467
+ "step": 351
2468
+ },
2469
+ {
2470
+ "epoch": 0.6759481517042727,
2471
+ "grad_norm": 0.715875104396104,
2472
+ "learning_rate": 9.96366853549982e-06,
2473
+ "loss": 1.3779,
2474
+ "step": 352
2475
+ },
2476
+ {
2477
+ "epoch": 0.6778684589534325,
2478
+ "grad_norm": 0.6658897567313692,
2479
+ "learning_rate": 9.962857690870507e-06,
2480
+ "loss": 1.3005,
2481
+ "step": 353
2482
+ },
2483
+ {
2484
+ "epoch": 0.6797887662025924,
2485
+ "grad_norm": 0.7869576623216241,
2486
+ "learning_rate": 9.962037931345058e-06,
2487
+ "loss": 1.3772,
2488
+ "step": 354
2489
+ },
2490
+ {
2491
+ "epoch": 0.6817090734517522,
2492
+ "grad_norm": 0.9271972422960602,
2493
+ "learning_rate": 9.96120925839603e-06,
2494
+ "loss": 1.346,
2495
+ "step": 355
2496
+ },
2497
+ {
2498
+ "epoch": 0.6836293807009122,
2499
+ "grad_norm": 0.7660166493856924,
2500
+ "learning_rate": 9.96037167351198e-06,
2501
+ "loss": 1.2745,
2502
+ "step": 356
2503
+ },
2504
+ {
2505
+ "epoch": 0.685549687950072,
2506
+ "grad_norm": 0.6278698318719681,
2507
+ "learning_rate": 9.959525178197484e-06,
2508
+ "loss": 1.1849,
2509
+ "step": 357
2510
+ },
2511
+ {
2512
+ "epoch": 0.6874699951992319,
2513
+ "grad_norm": 0.8957448047534449,
2514
+ "learning_rate": 9.958669773973124e-06,
2515
+ "loss": 1.47,
2516
+ "step": 358
2517
+ },
2518
+ {
2519
+ "epoch": 0.6893903024483917,
2520
+ "grad_norm": 0.7893290798004599,
2521
+ "learning_rate": 9.95780546237548e-06,
2522
+ "loss": 1.4411,
2523
+ "step": 359
2524
+ },
2525
+ {
2526
+ "epoch": 0.6913106096975516,
2527
+ "grad_norm": 0.6674442252477479,
2528
+ "learning_rate": 9.956932244957135e-06,
2529
+ "loss": 1.3468,
2530
+ "step": 360
2531
+ },
2532
+ {
2533
+ "epoch": 0.6932309169467115,
2534
+ "grad_norm": 0.8637622685527974,
2535
+ "learning_rate": 9.95605012328667e-06,
2536
+ "loss": 1.4951,
2537
+ "step": 361
2538
+ },
2539
+ {
2540
+ "epoch": 0.6951512241958714,
2541
+ "grad_norm": 0.7032170307148827,
2542
+ "learning_rate": 9.95515909894866e-06,
2543
+ "loss": 1.2168,
2544
+ "step": 362
2545
+ },
2546
+ {
2547
+ "epoch": 0.6970715314450312,
2548
+ "grad_norm": 0.7604809716338964,
2549
+ "learning_rate": 9.954259173543671e-06,
2550
+ "loss": 1.3405,
2551
+ "step": 363
2552
+ },
2553
+ {
2554
+ "epoch": 0.6989918386941911,
2555
+ "grad_norm": 0.7356596357988364,
2556
+ "learning_rate": 9.953350348688264e-06,
2557
+ "loss": 1.4851,
2558
+ "step": 364
2559
+ },
2560
+ {
2561
+ "epoch": 0.7009121459433509,
2562
+ "grad_norm": 0.7106099387583814,
2563
+ "learning_rate": 9.952432626014979e-06,
2564
+ "loss": 1.4105,
2565
+ "step": 365
2566
+ },
2567
+ {
2568
+ "epoch": 0.7028324531925108,
2569
+ "grad_norm": 0.7680103674421779,
2570
+ "learning_rate": 9.951506007172344e-06,
2571
+ "loss": 1.3767,
2572
+ "step": 366
2573
+ },
2574
+ {
2575
+ "epoch": 0.7047527604416707,
2576
+ "grad_norm": 0.7045547217675817,
2577
+ "learning_rate": 9.950570493824864e-06,
2578
+ "loss": 1.3534,
2579
+ "step": 367
2580
+ },
2581
+ {
2582
+ "epoch": 0.7066730676908305,
2583
+ "grad_norm": 0.8618867023288301,
2584
+ "learning_rate": 9.949626087653026e-06,
2585
+ "loss": 1.5932,
2586
+ "step": 368
2587
+ },
2588
+ {
2589
+ "epoch": 0.7085933749399904,
2590
+ "grad_norm": 0.7514120877501722,
2591
+ "learning_rate": 9.948672790353287e-06,
2592
+ "loss": 1.4226,
2593
+ "step": 369
2594
+ },
2595
+ {
2596
+ "epoch": 0.7105136821891502,
2597
+ "grad_norm": 0.7707655494026907,
2598
+ "learning_rate": 9.947710603638078e-06,
2599
+ "loss": 1.3086,
2600
+ "step": 370
2601
+ },
2602
+ {
2603
+ "epoch": 0.7124339894383102,
2604
+ "grad_norm": 0.7353314917000675,
2605
+ "learning_rate": 9.946739529235797e-06,
2606
+ "loss": 1.3498,
2607
+ "step": 371
2608
+ },
2609
+ {
2610
+ "epoch": 0.71435429668747,
2611
+ "grad_norm": 0.7677899312066072,
2612
+ "learning_rate": 9.945759568890804e-06,
2613
+ "loss": 1.337,
2614
+ "step": 372
2615
+ },
2616
+ {
2617
+ "epoch": 0.7162746039366299,
2618
+ "grad_norm": 0.7323170602281932,
2619
+ "learning_rate": 9.944770724363428e-06,
2620
+ "loss": 1.2262,
2621
+ "step": 373
2622
+ },
2623
+ {
2624
+ "epoch": 0.7181949111857897,
2625
+ "grad_norm": 0.7030503301748048,
2626
+ "learning_rate": 9.943772997429955e-06,
2627
+ "loss": 1.2604,
2628
+ "step": 374
2629
+ },
2630
+ {
2631
+ "epoch": 0.7201152184349496,
2632
+ "grad_norm": 0.8803804845996765,
2633
+ "learning_rate": 9.942766389882621e-06,
2634
+ "loss": 1.3465,
2635
+ "step": 375
2636
+ },
2637
+ {
2638
+ "epoch": 0.7220355256841094,
2639
+ "grad_norm": 0.765754153505594,
2640
+ "learning_rate": 9.94175090352962e-06,
2641
+ "loss": 1.4785,
2642
+ "step": 376
2643
+ },
2644
+ {
2645
+ "epoch": 0.7239558329332694,
2646
+ "grad_norm": 0.7412100725496786,
2647
+ "learning_rate": 9.940726540195093e-06,
2648
+ "loss": 1.3886,
2649
+ "step": 377
2650
+ },
2651
+ {
2652
+ "epoch": 0.7258761401824292,
2653
+ "grad_norm": 0.7352092180670398,
2654
+ "learning_rate": 9.939693301719131e-06,
2655
+ "loss": 1.3787,
2656
+ "step": 378
2657
+ },
2658
+ {
2659
+ "epoch": 0.727796447431589,
2660
+ "grad_norm": 0.7081810984489154,
2661
+ "learning_rate": 9.93865118995776e-06,
2662
+ "loss": 1.2855,
2663
+ "step": 379
2664
+ },
2665
+ {
2666
+ "epoch": 0.7297167546807489,
2667
+ "grad_norm": 0.721692280601312,
2668
+ "learning_rate": 9.937600206782951e-06,
2669
+ "loss": 1.2581,
2670
+ "step": 380
2671
+ },
2672
+ {
2673
+ "epoch": 0.7316370619299087,
2674
+ "grad_norm": 0.7219716174107607,
2675
+ "learning_rate": 9.93654035408261e-06,
2676
+ "loss": 1.3989,
2677
+ "step": 381
2678
+ },
2679
+ {
2680
+ "epoch": 0.7335573691790687,
2681
+ "grad_norm": 0.808844014227327,
2682
+ "learning_rate": 9.935471633760572e-06,
2683
+ "loss": 1.489,
2684
+ "step": 382
2685
+ },
2686
+ {
2687
+ "epoch": 0.7354776764282285,
2688
+ "grad_norm": 0.6931394591191726,
2689
+ "learning_rate": 9.934394047736608e-06,
2690
+ "loss": 1.3596,
2691
+ "step": 383
2692
+ },
2693
+ {
2694
+ "epoch": 0.7373979836773884,
2695
+ "grad_norm": 0.7255320444997646,
2696
+ "learning_rate": 9.93330759794641e-06,
2697
+ "loss": 1.2593,
2698
+ "step": 384
2699
+ },
2700
+ {
2701
+ "epoch": 0.7393182909265482,
2702
+ "grad_norm": 0.6469865776133421,
2703
+ "learning_rate": 9.932212286341591e-06,
2704
+ "loss": 1.4305,
2705
+ "step": 385
2706
+ },
2707
+ {
2708
+ "epoch": 0.7412385981757081,
2709
+ "grad_norm": 0.7276641692049547,
2710
+ "learning_rate": 9.931108114889685e-06,
2711
+ "loss": 1.531,
2712
+ "step": 386
2713
+ },
2714
+ {
2715
+ "epoch": 0.743158905424868,
2716
+ "grad_norm": 0.7064363862608019,
2717
+ "learning_rate": 9.929995085574142e-06,
2718
+ "loss": 1.3905,
2719
+ "step": 387
2720
+ },
2721
+ {
2722
+ "epoch": 0.7450792126740279,
2723
+ "grad_norm": 0.7331138015593877,
2724
+ "learning_rate": 9.928873200394323e-06,
2725
+ "loss": 1.3649,
2726
+ "step": 388
2727
+ },
2728
+ {
2729
+ "epoch": 0.7469995199231877,
2730
+ "grad_norm": 0.7324112634125343,
2731
+ "learning_rate": 9.927742461365493e-06,
2732
+ "loss": 1.4049,
2733
+ "step": 389
2734
+ },
2735
+ {
2736
+ "epoch": 0.7489198271723476,
2737
+ "grad_norm": 0.7448582260656762,
2738
+ "learning_rate": 9.926602870518826e-06,
2739
+ "loss": 1.3451,
2740
+ "step": 390
2741
+ },
2742
+ {
2743
+ "epoch": 0.7508401344215074,
2744
+ "grad_norm": 0.7290925508892867,
2745
+ "learning_rate": 9.925454429901397e-06,
2746
+ "loss": 1.265,
2747
+ "step": 391
2748
+ },
2749
+ {
2750
+ "epoch": 0.7527604416706674,
2751
+ "grad_norm": 0.8652107575311744,
2752
+ "learning_rate": 9.924297141576176e-06,
2753
+ "loss": 1.2601,
2754
+ "step": 392
2755
+ },
2756
+ {
2757
+ "epoch": 0.7546807489198272,
2758
+ "grad_norm": 0.8112589543786329,
2759
+ "learning_rate": 9.923131007622027e-06,
2760
+ "loss": 1.3949,
2761
+ "step": 393
2762
+ },
2763
+ {
2764
+ "epoch": 0.756601056168987,
2765
+ "grad_norm": 0.7564370059278668,
2766
+ "learning_rate": 9.9219560301337e-06,
2767
+ "loss": 1.5582,
2768
+ "step": 394
2769
+ },
2770
+ {
2771
+ "epoch": 0.7585213634181469,
2772
+ "grad_norm": 0.7217323314506744,
2773
+ "learning_rate": 9.920772211221841e-06,
2774
+ "loss": 1.3385,
2775
+ "step": 395
2776
+ },
2777
+ {
2778
+ "epoch": 0.7604416706673067,
2779
+ "grad_norm": 0.7276996906484348,
2780
+ "learning_rate": 9.919579553012964e-06,
2781
+ "loss": 1.3778,
2782
+ "step": 396
2783
+ },
2784
+ {
2785
+ "epoch": 0.7623619779164666,
2786
+ "grad_norm": 0.7823149650395126,
2787
+ "learning_rate": 9.918378057649474e-06,
2788
+ "loss": 1.3767,
2789
+ "step": 397
2790
+ },
2791
+ {
2792
+ "epoch": 0.7642822851656265,
2793
+ "grad_norm": 0.6630175095699308,
2794
+ "learning_rate": 9.917167727289641e-06,
2795
+ "loss": 1.4844,
2796
+ "step": 398
2797
+ },
2798
+ {
2799
+ "epoch": 0.7662025924147864,
2800
+ "grad_norm": 0.7344567983746931,
2801
+ "learning_rate": 9.915948564107611e-06,
2802
+ "loss": 1.3379,
2803
+ "step": 399
2804
+ },
2805
+ {
2806
+ "epoch": 0.7681228996639462,
2807
+ "grad_norm": 0.7466071399468908,
2808
+ "learning_rate": 9.914720570293397e-06,
2809
+ "loss": 1.3972,
2810
+ "step": 400
2811
+ },
2812
+ {
2813
+ "epoch": 0.7700432069131061,
2814
+ "grad_norm": 0.6949526386517407,
2815
+ "learning_rate": 9.913483748052871e-06,
2816
+ "loss": 1.4014,
2817
+ "step": 401
2818
+ },
2819
+ {
2820
+ "epoch": 0.7719635141622659,
2821
+ "grad_norm": 0.6613334975361209,
2822
+ "learning_rate": 9.912238099607763e-06,
2823
+ "loss": 1.2069,
2824
+ "step": 402
2825
+ },
2826
+ {
2827
+ "epoch": 0.7738838214114259,
2828
+ "grad_norm": 0.6632714829710001,
2829
+ "learning_rate": 9.910983627195665e-06,
2830
+ "loss": 1.2427,
2831
+ "step": 403
2832
+ },
2833
+ {
2834
+ "epoch": 0.7758041286605857,
2835
+ "grad_norm": 0.6899922310091848,
2836
+ "learning_rate": 9.90972033307001e-06,
2837
+ "loss": 1.4041,
2838
+ "step": 404
2839
+ },
2840
+ {
2841
+ "epoch": 0.7777244359097456,
2842
+ "grad_norm": 0.6259530173512385,
2843
+ "learning_rate": 9.908448219500087e-06,
2844
+ "loss": 1.0889,
2845
+ "step": 405
2846
+ },
2847
+ {
2848
+ "epoch": 0.7796447431589054,
2849
+ "grad_norm": 0.7856357851084043,
2850
+ "learning_rate": 9.90716728877102e-06,
2851
+ "loss": 1.4446,
2852
+ "step": 406
2853
+ },
2854
+ {
2855
+ "epoch": 0.7815650504080653,
2856
+ "grad_norm": 0.6391414313005859,
2857
+ "learning_rate": 9.905877543183776e-06,
2858
+ "loss": 1.3569,
2859
+ "step": 407
2860
+ },
2861
+ {
2862
+ "epoch": 0.7834853576572252,
2863
+ "grad_norm": 0.7168868905941123,
2864
+ "learning_rate": 9.904578985055151e-06,
2865
+ "loss": 1.3422,
2866
+ "step": 408
2867
+ },
2868
+ {
2869
+ "epoch": 0.785405664906385,
2870
+ "grad_norm": 0.7244557046923163,
2871
+ "learning_rate": 9.903271616717782e-06,
2872
+ "loss": 1.4439,
2873
+ "step": 409
2874
+ },
2875
+ {
2876
+ "epoch": 0.7873259721555449,
2877
+ "grad_norm": 0.7135679454347851,
2878
+ "learning_rate": 9.901955440520121e-06,
2879
+ "loss": 1.417,
2880
+ "step": 410
2881
+ },
2882
+ {
2883
+ "epoch": 0.7892462794047047,
2884
+ "grad_norm": 0.6975305523738247,
2885
+ "learning_rate": 9.900630458826443e-06,
2886
+ "loss": 1.2732,
2887
+ "step": 411
2888
+ },
2889
+ {
2890
+ "epoch": 0.7911665866538646,
2891
+ "grad_norm": 0.6844791536520864,
2892
+ "learning_rate": 9.89929667401685e-06,
2893
+ "loss": 1.1994,
2894
+ "step": 412
2895
+ },
2896
+ {
2897
+ "epoch": 0.7930868939030244,
2898
+ "grad_norm": 0.6995208409953875,
2899
+ "learning_rate": 9.897954088487245e-06,
2900
+ "loss": 1.44,
2901
+ "step": 413
2902
+ },
2903
+ {
2904
+ "epoch": 0.7950072011521844,
2905
+ "grad_norm": 0.6664160171541003,
2906
+ "learning_rate": 9.896602704649348e-06,
2907
+ "loss": 1.3604,
2908
+ "step": 414
2909
+ },
2910
+ {
2911
+ "epoch": 0.7969275084013442,
2912
+ "grad_norm": 0.6554390013099766,
2913
+ "learning_rate": 9.89524252493068e-06,
2914
+ "loss": 1.3002,
2915
+ "step": 415
2916
+ },
2917
+ {
2918
+ "epoch": 0.7988478156505041,
2919
+ "grad_norm": 0.7714848495681179,
2920
+ "learning_rate": 9.893873551774561e-06,
2921
+ "loss": 1.4559,
2922
+ "step": 416
2923
+ },
2924
+ {
2925
+ "epoch": 0.8007681228996639,
2926
+ "grad_norm": 0.684531285979124,
2927
+ "learning_rate": 9.892495787640117e-06,
2928
+ "loss": 1.4116,
2929
+ "step": 417
2930
+ },
2931
+ {
2932
+ "epoch": 0.8026884301488239,
2933
+ "grad_norm": 0.625351185162249,
2934
+ "learning_rate": 9.891109235002248e-06,
2935
+ "loss": 1.2968,
2936
+ "step": 418
2937
+ },
2938
+ {
2939
+ "epoch": 0.8046087373979837,
2940
+ "grad_norm": 0.6072425157093212,
2941
+ "learning_rate": 9.889713896351658e-06,
2942
+ "loss": 1.2834,
2943
+ "step": 419
2944
+ },
2945
+ {
2946
+ "epoch": 0.8065290446471436,
2947
+ "grad_norm": 0.7557266979543664,
2948
+ "learning_rate": 9.888309774194822e-06,
2949
+ "loss": 1.2581,
2950
+ "step": 420
2951
+ },
2952
+ {
2953
+ "epoch": 0.8084493518963034,
2954
+ "grad_norm": 0.6948893024278046,
2955
+ "learning_rate": 9.886896871053996e-06,
2956
+ "loss": 1.3472,
2957
+ "step": 421
2958
+ },
2959
+ {
2960
+ "epoch": 0.8103696591454633,
2961
+ "grad_norm": 0.782279217584078,
2962
+ "learning_rate": 9.885475189467217e-06,
2963
+ "loss": 1.3546,
2964
+ "step": 422
2965
+ },
2966
+ {
2967
+ "epoch": 0.8122899663946231,
2968
+ "grad_norm": 0.7188760215338773,
2969
+ "learning_rate": 9.884044731988278e-06,
2970
+ "loss": 1.3683,
2971
+ "step": 423
2972
+ },
2973
+ {
2974
+ "epoch": 0.814210273643783,
2975
+ "grad_norm": 0.7215722020243497,
2976
+ "learning_rate": 9.882605501186747e-06,
2977
+ "loss": 1.2629,
2978
+ "step": 424
2979
+ },
2980
+ {
2981
+ "epoch": 0.8161305808929429,
2982
+ "grad_norm": 0.699083447265363,
2983
+ "learning_rate": 9.881157499647944e-06,
2984
+ "loss": 1.3218,
2985
+ "step": 425
2986
+ },
2987
+ {
2988
+ "epoch": 0.8180508881421027,
2989
+ "grad_norm": 0.724984065762376,
2990
+ "learning_rate": 9.87970072997295e-06,
2991
+ "loss": 1.3034,
2992
+ "step": 426
2993
+ },
2994
+ {
2995
+ "epoch": 0.8199711953912626,
2996
+ "grad_norm": 0.7049961948332424,
2997
+ "learning_rate": 9.878235194778594e-06,
2998
+ "loss": 1.4015,
2999
+ "step": 427
3000
+ },
3001
+ {
3002
+ "epoch": 0.8218915026404224,
3003
+ "grad_norm": 0.6961558656551843,
3004
+ "learning_rate": 9.87676089669745e-06,
3005
+ "loss": 1.3292,
3006
+ "step": 428
3007
+ },
3008
+ {
3009
+ "epoch": 0.8238118098895824,
3010
+ "grad_norm": 0.6755568609982437,
3011
+ "learning_rate": 9.875277838377835e-06,
3012
+ "loss": 1.2485,
3013
+ "step": 429
3014
+ },
3015
+ {
3016
+ "epoch": 0.8257321171387422,
3017
+ "grad_norm": 0.731506928442002,
3018
+ "learning_rate": 9.8737860224838e-06,
3019
+ "loss": 1.371,
3020
+ "step": 430
3021
+ },
3022
+ {
3023
+ "epoch": 0.8276524243879021,
3024
+ "grad_norm": 0.8321982922227138,
3025
+ "learning_rate": 9.872285451695128e-06,
3026
+ "loss": 1.3981,
3027
+ "step": 431
3028
+ },
3029
+ {
3030
+ "epoch": 0.8295727316370619,
3031
+ "grad_norm": 0.7315030508325402,
3032
+ "learning_rate": 9.87077612870733e-06,
3033
+ "loss": 1.3311,
3034
+ "step": 432
3035
+ },
3036
+ {
3037
+ "epoch": 0.8314930388862218,
3038
+ "grad_norm": 0.798773303498576,
3039
+ "learning_rate": 9.869258056231638e-06,
3040
+ "loss": 1.3727,
3041
+ "step": 433
3042
+ },
3043
+ {
3044
+ "epoch": 0.8334133461353816,
3045
+ "grad_norm": 0.651844540018506,
3046
+ "learning_rate": 9.867731236995e-06,
3047
+ "loss": 1.3471,
3048
+ "step": 434
3049
+ },
3050
+ {
3051
+ "epoch": 0.8353336533845416,
3052
+ "grad_norm": 0.6771670988304741,
3053
+ "learning_rate": 9.866195673740076e-06,
3054
+ "loss": 1.3032,
3055
+ "step": 435
3056
+ },
3057
+ {
3058
+ "epoch": 0.8372539606337014,
3059
+ "grad_norm": 0.8611651792236157,
3060
+ "learning_rate": 9.864651369225236e-06,
3061
+ "loss": 1.2559,
3062
+ "step": 436
3063
+ },
3064
+ {
3065
+ "epoch": 0.8391742678828612,
3066
+ "grad_norm": 0.7436061953882284,
3067
+ "learning_rate": 9.863098326224546e-06,
3068
+ "loss": 1.3166,
3069
+ "step": 437
3070
+ },
3071
+ {
3072
+ "epoch": 0.8410945751320211,
3073
+ "grad_norm": 0.7409544469403813,
3074
+ "learning_rate": 9.86153654752778e-06,
3075
+ "loss": 1.4249,
3076
+ "step": 438
3077
+ },
3078
+ {
3079
+ "epoch": 0.8430148823811809,
3080
+ "grad_norm": 0.7184845856939001,
3081
+ "learning_rate": 9.859966035940391e-06,
3082
+ "loss": 1.3899,
3083
+ "step": 439
3084
+ },
3085
+ {
3086
+ "epoch": 0.8449351896303409,
3087
+ "grad_norm": 0.7569549756216626,
3088
+ "learning_rate": 9.858386794283527e-06,
3089
+ "loss": 1.4622,
3090
+ "step": 440
3091
+ },
3092
+ {
3093
+ "epoch": 0.8468554968795007,
3094
+ "grad_norm": 0.7230751877755235,
3095
+ "learning_rate": 9.856798825394017e-06,
3096
+ "loss": 1.3834,
3097
+ "step": 441
3098
+ },
3099
+ {
3100
+ "epoch": 0.8487758041286606,
3101
+ "grad_norm": 0.7861385241652444,
3102
+ "learning_rate": 9.855202132124367e-06,
3103
+ "loss": 1.4005,
3104
+ "step": 442
3105
+ },
3106
+ {
3107
+ "epoch": 0.8506961113778204,
3108
+ "grad_norm": 0.654961628331442,
3109
+ "learning_rate": 9.853596717342751e-06,
3110
+ "loss": 1.2536,
3111
+ "step": 443
3112
+ },
3113
+ {
3114
+ "epoch": 0.8526164186269803,
3115
+ "grad_norm": 0.7338664793979522,
3116
+ "learning_rate": 9.851982583933015e-06,
3117
+ "loss": 1.4289,
3118
+ "step": 444
3119
+ },
3120
+ {
3121
+ "epoch": 0.8545367258761402,
3122
+ "grad_norm": 0.647102767057043,
3123
+ "learning_rate": 9.850359734794664e-06,
3124
+ "loss": 1.3167,
3125
+ "step": 445
3126
+ },
3127
+ {
3128
+ "epoch": 0.8564570331253001,
3129
+ "grad_norm": 0.7940838292459027,
3130
+ "learning_rate": 9.84872817284286e-06,
3131
+ "loss": 1.4604,
3132
+ "step": 446
3133
+ },
3134
+ {
3135
+ "epoch": 0.8583773403744599,
3136
+ "grad_norm": 0.7447428727236874,
3137
+ "learning_rate": 9.847087901008415e-06,
3138
+ "loss": 1.392,
3139
+ "step": 447
3140
+ },
3141
+ {
3142
+ "epoch": 0.8602976476236198,
3143
+ "grad_norm": 0.7643508165383381,
3144
+ "learning_rate": 9.845438922237787e-06,
3145
+ "loss": 1.3017,
3146
+ "step": 448
3147
+ },
3148
+ {
3149
+ "epoch": 0.8622179548727796,
3150
+ "grad_norm": 0.7617962346454569,
3151
+ "learning_rate": 9.843781239493076e-06,
3152
+ "loss": 1.6087,
3153
+ "step": 449
3154
+ },
3155
+ {
3156
+ "epoch": 0.8641382621219396,
3157
+ "grad_norm": 0.7385042271210234,
3158
+ "learning_rate": 9.842114855752013e-06,
3159
+ "loss": 1.287,
3160
+ "step": 450
3161
+ },
3162
+ {
3163
+ "epoch": 0.8660585693710994,
3164
+ "grad_norm": 0.7904769194673538,
3165
+ "learning_rate": 9.840439774007963e-06,
3166
+ "loss": 1.3847,
3167
+ "step": 451
3168
+ },
3169
+ {
3170
+ "epoch": 0.8679788766202592,
3171
+ "grad_norm": 0.7796917727237478,
3172
+ "learning_rate": 9.838755997269917e-06,
3173
+ "loss": 1.4052,
3174
+ "step": 452
3175
+ },
3176
+ {
3177
+ "epoch": 0.8698991838694191,
3178
+ "grad_norm": 0.6685557701211076,
3179
+ "learning_rate": 9.837063528562479e-06,
3180
+ "loss": 1.2191,
3181
+ "step": 453
3182
+ },
3183
+ {
3184
+ "epoch": 0.8718194911185789,
3185
+ "grad_norm": 0.682007015556512,
3186
+ "learning_rate": 9.835362370925868e-06,
3187
+ "loss": 1.4041,
3188
+ "step": 454
3189
+ },
3190
+ {
3191
+ "epoch": 0.8737397983677389,
3192
+ "grad_norm": 0.6809420760471568,
3193
+ "learning_rate": 9.833652527415918e-06,
3194
+ "loss": 1.1179,
3195
+ "step": 455
3196
+ },
3197
+ {
3198
+ "epoch": 0.8756601056168987,
3199
+ "grad_norm": 0.7496451496119366,
3200
+ "learning_rate": 9.831934001104056e-06,
3201
+ "loss": 1.1863,
3202
+ "step": 456
3203
+ },
3204
+ {
3205
+ "epoch": 0.8775804128660586,
3206
+ "grad_norm": 0.7958820882337777,
3207
+ "learning_rate": 9.830206795077313e-06,
3208
+ "loss": 1.4097,
3209
+ "step": 457
3210
+ },
3211
+ {
3212
+ "epoch": 0.8795007201152184,
3213
+ "grad_norm": 0.7760893359826682,
3214
+ "learning_rate": 9.828470912438308e-06,
3215
+ "loss": 1.4765,
3216
+ "step": 458
3217
+ },
3218
+ {
3219
+ "epoch": 0.8814210273643783,
3220
+ "grad_norm": 0.7181251163054755,
3221
+ "learning_rate": 9.826726356305248e-06,
3222
+ "loss": 1.2336,
3223
+ "step": 459
3224
+ },
3225
+ {
3226
+ "epoch": 0.8833413346135381,
3227
+ "grad_norm": 0.7130113363618711,
3228
+ "learning_rate": 9.824973129811919e-06,
3229
+ "loss": 1.3356,
3230
+ "step": 460
3231
+ },
3232
+ {
3233
+ "epoch": 0.8852616418626981,
3234
+ "grad_norm": 0.6976783021258673,
3235
+ "learning_rate": 9.823211236107684e-06,
3236
+ "loss": 1.5375,
3237
+ "step": 461
3238
+ },
3239
+ {
3240
+ "epoch": 0.8871819491118579,
3241
+ "grad_norm": 0.6494482314881563,
3242
+ "learning_rate": 9.82144067835747e-06,
3243
+ "loss": 1.4216,
3244
+ "step": 462
3245
+ },
3246
+ {
3247
+ "epoch": 0.8891022563610178,
3248
+ "grad_norm": 0.6799368531582445,
3249
+ "learning_rate": 9.819661459741774e-06,
3250
+ "loss": 1.2607,
3251
+ "step": 463
3252
+ },
3253
+ {
3254
+ "epoch": 0.8910225636101776,
3255
+ "grad_norm": 0.7200924252996468,
3256
+ "learning_rate": 9.817873583456646e-06,
3257
+ "loss": 1.3954,
3258
+ "step": 464
3259
+ },
3260
+ {
3261
+ "epoch": 0.8929428708593375,
3262
+ "grad_norm": 0.723830426362561,
3263
+ "learning_rate": 9.816077052713689e-06,
3264
+ "loss": 1.2634,
3265
+ "step": 465
3266
+ },
3267
+ {
3268
+ "epoch": 0.8948631781084974,
3269
+ "grad_norm": 0.6795402172591166,
3270
+ "learning_rate": 9.814271870740054e-06,
3271
+ "loss": 1.288,
3272
+ "step": 466
3273
+ },
3274
+ {
3275
+ "epoch": 0.8967834853576572,
3276
+ "grad_norm": 0.7798610485610813,
3277
+ "learning_rate": 9.812458040778433e-06,
3278
+ "loss": 1.3816,
3279
+ "step": 467
3280
+ },
3281
+ {
3282
+ "epoch": 0.8987037926068171,
3283
+ "grad_norm": 0.6598552167407624,
3284
+ "learning_rate": 9.810635566087046e-06,
3285
+ "loss": 1.3142,
3286
+ "step": 468
3287
+ },
3288
+ {
3289
+ "epoch": 0.9006240998559769,
3290
+ "grad_norm": 0.8267440234447042,
3291
+ "learning_rate": 9.808804449939649e-06,
3292
+ "loss": 1.3952,
3293
+ "step": 469
3294
+ },
3295
+ {
3296
+ "epoch": 0.9025444071051368,
3297
+ "grad_norm": 0.6831251782753334,
3298
+ "learning_rate": 9.806964695625521e-06,
3299
+ "loss": 1.3507,
3300
+ "step": 470
3301
+ },
3302
+ {
3303
+ "epoch": 0.9044647143542967,
3304
+ "grad_norm": 0.6913550521559437,
3305
+ "learning_rate": 9.80511630644945e-06,
3306
+ "loss": 1.3858,
3307
+ "step": 471
3308
+ },
3309
+ {
3310
+ "epoch": 0.9063850216034566,
3311
+ "grad_norm": 0.651357091385134,
3312
+ "learning_rate": 9.803259285731744e-06,
3313
+ "loss": 1.3119,
3314
+ "step": 472
3315
+ },
3316
+ {
3317
+ "epoch": 0.9083053288526164,
3318
+ "grad_norm": 0.6876771805281661,
3319
+ "learning_rate": 9.801393636808213e-06,
3320
+ "loss": 1.405,
3321
+ "step": 473
3322
+ },
3323
+ {
3324
+ "epoch": 0.9102256361017763,
3325
+ "grad_norm": 0.6704161705700665,
3326
+ "learning_rate": 9.79951936303016e-06,
3327
+ "loss": 1.1645,
3328
+ "step": 474
3329
+ },
3330
+ {
3331
+ "epoch": 0.9121459433509361,
3332
+ "grad_norm": 0.8403757549868232,
3333
+ "learning_rate": 9.797636467764392e-06,
3334
+ "loss": 1.3374,
3335
+ "step": 475
3336
+ },
3337
+ {
3338
+ "epoch": 0.914066250600096,
3339
+ "grad_norm": 0.6976996239643926,
3340
+ "learning_rate": 9.795744954393193e-06,
3341
+ "loss": 1.2789,
3342
+ "step": 476
3343
+ },
3344
+ {
3345
+ "epoch": 0.9159865578492559,
3346
+ "grad_norm": 0.7007105159698541,
3347
+ "learning_rate": 9.793844826314338e-06,
3348
+ "loss": 1.2513,
3349
+ "step": 477
3350
+ },
3351
+ {
3352
+ "epoch": 0.9179068650984158,
3353
+ "grad_norm": 0.8046443692914484,
3354
+ "learning_rate": 9.791936086941065e-06,
3355
+ "loss": 1.4276,
3356
+ "step": 478
3357
+ },
3358
+ {
3359
+ "epoch": 0.9198271723475756,
3360
+ "grad_norm": 0.6689604084398844,
3361
+ "learning_rate": 9.790018739702091e-06,
3362
+ "loss": 1.1329,
3363
+ "step": 479
3364
+ },
3365
+ {
3366
+ "epoch": 0.9217474795967355,
3367
+ "grad_norm": 0.7418530237185074,
3368
+ "learning_rate": 9.788092788041589e-06,
3369
+ "loss": 1.2312,
3370
+ "step": 480
3371
+ },
3372
+ {
3373
+ "epoch": 0.9236677868458953,
3374
+ "grad_norm": 0.7344158824384261,
3375
+ "learning_rate": 9.78615823541919e-06,
3376
+ "loss": 1.5327,
3377
+ "step": 481
3378
+ },
3379
+ {
3380
+ "epoch": 0.9255880940950552,
3381
+ "grad_norm": 0.7029451657520306,
3382
+ "learning_rate": 9.784215085309977e-06,
3383
+ "loss": 1.3297,
3384
+ "step": 482
3385
+ },
3386
+ {
3387
+ "epoch": 0.9275084013442151,
3388
+ "grad_norm": 0.8107964882673727,
3389
+ "learning_rate": 9.782263341204477e-06,
3390
+ "loss": 1.2561,
3391
+ "step": 483
3392
+ },
3393
+ {
3394
+ "epoch": 0.9294287085933749,
3395
+ "grad_norm": 0.7114545290156662,
3396
+ "learning_rate": 9.78030300660865e-06,
3397
+ "loss": 1.3645,
3398
+ "step": 484
3399
+ },
3400
+ {
3401
+ "epoch": 0.9313490158425348,
3402
+ "grad_norm": 0.7402003366232237,
3403
+ "learning_rate": 9.77833408504389e-06,
3404
+ "loss": 1.3642,
3405
+ "step": 485
3406
+ },
3407
+ {
3408
+ "epoch": 0.9332693230916946,
3409
+ "grad_norm": 0.7109408774118504,
3410
+ "learning_rate": 9.77635658004702e-06,
3411
+ "loss": 1.3221,
3412
+ "step": 486
3413
+ },
3414
+ {
3415
+ "epoch": 0.9351896303408546,
3416
+ "grad_norm": 0.7433358040489166,
3417
+ "learning_rate": 9.774370495170276e-06,
3418
+ "loss": 1.4449,
3419
+ "step": 487
3420
+ },
3421
+ {
3422
+ "epoch": 0.9371099375900144,
3423
+ "grad_norm": 0.6785055655567391,
3424
+ "learning_rate": 9.772375833981306e-06,
3425
+ "loss": 1.3555,
3426
+ "step": 488
3427
+ },
3428
+ {
3429
+ "epoch": 0.9390302448391743,
3430
+ "grad_norm": 0.76870851128488,
3431
+ "learning_rate": 9.770372600063172e-06,
3432
+ "loss": 1.284,
3433
+ "step": 489
3434
+ },
3435
+ {
3436
+ "epoch": 0.9409505520883341,
3437
+ "grad_norm": 0.7344357851176699,
3438
+ "learning_rate": 9.768360797014325e-06,
3439
+ "loss": 1.2853,
3440
+ "step": 490
3441
+ },
3442
+ {
3443
+ "epoch": 0.942870859337494,
3444
+ "grad_norm": 0.8470942465410728,
3445
+ "learning_rate": 9.766340428448614e-06,
3446
+ "loss": 1.3829,
3447
+ "step": 491
3448
+ },
3449
+ {
3450
+ "epoch": 0.9447911665866539,
3451
+ "grad_norm": 0.7211389944931649,
3452
+ "learning_rate": 9.764311497995272e-06,
3453
+ "loss": 1.2677,
3454
+ "step": 492
3455
+ },
3456
+ {
3457
+ "epoch": 0.9467114738358138,
3458
+ "grad_norm": 0.7084359929065828,
3459
+ "learning_rate": 9.762274009298918e-06,
3460
+ "loss": 1.2434,
3461
+ "step": 493
3462
+ },
3463
+ {
3464
+ "epoch": 0.9486317810849736,
3465
+ "grad_norm": 0.7689934246592068,
3466
+ "learning_rate": 9.760227966019537e-06,
3467
+ "loss": 1.4095,
3468
+ "step": 494
3469
+ },
3470
+ {
3471
+ "epoch": 0.9505520883341335,
3472
+ "grad_norm": 0.7773642092371199,
3473
+ "learning_rate": 9.758173371832485e-06,
3474
+ "loss": 1.3244,
3475
+ "step": 495
3476
+ },
3477
+ {
3478
+ "epoch": 0.9524723955832933,
3479
+ "grad_norm": 0.6978701658115153,
3480
+ "learning_rate": 9.756110230428476e-06,
3481
+ "loss": 1.2787,
3482
+ "step": 496
3483
+ },
3484
+ {
3485
+ "epoch": 0.9543927028324531,
3486
+ "grad_norm": 0.6910966359494893,
3487
+ "learning_rate": 9.75403854551358e-06,
3488
+ "loss": 1.3348,
3489
+ "step": 497
3490
+ },
3491
+ {
3492
+ "epoch": 0.9563130100816131,
3493
+ "grad_norm": 0.732636720833676,
3494
+ "learning_rate": 9.751958320809213e-06,
3495
+ "loss": 1.2403,
3496
+ "step": 498
3497
+ },
3498
+ {
3499
+ "epoch": 0.9582333173307729,
3500
+ "grad_norm": 0.7804889809056719,
3501
+ "learning_rate": 9.749869560052128e-06,
3502
+ "loss": 1.1905,
3503
+ "step": 499
3504
+ },
3505
+ {
3506
+ "epoch": 0.9601536245799328,
3507
+ "grad_norm": 0.7286628977028098,
3508
+ "learning_rate": 9.747772266994418e-06,
3509
+ "loss": 1.3252,
3510
+ "step": 500
3511
+ },
3512
+ {
3513
+ "epoch": 0.9620739318290926,
3514
+ "grad_norm": 0.730360159535326,
3515
+ "learning_rate": 9.745666445403496e-06,
3516
+ "loss": 1.4712,
3517
+ "step": 501
3518
+ },
3519
+ {
3520
+ "epoch": 0.9639942390782525,
3521
+ "grad_norm": 0.6650898577066633,
3522
+ "learning_rate": 9.7435520990621e-06,
3523
+ "loss": 1.2945,
3524
+ "step": 502
3525
+ },
3526
+ {
3527
+ "epoch": 0.9659145463274124,
3528
+ "grad_norm": 0.6813965501305161,
3529
+ "learning_rate": 9.741429231768278e-06,
3530
+ "loss": 1.3214,
3531
+ "step": 503
3532
+ },
3533
+ {
3534
+ "epoch": 0.9678348535765723,
3535
+ "grad_norm": 0.8240692929170976,
3536
+ "learning_rate": 9.739297847335387e-06,
3537
+ "loss": 1.4367,
3538
+ "step": 504
3539
+ },
3540
+ {
3541
+ "epoch": 0.9697551608257321,
3542
+ "grad_norm": 0.7664659172540482,
3543
+ "learning_rate": 9.73715794959208e-06,
3544
+ "loss": 1.2429,
3545
+ "step": 505
3546
+ },
3547
+ {
3548
+ "epoch": 0.971675468074892,
3549
+ "grad_norm": 0.663273604561841,
3550
+ "learning_rate": 9.735009542382308e-06,
3551
+ "loss": 1.2678,
3552
+ "step": 506
3553
+ },
3554
+ {
3555
+ "epoch": 0.9735957753240518,
3556
+ "grad_norm": 0.7286317666999398,
3557
+ "learning_rate": 9.732852629565302e-06,
3558
+ "loss": 1.351,
3559
+ "step": 507
3560
+ },
3561
+ {
3562
+ "epoch": 0.9755160825732118,
3563
+ "grad_norm": 0.7222364516570275,
3564
+ "learning_rate": 9.730687215015576e-06,
3565
+ "loss": 1.3875,
3566
+ "step": 508
3567
+ },
3568
+ {
3569
+ "epoch": 0.9774363898223716,
3570
+ "grad_norm": 0.792789498600007,
3571
+ "learning_rate": 9.728513302622911e-06,
3572
+ "loss": 1.4158,
3573
+ "step": 509
3574
+ },
3575
+ {
3576
+ "epoch": 0.9793566970715314,
3577
+ "grad_norm": 0.6898048543889689,
3578
+ "learning_rate": 9.72633089629236e-06,
3579
+ "loss": 1.3018,
3580
+ "step": 510
3581
+ },
3582
+ {
3583
+ "epoch": 0.9812770043206913,
3584
+ "grad_norm": 0.7080789810250435,
3585
+ "learning_rate": 9.72413999994423e-06,
3586
+ "loss": 1.2951,
3587
+ "step": 511
3588
+ },
3589
+ {
3590
+ "epoch": 0.9831973115698511,
3591
+ "grad_norm": 0.6471793883594157,
3592
+ "learning_rate": 9.721940617514076e-06,
3593
+ "loss": 1.1768,
3594
+ "step": 512
3595
+ },
3596
+ {
3597
+ "epoch": 0.985117618819011,
3598
+ "grad_norm": 0.6848848680839071,
3599
+ "learning_rate": 9.719732752952702e-06,
3600
+ "loss": 1.262,
3601
+ "step": 513
3602
+ },
3603
+ {
3604
+ "epoch": 0.9870379260681709,
3605
+ "grad_norm": 0.7903965882462866,
3606
+ "learning_rate": 9.717516410226144e-06,
3607
+ "loss": 1.4717,
3608
+ "step": 514
3609
+ },
3610
+ {
3611
+ "epoch": 0.9889582333173308,
3612
+ "grad_norm": 0.7404310033314039,
3613
+ "learning_rate": 9.715291593315672e-06,
3614
+ "loss": 1.3879,
3615
+ "step": 515
3616
+ },
3617
+ {
3618
+ "epoch": 0.9908785405664906,
3619
+ "grad_norm": 0.735452133325044,
3620
+ "learning_rate": 9.713058306217776e-06,
3621
+ "loss": 1.3079,
3622
+ "step": 516
3623
+ },
3624
+ {
3625
+ "epoch": 0.9927988478156505,
3626
+ "grad_norm": 0.8130352152653534,
3627
+ "learning_rate": 9.710816552944157e-06,
3628
+ "loss": 1.434,
3629
+ "step": 517
3630
+ },
3631
+ {
3632
+ "epoch": 0.9947191550648103,
3633
+ "grad_norm": 0.7502971580652452,
3634
+ "learning_rate": 9.708566337521736e-06,
3635
+ "loss": 1.3013,
3636
+ "step": 518
3637
+ },
3638
+ {
3639
+ "epoch": 0.9966394623139703,
3640
+ "grad_norm": 0.6582057806093718,
3641
+ "learning_rate": 9.70630766399262e-06,
3642
+ "loss": 1.2994,
3643
+ "step": 519
3644
+ },
3645
+ {
3646
+ "epoch": 0.9985597695631301,
3647
+ "grad_norm": 0.7398007707770013,
3648
+ "learning_rate": 9.70404053641412e-06,
3649
+ "loss": 1.3135,
3650
+ "step": 520
3651
+ },
3652
+ {
3653
+ "epoch": 1.0,
3654
+ "grad_norm": 0.7398007707770013,
3655
+ "learning_rate": 9.701764958858729e-06,
3656
+ "loss": 1.1265,
3657
+ "step": 521
3658
+ }
3659
+ ],
3660
+ "logging_steps": 1,
3661
+ "max_steps": 2605,
3662
+ "num_input_tokens_seen": 0,
3663
+ "num_train_epochs": 5,
3664
+ "save_steps": 500,
3665
+ "stateful_callbacks": {
3666
+ "TrainerControl": {
3667
+ "args": {
3668
+ "should_epoch_stop": false,
3669
+ "should_evaluate": false,
3670
+ "should_log": false,
3671
+ "should_save": true,
3672
+ "should_training_stop": false
3673
+ },
3674
+ "attributes": {}
3675
+ }
3676
+ },
3677
+ "total_flos": 90367657066496.0,
3678
+ "train_batch_size": 1,
3679
+ "trial_name": null,
3680
+ "trial_params": null
3681
+ }
checkpoint-521/vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-521/zero_to_fp32.py ADDED
@@ -0,0 +1,760 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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:
14
+ # python zero_to_fp32.py . output_dir/
15
+ # or
16
+ # python zero_to_fp32.py . output_dir/ --safe_serialization
17
+
18
+ import argparse
19
+ import torch
20
+ import glob
21
+ import math
22
+ import os
23
+ import re
24
+ import gc
25
+ import json
26
+ import numpy as np
27
+ from tqdm import tqdm
28
+ from collections import OrderedDict
29
+ from dataclasses import dataclass
30
+
31
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
32
+ # DeepSpeed data structures it has to be available in the current python environment.
33
+ from deepspeed.utils import logger
34
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
35
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
36
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
37
+
38
+
39
+ @dataclass
40
+ class zero_model_state:
41
+ buffers: dict()
42
+ param_shapes: dict()
43
+ shared_params: list
44
+ ds_version: int
45
+ frozen_param_shapes: dict()
46
+ frozen_param_fragments: dict()
47
+
48
+
49
+ debug = 0
50
+
51
+ # load to cpu
52
+ device = torch.device('cpu')
53
+
54
+
55
+ def atoi(text):
56
+ return int(text) if text.isdigit() else text
57
+
58
+
59
+ def natural_keys(text):
60
+ '''
61
+ alist.sort(key=natural_keys) sorts in human order
62
+ http://nedbatchelder.com/blog/200712/human_sorting.html
63
+ (See Toothy's implementation in the comments)
64
+ '''
65
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
66
+
67
+
68
+ def get_model_state_file(checkpoint_dir, zero_stage):
69
+ if not os.path.isdir(checkpoint_dir):
70
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
71
+
72
+ # there should be only one file
73
+ if zero_stage <= 2:
74
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
75
+ elif zero_stage == 3:
76
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
77
+
78
+ if not os.path.exists(file):
79
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
80
+
81
+ return file
82
+
83
+
84
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
85
+ # XXX: need to test that this simple glob rule works for multi-node setup too
86
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
87
+
88
+ if len(ckpt_files) == 0:
89
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
90
+
91
+ return ckpt_files
92
+
93
+
94
+ def get_optim_files(checkpoint_dir):
95
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
96
+
97
+
98
+ def get_model_state_files(checkpoint_dir):
99
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
100
+
101
+
102
+ def parse_model_states(files):
103
+ zero_model_states = []
104
+ for file in files:
105
+ state_dict = torch.load(file, map_location=device, weights_only=False)
106
+
107
+ if BUFFER_NAMES not in state_dict:
108
+ raise ValueError(f"{file} is not a model state checkpoint")
109
+ buffer_names = state_dict[BUFFER_NAMES]
110
+ if debug:
111
+ print("Found buffers:", buffer_names)
112
+
113
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
114
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
115
+ param_shapes = state_dict[PARAM_SHAPES]
116
+
117
+ # collect parameters that are included in param_shapes
118
+ param_names = []
119
+ for s in param_shapes:
120
+ for name in s.keys():
121
+ param_names.append(name)
122
+
123
+ # update with frozen parameters
124
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
125
+ if frozen_param_shapes is not None:
126
+ if debug:
127
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
128
+ param_names += list(frozen_param_shapes.keys())
129
+
130
+ # handle shared params
131
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
132
+
133
+ ds_version = state_dict.get(DS_VERSION, None)
134
+
135
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
136
+
137
+ z_model_state = zero_model_state(buffers=buffers,
138
+ param_shapes=param_shapes,
139
+ shared_params=shared_params,
140
+ ds_version=ds_version,
141
+ frozen_param_shapes=frozen_param_shapes,
142
+ frozen_param_fragments=frozen_param_fragments)
143
+ zero_model_states.append(z_model_state)
144
+
145
+ return zero_model_states
146
+
147
+
148
+ def parse_optim_states(files, ds_checkpoint_dir):
149
+ total_files = len(files)
150
+ state_dicts = []
151
+ for f in tqdm(files, desc='Loading checkpoint shards'):
152
+ state_dict = torch.load(f, map_location=device, mmap=True, weights_only=False)
153
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
154
+ # and also handle the case where it was already removed by another helper script
155
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
156
+ state_dicts.append(state_dict)
157
+
158
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
159
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
160
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
161
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
162
+
163
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
164
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
165
+ # use the max of the partition_count to get the dp world_size.
166
+
167
+ if type(world_size) is list:
168
+ world_size = max(world_size)
169
+
170
+ if world_size != total_files:
171
+ raise ValueError(
172
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
173
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
174
+ )
175
+
176
+ # the groups are named differently in each stage
177
+ if zero_stage <= 2:
178
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
179
+ elif zero_stage == 3:
180
+ fp32_groups_key = FP32_FLAT_GROUPS
181
+ else:
182
+ raise ValueError(f"unknown zero stage {zero_stage}")
183
+
184
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
185
+ return zero_stage, world_size, fp32_flat_groups
186
+
187
+
188
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
189
+ """
190
+ Returns fp32 state_dict reconstructed from ds checkpoint
191
+
192
+ Args:
193
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
194
+
195
+ """
196
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
197
+
198
+ optim_files = get_optim_files(ds_checkpoint_dir)
199
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
200
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
201
+
202
+ model_files = get_model_state_files(ds_checkpoint_dir)
203
+
204
+ zero_model_states = parse_model_states(model_files)
205
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
206
+
207
+ if zero_stage <= 2:
208
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
209
+ exclude_frozen_parameters)
210
+ elif zero_stage == 3:
211
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
212
+ exclude_frozen_parameters)
213
+
214
+
215
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
216
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
217
+ return
218
+
219
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
220
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
221
+
222
+ if debug:
223
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
224
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
225
+
226
+ wanted_params = len(frozen_param_shapes)
227
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
228
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
229
+ print(f'Frozen params: Have {avail_numel} numels to process.')
230
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
231
+
232
+ total_params = 0
233
+ total_numel = 0
234
+ for name, shape in frozen_param_shapes.items():
235
+ total_params += 1
236
+ unpartitioned_numel = shape.numel()
237
+ total_numel += unpartitioned_numel
238
+
239
+ state_dict[name] = frozen_param_fragments[name]
240
+
241
+ if debug:
242
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
243
+
244
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
245
+
246
+
247
+ def _has_callable(obj, fn):
248
+ attr = getattr(obj, fn, None)
249
+ return callable(attr)
250
+
251
+
252
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
253
+ param_shapes = zero_model_states[0].param_shapes
254
+
255
+ # Reconstruction protocol:
256
+ #
257
+ # XXX: document this
258
+
259
+ if debug:
260
+ for i in range(world_size):
261
+ for j in range(len(fp32_flat_groups[0])):
262
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
263
+
264
+ # XXX: memory usage doubles here (zero2)
265
+ num_param_groups = len(fp32_flat_groups[0])
266
+ merged_single_partition_of_fp32_groups = []
267
+ for i in range(num_param_groups):
268
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
269
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
270
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
271
+ avail_numel = sum(
272
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
273
+
274
+ if debug:
275
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
276
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
277
+ # not asserting if there is a mismatch due to possible padding
278
+ print(f"Have {avail_numel} numels to process.")
279
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
280
+
281
+ # params
282
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
283
+ # out-of-core computing solution
284
+ total_numel = 0
285
+ total_params = 0
286
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
287
+ offset = 0
288
+ avail_numel = full_single_fp32_vector.numel()
289
+ for name, shape in shapes.items():
290
+
291
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
292
+ total_numel += unpartitioned_numel
293
+ total_params += 1
294
+
295
+ if debug:
296
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
297
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
298
+ offset += unpartitioned_numel
299
+
300
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
301
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
302
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
303
+ # live optimizer object, so we are checking that the numbers are within the right range
304
+ align_to = 2 * world_size
305
+
306
+ def zero2_align(x):
307
+ return align_to * math.ceil(x / align_to)
308
+
309
+ if debug:
310
+ print(f"original offset={offset}, avail_numel={avail_numel}")
311
+
312
+ offset = zero2_align(offset)
313
+ avail_numel = zero2_align(avail_numel)
314
+
315
+ if debug:
316
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
317
+
318
+ # Sanity check
319
+ if offset != avail_numel:
320
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
321
+
322
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
323
+
324
+
325
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
326
+ exclude_frozen_parameters):
327
+ state_dict = OrderedDict()
328
+
329
+ # buffers
330
+ buffers = zero_model_states[0].buffers
331
+ state_dict.update(buffers)
332
+ if debug:
333
+ print(f"added {len(buffers)} buffers")
334
+
335
+ if not exclude_frozen_parameters:
336
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
337
+
338
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
339
+
340
+ # recover shared parameters
341
+ for pair in zero_model_states[0].shared_params:
342
+ if pair[1] in state_dict:
343
+ state_dict[pair[0]] = state_dict[pair[1]]
344
+
345
+ return state_dict
346
+
347
+
348
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
349
+ remainder = unpartitioned_numel % world_size
350
+ padding_numel = (world_size - remainder) if remainder else 0
351
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
352
+ return partitioned_numel, padding_numel
353
+
354
+
355
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
356
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
357
+ return
358
+
359
+ if debug:
360
+ for i in range(world_size):
361
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
362
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
363
+
364
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
365
+ wanted_params = len(frozen_param_shapes)
366
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
367
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
368
+ print(f'Frozen params: Have {avail_numel} numels to process.')
369
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
370
+
371
+ total_params = 0
372
+ total_numel = 0
373
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
374
+ total_params += 1
375
+ unpartitioned_numel = shape.numel()
376
+ total_numel += unpartitioned_numel
377
+
378
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
379
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
380
+
381
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
382
+
383
+ if debug:
384
+ print(
385
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
386
+ )
387
+
388
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
389
+
390
+
391
+ class GatheredTensor:
392
+ """
393
+ A pseudo tensor that collects partitioned weights.
394
+ It is more memory efficient when there are multiple groups.
395
+ """
396
+
397
+ def __init__(self, flat_groups, flat_groups_offset, offset, partitioned_numel, shape):
398
+ self.flat_groups = flat_groups
399
+ self.flat_groups_offset = flat_groups_offset
400
+ self.offset = offset
401
+ self.partitioned_numel = partitioned_numel
402
+ self.shape = shape
403
+ self.dtype = self.flat_groups[0][0].dtype
404
+
405
+ def contiguous(self):
406
+ """
407
+ Merge partitioned weights from flat_groups into a single tensor.
408
+ """
409
+ end_idx = self.offset + self.partitioned_numel
410
+ world_size = len(self.flat_groups)
411
+ pad_flat_param_chunks = []
412
+
413
+ for rank_i in range(world_size):
414
+ # for each rank, we need to collect weights from related group/groups
415
+ flat_groups_at_rank_i = self.flat_groups[rank_i]
416
+ start_group_id = None
417
+ end_group_id = None
418
+ for group_id in range(len(self.flat_groups_offset)):
419
+ if self.flat_groups_offset[group_id] <= self.offset < self.flat_groups_offset[group_id + 1]:
420
+ start_group_id = group_id
421
+ if self.flat_groups_offset[group_id] < end_idx <= self.flat_groups_offset[group_id + 1]:
422
+ end_group_id = group_id
423
+ break
424
+ # collect weights from related group/groups
425
+ for group_id in range(start_group_id, end_group_id + 1):
426
+ flat_tensor = flat_groups_at_rank_i[group_id]
427
+ start_offset = self.offset - self.flat_groups_offset[group_id]
428
+ end_offset = min(end_idx, self.flat_groups_offset[group_id + 1]) - self.flat_groups_offset[group_id]
429
+ pad_flat_param_chunks.append(flat_tensor[start_offset:end_offset])
430
+
431
+ # collect weights from all ranks
432
+ pad_flat_param = torch.cat(pad_flat_param_chunks, dim=0)
433
+ param = pad_flat_param[:self.shape.numel()].view(self.shape).contiguous()
434
+ return param
435
+
436
+
437
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
438
+ param_shapes = zero_model_states[0].param_shapes
439
+ avail_numel = sum([flat_group.numel() for flat_group in fp32_flat_groups[0]]) * world_size
440
+
441
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
442
+ # param, re-consolidating each param, while dealing with padding if any
443
+
444
+ # merge list of dicts, preserving order
445
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
446
+
447
+ if debug:
448
+ for i in range(world_size):
449
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
450
+
451
+ wanted_params = len(param_shapes)
452
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
453
+ # not asserting if there is a mismatch due to possible padding
454
+ avail_numel = fp32_flat_groups[0].numel() * world_size
455
+ print(f"Trainable params: Have {avail_numel} numels to process.")
456
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
457
+
458
+ # params
459
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
460
+ # out-of-core computing solution
461
+ offset = 0
462
+ total_numel = 0
463
+ total_params = 0
464
+ flat_groups_offset = [0] + list(np.cumsum([flat_tensor.numel() for flat_tensor in fp32_flat_groups[0]]))
465
+ for name, shape in tqdm(param_shapes.items(), desc='Gathering sharded weights'):
466
+ unpartitioned_numel = shape.numel()
467
+ total_numel += unpartitioned_numel
468
+ total_params += 1
469
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
470
+
471
+ if debug:
472
+ print(
473
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
474
+ )
475
+
476
+ # memory efficient tensor
477
+ tensor = GatheredTensor(fp32_flat_groups, flat_groups_offset, offset, partitioned_numel, shape)
478
+ state_dict[name] = tensor
479
+ offset += partitioned_numel
480
+
481
+ offset *= world_size
482
+
483
+ # Sanity check
484
+ if offset != avail_numel:
485
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
486
+
487
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
488
+
489
+
490
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
491
+ exclude_frozen_parameters):
492
+ state_dict = OrderedDict()
493
+
494
+ # buffers
495
+ buffers = zero_model_states[0].buffers
496
+ state_dict.update(buffers)
497
+ if debug:
498
+ print(f"added {len(buffers)} buffers")
499
+
500
+ if not exclude_frozen_parameters:
501
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
502
+
503
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
504
+
505
+ # recover shared parameters
506
+ for pair in zero_model_states[0].shared_params:
507
+ if pair[1] in state_dict:
508
+ state_dict[pair[0]] = state_dict[pair[1]]
509
+
510
+ return state_dict
511
+
512
+
513
+ def to_torch_tensor(state_dict, return_empty_tensor=False):
514
+ """
515
+ Convert state_dict of GatheredTensor to torch tensor
516
+ """
517
+ torch_state_dict = {}
518
+ converted_tensors = {}
519
+ for name, tensor in state_dict.items():
520
+ tensor_id = id(tensor)
521
+ if tensor_id in converted_tensors: # shared tensors
522
+ shared_tensor = torch_state_dict[converted_tensors[tensor_id]]
523
+ torch_state_dict[name] = shared_tensor
524
+ else:
525
+ converted_tensors[tensor_id] = name
526
+ if return_empty_tensor:
527
+ torch_state_dict[name] = torch.empty(tensor.shape, dtype=tensor.dtype)
528
+ else:
529
+ torch_state_dict[name] = tensor.contiguous()
530
+ return torch_state_dict
531
+
532
+
533
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
534
+ tag=None,
535
+ exclude_frozen_parameters=False,
536
+ lazy_mode=False):
537
+ """
538
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
539
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
540
+ via a model hub.
541
+
542
+ Args:
543
+ - ``checkpoint_dir``: path to the desired checkpoint folder
544
+ - ``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``
545
+ - ``exclude_frozen_parameters``: exclude frozen parameters
546
+ - ``lazy_mode``: get state_dict in lazy mode. It returns a dict of pesduo tensor instead of torch tensor, which is more memory efficient.
547
+ Convert the pesduo tensor to torch tensor by ``.contiguous()``
548
+
549
+ Returns:
550
+ - pytorch ``state_dict``
551
+
552
+ A typical usage might be ::
553
+
554
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
555
+ # do the training and checkpoint saving
556
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
557
+ model = model.cpu() # move to cpu
558
+ model.load_state_dict(state_dict)
559
+ # submit to model hub or save the model to share with others
560
+
561
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
562
+ application. i.e. you will need to re-initialize the deepspeed engine, since
563
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
564
+
565
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
566
+
567
+ Note: the above usage may not work if your application doesn't have sufficient free CPU memory.
568
+ You may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
569
+ the checkpoint. Or you can load state_dict in lazy mode ::
570
+
571
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
572
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, lazy_mode=True) # not on cpu
573
+ for name, lazy_tensor in state_dict.item():
574
+ tensor = lazy_tensor.contiguous() # to cpu
575
+ print(name, tensor)
576
+ # del tensor to release memory if it no longer in use
577
+ """
578
+ if tag is None:
579
+ latest_path = os.path.join(checkpoint_dir, 'latest')
580
+ if os.path.isfile(latest_path):
581
+ with open(latest_path, 'r') as fd:
582
+ tag = fd.read().strip()
583
+ else:
584
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
585
+
586
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
587
+
588
+ if not os.path.isdir(ds_checkpoint_dir):
589
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
590
+
591
+ state_dict = _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
592
+ if lazy_mode:
593
+ return state_dict
594
+ else:
595
+ return to_torch_tensor(state_dict)
596
+
597
+
598
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
599
+ output_dir,
600
+ max_shard_size="5GB",
601
+ safe_serialization=False,
602
+ tag=None,
603
+ exclude_frozen_parameters=False):
604
+ """
605
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
606
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
607
+
608
+ Args:
609
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
610
+ - ``output_dir``: directory to the pytorch fp32 state_dict output files
611
+ - ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
612
+ - ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
613
+ - ``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``
614
+ - ``exclude_frozen_parameters``: exclude frozen parameters
615
+ """
616
+
617
+ # Dependency pre-check
618
+ if safe_serialization:
619
+ try:
620
+ from safetensors.torch import save_file
621
+ except ImportError:
622
+ print('If you want to use `safe_serialization`, please `pip install safetensors`')
623
+ raise
624
+ if max_shard_size is not None:
625
+ try:
626
+ from huggingface_hub import split_torch_state_dict_into_shards
627
+ except ImportError:
628
+ print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
629
+ raise
630
+
631
+ # Convert zero checkpoint to state_dict
632
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
633
+ tag,
634
+ exclude_frozen_parameters,
635
+ lazy_mode=True)
636
+
637
+ # Shard the model if it is too big.
638
+ weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
639
+ if max_shard_size is not None:
640
+ filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
641
+ # an memory-efficient approach for sharding
642
+ empty_state_dict = to_torch_tensor(state_dict, return_empty_tensor=True)
643
+ state_dict_split = split_torch_state_dict_into_shards(empty_state_dict,
644
+ filename_pattern=filename_pattern,
645
+ max_shard_size=max_shard_size)
646
+ else:
647
+ from collections import namedtuple
648
+ StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
649
+ state_dict_split = StateDictSplit(is_sharded=False,
650
+ filename_to_tensors={weights_name: list(state_dict.keys())})
651
+
652
+ # Save the model by shard
653
+ os.makedirs(output_dir, exist_ok=True)
654
+ filename_to_tensors = state_dict_split.filename_to_tensors.items()
655
+ for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
656
+ shard_state_dict = {tensor_name: state_dict[tensor_name] for tensor_name in tensors}
657
+ shard_state_dict = to_torch_tensor(shard_state_dict)
658
+ output_path = os.path.join(output_dir, shard_file)
659
+ if safe_serialization:
660
+ save_file(shard_state_dict, output_path, metadata={"format": "pt"})
661
+ else:
662
+ torch.save(shard_state_dict, output_path)
663
+ # release the memory of current shard
664
+ for tensor_name in list(shard_state_dict.keys()):
665
+ del state_dict[tensor_name]
666
+ del shard_state_dict[tensor_name]
667
+ del shard_state_dict
668
+ gc.collect()
669
+
670
+ # Save index if sharded
671
+ if state_dict_split.is_sharded:
672
+ index = {
673
+ "metadata": state_dict_split.metadata,
674
+ "weight_map": state_dict_split.tensor_to_filename,
675
+ }
676
+ save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
677
+ save_index_file = os.path.join(output_dir, save_index_file)
678
+ with open(save_index_file, "w", encoding="utf-8") as f:
679
+ content = json.dumps(index, indent=2, sort_keys=True) + "\n"
680
+ f.write(content)
681
+
682
+
683
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
684
+ """
685
+ 1. Put the provided model to cpu
686
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
687
+ 3. Load it into the provided model
688
+
689
+ Args:
690
+ - ``model``: the model object to update
691
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
692
+ - ``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``
693
+
694
+ Returns:
695
+ - ``model`: modified model
696
+
697
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
698
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
699
+ conveniently placed for you in the checkpoint folder.
700
+
701
+ A typical usage might be ::
702
+
703
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
704
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
705
+ # submit to model hub or save the model to share with others
706
+
707
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
708
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
709
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
710
+
711
+ """
712
+ logger.info(f"Extracting fp32 weights")
713
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
714
+
715
+ logger.info(f"Overwriting model with fp32 weights")
716
+ model = model.cpu()
717
+ model.load_state_dict(state_dict, strict=False)
718
+
719
+ return model
720
+
721
+
722
+ if __name__ == "__main__":
723
+ parser = argparse.ArgumentParser()
724
+ parser.add_argument("checkpoint_dir",
725
+ type=str,
726
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
727
+ parser.add_argument("output_dir",
728
+ type=str,
729
+ help="directory to the pytorch fp32 state_dict output files"
730
+ "(e.g. path/checkpoint-12-output/)")
731
+ parser.add_argument(
732
+ "--max_shard_size",
733
+ type=str,
734
+ default="5GB",
735
+ help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
736
+ "lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
737
+ "We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
738
+ "without CPU OOM issues.")
739
+ parser.add_argument(
740
+ "--safe_serialization",
741
+ default=False,
742
+ action='store_true',
743
+ help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
744
+ parser.add_argument("-t",
745
+ "--tag",
746
+ type=str,
747
+ default=None,
748
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
749
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
750
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
751
+ args = parser.parse_args()
752
+
753
+ debug = args.debug
754
+
755
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
756
+ args.output_dir,
757
+ max_shard_size=args.max_shard_size,
758
+ safe_serialization=args.safe_serialization,
759
+ tag=args.tag,
760
+ exclude_frozen_parameters=args.exclude_frozen_parameters)
config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen2ForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "bos_token_id": 151643,
7
+ "eos_token_id": 151645,
8
+ "hidden_act": "silu",
9
+ "hidden_size": 1536,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 8960,
12
+ "max_position_embeddings": 32768,
13
+ "max_window_layers": 21,
14
+ "model_type": "qwen2",
15
+ "num_attention_heads": 12,
16
+ "num_hidden_layers": 28,
17
+ "num_key_value_heads": 2,
18
+ "rms_norm_eps": 1e-06,
19
+ "rope_scaling": null,
20
+ "rope_theta": 1000000.0,
21
+ "sliding_window": 32768,
22
+ "tie_word_embeddings": true,
23
+ "torch_dtype": "bfloat16",
24
+ "transformers_version": "4.52.4",
25
+ "use_cache": false,
26
+ "use_sliding_window": false,
27
+ "vocab_size": 151936
28
+ }
generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "repetition_penalty": 1.1,
10
+ "temperature": 0.7,
11
+ "top_k": 20,
12
+ "top_p": 0.8,
13
+ "transformers_version": "4.52.4"
14
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
special_tokens_map.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|im_end|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": {
25
+ "content": "<|endoftext|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ }
31
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ }
181
+ },
182
+ "additional_special_tokens": [
183
+ "<|im_start|>",
184
+ "<|im_end|>",
185
+ "<|object_ref_start|>",
186
+ "<|object_ref_end|>",
187
+ "<|box_start|>",
188
+ "<|box_end|>",
189
+ "<|quad_start|>",
190
+ "<|quad_end|>",
191
+ "<|vision_start|>",
192
+ "<|vision_end|>",
193
+ "<|vision_pad|>",
194
+ "<|image_pad|>",
195
+ "<|video_pad|>"
196
+ ],
197
+ "bos_token": null,
198
+ "clean_up_tokenization_spaces": false,
199
+ "eos_token": "<|im_end|>",
200
+ "errors": "replace",
201
+ "extra_special_tokens": {},
202
+ "model_max_length": 131072,
203
+ "pad_token": "<|endoftext|>",
204
+ "padding_side": "right",
205
+ "split_special_tokens": false,
206
+ "tokenizer_class": "Qwen2Tokenizer",
207
+ "unk_token": null
208
+ }
train_results.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 5.0,
3
+ "total_flos": 451881746563072.0,
4
+ "train_loss": 1.2663256504714147,
5
+ "train_runtime": 105590.0324,
6
+ "train_samples_per_second": 0.394,
7
+ "train_steps_per_second": 0.025
8
+ }
trainer_log.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
trainer_state.json ADDED
The diff for this file is too large to render. See raw diff
 
training_loss.png ADDED
vocab.json ADDED
The diff for this file is too large to render. See raw diff