trapoom555 commited on
Commit
f14ec11
1 Parent(s): 4e4a281

Upload checkpoints

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .DS_Store +0 -0
  2. adapter_config.json +29 -0
  3. adapter_model.safetensors +3 -0
  4. checkpoints/.DS_Store +0 -0
  5. checkpoints/checkpoint-1000/README.md +202 -0
  6. checkpoints/checkpoint-1000/adapter_config.json +29 -0
  7. checkpoints/checkpoint-1000/adapter_model.safetensors +3 -0
  8. checkpoints/checkpoint-1000/global_step1000/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt +3 -0
  9. checkpoints/checkpoint-1000/global_step1000/zero_pp_rank_0_mp_rank_00_model_states.pt +3 -0
  10. checkpoints/checkpoint-1000/latest +1 -0
  11. checkpoints/checkpoint-1000/rng_state.pth +3 -0
  12. checkpoints/checkpoint-1000/scheduler.pt +3 -0
  13. checkpoints/checkpoint-1000/special_tokens_map.json +24 -0
  14. checkpoints/checkpoint-1000/tokenizer.json +0 -0
  15. checkpoints/checkpoint-1000/tokenizer_config.json +42 -0
  16. checkpoints/checkpoint-1000/trainer_state.json +737 -0
  17. checkpoints/checkpoint-1000/training_args.bin +3 -0
  18. checkpoints/checkpoint-1000/zero_to_fp32.py +604 -0
  19. checkpoints/checkpoint-1500/README.md +202 -0
  20. checkpoints/checkpoint-1500/adapter_config.json +29 -0
  21. checkpoints/checkpoint-1500/adapter_model.safetensors +3 -0
  22. checkpoints/checkpoint-1500/global_step1500/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt +3 -0
  23. checkpoints/checkpoint-1500/global_step1500/zero_pp_rank_0_mp_rank_00_model_states.pt +3 -0
  24. checkpoints/checkpoint-1500/latest +1 -0
  25. checkpoints/checkpoint-1500/rng_state.pth +3 -0
  26. checkpoints/checkpoint-1500/scheduler.pt +3 -0
  27. checkpoints/checkpoint-1500/special_tokens_map.json +24 -0
  28. checkpoints/checkpoint-1500/tokenizer.json +0 -0
  29. checkpoints/checkpoint-1500/tokenizer_config.json +42 -0
  30. checkpoints/checkpoint-1500/trainer_state.json +1095 -0
  31. checkpoints/checkpoint-1500/training_args.bin +3 -0
  32. checkpoints/checkpoint-1500/zero_to_fp32.py +604 -0
  33. checkpoints/checkpoint-2000/README.md +202 -0
  34. checkpoints/checkpoint-2000/adapter_config.json +29 -0
  35. checkpoints/checkpoint-2000/adapter_model.safetensors +3 -0
  36. checkpoints/checkpoint-2000/global_step2000/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt +3 -0
  37. checkpoints/checkpoint-2000/global_step2000/zero_pp_rank_0_mp_rank_00_model_states.pt +3 -0
  38. checkpoints/checkpoint-2000/latest +1 -0
  39. checkpoints/checkpoint-2000/rng_state.pth +3 -0
  40. checkpoints/checkpoint-2000/scheduler.pt +3 -0
  41. checkpoints/checkpoint-2000/special_tokens_map.json +24 -0
  42. checkpoints/checkpoint-2000/tokenizer.json +0 -0
  43. checkpoints/checkpoint-2000/tokenizer_config.json +42 -0
  44. checkpoints/checkpoint-2000/trainer_state.json +1453 -0
  45. checkpoints/checkpoint-2000/training_args.bin +3 -0
  46. checkpoints/checkpoint-2000/zero_to_fp32.py +604 -0
  47. checkpoints/checkpoint-2500/README.md +202 -0
  48. checkpoints/checkpoint-2500/adapter_config.json +29 -0
  49. checkpoints/checkpoint-2500/adapter_model.safetensors +3 -0
  50. checkpoints/checkpoint-2500/global_step2500/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt +3 -0
.DS_Store ADDED
Binary file (6.15 kB). View file
 
adapter_config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "openbmb/MiniCPM-2B-dpo-bf16",
5
+ "bias": "none",
6
+ "fan_in_fan_out": false,
7
+ "inference_mode": true,
8
+ "init_lora_weights": "gaussian",
9
+ "layer_replication": null,
10
+ "layers_pattern": null,
11
+ "layers_to_transform": null,
12
+ "loftq_config": {},
13
+ "lora_alpha": 32,
14
+ "lora_dropout": 0.1,
15
+ "megatron_config": null,
16
+ "megatron_core": "megatron.core",
17
+ "modules_to_save": null,
18
+ "peft_type": "LORA",
19
+ "r": 8,
20
+ "rank_pattern": {},
21
+ "revision": null,
22
+ "target_modules": [
23
+ "v_proj",
24
+ "q_proj"
25
+ ],
26
+ "task_type": "CAUSAL_LM",
27
+ "use_dora": false,
28
+ "use_rslora": false
29
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bc12271f98dc5360edbd7b573143dee888c2dcd38b2bfc2fd39140291875ebb8
3
+ size 5919456
checkpoints/.DS_Store ADDED
Binary file (6.15 kB). View file
 
checkpoints/checkpoint-1000/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: peft
3
+ base_model: openbmb/MiniCPM-2B-dpo-bf16
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
200
+ ### Framework versions
201
+
202
+ - PEFT 0.10.0
checkpoints/checkpoint-1000/adapter_config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "openbmb/MiniCPM-2B-dpo-bf16",
5
+ "bias": "none",
6
+ "fan_in_fan_out": false,
7
+ "inference_mode": true,
8
+ "init_lora_weights": "gaussian",
9
+ "layer_replication": null,
10
+ "layers_pattern": null,
11
+ "layers_to_transform": null,
12
+ "loftq_config": {},
13
+ "lora_alpha": 32,
14
+ "lora_dropout": 0.1,
15
+ "megatron_config": null,
16
+ "megatron_core": "megatron.core",
17
+ "modules_to_save": null,
18
+ "peft_type": "LORA",
19
+ "r": 8,
20
+ "rank_pattern": {},
21
+ "revision": null,
22
+ "target_modules": [
23
+ "v_proj",
24
+ "q_proj"
25
+ ],
26
+ "task_type": "CAUSAL_LM",
27
+ "use_dora": false,
28
+ "use_rslora": false
29
+ }
checkpoints/checkpoint-1000/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d0b71af557e40475bbd0ed5580b1163fc1e5813e6f18549c162fde489d38b7f
3
+ size 5919456
checkpoints/checkpoint-1000/global_step1000/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4a4c216a05e414bd591cc3e065a79ed8d7d527e52eb808fce6d214c43d12a8a
3
+ size 35393392
checkpoints/checkpoint-1000/global_step1000/zero_pp_rank_0_mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3394fcb77dc912f199fe9c2ebfb5a65dd81faa98b7bd60c9a238314ef859fcee
3
+ size 183275
checkpoints/checkpoint-1000/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step1000
checkpoints/checkpoint-1000/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e8e0d9241eef1fbbb5da2f0e430c8a311fd2376d925c255c8ae5c0b1105086c8
3
+ size 14244
checkpoints/checkpoint-1000/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2fac7b4ec7da78a13fae6d5e24455e41750b089d8c7eca1f0a65f95de6385bb8
3
+ size 1064
checkpoints/checkpoint-1000/special_tokens_map.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "</s>",
17
+ "unk_token": {
18
+ "content": "<unk>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ }
24
+ }
checkpoints/checkpoint-1000/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoints/checkpoint-1000/tokenizer_config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<unk>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ }
29
+ },
30
+ "bos_token": "<s>",
31
+ "chat_template": "{% for message in messages %}{% if message['role'] == 'user' %}{{'<用户>' + message['content'].strip() + '<AI>'}}{% else %}{{message['content'].strip()}}{% endif %}{% endfor %}",
32
+ "clean_up_tokenization_spaces": false,
33
+ "eos_token": "</s>",
34
+ "legacy": true,
35
+ "model_max_length": 1000000000000000019884624838656,
36
+ "pad_token": "</s>",
37
+ "sp_model_kwargs": {},
38
+ "spaces_between_special_tokens": false,
39
+ "tokenizer_class": "LlamaTokenizer",
40
+ "unk_token": "<unk>",
41
+ "use_default_system_prompt": false
42
+ }
checkpoints/checkpoint-1000/trainer_state.json ADDED
@@ -0,0 +1,737 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.5350454788657036,
5
+ "eval_steps": 500,
6
+ "global_step": 1000,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 0.01,
13
+ "grad_norm": 7.3019086777975994,
14
+ "learning_rate": 5e-06,
15
+ "loss": 0.6939,
16
+ "step": 10
17
+ },
18
+ {
19
+ "epoch": 0.01,
20
+ "grad_norm": 5.150989333266983,
21
+ "learning_rate": 1e-05,
22
+ "loss": 0.7167,
23
+ "step": 20
24
+ },
25
+ {
26
+ "epoch": 0.02,
27
+ "grad_norm": 3.640558809610037,
28
+ "learning_rate": 1.5e-05,
29
+ "loss": 0.5683,
30
+ "step": 30
31
+ },
32
+ {
33
+ "epoch": 0.02,
34
+ "grad_norm": 7.517999397731128,
35
+ "learning_rate": 2e-05,
36
+ "loss": 0.5472,
37
+ "step": 40
38
+ },
39
+ {
40
+ "epoch": 0.03,
41
+ "grad_norm": 1.9687061679463425,
42
+ "learning_rate": 2.5e-05,
43
+ "loss": 0.4439,
44
+ "step": 50
45
+ },
46
+ {
47
+ "epoch": 0.03,
48
+ "grad_norm": 3.643479206523606,
49
+ "learning_rate": 3e-05,
50
+ "loss": 0.2486,
51
+ "step": 60
52
+ },
53
+ {
54
+ "epoch": 0.04,
55
+ "grad_norm": 2.2754773308695095,
56
+ "learning_rate": 3.5e-05,
57
+ "loss": 0.2217,
58
+ "step": 70
59
+ },
60
+ {
61
+ "epoch": 0.04,
62
+ "grad_norm": 1.7144730049127388,
63
+ "learning_rate": 4e-05,
64
+ "loss": 0.169,
65
+ "step": 80
66
+ },
67
+ {
68
+ "epoch": 0.05,
69
+ "grad_norm": 3.4702829704135114,
70
+ "learning_rate": 4.5e-05,
71
+ "loss": 0.1994,
72
+ "step": 90
73
+ },
74
+ {
75
+ "epoch": 0.05,
76
+ "grad_norm": 1.3985127340985621,
77
+ "learning_rate": 5e-05,
78
+ "loss": 0.1612,
79
+ "step": 100
80
+ },
81
+ {
82
+ "epoch": 0.06,
83
+ "grad_norm": 1.375992184386137,
84
+ "learning_rate": 4.982758620689655e-05,
85
+ "loss": 0.1576,
86
+ "step": 110
87
+ },
88
+ {
89
+ "epoch": 0.06,
90
+ "grad_norm": 1.9528635753013313,
91
+ "learning_rate": 4.9655172413793107e-05,
92
+ "loss": 0.1393,
93
+ "step": 120
94
+ },
95
+ {
96
+ "epoch": 0.07,
97
+ "grad_norm": 4.075169010198401,
98
+ "learning_rate": 4.9482758620689655e-05,
99
+ "loss": 0.1969,
100
+ "step": 130
101
+ },
102
+ {
103
+ "epoch": 0.07,
104
+ "grad_norm": 2.0953991165751207,
105
+ "learning_rate": 4.931034482758621e-05,
106
+ "loss": 0.1294,
107
+ "step": 140
108
+ },
109
+ {
110
+ "epoch": 0.08,
111
+ "grad_norm": 1.942660591044849,
112
+ "learning_rate": 4.913793103448276e-05,
113
+ "loss": 0.1306,
114
+ "step": 150
115
+ },
116
+ {
117
+ "epoch": 0.09,
118
+ "grad_norm": 3.1508904015728345,
119
+ "learning_rate": 4.896551724137931e-05,
120
+ "loss": 0.1526,
121
+ "step": 160
122
+ },
123
+ {
124
+ "epoch": 0.09,
125
+ "grad_norm": 1.9862795165358471,
126
+ "learning_rate": 4.8793103448275864e-05,
127
+ "loss": 0.1186,
128
+ "step": 170
129
+ },
130
+ {
131
+ "epoch": 0.1,
132
+ "grad_norm": 2.633061833817991,
133
+ "learning_rate": 4.862068965517241e-05,
134
+ "loss": 0.1457,
135
+ "step": 180
136
+ },
137
+ {
138
+ "epoch": 0.1,
139
+ "grad_norm": 1.8017052368446178,
140
+ "learning_rate": 4.844827586206897e-05,
141
+ "loss": 0.1234,
142
+ "step": 190
143
+ },
144
+ {
145
+ "epoch": 0.11,
146
+ "grad_norm": 2.1560694100709803,
147
+ "learning_rate": 4.827586206896552e-05,
148
+ "loss": 0.1346,
149
+ "step": 200
150
+ },
151
+ {
152
+ "epoch": 0.11,
153
+ "grad_norm": 1.5737689267430703,
154
+ "learning_rate": 4.810344827586207e-05,
155
+ "loss": 0.116,
156
+ "step": 210
157
+ },
158
+ {
159
+ "epoch": 0.12,
160
+ "grad_norm": 1.957864677854788,
161
+ "learning_rate": 4.793103448275863e-05,
162
+ "loss": 0.1692,
163
+ "step": 220
164
+ },
165
+ {
166
+ "epoch": 0.12,
167
+ "grad_norm": 2.215039223521855,
168
+ "learning_rate": 4.7758620689655176e-05,
169
+ "loss": 0.1245,
170
+ "step": 230
171
+ },
172
+ {
173
+ "epoch": 0.13,
174
+ "grad_norm": 1.370517239734168,
175
+ "learning_rate": 4.7586206896551725e-05,
176
+ "loss": 0.1476,
177
+ "step": 240
178
+ },
179
+ {
180
+ "epoch": 0.13,
181
+ "grad_norm": 1.7341334563022532,
182
+ "learning_rate": 4.741379310344828e-05,
183
+ "loss": 0.1236,
184
+ "step": 250
185
+ },
186
+ {
187
+ "epoch": 0.14,
188
+ "grad_norm": 1.5994298113068974,
189
+ "learning_rate": 4.724137931034483e-05,
190
+ "loss": 0.1161,
191
+ "step": 260
192
+ },
193
+ {
194
+ "epoch": 0.14,
195
+ "grad_norm": 1.5317433190951963,
196
+ "learning_rate": 4.7068965517241385e-05,
197
+ "loss": 0.1035,
198
+ "step": 270
199
+ },
200
+ {
201
+ "epoch": 0.15,
202
+ "grad_norm": 2.191977732539556,
203
+ "learning_rate": 4.689655172413793e-05,
204
+ "loss": 0.1427,
205
+ "step": 280
206
+ },
207
+ {
208
+ "epoch": 0.16,
209
+ "grad_norm": 1.6038667570691656,
210
+ "learning_rate": 4.672413793103448e-05,
211
+ "loss": 0.1225,
212
+ "step": 290
213
+ },
214
+ {
215
+ "epoch": 0.16,
216
+ "grad_norm": 2.577572731831179,
217
+ "learning_rate": 4.655172413793104e-05,
218
+ "loss": 0.1399,
219
+ "step": 300
220
+ },
221
+ {
222
+ "epoch": 0.17,
223
+ "grad_norm": 1.6199241001441385,
224
+ "learning_rate": 4.6379310344827586e-05,
225
+ "loss": 0.1242,
226
+ "step": 310
227
+ },
228
+ {
229
+ "epoch": 0.17,
230
+ "grad_norm": 2.236577821186196,
231
+ "learning_rate": 4.6206896551724135e-05,
232
+ "loss": 0.1656,
233
+ "step": 320
234
+ },
235
+ {
236
+ "epoch": 0.18,
237
+ "grad_norm": 1.7294690605254757,
238
+ "learning_rate": 4.603448275862069e-05,
239
+ "loss": 0.1382,
240
+ "step": 330
241
+ },
242
+ {
243
+ "epoch": 0.18,
244
+ "grad_norm": 2.196527516378511,
245
+ "learning_rate": 4.586206896551724e-05,
246
+ "loss": 0.1257,
247
+ "step": 340
248
+ },
249
+ {
250
+ "epoch": 0.19,
251
+ "grad_norm": 2.1057444340221463,
252
+ "learning_rate": 4.5689655172413794e-05,
253
+ "loss": 0.1238,
254
+ "step": 350
255
+ },
256
+ {
257
+ "epoch": 0.19,
258
+ "grad_norm": 1.5409556870328274,
259
+ "learning_rate": 4.551724137931035e-05,
260
+ "loss": 0.1383,
261
+ "step": 360
262
+ },
263
+ {
264
+ "epoch": 0.2,
265
+ "grad_norm": 1.5204083616874053,
266
+ "learning_rate": 4.53448275862069e-05,
267
+ "loss": 0.1068,
268
+ "step": 370
269
+ },
270
+ {
271
+ "epoch": 0.2,
272
+ "grad_norm": 2.3557725298931746,
273
+ "learning_rate": 4.5172413793103454e-05,
274
+ "loss": 0.1071,
275
+ "step": 380
276
+ },
277
+ {
278
+ "epoch": 0.21,
279
+ "grad_norm": 3.2601538460418644,
280
+ "learning_rate": 4.5e-05,
281
+ "loss": 0.125,
282
+ "step": 390
283
+ },
284
+ {
285
+ "epoch": 0.21,
286
+ "grad_norm": 1.9031725385762286,
287
+ "learning_rate": 4.482758620689655e-05,
288
+ "loss": 0.0991,
289
+ "step": 400
290
+ },
291
+ {
292
+ "epoch": 0.22,
293
+ "grad_norm": 1.3946050262183123,
294
+ "learning_rate": 4.465517241379311e-05,
295
+ "loss": 0.1156,
296
+ "step": 410
297
+ },
298
+ {
299
+ "epoch": 0.22,
300
+ "grad_norm": 1.097644875106397,
301
+ "learning_rate": 4.4482758620689656e-05,
302
+ "loss": 0.1366,
303
+ "step": 420
304
+ },
305
+ {
306
+ "epoch": 0.23,
307
+ "grad_norm": 1.37846299019108,
308
+ "learning_rate": 4.431034482758621e-05,
309
+ "loss": 0.126,
310
+ "step": 430
311
+ },
312
+ {
313
+ "epoch": 0.24,
314
+ "grad_norm": 1.8340152889320331,
315
+ "learning_rate": 4.413793103448276e-05,
316
+ "loss": 0.1066,
317
+ "step": 440
318
+ },
319
+ {
320
+ "epoch": 0.24,
321
+ "grad_norm": 1.8304505611337867,
322
+ "learning_rate": 4.396551724137931e-05,
323
+ "loss": 0.0868,
324
+ "step": 450
325
+ },
326
+ {
327
+ "epoch": 0.25,
328
+ "grad_norm": 1.550196490898523,
329
+ "learning_rate": 4.3793103448275864e-05,
330
+ "loss": 0.1286,
331
+ "step": 460
332
+ },
333
+ {
334
+ "epoch": 0.25,
335
+ "grad_norm": 2.176112247796248,
336
+ "learning_rate": 4.362068965517241e-05,
337
+ "loss": 0.1206,
338
+ "step": 470
339
+ },
340
+ {
341
+ "epoch": 0.26,
342
+ "grad_norm": 1.6589263894091213,
343
+ "learning_rate": 4.344827586206897e-05,
344
+ "loss": 0.1008,
345
+ "step": 480
346
+ },
347
+ {
348
+ "epoch": 0.26,
349
+ "grad_norm": 1.8349611508902046,
350
+ "learning_rate": 4.327586206896552e-05,
351
+ "loss": 0.1198,
352
+ "step": 490
353
+ },
354
+ {
355
+ "epoch": 0.27,
356
+ "grad_norm": 2.1218964920724126,
357
+ "learning_rate": 4.3103448275862066e-05,
358
+ "loss": 0.1166,
359
+ "step": 500
360
+ },
361
+ {
362
+ "epoch": 0.27,
363
+ "eval_loss": 0.6078919172286987,
364
+ "eval_runtime": 116.8471,
365
+ "eval_samples_per_second": 11.288,
366
+ "eval_steps_per_second": 2.824,
367
+ "step": 500
368
+ },
369
+ {
370
+ "epoch": 0.27,
371
+ "grad_norm": 2.5775141311007856,
372
+ "learning_rate": 4.293103448275863e-05,
373
+ "loss": 0.1124,
374
+ "step": 510
375
+ },
376
+ {
377
+ "epoch": 0.28,
378
+ "grad_norm": 1.6019517017800202,
379
+ "learning_rate": 4.275862068965518e-05,
380
+ "loss": 0.1068,
381
+ "step": 520
382
+ },
383
+ {
384
+ "epoch": 0.28,
385
+ "grad_norm": 2.6901962755310205,
386
+ "learning_rate": 4.2586206896551725e-05,
387
+ "loss": 0.1286,
388
+ "step": 530
389
+ },
390
+ {
391
+ "epoch": 0.29,
392
+ "grad_norm": 3.9517995356721767,
393
+ "learning_rate": 4.241379310344828e-05,
394
+ "loss": 0.1149,
395
+ "step": 540
396
+ },
397
+ {
398
+ "epoch": 0.29,
399
+ "grad_norm": 2.0428896228074076,
400
+ "learning_rate": 4.224137931034483e-05,
401
+ "loss": 0.141,
402
+ "step": 550
403
+ },
404
+ {
405
+ "epoch": 0.3,
406
+ "grad_norm": 2.263258592133553,
407
+ "learning_rate": 4.2068965517241385e-05,
408
+ "loss": 0.0949,
409
+ "step": 560
410
+ },
411
+ {
412
+ "epoch": 0.3,
413
+ "grad_norm": 1.4823165953974604,
414
+ "learning_rate": 4.1896551724137934e-05,
415
+ "loss": 0.1365,
416
+ "step": 570
417
+ },
418
+ {
419
+ "epoch": 0.31,
420
+ "grad_norm": 1.4441377020989878,
421
+ "learning_rate": 4.172413793103448e-05,
422
+ "loss": 0.1015,
423
+ "step": 580
424
+ },
425
+ {
426
+ "epoch": 0.32,
427
+ "grad_norm": 1.4779059254436886,
428
+ "learning_rate": 4.155172413793104e-05,
429
+ "loss": 0.0988,
430
+ "step": 590
431
+ },
432
+ {
433
+ "epoch": 0.32,
434
+ "grad_norm": 1.7777823671018818,
435
+ "learning_rate": 4.1379310344827587e-05,
436
+ "loss": 0.1124,
437
+ "step": 600
438
+ },
439
+ {
440
+ "epoch": 0.33,
441
+ "grad_norm": 1.737579831138191,
442
+ "learning_rate": 4.120689655172414e-05,
443
+ "loss": 0.086,
444
+ "step": 610
445
+ },
446
+ {
447
+ "epoch": 0.33,
448
+ "grad_norm": 2.708453961232997,
449
+ "learning_rate": 4.103448275862069e-05,
450
+ "loss": 0.0933,
451
+ "step": 620
452
+ },
453
+ {
454
+ "epoch": 0.34,
455
+ "grad_norm": 1.8871805824236731,
456
+ "learning_rate": 4.086206896551724e-05,
457
+ "loss": 0.1407,
458
+ "step": 630
459
+ },
460
+ {
461
+ "epoch": 0.34,
462
+ "grad_norm": 1.7300112722427339,
463
+ "learning_rate": 4.0689655172413795e-05,
464
+ "loss": 0.1224,
465
+ "step": 640
466
+ },
467
+ {
468
+ "epoch": 0.35,
469
+ "grad_norm": 1.4631236252240614,
470
+ "learning_rate": 4.0517241379310344e-05,
471
+ "loss": 0.1014,
472
+ "step": 650
473
+ },
474
+ {
475
+ "epoch": 0.35,
476
+ "grad_norm": 1.2602431597419264,
477
+ "learning_rate": 4.03448275862069e-05,
478
+ "loss": 0.1583,
479
+ "step": 660
480
+ },
481
+ {
482
+ "epoch": 0.36,
483
+ "grad_norm": 1.2077937041919453,
484
+ "learning_rate": 4.0172413793103455e-05,
485
+ "loss": 0.1209,
486
+ "step": 670
487
+ },
488
+ {
489
+ "epoch": 0.36,
490
+ "grad_norm": 1.4386184566429954,
491
+ "learning_rate": 4e-05,
492
+ "loss": 0.1016,
493
+ "step": 680
494
+ },
495
+ {
496
+ "epoch": 0.37,
497
+ "grad_norm": 2.6160358835758584,
498
+ "learning_rate": 3.982758620689656e-05,
499
+ "loss": 0.1062,
500
+ "step": 690
501
+ },
502
+ {
503
+ "epoch": 0.37,
504
+ "grad_norm": 1.9278794640498955,
505
+ "learning_rate": 3.965517241379311e-05,
506
+ "loss": 0.1037,
507
+ "step": 700
508
+ },
509
+ {
510
+ "epoch": 0.38,
511
+ "grad_norm": 1.2872571900237024,
512
+ "learning_rate": 3.9482758620689656e-05,
513
+ "loss": 0.096,
514
+ "step": 710
515
+ },
516
+ {
517
+ "epoch": 0.39,
518
+ "grad_norm": 1.243554309347296,
519
+ "learning_rate": 3.931034482758621e-05,
520
+ "loss": 0.1084,
521
+ "step": 720
522
+ },
523
+ {
524
+ "epoch": 0.39,
525
+ "grad_norm": 1.5090589714253309,
526
+ "learning_rate": 3.913793103448276e-05,
527
+ "loss": 0.0877,
528
+ "step": 730
529
+ },
530
+ {
531
+ "epoch": 0.4,
532
+ "grad_norm": 2.1419550623025168,
533
+ "learning_rate": 3.896551724137931e-05,
534
+ "loss": 0.0994,
535
+ "step": 740
536
+ },
537
+ {
538
+ "epoch": 0.4,
539
+ "grad_norm": 1.7807417973632438,
540
+ "learning_rate": 3.8793103448275865e-05,
541
+ "loss": 0.1029,
542
+ "step": 750
543
+ },
544
+ {
545
+ "epoch": 0.41,
546
+ "grad_norm": 1.3342960263057682,
547
+ "learning_rate": 3.862068965517241e-05,
548
+ "loss": 0.1072,
549
+ "step": 760
550
+ },
551
+ {
552
+ "epoch": 0.41,
553
+ "grad_norm": 2.3865282340158136,
554
+ "learning_rate": 3.844827586206897e-05,
555
+ "loss": 0.1193,
556
+ "step": 770
557
+ },
558
+ {
559
+ "epoch": 0.42,
560
+ "grad_norm": 1.5428742248459941,
561
+ "learning_rate": 3.827586206896552e-05,
562
+ "loss": 0.1156,
563
+ "step": 780
564
+ },
565
+ {
566
+ "epoch": 0.42,
567
+ "grad_norm": 1.7660532115509044,
568
+ "learning_rate": 3.8103448275862066e-05,
569
+ "loss": 0.122,
570
+ "step": 790
571
+ },
572
+ {
573
+ "epoch": 0.43,
574
+ "grad_norm": 1.8149742752994733,
575
+ "learning_rate": 3.793103448275862e-05,
576
+ "loss": 0.1346,
577
+ "step": 800
578
+ },
579
+ {
580
+ "epoch": 0.43,
581
+ "grad_norm": 1.7456408876472995,
582
+ "learning_rate": 3.775862068965517e-05,
583
+ "loss": 0.1223,
584
+ "step": 810
585
+ },
586
+ {
587
+ "epoch": 0.44,
588
+ "grad_norm": 1.10163248244056,
589
+ "learning_rate": 3.7586206896551726e-05,
590
+ "loss": 0.1031,
591
+ "step": 820
592
+ },
593
+ {
594
+ "epoch": 0.44,
595
+ "grad_norm": 1.6441057737088702,
596
+ "learning_rate": 3.741379310344828e-05,
597
+ "loss": 0.1059,
598
+ "step": 830
599
+ },
600
+ {
601
+ "epoch": 0.45,
602
+ "grad_norm": 2.3999279790163484,
603
+ "learning_rate": 3.724137931034483e-05,
604
+ "loss": 0.1125,
605
+ "step": 840
606
+ },
607
+ {
608
+ "epoch": 0.45,
609
+ "grad_norm": 2.2081477934156903,
610
+ "learning_rate": 3.7068965517241385e-05,
611
+ "loss": 0.1266,
612
+ "step": 850
613
+ },
614
+ {
615
+ "epoch": 0.46,
616
+ "grad_norm": 2.366783771480017,
617
+ "learning_rate": 3.6896551724137934e-05,
618
+ "loss": 0.1127,
619
+ "step": 860
620
+ },
621
+ {
622
+ "epoch": 0.47,
623
+ "grad_norm": 1.3077873674136173,
624
+ "learning_rate": 3.672413793103448e-05,
625
+ "loss": 0.1095,
626
+ "step": 870
627
+ },
628
+ {
629
+ "epoch": 0.47,
630
+ "grad_norm": 1.8197812508114701,
631
+ "learning_rate": 3.655172413793104e-05,
632
+ "loss": 0.0932,
633
+ "step": 880
634
+ },
635
+ {
636
+ "epoch": 0.48,
637
+ "grad_norm": 1.0806192057981219,
638
+ "learning_rate": 3.637931034482759e-05,
639
+ "loss": 0.1166,
640
+ "step": 890
641
+ },
642
+ {
643
+ "epoch": 0.48,
644
+ "grad_norm": 1.520666439337001,
645
+ "learning_rate": 3.620689655172414e-05,
646
+ "loss": 0.0883,
647
+ "step": 900
648
+ },
649
+ {
650
+ "epoch": 0.49,
651
+ "grad_norm": 1.690002270629302,
652
+ "learning_rate": 3.603448275862069e-05,
653
+ "loss": 0.1199,
654
+ "step": 910
655
+ },
656
+ {
657
+ "epoch": 0.49,
658
+ "grad_norm": 1.4319374130118003,
659
+ "learning_rate": 3.586206896551724e-05,
660
+ "loss": 0.0991,
661
+ "step": 920
662
+ },
663
+ {
664
+ "epoch": 0.5,
665
+ "grad_norm": 1.0626084369653164,
666
+ "learning_rate": 3.5689655172413795e-05,
667
+ "loss": 0.0923,
668
+ "step": 930
669
+ },
670
+ {
671
+ "epoch": 0.5,
672
+ "grad_norm": 2.0848060597460902,
673
+ "learning_rate": 3.5517241379310344e-05,
674
+ "loss": 0.0979,
675
+ "step": 940
676
+ },
677
+ {
678
+ "epoch": 0.51,
679
+ "grad_norm": 1.4997189461483256,
680
+ "learning_rate": 3.53448275862069e-05,
681
+ "loss": 0.0949,
682
+ "step": 950
683
+ },
684
+ {
685
+ "epoch": 0.51,
686
+ "grad_norm": 1.7887817042743388,
687
+ "learning_rate": 3.517241379310345e-05,
688
+ "loss": 0.1135,
689
+ "step": 960
690
+ },
691
+ {
692
+ "epoch": 0.52,
693
+ "grad_norm": 3.242965692388458,
694
+ "learning_rate": 3.5e-05,
695
+ "loss": 0.1315,
696
+ "step": 970
697
+ },
698
+ {
699
+ "epoch": 0.52,
700
+ "grad_norm": 1.5034762176322083,
701
+ "learning_rate": 3.482758620689655e-05,
702
+ "loss": 0.1177,
703
+ "step": 980
704
+ },
705
+ {
706
+ "epoch": 0.53,
707
+ "grad_norm": 1.6679474444200848,
708
+ "learning_rate": 3.465517241379311e-05,
709
+ "loss": 0.1182,
710
+ "step": 990
711
+ },
712
+ {
713
+ "epoch": 0.54,
714
+ "grad_norm": 2.814574507251776,
715
+ "learning_rate": 3.4482758620689657e-05,
716
+ "loss": 0.0912,
717
+ "step": 1000
718
+ },
719
+ {
720
+ "epoch": 0.54,
721
+ "eval_loss": 0.6101276874542236,
722
+ "eval_runtime": 113.9995,
723
+ "eval_samples_per_second": 11.57,
724
+ "eval_steps_per_second": 2.895,
725
+ "step": 1000
726
+ }
727
+ ],
728
+ "logging_steps": 10,
729
+ "max_steps": 3000,
730
+ "num_input_tokens_seen": 0,
731
+ "num_train_epochs": 2,
732
+ "save_steps": 500,
733
+ "total_flos": 28899016704000.0,
734
+ "train_batch_size": 4,
735
+ "trial_name": null,
736
+ "trial_params": null
737
+ }
checkpoints/checkpoint-1000/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:22266252322e6977894297b61731ca9228c8fcfe4e8d788aef270218c40fec98
3
+ size 6776
checkpoints/checkpoint-1000/zero_to_fp32.py ADDED
@@ -0,0 +1,604 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example: python zero_to_fp32.py . pytorch_model.bin
14
+
15
+ import argparse
16
+ import torch
17
+ import glob
18
+ import math
19
+ import os
20
+ import re
21
+ from collections import OrderedDict
22
+ from dataclasses import dataclass
23
+
24
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
25
+ # DeepSpeed data structures it has to be available in the current python environment.
26
+ from deepspeed.utils import logger
27
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
28
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
29
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
30
+
31
+
32
+ @dataclass
33
+ class zero_model_state:
34
+ buffers: dict()
35
+ param_shapes: dict()
36
+ shared_params: list
37
+ ds_version: int
38
+ frozen_param_shapes: dict()
39
+ frozen_param_fragments: dict()
40
+
41
+
42
+ debug = 0
43
+
44
+ # load to cpu
45
+ device = torch.device('cpu')
46
+
47
+
48
+ def atoi(text):
49
+ return int(text) if text.isdigit() else text
50
+
51
+
52
+ def natural_keys(text):
53
+ '''
54
+ alist.sort(key=natural_keys) sorts in human order
55
+ http://nedbatchelder.com/blog/200712/human_sorting.html
56
+ (See Toothy's implementation in the comments)
57
+ '''
58
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
59
+
60
+
61
+ def get_model_state_file(checkpoint_dir, zero_stage):
62
+ if not os.path.isdir(checkpoint_dir):
63
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
64
+
65
+ # there should be only one file
66
+ if zero_stage <= 2:
67
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
68
+ elif zero_stage == 3:
69
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
70
+
71
+ if not os.path.exists(file):
72
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
73
+
74
+ return file
75
+
76
+
77
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
78
+ # XXX: need to test that this simple glob rule works for multi-node setup too
79
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
80
+
81
+ if len(ckpt_files) == 0:
82
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
83
+
84
+ return ckpt_files
85
+
86
+
87
+ def get_optim_files(checkpoint_dir):
88
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
89
+
90
+
91
+ def get_model_state_files(checkpoint_dir):
92
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
93
+
94
+
95
+ def parse_model_states(files):
96
+ zero_model_states = []
97
+ for file in files:
98
+ state_dict = torch.load(file, map_location=device)
99
+
100
+ if BUFFER_NAMES not in state_dict:
101
+ raise ValueError(f"{file} is not a model state checkpoint")
102
+ buffer_names = state_dict[BUFFER_NAMES]
103
+ if debug:
104
+ print("Found buffers:", buffer_names)
105
+
106
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
107
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
108
+ param_shapes = state_dict[PARAM_SHAPES]
109
+
110
+ # collect parameters that are included in param_shapes
111
+ param_names = []
112
+ for s in param_shapes:
113
+ for name in s.keys():
114
+ param_names.append(name)
115
+
116
+ # update with frozen parameters
117
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
118
+ if frozen_param_shapes is not None:
119
+ if debug:
120
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
121
+ param_names += list(frozen_param_shapes.keys())
122
+
123
+ # handle shared params
124
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
125
+
126
+ ds_version = state_dict.get(DS_VERSION, None)
127
+
128
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
129
+
130
+ z_model_state = zero_model_state(buffers=buffers,
131
+ param_shapes=param_shapes,
132
+ shared_params=shared_params,
133
+ ds_version=ds_version,
134
+ frozen_param_shapes=frozen_param_shapes,
135
+ frozen_param_fragments=frozen_param_fragments)
136
+ zero_model_states.append(z_model_state)
137
+
138
+ return zero_model_states
139
+
140
+
141
+ def parse_optim_states(files, ds_checkpoint_dir):
142
+
143
+ total_files = len(files)
144
+ state_dicts = []
145
+ for f in files:
146
+ state_dict = torch.load(f, map_location=device)
147
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
148
+ # and also handle the case where it was already removed by another helper script
149
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
150
+ state_dicts.append(state_dict)
151
+
152
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
153
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
154
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
155
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
156
+
157
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
158
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
159
+ # use the max of the partition_count to get the dp world_size.
160
+
161
+ if type(world_size) is list:
162
+ world_size = max(world_size)
163
+
164
+ if world_size != total_files:
165
+ raise ValueError(
166
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
167
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
168
+ )
169
+
170
+ # the groups are named differently in each stage
171
+ if zero_stage <= 2:
172
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
173
+ elif zero_stage == 3:
174
+ fp32_groups_key = FP32_FLAT_GROUPS
175
+ else:
176
+ raise ValueError(f"unknown zero stage {zero_stage}")
177
+
178
+ if zero_stage <= 2:
179
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
180
+ elif zero_stage == 3:
181
+ # if there is more than one param group, there will be multiple flattened tensors - one
182
+ # flattened tensor per group - for simplicity merge them into a single tensor
183
+ #
184
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
185
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
186
+
187
+ fp32_flat_groups = [
188
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key], 0) for i in range(len(state_dicts))
189
+ ]
190
+
191
+ return zero_stage, world_size, fp32_flat_groups
192
+
193
+
194
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
195
+ """
196
+ Returns fp32 state_dict reconstructed from ds checkpoint
197
+
198
+ Args:
199
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
200
+
201
+ """
202
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
203
+
204
+ optim_files = get_optim_files(ds_checkpoint_dir)
205
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
206
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
207
+
208
+ model_files = get_model_state_files(ds_checkpoint_dir)
209
+
210
+ zero_model_states = parse_model_states(model_files)
211
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
212
+
213
+ if zero_stage <= 2:
214
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
215
+ exclude_frozen_parameters)
216
+ elif zero_stage == 3:
217
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
218
+ exclude_frozen_parameters)
219
+
220
+
221
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
222
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
223
+ return
224
+
225
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
226
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
227
+
228
+ if debug:
229
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
230
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
231
+
232
+ wanted_params = len(frozen_param_shapes)
233
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
234
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
235
+ print(f'Frozen params: Have {avail_numel} numels to process.')
236
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
237
+
238
+ total_params = 0
239
+ total_numel = 0
240
+ for name, shape in frozen_param_shapes.items():
241
+ total_params += 1
242
+ unpartitioned_numel = shape.numel()
243
+ total_numel += unpartitioned_numel
244
+
245
+ state_dict[name] = frozen_param_fragments[name]
246
+
247
+ if debug:
248
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
249
+
250
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
251
+
252
+
253
+ def _has_callable(obj, fn):
254
+ attr = getattr(obj, fn, None)
255
+ return callable(attr)
256
+
257
+
258
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
259
+ param_shapes = zero_model_states[0].param_shapes
260
+
261
+ # Reconstruction protocol:
262
+ #
263
+ # XXX: document this
264
+
265
+ if debug:
266
+ for i in range(world_size):
267
+ for j in range(len(fp32_flat_groups[0])):
268
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
269
+
270
+ # XXX: memory usage doubles here (zero2)
271
+ num_param_groups = len(fp32_flat_groups[0])
272
+ merged_single_partition_of_fp32_groups = []
273
+ for i in range(num_param_groups):
274
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
275
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
276
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
277
+ avail_numel = sum(
278
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
279
+
280
+ if debug:
281
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
282
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
283
+ # not asserting if there is a mismatch due to possible padding
284
+ print(f"Have {avail_numel} numels to process.")
285
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
286
+
287
+ # params
288
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
289
+ # out-of-core computing solution
290
+ total_numel = 0
291
+ total_params = 0
292
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
293
+ offset = 0
294
+ avail_numel = full_single_fp32_vector.numel()
295
+ for name, shape in shapes.items():
296
+
297
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
298
+ total_numel += unpartitioned_numel
299
+ total_params += 1
300
+
301
+ if debug:
302
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
303
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
304
+ offset += unpartitioned_numel
305
+
306
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
307
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
308
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
309
+ # live optimizer object, so we are checking that the numbers are within the right range
310
+ align_to = 2 * world_size
311
+
312
+ def zero2_align(x):
313
+ return align_to * math.ceil(x / align_to)
314
+
315
+ if debug:
316
+ print(f"original offset={offset}, avail_numel={avail_numel}")
317
+
318
+ offset = zero2_align(offset)
319
+ avail_numel = zero2_align(avail_numel)
320
+
321
+ if debug:
322
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
323
+
324
+ # Sanity check
325
+ if offset != avail_numel:
326
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
327
+
328
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
329
+
330
+
331
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
332
+ exclude_frozen_parameters):
333
+ state_dict = OrderedDict()
334
+
335
+ # buffers
336
+ buffers = zero_model_states[0].buffers
337
+ state_dict.update(buffers)
338
+ if debug:
339
+ print(f"added {len(buffers)} buffers")
340
+
341
+ if not exclude_frozen_parameters:
342
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
343
+
344
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
345
+
346
+ # recover shared parameters
347
+ for pair in zero_model_states[0].shared_params:
348
+ if pair[1] in state_dict:
349
+ state_dict[pair[0]] = state_dict[pair[1]]
350
+
351
+ return state_dict
352
+
353
+
354
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
355
+ remainder = unpartitioned_numel % world_size
356
+ padding_numel = (world_size - remainder) if remainder else 0
357
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
358
+ return partitioned_numel, padding_numel
359
+
360
+
361
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
362
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
363
+ return
364
+
365
+ if debug:
366
+ for i in range(world_size):
367
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
368
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
369
+
370
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
371
+ wanted_params = len(frozen_param_shapes)
372
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
373
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
374
+ print(f'Frozen params: Have {avail_numel} numels to process.')
375
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
376
+
377
+ total_params = 0
378
+ total_numel = 0
379
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
380
+ total_params += 1
381
+ unpartitioned_numel = shape.numel()
382
+ total_numel += unpartitioned_numel
383
+
384
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
385
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
386
+
387
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
388
+
389
+ if debug:
390
+ print(
391
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
392
+ )
393
+
394
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
395
+
396
+
397
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
398
+ param_shapes = zero_model_states[0].param_shapes
399
+ avail_numel = fp32_flat_groups[0].numel() * world_size
400
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
401
+ # param, re-consolidating each param, while dealing with padding if any
402
+
403
+ # merge list of dicts, preserving order
404
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
405
+
406
+ if debug:
407
+ for i in range(world_size):
408
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
409
+
410
+ wanted_params = len(param_shapes)
411
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
412
+ # not asserting if there is a mismatch due to possible padding
413
+ avail_numel = fp32_flat_groups[0].numel() * world_size
414
+ print(f"Trainable params: Have {avail_numel} numels to process.")
415
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
416
+
417
+ # params
418
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
419
+ # out-of-core computing solution
420
+ offset = 0
421
+ total_numel = 0
422
+ total_params = 0
423
+ for name, shape in param_shapes.items():
424
+
425
+ unpartitioned_numel = shape.numel()
426
+ total_numel += unpartitioned_numel
427
+ total_params += 1
428
+
429
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
430
+
431
+ if debug:
432
+ print(
433
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
434
+ )
435
+
436
+ # XXX: memory usage doubles here
437
+ state_dict[name] = torch.cat(
438
+ tuple(fp32_flat_groups[i].narrow(0, offset, partitioned_numel) for i in range(world_size)),
439
+ 0).narrow(0, 0, unpartitioned_numel).view(shape)
440
+ offset += partitioned_numel
441
+
442
+ offset *= world_size
443
+
444
+ # Sanity check
445
+ if offset != avail_numel:
446
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
447
+
448
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
449
+
450
+
451
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
452
+ exclude_frozen_parameters):
453
+ state_dict = OrderedDict()
454
+
455
+ # buffers
456
+ buffers = zero_model_states[0].buffers
457
+ state_dict.update(buffers)
458
+ if debug:
459
+ print(f"added {len(buffers)} buffers")
460
+
461
+ if not exclude_frozen_parameters:
462
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
463
+
464
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
465
+
466
+ # recover shared parameters
467
+ for pair in zero_model_states[0].shared_params:
468
+ if pair[1] in state_dict:
469
+ state_dict[pair[0]] = state_dict[pair[1]]
470
+
471
+ return state_dict
472
+
473
+
474
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None, exclude_frozen_parameters=False):
475
+ """
476
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
477
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
478
+ via a model hub.
479
+
480
+ Args:
481
+ - ``checkpoint_dir``: path to the desired checkpoint folder
482
+ - ``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``
483
+ - ``exclude_frozen_parameters``: exclude frozen parameters
484
+
485
+ Returns:
486
+ - pytorch ``state_dict``
487
+
488
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
489
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
490
+ the checkpoint.
491
+
492
+ A typical usage might be ::
493
+
494
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
495
+ # do the training and checkpoint saving
496
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
497
+ model = model.cpu() # move to cpu
498
+ model.load_state_dict(state_dict)
499
+ # submit to model hub or save the model to share with others
500
+
501
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
502
+ application. i.e. you will need to re-initialize the deepspeed engine, since
503
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
504
+
505
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
506
+
507
+ """
508
+ if tag is None:
509
+ latest_path = os.path.join(checkpoint_dir, 'latest')
510
+ if os.path.isfile(latest_path):
511
+ with open(latest_path, 'r') as fd:
512
+ tag = fd.read().strip()
513
+ else:
514
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
515
+
516
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
517
+
518
+ if not os.path.isdir(ds_checkpoint_dir):
519
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
520
+
521
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
522
+
523
+
524
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None, exclude_frozen_parameters=False):
525
+ """
526
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
527
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
528
+
529
+ Args:
530
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
531
+ - ``output_file``: path to the pytorch fp32 state_dict output file (e.g. path/pytorch_model.bin)
532
+ - ``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``
533
+ - ``exclude_frozen_parameters``: exclude frozen parameters
534
+ """
535
+
536
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag, exclude_frozen_parameters)
537
+ print(f"Saving fp32 state dict to {output_file}")
538
+ torch.save(state_dict, output_file)
539
+
540
+
541
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
542
+ """
543
+ 1. Put the provided model to cpu
544
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
545
+ 3. Load it into the provided model
546
+
547
+ Args:
548
+ - ``model``: the model object to update
549
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
550
+ - ``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``
551
+
552
+ Returns:
553
+ - ``model`: modified model
554
+
555
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
556
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
557
+ conveniently placed for you in the checkpoint folder.
558
+
559
+ A typical usage might be ::
560
+
561
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
562
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
563
+ # submit to model hub or save the model to share with others
564
+
565
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
566
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
567
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
568
+
569
+ """
570
+ logger.info(f"Extracting fp32 weights")
571
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
572
+
573
+ logger.info(f"Overwriting model with fp32 weights")
574
+ model = model.cpu()
575
+ model.load_state_dict(state_dict, strict=False)
576
+
577
+ return model
578
+
579
+
580
+ if __name__ == "__main__":
581
+
582
+ parser = argparse.ArgumentParser()
583
+ parser.add_argument("checkpoint_dir",
584
+ type=str,
585
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
586
+ parser.add_argument(
587
+ "output_file",
588
+ type=str,
589
+ help="path to the pytorch fp32 state_dict output file (e.g. path/checkpoint-12/pytorch_model.bin)")
590
+ parser.add_argument("-t",
591
+ "--tag",
592
+ type=str,
593
+ default=None,
594
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
595
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
596
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
597
+ args = parser.parse_args()
598
+
599
+ debug = args.debug
600
+
601
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
602
+ args.output_file,
603
+ tag=args.tag,
604
+ exclude_frozen_parameters=args.exclude_frozen_parameters)
checkpoints/checkpoint-1500/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: peft
3
+ base_model: openbmb/MiniCPM-2B-dpo-bf16
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
200
+ ### Framework versions
201
+
202
+ - PEFT 0.10.0
checkpoints/checkpoint-1500/adapter_config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "openbmb/MiniCPM-2B-dpo-bf16",
5
+ "bias": "none",
6
+ "fan_in_fan_out": false,
7
+ "inference_mode": true,
8
+ "init_lora_weights": "gaussian",
9
+ "layer_replication": null,
10
+ "layers_pattern": null,
11
+ "layers_to_transform": null,
12
+ "loftq_config": {},
13
+ "lora_alpha": 32,
14
+ "lora_dropout": 0.1,
15
+ "megatron_config": null,
16
+ "megatron_core": "megatron.core",
17
+ "modules_to_save": null,
18
+ "peft_type": "LORA",
19
+ "r": 8,
20
+ "rank_pattern": {},
21
+ "revision": null,
22
+ "target_modules": [
23
+ "v_proj",
24
+ "q_proj"
25
+ ],
26
+ "task_type": "CAUSAL_LM",
27
+ "use_dora": false,
28
+ "use_rslora": false
29
+ }
checkpoints/checkpoint-1500/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:de9e2856e08d5173f8e2af8a3753fd4b9d7ff846b54a5ff0c58f7c3f5766adbd
3
+ size 5919456
checkpoints/checkpoint-1500/global_step1500/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84bae28b1e6bf0e12a34d4a32f9f04cc7dacf4cb9fcc31079d3efe068b295712
3
+ size 35393392
checkpoints/checkpoint-1500/global_step1500/zero_pp_rank_0_mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e17a037ee17783aebea4d60a2ca9224419f83386c47c8f19b0e070d416c5d008
3
+ size 183275
checkpoints/checkpoint-1500/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step1500
checkpoints/checkpoint-1500/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ff7bfe3bfc07bfdf7a752b2b29572987f4902cac1a5149315d94e9b25b3c90a
3
+ size 14244
checkpoints/checkpoint-1500/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bf4ee1a21cac7b0db9a6509d4738739668da3752503f4e308a0d5e0435a00c03
3
+ size 1064
checkpoints/checkpoint-1500/special_tokens_map.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "</s>",
17
+ "unk_token": {
18
+ "content": "<unk>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ }
24
+ }
checkpoints/checkpoint-1500/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoints/checkpoint-1500/tokenizer_config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<unk>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ }
29
+ },
30
+ "bos_token": "<s>",
31
+ "chat_template": "{% for message in messages %}{% if message['role'] == 'user' %}{{'<用户>' + message['content'].strip() + '<AI>'}}{% else %}{{message['content'].strip()}}{% endif %}{% endfor %}",
32
+ "clean_up_tokenization_spaces": false,
33
+ "eos_token": "</s>",
34
+ "legacy": true,
35
+ "model_max_length": 1000000000000000019884624838656,
36
+ "pad_token": "</s>",
37
+ "sp_model_kwargs": {},
38
+ "spaces_between_special_tokens": false,
39
+ "tokenizer_class": "LlamaTokenizer",
40
+ "unk_token": "<unk>",
41
+ "use_default_system_prompt": false
42
+ }
checkpoints/checkpoint-1500/trainer_state.json ADDED
@@ -0,0 +1,1095 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.8025682182985554,
5
+ "eval_steps": 500,
6
+ "global_step": 1500,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 0.01,
13
+ "grad_norm": 7.3019086777975994,
14
+ "learning_rate": 5e-06,
15
+ "loss": 0.6939,
16
+ "step": 10
17
+ },
18
+ {
19
+ "epoch": 0.01,
20
+ "grad_norm": 5.150989333266983,
21
+ "learning_rate": 1e-05,
22
+ "loss": 0.7167,
23
+ "step": 20
24
+ },
25
+ {
26
+ "epoch": 0.02,
27
+ "grad_norm": 3.640558809610037,
28
+ "learning_rate": 1.5e-05,
29
+ "loss": 0.5683,
30
+ "step": 30
31
+ },
32
+ {
33
+ "epoch": 0.02,
34
+ "grad_norm": 7.517999397731128,
35
+ "learning_rate": 2e-05,
36
+ "loss": 0.5472,
37
+ "step": 40
38
+ },
39
+ {
40
+ "epoch": 0.03,
41
+ "grad_norm": 1.9687061679463425,
42
+ "learning_rate": 2.5e-05,
43
+ "loss": 0.4439,
44
+ "step": 50
45
+ },
46
+ {
47
+ "epoch": 0.03,
48
+ "grad_norm": 3.643479206523606,
49
+ "learning_rate": 3e-05,
50
+ "loss": 0.2486,
51
+ "step": 60
52
+ },
53
+ {
54
+ "epoch": 0.04,
55
+ "grad_norm": 2.2754773308695095,
56
+ "learning_rate": 3.5e-05,
57
+ "loss": 0.2217,
58
+ "step": 70
59
+ },
60
+ {
61
+ "epoch": 0.04,
62
+ "grad_norm": 1.7144730049127388,
63
+ "learning_rate": 4e-05,
64
+ "loss": 0.169,
65
+ "step": 80
66
+ },
67
+ {
68
+ "epoch": 0.05,
69
+ "grad_norm": 3.4702829704135114,
70
+ "learning_rate": 4.5e-05,
71
+ "loss": 0.1994,
72
+ "step": 90
73
+ },
74
+ {
75
+ "epoch": 0.05,
76
+ "grad_norm": 1.3985127340985621,
77
+ "learning_rate": 5e-05,
78
+ "loss": 0.1612,
79
+ "step": 100
80
+ },
81
+ {
82
+ "epoch": 0.06,
83
+ "grad_norm": 1.375992184386137,
84
+ "learning_rate": 4.982758620689655e-05,
85
+ "loss": 0.1576,
86
+ "step": 110
87
+ },
88
+ {
89
+ "epoch": 0.06,
90
+ "grad_norm": 1.9528635753013313,
91
+ "learning_rate": 4.9655172413793107e-05,
92
+ "loss": 0.1393,
93
+ "step": 120
94
+ },
95
+ {
96
+ "epoch": 0.07,
97
+ "grad_norm": 4.075169010198401,
98
+ "learning_rate": 4.9482758620689655e-05,
99
+ "loss": 0.1969,
100
+ "step": 130
101
+ },
102
+ {
103
+ "epoch": 0.07,
104
+ "grad_norm": 2.0953991165751207,
105
+ "learning_rate": 4.931034482758621e-05,
106
+ "loss": 0.1294,
107
+ "step": 140
108
+ },
109
+ {
110
+ "epoch": 0.08,
111
+ "grad_norm": 1.942660591044849,
112
+ "learning_rate": 4.913793103448276e-05,
113
+ "loss": 0.1306,
114
+ "step": 150
115
+ },
116
+ {
117
+ "epoch": 0.09,
118
+ "grad_norm": 3.1508904015728345,
119
+ "learning_rate": 4.896551724137931e-05,
120
+ "loss": 0.1526,
121
+ "step": 160
122
+ },
123
+ {
124
+ "epoch": 0.09,
125
+ "grad_norm": 1.9862795165358471,
126
+ "learning_rate": 4.8793103448275864e-05,
127
+ "loss": 0.1186,
128
+ "step": 170
129
+ },
130
+ {
131
+ "epoch": 0.1,
132
+ "grad_norm": 2.633061833817991,
133
+ "learning_rate": 4.862068965517241e-05,
134
+ "loss": 0.1457,
135
+ "step": 180
136
+ },
137
+ {
138
+ "epoch": 0.1,
139
+ "grad_norm": 1.8017052368446178,
140
+ "learning_rate": 4.844827586206897e-05,
141
+ "loss": 0.1234,
142
+ "step": 190
143
+ },
144
+ {
145
+ "epoch": 0.11,
146
+ "grad_norm": 2.1560694100709803,
147
+ "learning_rate": 4.827586206896552e-05,
148
+ "loss": 0.1346,
149
+ "step": 200
150
+ },
151
+ {
152
+ "epoch": 0.11,
153
+ "grad_norm": 1.5737689267430703,
154
+ "learning_rate": 4.810344827586207e-05,
155
+ "loss": 0.116,
156
+ "step": 210
157
+ },
158
+ {
159
+ "epoch": 0.12,
160
+ "grad_norm": 1.957864677854788,
161
+ "learning_rate": 4.793103448275863e-05,
162
+ "loss": 0.1692,
163
+ "step": 220
164
+ },
165
+ {
166
+ "epoch": 0.12,
167
+ "grad_norm": 2.215039223521855,
168
+ "learning_rate": 4.7758620689655176e-05,
169
+ "loss": 0.1245,
170
+ "step": 230
171
+ },
172
+ {
173
+ "epoch": 0.13,
174
+ "grad_norm": 1.370517239734168,
175
+ "learning_rate": 4.7586206896551725e-05,
176
+ "loss": 0.1476,
177
+ "step": 240
178
+ },
179
+ {
180
+ "epoch": 0.13,
181
+ "grad_norm": 1.7341334563022532,
182
+ "learning_rate": 4.741379310344828e-05,
183
+ "loss": 0.1236,
184
+ "step": 250
185
+ },
186
+ {
187
+ "epoch": 0.14,
188
+ "grad_norm": 1.5994298113068974,
189
+ "learning_rate": 4.724137931034483e-05,
190
+ "loss": 0.1161,
191
+ "step": 260
192
+ },
193
+ {
194
+ "epoch": 0.14,
195
+ "grad_norm": 1.5317433190951963,
196
+ "learning_rate": 4.7068965517241385e-05,
197
+ "loss": 0.1035,
198
+ "step": 270
199
+ },
200
+ {
201
+ "epoch": 0.15,
202
+ "grad_norm": 2.191977732539556,
203
+ "learning_rate": 4.689655172413793e-05,
204
+ "loss": 0.1427,
205
+ "step": 280
206
+ },
207
+ {
208
+ "epoch": 0.16,
209
+ "grad_norm": 1.6038667570691656,
210
+ "learning_rate": 4.672413793103448e-05,
211
+ "loss": 0.1225,
212
+ "step": 290
213
+ },
214
+ {
215
+ "epoch": 0.16,
216
+ "grad_norm": 2.577572731831179,
217
+ "learning_rate": 4.655172413793104e-05,
218
+ "loss": 0.1399,
219
+ "step": 300
220
+ },
221
+ {
222
+ "epoch": 0.17,
223
+ "grad_norm": 1.6199241001441385,
224
+ "learning_rate": 4.6379310344827586e-05,
225
+ "loss": 0.1242,
226
+ "step": 310
227
+ },
228
+ {
229
+ "epoch": 0.17,
230
+ "grad_norm": 2.236577821186196,
231
+ "learning_rate": 4.6206896551724135e-05,
232
+ "loss": 0.1656,
233
+ "step": 320
234
+ },
235
+ {
236
+ "epoch": 0.18,
237
+ "grad_norm": 1.7294690605254757,
238
+ "learning_rate": 4.603448275862069e-05,
239
+ "loss": 0.1382,
240
+ "step": 330
241
+ },
242
+ {
243
+ "epoch": 0.18,
244
+ "grad_norm": 2.196527516378511,
245
+ "learning_rate": 4.586206896551724e-05,
246
+ "loss": 0.1257,
247
+ "step": 340
248
+ },
249
+ {
250
+ "epoch": 0.19,
251
+ "grad_norm": 2.1057444340221463,
252
+ "learning_rate": 4.5689655172413794e-05,
253
+ "loss": 0.1238,
254
+ "step": 350
255
+ },
256
+ {
257
+ "epoch": 0.19,
258
+ "grad_norm": 1.5409556870328274,
259
+ "learning_rate": 4.551724137931035e-05,
260
+ "loss": 0.1383,
261
+ "step": 360
262
+ },
263
+ {
264
+ "epoch": 0.2,
265
+ "grad_norm": 1.5204083616874053,
266
+ "learning_rate": 4.53448275862069e-05,
267
+ "loss": 0.1068,
268
+ "step": 370
269
+ },
270
+ {
271
+ "epoch": 0.2,
272
+ "grad_norm": 2.3557725298931746,
273
+ "learning_rate": 4.5172413793103454e-05,
274
+ "loss": 0.1071,
275
+ "step": 380
276
+ },
277
+ {
278
+ "epoch": 0.21,
279
+ "grad_norm": 3.2601538460418644,
280
+ "learning_rate": 4.5e-05,
281
+ "loss": 0.125,
282
+ "step": 390
283
+ },
284
+ {
285
+ "epoch": 0.21,
286
+ "grad_norm": 1.9031725385762286,
287
+ "learning_rate": 4.482758620689655e-05,
288
+ "loss": 0.0991,
289
+ "step": 400
290
+ },
291
+ {
292
+ "epoch": 0.22,
293
+ "grad_norm": 1.3946050262183123,
294
+ "learning_rate": 4.465517241379311e-05,
295
+ "loss": 0.1156,
296
+ "step": 410
297
+ },
298
+ {
299
+ "epoch": 0.22,
300
+ "grad_norm": 1.097644875106397,
301
+ "learning_rate": 4.4482758620689656e-05,
302
+ "loss": 0.1366,
303
+ "step": 420
304
+ },
305
+ {
306
+ "epoch": 0.23,
307
+ "grad_norm": 1.37846299019108,
308
+ "learning_rate": 4.431034482758621e-05,
309
+ "loss": 0.126,
310
+ "step": 430
311
+ },
312
+ {
313
+ "epoch": 0.24,
314
+ "grad_norm": 1.8340152889320331,
315
+ "learning_rate": 4.413793103448276e-05,
316
+ "loss": 0.1066,
317
+ "step": 440
318
+ },
319
+ {
320
+ "epoch": 0.24,
321
+ "grad_norm": 1.8304505611337867,
322
+ "learning_rate": 4.396551724137931e-05,
323
+ "loss": 0.0868,
324
+ "step": 450
325
+ },
326
+ {
327
+ "epoch": 0.25,
328
+ "grad_norm": 1.550196490898523,
329
+ "learning_rate": 4.3793103448275864e-05,
330
+ "loss": 0.1286,
331
+ "step": 460
332
+ },
333
+ {
334
+ "epoch": 0.25,
335
+ "grad_norm": 2.176112247796248,
336
+ "learning_rate": 4.362068965517241e-05,
337
+ "loss": 0.1206,
338
+ "step": 470
339
+ },
340
+ {
341
+ "epoch": 0.26,
342
+ "grad_norm": 1.6589263894091213,
343
+ "learning_rate": 4.344827586206897e-05,
344
+ "loss": 0.1008,
345
+ "step": 480
346
+ },
347
+ {
348
+ "epoch": 0.26,
349
+ "grad_norm": 1.8349611508902046,
350
+ "learning_rate": 4.327586206896552e-05,
351
+ "loss": 0.1198,
352
+ "step": 490
353
+ },
354
+ {
355
+ "epoch": 0.27,
356
+ "grad_norm": 2.1218964920724126,
357
+ "learning_rate": 4.3103448275862066e-05,
358
+ "loss": 0.1166,
359
+ "step": 500
360
+ },
361
+ {
362
+ "epoch": 0.27,
363
+ "eval_loss": 0.6078919172286987,
364
+ "eval_runtime": 116.8471,
365
+ "eval_samples_per_second": 11.288,
366
+ "eval_steps_per_second": 2.824,
367
+ "step": 500
368
+ },
369
+ {
370
+ "epoch": 0.27,
371
+ "grad_norm": 2.5775141311007856,
372
+ "learning_rate": 4.293103448275863e-05,
373
+ "loss": 0.1124,
374
+ "step": 510
375
+ },
376
+ {
377
+ "epoch": 0.28,
378
+ "grad_norm": 1.6019517017800202,
379
+ "learning_rate": 4.275862068965518e-05,
380
+ "loss": 0.1068,
381
+ "step": 520
382
+ },
383
+ {
384
+ "epoch": 0.28,
385
+ "grad_norm": 2.6901962755310205,
386
+ "learning_rate": 4.2586206896551725e-05,
387
+ "loss": 0.1286,
388
+ "step": 530
389
+ },
390
+ {
391
+ "epoch": 0.29,
392
+ "grad_norm": 3.9517995356721767,
393
+ "learning_rate": 4.241379310344828e-05,
394
+ "loss": 0.1149,
395
+ "step": 540
396
+ },
397
+ {
398
+ "epoch": 0.29,
399
+ "grad_norm": 2.0428896228074076,
400
+ "learning_rate": 4.224137931034483e-05,
401
+ "loss": 0.141,
402
+ "step": 550
403
+ },
404
+ {
405
+ "epoch": 0.3,
406
+ "grad_norm": 2.263258592133553,
407
+ "learning_rate": 4.2068965517241385e-05,
408
+ "loss": 0.0949,
409
+ "step": 560
410
+ },
411
+ {
412
+ "epoch": 0.3,
413
+ "grad_norm": 1.4823165953974604,
414
+ "learning_rate": 4.1896551724137934e-05,
415
+ "loss": 0.1365,
416
+ "step": 570
417
+ },
418
+ {
419
+ "epoch": 0.31,
420
+ "grad_norm": 1.4441377020989878,
421
+ "learning_rate": 4.172413793103448e-05,
422
+ "loss": 0.1015,
423
+ "step": 580
424
+ },
425
+ {
426
+ "epoch": 0.32,
427
+ "grad_norm": 1.4779059254436886,
428
+ "learning_rate": 4.155172413793104e-05,
429
+ "loss": 0.0988,
430
+ "step": 590
431
+ },
432
+ {
433
+ "epoch": 0.32,
434
+ "grad_norm": 1.7777823671018818,
435
+ "learning_rate": 4.1379310344827587e-05,
436
+ "loss": 0.1124,
437
+ "step": 600
438
+ },
439
+ {
440
+ "epoch": 0.33,
441
+ "grad_norm": 1.737579831138191,
442
+ "learning_rate": 4.120689655172414e-05,
443
+ "loss": 0.086,
444
+ "step": 610
445
+ },
446
+ {
447
+ "epoch": 0.33,
448
+ "grad_norm": 2.708453961232997,
449
+ "learning_rate": 4.103448275862069e-05,
450
+ "loss": 0.0933,
451
+ "step": 620
452
+ },
453
+ {
454
+ "epoch": 0.34,
455
+ "grad_norm": 1.8871805824236731,
456
+ "learning_rate": 4.086206896551724e-05,
457
+ "loss": 0.1407,
458
+ "step": 630
459
+ },
460
+ {
461
+ "epoch": 0.34,
462
+ "grad_norm": 1.7300112722427339,
463
+ "learning_rate": 4.0689655172413795e-05,
464
+ "loss": 0.1224,
465
+ "step": 640
466
+ },
467
+ {
468
+ "epoch": 0.35,
469
+ "grad_norm": 1.4631236252240614,
470
+ "learning_rate": 4.0517241379310344e-05,
471
+ "loss": 0.1014,
472
+ "step": 650
473
+ },
474
+ {
475
+ "epoch": 0.35,
476
+ "grad_norm": 1.2602431597419264,
477
+ "learning_rate": 4.03448275862069e-05,
478
+ "loss": 0.1583,
479
+ "step": 660
480
+ },
481
+ {
482
+ "epoch": 0.36,
483
+ "grad_norm": 1.2077937041919453,
484
+ "learning_rate": 4.0172413793103455e-05,
485
+ "loss": 0.1209,
486
+ "step": 670
487
+ },
488
+ {
489
+ "epoch": 0.36,
490
+ "grad_norm": 1.4386184566429954,
491
+ "learning_rate": 4e-05,
492
+ "loss": 0.1016,
493
+ "step": 680
494
+ },
495
+ {
496
+ "epoch": 0.37,
497
+ "grad_norm": 2.6160358835758584,
498
+ "learning_rate": 3.982758620689656e-05,
499
+ "loss": 0.1062,
500
+ "step": 690
501
+ },
502
+ {
503
+ "epoch": 0.37,
504
+ "grad_norm": 1.9278794640498955,
505
+ "learning_rate": 3.965517241379311e-05,
506
+ "loss": 0.1037,
507
+ "step": 700
508
+ },
509
+ {
510
+ "epoch": 0.38,
511
+ "grad_norm": 1.2872571900237024,
512
+ "learning_rate": 3.9482758620689656e-05,
513
+ "loss": 0.096,
514
+ "step": 710
515
+ },
516
+ {
517
+ "epoch": 0.39,
518
+ "grad_norm": 1.243554309347296,
519
+ "learning_rate": 3.931034482758621e-05,
520
+ "loss": 0.1084,
521
+ "step": 720
522
+ },
523
+ {
524
+ "epoch": 0.39,
525
+ "grad_norm": 1.5090589714253309,
526
+ "learning_rate": 3.913793103448276e-05,
527
+ "loss": 0.0877,
528
+ "step": 730
529
+ },
530
+ {
531
+ "epoch": 0.4,
532
+ "grad_norm": 2.1419550623025168,
533
+ "learning_rate": 3.896551724137931e-05,
534
+ "loss": 0.0994,
535
+ "step": 740
536
+ },
537
+ {
538
+ "epoch": 0.4,
539
+ "grad_norm": 1.7807417973632438,
540
+ "learning_rate": 3.8793103448275865e-05,
541
+ "loss": 0.1029,
542
+ "step": 750
543
+ },
544
+ {
545
+ "epoch": 0.41,
546
+ "grad_norm": 1.3342960263057682,
547
+ "learning_rate": 3.862068965517241e-05,
548
+ "loss": 0.1072,
549
+ "step": 760
550
+ },
551
+ {
552
+ "epoch": 0.41,
553
+ "grad_norm": 2.3865282340158136,
554
+ "learning_rate": 3.844827586206897e-05,
555
+ "loss": 0.1193,
556
+ "step": 770
557
+ },
558
+ {
559
+ "epoch": 0.42,
560
+ "grad_norm": 1.5428742248459941,
561
+ "learning_rate": 3.827586206896552e-05,
562
+ "loss": 0.1156,
563
+ "step": 780
564
+ },
565
+ {
566
+ "epoch": 0.42,
567
+ "grad_norm": 1.7660532115509044,
568
+ "learning_rate": 3.8103448275862066e-05,
569
+ "loss": 0.122,
570
+ "step": 790
571
+ },
572
+ {
573
+ "epoch": 0.43,
574
+ "grad_norm": 1.8149742752994733,
575
+ "learning_rate": 3.793103448275862e-05,
576
+ "loss": 0.1346,
577
+ "step": 800
578
+ },
579
+ {
580
+ "epoch": 0.43,
581
+ "grad_norm": 1.7456408876472995,
582
+ "learning_rate": 3.775862068965517e-05,
583
+ "loss": 0.1223,
584
+ "step": 810
585
+ },
586
+ {
587
+ "epoch": 0.44,
588
+ "grad_norm": 1.10163248244056,
589
+ "learning_rate": 3.7586206896551726e-05,
590
+ "loss": 0.1031,
591
+ "step": 820
592
+ },
593
+ {
594
+ "epoch": 0.44,
595
+ "grad_norm": 1.6441057737088702,
596
+ "learning_rate": 3.741379310344828e-05,
597
+ "loss": 0.1059,
598
+ "step": 830
599
+ },
600
+ {
601
+ "epoch": 0.45,
602
+ "grad_norm": 2.3999279790163484,
603
+ "learning_rate": 3.724137931034483e-05,
604
+ "loss": 0.1125,
605
+ "step": 840
606
+ },
607
+ {
608
+ "epoch": 0.45,
609
+ "grad_norm": 2.2081477934156903,
610
+ "learning_rate": 3.7068965517241385e-05,
611
+ "loss": 0.1266,
612
+ "step": 850
613
+ },
614
+ {
615
+ "epoch": 0.46,
616
+ "grad_norm": 2.366783771480017,
617
+ "learning_rate": 3.6896551724137934e-05,
618
+ "loss": 0.1127,
619
+ "step": 860
620
+ },
621
+ {
622
+ "epoch": 0.47,
623
+ "grad_norm": 1.3077873674136173,
624
+ "learning_rate": 3.672413793103448e-05,
625
+ "loss": 0.1095,
626
+ "step": 870
627
+ },
628
+ {
629
+ "epoch": 0.47,
630
+ "grad_norm": 1.8197812508114701,
631
+ "learning_rate": 3.655172413793104e-05,
632
+ "loss": 0.0932,
633
+ "step": 880
634
+ },
635
+ {
636
+ "epoch": 0.48,
637
+ "grad_norm": 1.0806192057981219,
638
+ "learning_rate": 3.637931034482759e-05,
639
+ "loss": 0.1166,
640
+ "step": 890
641
+ },
642
+ {
643
+ "epoch": 0.48,
644
+ "grad_norm": 1.520666439337001,
645
+ "learning_rate": 3.620689655172414e-05,
646
+ "loss": 0.0883,
647
+ "step": 900
648
+ },
649
+ {
650
+ "epoch": 0.49,
651
+ "grad_norm": 1.690002270629302,
652
+ "learning_rate": 3.603448275862069e-05,
653
+ "loss": 0.1199,
654
+ "step": 910
655
+ },
656
+ {
657
+ "epoch": 0.49,
658
+ "grad_norm": 1.4319374130118003,
659
+ "learning_rate": 3.586206896551724e-05,
660
+ "loss": 0.0991,
661
+ "step": 920
662
+ },
663
+ {
664
+ "epoch": 0.5,
665
+ "grad_norm": 1.0626084369653164,
666
+ "learning_rate": 3.5689655172413795e-05,
667
+ "loss": 0.0923,
668
+ "step": 930
669
+ },
670
+ {
671
+ "epoch": 0.5,
672
+ "grad_norm": 2.0848060597460902,
673
+ "learning_rate": 3.5517241379310344e-05,
674
+ "loss": 0.0979,
675
+ "step": 940
676
+ },
677
+ {
678
+ "epoch": 0.51,
679
+ "grad_norm": 1.4997189461483256,
680
+ "learning_rate": 3.53448275862069e-05,
681
+ "loss": 0.0949,
682
+ "step": 950
683
+ },
684
+ {
685
+ "epoch": 0.51,
686
+ "grad_norm": 1.7887817042743388,
687
+ "learning_rate": 3.517241379310345e-05,
688
+ "loss": 0.1135,
689
+ "step": 960
690
+ },
691
+ {
692
+ "epoch": 0.52,
693
+ "grad_norm": 3.242965692388458,
694
+ "learning_rate": 3.5e-05,
695
+ "loss": 0.1315,
696
+ "step": 970
697
+ },
698
+ {
699
+ "epoch": 0.52,
700
+ "grad_norm": 1.5034762176322083,
701
+ "learning_rate": 3.482758620689655e-05,
702
+ "loss": 0.1177,
703
+ "step": 980
704
+ },
705
+ {
706
+ "epoch": 0.53,
707
+ "grad_norm": 1.6679474444200848,
708
+ "learning_rate": 3.465517241379311e-05,
709
+ "loss": 0.1182,
710
+ "step": 990
711
+ },
712
+ {
713
+ "epoch": 0.54,
714
+ "grad_norm": 2.814574507251776,
715
+ "learning_rate": 3.4482758620689657e-05,
716
+ "loss": 0.0912,
717
+ "step": 1000
718
+ },
719
+ {
720
+ "epoch": 0.54,
721
+ "eval_loss": 0.6101276874542236,
722
+ "eval_runtime": 113.9995,
723
+ "eval_samples_per_second": 11.57,
724
+ "eval_steps_per_second": 2.895,
725
+ "step": 1000
726
+ },
727
+ {
728
+ "epoch": 0.54,
729
+ "grad_norm": 2.1321319681580535,
730
+ "learning_rate": 3.431034482758621e-05,
731
+ "loss": 0.0983,
732
+ "step": 1010
733
+ },
734
+ {
735
+ "epoch": 0.55,
736
+ "grad_norm": 1.8915101367452352,
737
+ "learning_rate": 3.413793103448276e-05,
738
+ "loss": 0.1113,
739
+ "step": 1020
740
+ },
741
+ {
742
+ "epoch": 0.55,
743
+ "grad_norm": 1.4160985095468477,
744
+ "learning_rate": 3.3965517241379316e-05,
745
+ "loss": 0.1076,
746
+ "step": 1030
747
+ },
748
+ {
749
+ "epoch": 0.56,
750
+ "grad_norm": 1.8562788974878586,
751
+ "learning_rate": 3.3793103448275865e-05,
752
+ "loss": 0.1011,
753
+ "step": 1040
754
+ },
755
+ {
756
+ "epoch": 0.56,
757
+ "grad_norm": 1.3793192563691294,
758
+ "learning_rate": 3.3620689655172414e-05,
759
+ "loss": 0.0978,
760
+ "step": 1050
761
+ },
762
+ {
763
+ "epoch": 0.57,
764
+ "grad_norm": 1.4606563129628805,
765
+ "learning_rate": 3.344827586206897e-05,
766
+ "loss": 0.1069,
767
+ "step": 1060
768
+ },
769
+ {
770
+ "epoch": 0.57,
771
+ "grad_norm": 1.5680856211032999,
772
+ "learning_rate": 3.327586206896552e-05,
773
+ "loss": 0.0988,
774
+ "step": 1070
775
+ },
776
+ {
777
+ "epoch": 0.58,
778
+ "grad_norm": 1.5829345931951275,
779
+ "learning_rate": 3.310344827586207e-05,
780
+ "loss": 0.1256,
781
+ "step": 1080
782
+ },
783
+ {
784
+ "epoch": 0.58,
785
+ "grad_norm": 1.6200852939319585,
786
+ "learning_rate": 3.293103448275862e-05,
787
+ "loss": 0.097,
788
+ "step": 1090
789
+ },
790
+ {
791
+ "epoch": 0.59,
792
+ "grad_norm": 2.259656836213122,
793
+ "learning_rate": 3.275862068965517e-05,
794
+ "loss": 0.1137,
795
+ "step": 1100
796
+ },
797
+ {
798
+ "epoch": 0.59,
799
+ "grad_norm": 2.2483622341560645,
800
+ "learning_rate": 3.2586206896551726e-05,
801
+ "loss": 0.0999,
802
+ "step": 1110
803
+ },
804
+ {
805
+ "epoch": 0.6,
806
+ "grad_norm": 1.168198861956421,
807
+ "learning_rate": 3.2413793103448275e-05,
808
+ "loss": 0.1018,
809
+ "step": 1120
810
+ },
811
+ {
812
+ "epoch": 0.6,
813
+ "grad_norm": 2.4699824799031482,
814
+ "learning_rate": 3.2241379310344824e-05,
815
+ "loss": 0.1132,
816
+ "step": 1130
817
+ },
818
+ {
819
+ "epoch": 0.61,
820
+ "grad_norm": 1.2571654549549751,
821
+ "learning_rate": 3.206896551724138e-05,
822
+ "loss": 0.1054,
823
+ "step": 1140
824
+ },
825
+ {
826
+ "epoch": 0.62,
827
+ "grad_norm": 0.5559534032307631,
828
+ "learning_rate": 3.1896551724137935e-05,
829
+ "loss": 0.0789,
830
+ "step": 1150
831
+ },
832
+ {
833
+ "epoch": 0.62,
834
+ "grad_norm": 1.636369759504475,
835
+ "learning_rate": 3.172413793103448e-05,
836
+ "loss": 0.0902,
837
+ "step": 1160
838
+ },
839
+ {
840
+ "epoch": 0.63,
841
+ "grad_norm": 1.6137142935446496,
842
+ "learning_rate": 3.155172413793104e-05,
843
+ "loss": 0.1199,
844
+ "step": 1170
845
+ },
846
+ {
847
+ "epoch": 0.63,
848
+ "grad_norm": 1.7448003760796802,
849
+ "learning_rate": 3.137931034482759e-05,
850
+ "loss": 0.1295,
851
+ "step": 1180
852
+ },
853
+ {
854
+ "epoch": 0.64,
855
+ "grad_norm": 1.3261005358227276,
856
+ "learning_rate": 3.120689655172414e-05,
857
+ "loss": 0.1117,
858
+ "step": 1190
859
+ },
860
+ {
861
+ "epoch": 0.64,
862
+ "grad_norm": 1.7353127177901462,
863
+ "learning_rate": 3.103448275862069e-05,
864
+ "loss": 0.0951,
865
+ "step": 1200
866
+ },
867
+ {
868
+ "epoch": 0.65,
869
+ "grad_norm": 2.8569975913367074,
870
+ "learning_rate": 3.086206896551724e-05,
871
+ "loss": 0.112,
872
+ "step": 1210
873
+ },
874
+ {
875
+ "epoch": 0.65,
876
+ "grad_norm": 1.3481947218871082,
877
+ "learning_rate": 3.0689655172413796e-05,
878
+ "loss": 0.0876,
879
+ "step": 1220
880
+ },
881
+ {
882
+ "epoch": 0.66,
883
+ "grad_norm": 2.015933141613929,
884
+ "learning_rate": 3.0517241379310348e-05,
885
+ "loss": 0.0993,
886
+ "step": 1230
887
+ },
888
+ {
889
+ "epoch": 0.66,
890
+ "grad_norm": 1.0588164394448019,
891
+ "learning_rate": 3.0344827586206897e-05,
892
+ "loss": 0.1034,
893
+ "step": 1240
894
+ },
895
+ {
896
+ "epoch": 0.67,
897
+ "grad_norm": 1.3594986645993228,
898
+ "learning_rate": 3.017241379310345e-05,
899
+ "loss": 0.1004,
900
+ "step": 1250
901
+ },
902
+ {
903
+ "epoch": 0.67,
904
+ "grad_norm": 1.333098402625009,
905
+ "learning_rate": 3e-05,
906
+ "loss": 0.1259,
907
+ "step": 1260
908
+ },
909
+ {
910
+ "epoch": 0.68,
911
+ "grad_norm": 1.1324206075196583,
912
+ "learning_rate": 2.9827586206896553e-05,
913
+ "loss": 0.1155,
914
+ "step": 1270
915
+ },
916
+ {
917
+ "epoch": 0.68,
918
+ "grad_norm": 1.2270687927795876,
919
+ "learning_rate": 2.96551724137931e-05,
920
+ "loss": 0.092,
921
+ "step": 1280
922
+ },
923
+ {
924
+ "epoch": 0.69,
925
+ "grad_norm": 1.3085362507403875,
926
+ "learning_rate": 2.9482758620689654e-05,
927
+ "loss": 0.1064,
928
+ "step": 1290
929
+ },
930
+ {
931
+ "epoch": 0.7,
932
+ "grad_norm": 1.7135250277750762,
933
+ "learning_rate": 2.9310344827586206e-05,
934
+ "loss": 0.1132,
935
+ "step": 1300
936
+ },
937
+ {
938
+ "epoch": 0.7,
939
+ "grad_norm": 1.6121189707451158,
940
+ "learning_rate": 2.913793103448276e-05,
941
+ "loss": 0.1006,
942
+ "step": 1310
943
+ },
944
+ {
945
+ "epoch": 0.71,
946
+ "grad_norm": 1.3958680925504208,
947
+ "learning_rate": 2.8965517241379313e-05,
948
+ "loss": 0.0956,
949
+ "step": 1320
950
+ },
951
+ {
952
+ "epoch": 0.71,
953
+ "grad_norm": 1.546226150121884,
954
+ "learning_rate": 2.8793103448275865e-05,
955
+ "loss": 0.1142,
956
+ "step": 1330
957
+ },
958
+ {
959
+ "epoch": 0.72,
960
+ "grad_norm": 2.1837739995965415,
961
+ "learning_rate": 2.8620689655172417e-05,
962
+ "loss": 0.1127,
963
+ "step": 1340
964
+ },
965
+ {
966
+ "epoch": 0.72,
967
+ "grad_norm": 1.9402402206909504,
968
+ "learning_rate": 2.844827586206897e-05,
969
+ "loss": 0.0922,
970
+ "step": 1350
971
+ },
972
+ {
973
+ "epoch": 0.73,
974
+ "grad_norm": 1.7914401953164802,
975
+ "learning_rate": 2.8275862068965518e-05,
976
+ "loss": 0.1038,
977
+ "step": 1360
978
+ },
979
+ {
980
+ "epoch": 0.73,
981
+ "grad_norm": 1.505804090650568,
982
+ "learning_rate": 2.810344827586207e-05,
983
+ "loss": 0.1034,
984
+ "step": 1370
985
+ },
986
+ {
987
+ "epoch": 0.74,
988
+ "grad_norm": 1.9907350713586716,
989
+ "learning_rate": 2.7931034482758622e-05,
990
+ "loss": 0.103,
991
+ "step": 1380
992
+ },
993
+ {
994
+ "epoch": 0.74,
995
+ "grad_norm": 1.6948381773166858,
996
+ "learning_rate": 2.7758620689655175e-05,
997
+ "loss": 0.1091,
998
+ "step": 1390
999
+ },
1000
+ {
1001
+ "epoch": 0.75,
1002
+ "grad_norm": 1.3995985437024723,
1003
+ "learning_rate": 2.7586206896551727e-05,
1004
+ "loss": 0.0852,
1005
+ "step": 1400
1006
+ },
1007
+ {
1008
+ "epoch": 0.75,
1009
+ "grad_norm": 1.9347024029069393,
1010
+ "learning_rate": 2.7413793103448275e-05,
1011
+ "loss": 0.1393,
1012
+ "step": 1410
1013
+ },
1014
+ {
1015
+ "epoch": 0.76,
1016
+ "grad_norm": 1.608776792445342,
1017
+ "learning_rate": 2.7241379310344827e-05,
1018
+ "loss": 0.0951,
1019
+ "step": 1420
1020
+ },
1021
+ {
1022
+ "epoch": 0.77,
1023
+ "grad_norm": 1.6005483580619249,
1024
+ "learning_rate": 2.706896551724138e-05,
1025
+ "loss": 0.1037,
1026
+ "step": 1430
1027
+ },
1028
+ {
1029
+ "epoch": 0.77,
1030
+ "grad_norm": 2.374208686020403,
1031
+ "learning_rate": 2.689655172413793e-05,
1032
+ "loss": 0.0926,
1033
+ "step": 1440
1034
+ },
1035
+ {
1036
+ "epoch": 0.78,
1037
+ "grad_norm": 1.7554923995400171,
1038
+ "learning_rate": 2.672413793103448e-05,
1039
+ "loss": 0.1164,
1040
+ "step": 1450
1041
+ },
1042
+ {
1043
+ "epoch": 0.78,
1044
+ "grad_norm": 1.2965114220197742,
1045
+ "learning_rate": 2.6551724137931032e-05,
1046
+ "loss": 0.1102,
1047
+ "step": 1460
1048
+ },
1049
+ {
1050
+ "epoch": 0.79,
1051
+ "grad_norm": 1.8857303249108055,
1052
+ "learning_rate": 2.637931034482759e-05,
1053
+ "loss": 0.0868,
1054
+ "step": 1470
1055
+ },
1056
+ {
1057
+ "epoch": 0.79,
1058
+ "grad_norm": 1.406207551120988,
1059
+ "learning_rate": 2.620689655172414e-05,
1060
+ "loss": 0.1179,
1061
+ "step": 1480
1062
+ },
1063
+ {
1064
+ "epoch": 0.8,
1065
+ "grad_norm": 1.275728362064451,
1066
+ "learning_rate": 2.6034482758620692e-05,
1067
+ "loss": 0.1128,
1068
+ "step": 1490
1069
+ },
1070
+ {
1071
+ "epoch": 0.8,
1072
+ "grad_norm": 1.7122434387720797,
1073
+ "learning_rate": 2.5862068965517244e-05,
1074
+ "loss": 0.1045,
1075
+ "step": 1500
1076
+ },
1077
+ {
1078
+ "epoch": 0.8,
1079
+ "eval_loss": 0.6075221300125122,
1080
+ "eval_runtime": 114.4297,
1081
+ "eval_samples_per_second": 11.527,
1082
+ "eval_steps_per_second": 2.884,
1083
+ "step": 1500
1084
+ }
1085
+ ],
1086
+ "logging_steps": 10,
1087
+ "max_steps": 3000,
1088
+ "num_input_tokens_seen": 0,
1089
+ "num_train_epochs": 2,
1090
+ "save_steps": 500,
1091
+ "total_flos": 43348525056000.0,
1092
+ "train_batch_size": 4,
1093
+ "trial_name": null,
1094
+ "trial_params": null
1095
+ }
checkpoints/checkpoint-1500/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:22266252322e6977894297b61731ca9228c8fcfe4e8d788aef270218c40fec98
3
+ size 6776
checkpoints/checkpoint-1500/zero_to_fp32.py ADDED
@@ -0,0 +1,604 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example: python zero_to_fp32.py . pytorch_model.bin
14
+
15
+ import argparse
16
+ import torch
17
+ import glob
18
+ import math
19
+ import os
20
+ import re
21
+ from collections import OrderedDict
22
+ from dataclasses import dataclass
23
+
24
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
25
+ # DeepSpeed data structures it has to be available in the current python environment.
26
+ from deepspeed.utils import logger
27
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
28
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
29
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
30
+
31
+
32
+ @dataclass
33
+ class zero_model_state:
34
+ buffers: dict()
35
+ param_shapes: dict()
36
+ shared_params: list
37
+ ds_version: int
38
+ frozen_param_shapes: dict()
39
+ frozen_param_fragments: dict()
40
+
41
+
42
+ debug = 0
43
+
44
+ # load to cpu
45
+ device = torch.device('cpu')
46
+
47
+
48
+ def atoi(text):
49
+ return int(text) if text.isdigit() else text
50
+
51
+
52
+ def natural_keys(text):
53
+ '''
54
+ alist.sort(key=natural_keys) sorts in human order
55
+ http://nedbatchelder.com/blog/200712/human_sorting.html
56
+ (See Toothy's implementation in the comments)
57
+ '''
58
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
59
+
60
+
61
+ def get_model_state_file(checkpoint_dir, zero_stage):
62
+ if not os.path.isdir(checkpoint_dir):
63
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
64
+
65
+ # there should be only one file
66
+ if zero_stage <= 2:
67
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
68
+ elif zero_stage == 3:
69
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
70
+
71
+ if not os.path.exists(file):
72
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
73
+
74
+ return file
75
+
76
+
77
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
78
+ # XXX: need to test that this simple glob rule works for multi-node setup too
79
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
80
+
81
+ if len(ckpt_files) == 0:
82
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
83
+
84
+ return ckpt_files
85
+
86
+
87
+ def get_optim_files(checkpoint_dir):
88
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
89
+
90
+
91
+ def get_model_state_files(checkpoint_dir):
92
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
93
+
94
+
95
+ def parse_model_states(files):
96
+ zero_model_states = []
97
+ for file in files:
98
+ state_dict = torch.load(file, map_location=device)
99
+
100
+ if BUFFER_NAMES not in state_dict:
101
+ raise ValueError(f"{file} is not a model state checkpoint")
102
+ buffer_names = state_dict[BUFFER_NAMES]
103
+ if debug:
104
+ print("Found buffers:", buffer_names)
105
+
106
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
107
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
108
+ param_shapes = state_dict[PARAM_SHAPES]
109
+
110
+ # collect parameters that are included in param_shapes
111
+ param_names = []
112
+ for s in param_shapes:
113
+ for name in s.keys():
114
+ param_names.append(name)
115
+
116
+ # update with frozen parameters
117
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
118
+ if frozen_param_shapes is not None:
119
+ if debug:
120
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
121
+ param_names += list(frozen_param_shapes.keys())
122
+
123
+ # handle shared params
124
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
125
+
126
+ ds_version = state_dict.get(DS_VERSION, None)
127
+
128
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
129
+
130
+ z_model_state = zero_model_state(buffers=buffers,
131
+ param_shapes=param_shapes,
132
+ shared_params=shared_params,
133
+ ds_version=ds_version,
134
+ frozen_param_shapes=frozen_param_shapes,
135
+ frozen_param_fragments=frozen_param_fragments)
136
+ zero_model_states.append(z_model_state)
137
+
138
+ return zero_model_states
139
+
140
+
141
+ def parse_optim_states(files, ds_checkpoint_dir):
142
+
143
+ total_files = len(files)
144
+ state_dicts = []
145
+ for f in files:
146
+ state_dict = torch.load(f, map_location=device)
147
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
148
+ # and also handle the case where it was already removed by another helper script
149
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
150
+ state_dicts.append(state_dict)
151
+
152
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
153
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
154
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
155
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
156
+
157
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
158
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
159
+ # use the max of the partition_count to get the dp world_size.
160
+
161
+ if type(world_size) is list:
162
+ world_size = max(world_size)
163
+
164
+ if world_size != total_files:
165
+ raise ValueError(
166
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
167
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
168
+ )
169
+
170
+ # the groups are named differently in each stage
171
+ if zero_stage <= 2:
172
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
173
+ elif zero_stage == 3:
174
+ fp32_groups_key = FP32_FLAT_GROUPS
175
+ else:
176
+ raise ValueError(f"unknown zero stage {zero_stage}")
177
+
178
+ if zero_stage <= 2:
179
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
180
+ elif zero_stage == 3:
181
+ # if there is more than one param group, there will be multiple flattened tensors - one
182
+ # flattened tensor per group - for simplicity merge them into a single tensor
183
+ #
184
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
185
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
186
+
187
+ fp32_flat_groups = [
188
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key], 0) for i in range(len(state_dicts))
189
+ ]
190
+
191
+ return zero_stage, world_size, fp32_flat_groups
192
+
193
+
194
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
195
+ """
196
+ Returns fp32 state_dict reconstructed from ds checkpoint
197
+
198
+ Args:
199
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
200
+
201
+ """
202
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
203
+
204
+ optim_files = get_optim_files(ds_checkpoint_dir)
205
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
206
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
207
+
208
+ model_files = get_model_state_files(ds_checkpoint_dir)
209
+
210
+ zero_model_states = parse_model_states(model_files)
211
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
212
+
213
+ if zero_stage <= 2:
214
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
215
+ exclude_frozen_parameters)
216
+ elif zero_stage == 3:
217
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
218
+ exclude_frozen_parameters)
219
+
220
+
221
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
222
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
223
+ return
224
+
225
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
226
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
227
+
228
+ if debug:
229
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
230
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
231
+
232
+ wanted_params = len(frozen_param_shapes)
233
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
234
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
235
+ print(f'Frozen params: Have {avail_numel} numels to process.')
236
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
237
+
238
+ total_params = 0
239
+ total_numel = 0
240
+ for name, shape in frozen_param_shapes.items():
241
+ total_params += 1
242
+ unpartitioned_numel = shape.numel()
243
+ total_numel += unpartitioned_numel
244
+
245
+ state_dict[name] = frozen_param_fragments[name]
246
+
247
+ if debug:
248
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
249
+
250
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
251
+
252
+
253
+ def _has_callable(obj, fn):
254
+ attr = getattr(obj, fn, None)
255
+ return callable(attr)
256
+
257
+
258
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
259
+ param_shapes = zero_model_states[0].param_shapes
260
+
261
+ # Reconstruction protocol:
262
+ #
263
+ # XXX: document this
264
+
265
+ if debug:
266
+ for i in range(world_size):
267
+ for j in range(len(fp32_flat_groups[0])):
268
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
269
+
270
+ # XXX: memory usage doubles here (zero2)
271
+ num_param_groups = len(fp32_flat_groups[0])
272
+ merged_single_partition_of_fp32_groups = []
273
+ for i in range(num_param_groups):
274
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
275
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
276
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
277
+ avail_numel = sum(
278
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
279
+
280
+ if debug:
281
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
282
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
283
+ # not asserting if there is a mismatch due to possible padding
284
+ print(f"Have {avail_numel} numels to process.")
285
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
286
+
287
+ # params
288
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
289
+ # out-of-core computing solution
290
+ total_numel = 0
291
+ total_params = 0
292
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
293
+ offset = 0
294
+ avail_numel = full_single_fp32_vector.numel()
295
+ for name, shape in shapes.items():
296
+
297
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
298
+ total_numel += unpartitioned_numel
299
+ total_params += 1
300
+
301
+ if debug:
302
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
303
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
304
+ offset += unpartitioned_numel
305
+
306
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
307
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
308
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
309
+ # live optimizer object, so we are checking that the numbers are within the right range
310
+ align_to = 2 * world_size
311
+
312
+ def zero2_align(x):
313
+ return align_to * math.ceil(x / align_to)
314
+
315
+ if debug:
316
+ print(f"original offset={offset}, avail_numel={avail_numel}")
317
+
318
+ offset = zero2_align(offset)
319
+ avail_numel = zero2_align(avail_numel)
320
+
321
+ if debug:
322
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
323
+
324
+ # Sanity check
325
+ if offset != avail_numel:
326
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
327
+
328
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
329
+
330
+
331
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
332
+ exclude_frozen_parameters):
333
+ state_dict = OrderedDict()
334
+
335
+ # buffers
336
+ buffers = zero_model_states[0].buffers
337
+ state_dict.update(buffers)
338
+ if debug:
339
+ print(f"added {len(buffers)} buffers")
340
+
341
+ if not exclude_frozen_parameters:
342
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
343
+
344
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
345
+
346
+ # recover shared parameters
347
+ for pair in zero_model_states[0].shared_params:
348
+ if pair[1] in state_dict:
349
+ state_dict[pair[0]] = state_dict[pair[1]]
350
+
351
+ return state_dict
352
+
353
+
354
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
355
+ remainder = unpartitioned_numel % world_size
356
+ padding_numel = (world_size - remainder) if remainder else 0
357
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
358
+ return partitioned_numel, padding_numel
359
+
360
+
361
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
362
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
363
+ return
364
+
365
+ if debug:
366
+ for i in range(world_size):
367
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
368
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
369
+
370
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
371
+ wanted_params = len(frozen_param_shapes)
372
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
373
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
374
+ print(f'Frozen params: Have {avail_numel} numels to process.')
375
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
376
+
377
+ total_params = 0
378
+ total_numel = 0
379
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
380
+ total_params += 1
381
+ unpartitioned_numel = shape.numel()
382
+ total_numel += unpartitioned_numel
383
+
384
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
385
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
386
+
387
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
388
+
389
+ if debug:
390
+ print(
391
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
392
+ )
393
+
394
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
395
+
396
+
397
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
398
+ param_shapes = zero_model_states[0].param_shapes
399
+ avail_numel = fp32_flat_groups[0].numel() * world_size
400
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
401
+ # param, re-consolidating each param, while dealing with padding if any
402
+
403
+ # merge list of dicts, preserving order
404
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
405
+
406
+ if debug:
407
+ for i in range(world_size):
408
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
409
+
410
+ wanted_params = len(param_shapes)
411
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
412
+ # not asserting if there is a mismatch due to possible padding
413
+ avail_numel = fp32_flat_groups[0].numel() * world_size
414
+ print(f"Trainable params: Have {avail_numel} numels to process.")
415
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
416
+
417
+ # params
418
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
419
+ # out-of-core computing solution
420
+ offset = 0
421
+ total_numel = 0
422
+ total_params = 0
423
+ for name, shape in param_shapes.items():
424
+
425
+ unpartitioned_numel = shape.numel()
426
+ total_numel += unpartitioned_numel
427
+ total_params += 1
428
+
429
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
430
+
431
+ if debug:
432
+ print(
433
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
434
+ )
435
+
436
+ # XXX: memory usage doubles here
437
+ state_dict[name] = torch.cat(
438
+ tuple(fp32_flat_groups[i].narrow(0, offset, partitioned_numel) for i in range(world_size)),
439
+ 0).narrow(0, 0, unpartitioned_numel).view(shape)
440
+ offset += partitioned_numel
441
+
442
+ offset *= world_size
443
+
444
+ # Sanity check
445
+ if offset != avail_numel:
446
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
447
+
448
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
449
+
450
+
451
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
452
+ exclude_frozen_parameters):
453
+ state_dict = OrderedDict()
454
+
455
+ # buffers
456
+ buffers = zero_model_states[0].buffers
457
+ state_dict.update(buffers)
458
+ if debug:
459
+ print(f"added {len(buffers)} buffers")
460
+
461
+ if not exclude_frozen_parameters:
462
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
463
+
464
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
465
+
466
+ # recover shared parameters
467
+ for pair in zero_model_states[0].shared_params:
468
+ if pair[1] in state_dict:
469
+ state_dict[pair[0]] = state_dict[pair[1]]
470
+
471
+ return state_dict
472
+
473
+
474
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None, exclude_frozen_parameters=False):
475
+ """
476
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
477
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
478
+ via a model hub.
479
+
480
+ Args:
481
+ - ``checkpoint_dir``: path to the desired checkpoint folder
482
+ - ``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``
483
+ - ``exclude_frozen_parameters``: exclude frozen parameters
484
+
485
+ Returns:
486
+ - pytorch ``state_dict``
487
+
488
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
489
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
490
+ the checkpoint.
491
+
492
+ A typical usage might be ::
493
+
494
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
495
+ # do the training and checkpoint saving
496
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
497
+ model = model.cpu() # move to cpu
498
+ model.load_state_dict(state_dict)
499
+ # submit to model hub or save the model to share with others
500
+
501
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
502
+ application. i.e. you will need to re-initialize the deepspeed engine, since
503
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
504
+
505
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
506
+
507
+ """
508
+ if tag is None:
509
+ latest_path = os.path.join(checkpoint_dir, 'latest')
510
+ if os.path.isfile(latest_path):
511
+ with open(latest_path, 'r') as fd:
512
+ tag = fd.read().strip()
513
+ else:
514
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
515
+
516
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
517
+
518
+ if not os.path.isdir(ds_checkpoint_dir):
519
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
520
+
521
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
522
+
523
+
524
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None, exclude_frozen_parameters=False):
525
+ """
526
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
527
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
528
+
529
+ Args:
530
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
531
+ - ``output_file``: path to the pytorch fp32 state_dict output file (e.g. path/pytorch_model.bin)
532
+ - ``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``
533
+ - ``exclude_frozen_parameters``: exclude frozen parameters
534
+ """
535
+
536
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag, exclude_frozen_parameters)
537
+ print(f"Saving fp32 state dict to {output_file}")
538
+ torch.save(state_dict, output_file)
539
+
540
+
541
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
542
+ """
543
+ 1. Put the provided model to cpu
544
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
545
+ 3. Load it into the provided model
546
+
547
+ Args:
548
+ - ``model``: the model object to update
549
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
550
+ - ``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``
551
+
552
+ Returns:
553
+ - ``model`: modified model
554
+
555
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
556
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
557
+ conveniently placed for you in the checkpoint folder.
558
+
559
+ A typical usage might be ::
560
+
561
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
562
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
563
+ # submit to model hub or save the model to share with others
564
+
565
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
566
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
567
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
568
+
569
+ """
570
+ logger.info(f"Extracting fp32 weights")
571
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
572
+
573
+ logger.info(f"Overwriting model with fp32 weights")
574
+ model = model.cpu()
575
+ model.load_state_dict(state_dict, strict=False)
576
+
577
+ return model
578
+
579
+
580
+ if __name__ == "__main__":
581
+
582
+ parser = argparse.ArgumentParser()
583
+ parser.add_argument("checkpoint_dir",
584
+ type=str,
585
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
586
+ parser.add_argument(
587
+ "output_file",
588
+ type=str,
589
+ help="path to the pytorch fp32 state_dict output file (e.g. path/checkpoint-12/pytorch_model.bin)")
590
+ parser.add_argument("-t",
591
+ "--tag",
592
+ type=str,
593
+ default=None,
594
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
595
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
596
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
597
+ args = parser.parse_args()
598
+
599
+ debug = args.debug
600
+
601
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
602
+ args.output_file,
603
+ tag=args.tag,
604
+ exclude_frozen_parameters=args.exclude_frozen_parameters)
checkpoints/checkpoint-2000/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: peft
3
+ base_model: openbmb/MiniCPM-2B-dpo-bf16
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
200
+ ### Framework versions
201
+
202
+ - PEFT 0.10.0
checkpoints/checkpoint-2000/adapter_config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "openbmb/MiniCPM-2B-dpo-bf16",
5
+ "bias": "none",
6
+ "fan_in_fan_out": false,
7
+ "inference_mode": true,
8
+ "init_lora_weights": "gaussian",
9
+ "layer_replication": null,
10
+ "layers_pattern": null,
11
+ "layers_to_transform": null,
12
+ "loftq_config": {},
13
+ "lora_alpha": 32,
14
+ "lora_dropout": 0.1,
15
+ "megatron_config": null,
16
+ "megatron_core": "megatron.core",
17
+ "modules_to_save": null,
18
+ "peft_type": "LORA",
19
+ "r": 8,
20
+ "rank_pattern": {},
21
+ "revision": null,
22
+ "target_modules": [
23
+ "v_proj",
24
+ "q_proj"
25
+ ],
26
+ "task_type": "CAUSAL_LM",
27
+ "use_dora": false,
28
+ "use_rslora": false
29
+ }
checkpoints/checkpoint-2000/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c1b8d76bd1aed8b1d8412eb6c56e84db43664bebd6ad688ad0950fd8209fc950
3
+ size 5919456
checkpoints/checkpoint-2000/global_step2000/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dda5a911ff898c12d55662a92778edfd52a8073eea19f9b26697459b3193b10a
3
+ size 35393392
checkpoints/checkpoint-2000/global_step2000/zero_pp_rank_0_mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4e9a98f645b03701444c7e44c6c6a7f0356f803ea2720858c1e66a25b785255d
3
+ size 183275
checkpoints/checkpoint-2000/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step2000
checkpoints/checkpoint-2000/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a818498d41465e958bf28c1ed45c89226bd9e0922529cc444009e8907e458b5c
3
+ size 14244
checkpoints/checkpoint-2000/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:047852d7b48f1f8dbf5d56d9f5244137e0e2504e7bca2d487065561fcb1ffc15
3
+ size 1064
checkpoints/checkpoint-2000/special_tokens_map.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": "</s>",
17
+ "unk_token": {
18
+ "content": "<unk>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ }
24
+ }
checkpoints/checkpoint-2000/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoints/checkpoint-2000/tokenizer_config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<unk>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ }
29
+ },
30
+ "bos_token": "<s>",
31
+ "chat_template": "{% for message in messages %}{% if message['role'] == 'user' %}{{'<用户>' + message['content'].strip() + '<AI>'}}{% else %}{{message['content'].strip()}}{% endif %}{% endfor %}",
32
+ "clean_up_tokenization_spaces": false,
33
+ "eos_token": "</s>",
34
+ "legacy": true,
35
+ "model_max_length": 1000000000000000019884624838656,
36
+ "pad_token": "</s>",
37
+ "sp_model_kwargs": {},
38
+ "spaces_between_special_tokens": false,
39
+ "tokenizer_class": "LlamaTokenizer",
40
+ "unk_token": "<unk>",
41
+ "use_default_system_prompt": false
42
+ }
checkpoints/checkpoint-2000/trainer_state.json ADDED
@@ -0,0 +1,1453 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 1.070090957731407,
5
+ "eval_steps": 500,
6
+ "global_step": 2000,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 0.01,
13
+ "grad_norm": 7.3019086777975994,
14
+ "learning_rate": 5e-06,
15
+ "loss": 0.6939,
16
+ "step": 10
17
+ },
18
+ {
19
+ "epoch": 0.01,
20
+ "grad_norm": 5.150989333266983,
21
+ "learning_rate": 1e-05,
22
+ "loss": 0.7167,
23
+ "step": 20
24
+ },
25
+ {
26
+ "epoch": 0.02,
27
+ "grad_norm": 3.640558809610037,
28
+ "learning_rate": 1.5e-05,
29
+ "loss": 0.5683,
30
+ "step": 30
31
+ },
32
+ {
33
+ "epoch": 0.02,
34
+ "grad_norm": 7.517999397731128,
35
+ "learning_rate": 2e-05,
36
+ "loss": 0.5472,
37
+ "step": 40
38
+ },
39
+ {
40
+ "epoch": 0.03,
41
+ "grad_norm": 1.9687061679463425,
42
+ "learning_rate": 2.5e-05,
43
+ "loss": 0.4439,
44
+ "step": 50
45
+ },
46
+ {
47
+ "epoch": 0.03,
48
+ "grad_norm": 3.643479206523606,
49
+ "learning_rate": 3e-05,
50
+ "loss": 0.2486,
51
+ "step": 60
52
+ },
53
+ {
54
+ "epoch": 0.04,
55
+ "grad_norm": 2.2754773308695095,
56
+ "learning_rate": 3.5e-05,
57
+ "loss": 0.2217,
58
+ "step": 70
59
+ },
60
+ {
61
+ "epoch": 0.04,
62
+ "grad_norm": 1.7144730049127388,
63
+ "learning_rate": 4e-05,
64
+ "loss": 0.169,
65
+ "step": 80
66
+ },
67
+ {
68
+ "epoch": 0.05,
69
+ "grad_norm": 3.4702829704135114,
70
+ "learning_rate": 4.5e-05,
71
+ "loss": 0.1994,
72
+ "step": 90
73
+ },
74
+ {
75
+ "epoch": 0.05,
76
+ "grad_norm": 1.3985127340985621,
77
+ "learning_rate": 5e-05,
78
+ "loss": 0.1612,
79
+ "step": 100
80
+ },
81
+ {
82
+ "epoch": 0.06,
83
+ "grad_norm": 1.375992184386137,
84
+ "learning_rate": 4.982758620689655e-05,
85
+ "loss": 0.1576,
86
+ "step": 110
87
+ },
88
+ {
89
+ "epoch": 0.06,
90
+ "grad_norm": 1.9528635753013313,
91
+ "learning_rate": 4.9655172413793107e-05,
92
+ "loss": 0.1393,
93
+ "step": 120
94
+ },
95
+ {
96
+ "epoch": 0.07,
97
+ "grad_norm": 4.075169010198401,
98
+ "learning_rate": 4.9482758620689655e-05,
99
+ "loss": 0.1969,
100
+ "step": 130
101
+ },
102
+ {
103
+ "epoch": 0.07,
104
+ "grad_norm": 2.0953991165751207,
105
+ "learning_rate": 4.931034482758621e-05,
106
+ "loss": 0.1294,
107
+ "step": 140
108
+ },
109
+ {
110
+ "epoch": 0.08,
111
+ "grad_norm": 1.942660591044849,
112
+ "learning_rate": 4.913793103448276e-05,
113
+ "loss": 0.1306,
114
+ "step": 150
115
+ },
116
+ {
117
+ "epoch": 0.09,
118
+ "grad_norm": 3.1508904015728345,
119
+ "learning_rate": 4.896551724137931e-05,
120
+ "loss": 0.1526,
121
+ "step": 160
122
+ },
123
+ {
124
+ "epoch": 0.09,
125
+ "grad_norm": 1.9862795165358471,
126
+ "learning_rate": 4.8793103448275864e-05,
127
+ "loss": 0.1186,
128
+ "step": 170
129
+ },
130
+ {
131
+ "epoch": 0.1,
132
+ "grad_norm": 2.633061833817991,
133
+ "learning_rate": 4.862068965517241e-05,
134
+ "loss": 0.1457,
135
+ "step": 180
136
+ },
137
+ {
138
+ "epoch": 0.1,
139
+ "grad_norm": 1.8017052368446178,
140
+ "learning_rate": 4.844827586206897e-05,
141
+ "loss": 0.1234,
142
+ "step": 190
143
+ },
144
+ {
145
+ "epoch": 0.11,
146
+ "grad_norm": 2.1560694100709803,
147
+ "learning_rate": 4.827586206896552e-05,
148
+ "loss": 0.1346,
149
+ "step": 200
150
+ },
151
+ {
152
+ "epoch": 0.11,
153
+ "grad_norm": 1.5737689267430703,
154
+ "learning_rate": 4.810344827586207e-05,
155
+ "loss": 0.116,
156
+ "step": 210
157
+ },
158
+ {
159
+ "epoch": 0.12,
160
+ "grad_norm": 1.957864677854788,
161
+ "learning_rate": 4.793103448275863e-05,
162
+ "loss": 0.1692,
163
+ "step": 220
164
+ },
165
+ {
166
+ "epoch": 0.12,
167
+ "grad_norm": 2.215039223521855,
168
+ "learning_rate": 4.7758620689655176e-05,
169
+ "loss": 0.1245,
170
+ "step": 230
171
+ },
172
+ {
173
+ "epoch": 0.13,
174
+ "grad_norm": 1.370517239734168,
175
+ "learning_rate": 4.7586206896551725e-05,
176
+ "loss": 0.1476,
177
+ "step": 240
178
+ },
179
+ {
180
+ "epoch": 0.13,
181
+ "grad_norm": 1.7341334563022532,
182
+ "learning_rate": 4.741379310344828e-05,
183
+ "loss": 0.1236,
184
+ "step": 250
185
+ },
186
+ {
187
+ "epoch": 0.14,
188
+ "grad_norm": 1.5994298113068974,
189
+ "learning_rate": 4.724137931034483e-05,
190
+ "loss": 0.1161,
191
+ "step": 260
192
+ },
193
+ {
194
+ "epoch": 0.14,
195
+ "grad_norm": 1.5317433190951963,
196
+ "learning_rate": 4.7068965517241385e-05,
197
+ "loss": 0.1035,
198
+ "step": 270
199
+ },
200
+ {
201
+ "epoch": 0.15,
202
+ "grad_norm": 2.191977732539556,
203
+ "learning_rate": 4.689655172413793e-05,
204
+ "loss": 0.1427,
205
+ "step": 280
206
+ },
207
+ {
208
+ "epoch": 0.16,
209
+ "grad_norm": 1.6038667570691656,
210
+ "learning_rate": 4.672413793103448e-05,
211
+ "loss": 0.1225,
212
+ "step": 290
213
+ },
214
+ {
215
+ "epoch": 0.16,
216
+ "grad_norm": 2.577572731831179,
217
+ "learning_rate": 4.655172413793104e-05,
218
+ "loss": 0.1399,
219
+ "step": 300
220
+ },
221
+ {
222
+ "epoch": 0.17,
223
+ "grad_norm": 1.6199241001441385,
224
+ "learning_rate": 4.6379310344827586e-05,
225
+ "loss": 0.1242,
226
+ "step": 310
227
+ },
228
+ {
229
+ "epoch": 0.17,
230
+ "grad_norm": 2.236577821186196,
231
+ "learning_rate": 4.6206896551724135e-05,
232
+ "loss": 0.1656,
233
+ "step": 320
234
+ },
235
+ {
236
+ "epoch": 0.18,
237
+ "grad_norm": 1.7294690605254757,
238
+ "learning_rate": 4.603448275862069e-05,
239
+ "loss": 0.1382,
240
+ "step": 330
241
+ },
242
+ {
243
+ "epoch": 0.18,
244
+ "grad_norm": 2.196527516378511,
245
+ "learning_rate": 4.586206896551724e-05,
246
+ "loss": 0.1257,
247
+ "step": 340
248
+ },
249
+ {
250
+ "epoch": 0.19,
251
+ "grad_norm": 2.1057444340221463,
252
+ "learning_rate": 4.5689655172413794e-05,
253
+ "loss": 0.1238,
254
+ "step": 350
255
+ },
256
+ {
257
+ "epoch": 0.19,
258
+ "grad_norm": 1.5409556870328274,
259
+ "learning_rate": 4.551724137931035e-05,
260
+ "loss": 0.1383,
261
+ "step": 360
262
+ },
263
+ {
264
+ "epoch": 0.2,
265
+ "grad_norm": 1.5204083616874053,
266
+ "learning_rate": 4.53448275862069e-05,
267
+ "loss": 0.1068,
268
+ "step": 370
269
+ },
270
+ {
271
+ "epoch": 0.2,
272
+ "grad_norm": 2.3557725298931746,
273
+ "learning_rate": 4.5172413793103454e-05,
274
+ "loss": 0.1071,
275
+ "step": 380
276
+ },
277
+ {
278
+ "epoch": 0.21,
279
+ "grad_norm": 3.2601538460418644,
280
+ "learning_rate": 4.5e-05,
281
+ "loss": 0.125,
282
+ "step": 390
283
+ },
284
+ {
285
+ "epoch": 0.21,
286
+ "grad_norm": 1.9031725385762286,
287
+ "learning_rate": 4.482758620689655e-05,
288
+ "loss": 0.0991,
289
+ "step": 400
290
+ },
291
+ {
292
+ "epoch": 0.22,
293
+ "grad_norm": 1.3946050262183123,
294
+ "learning_rate": 4.465517241379311e-05,
295
+ "loss": 0.1156,
296
+ "step": 410
297
+ },
298
+ {
299
+ "epoch": 0.22,
300
+ "grad_norm": 1.097644875106397,
301
+ "learning_rate": 4.4482758620689656e-05,
302
+ "loss": 0.1366,
303
+ "step": 420
304
+ },
305
+ {
306
+ "epoch": 0.23,
307
+ "grad_norm": 1.37846299019108,
308
+ "learning_rate": 4.431034482758621e-05,
309
+ "loss": 0.126,
310
+ "step": 430
311
+ },
312
+ {
313
+ "epoch": 0.24,
314
+ "grad_norm": 1.8340152889320331,
315
+ "learning_rate": 4.413793103448276e-05,
316
+ "loss": 0.1066,
317
+ "step": 440
318
+ },
319
+ {
320
+ "epoch": 0.24,
321
+ "grad_norm": 1.8304505611337867,
322
+ "learning_rate": 4.396551724137931e-05,
323
+ "loss": 0.0868,
324
+ "step": 450
325
+ },
326
+ {
327
+ "epoch": 0.25,
328
+ "grad_norm": 1.550196490898523,
329
+ "learning_rate": 4.3793103448275864e-05,
330
+ "loss": 0.1286,
331
+ "step": 460
332
+ },
333
+ {
334
+ "epoch": 0.25,
335
+ "grad_norm": 2.176112247796248,
336
+ "learning_rate": 4.362068965517241e-05,
337
+ "loss": 0.1206,
338
+ "step": 470
339
+ },
340
+ {
341
+ "epoch": 0.26,
342
+ "grad_norm": 1.6589263894091213,
343
+ "learning_rate": 4.344827586206897e-05,
344
+ "loss": 0.1008,
345
+ "step": 480
346
+ },
347
+ {
348
+ "epoch": 0.26,
349
+ "grad_norm": 1.8349611508902046,
350
+ "learning_rate": 4.327586206896552e-05,
351
+ "loss": 0.1198,
352
+ "step": 490
353
+ },
354
+ {
355
+ "epoch": 0.27,
356
+ "grad_norm": 2.1218964920724126,
357
+ "learning_rate": 4.3103448275862066e-05,
358
+ "loss": 0.1166,
359
+ "step": 500
360
+ },
361
+ {
362
+ "epoch": 0.27,
363
+ "eval_loss": 0.6078919172286987,
364
+ "eval_runtime": 116.8471,
365
+ "eval_samples_per_second": 11.288,
366
+ "eval_steps_per_second": 2.824,
367
+ "step": 500
368
+ },
369
+ {
370
+ "epoch": 0.27,
371
+ "grad_norm": 2.5775141311007856,
372
+ "learning_rate": 4.293103448275863e-05,
373
+ "loss": 0.1124,
374
+ "step": 510
375
+ },
376
+ {
377
+ "epoch": 0.28,
378
+ "grad_norm": 1.6019517017800202,
379
+ "learning_rate": 4.275862068965518e-05,
380
+ "loss": 0.1068,
381
+ "step": 520
382
+ },
383
+ {
384
+ "epoch": 0.28,
385
+ "grad_norm": 2.6901962755310205,
386
+ "learning_rate": 4.2586206896551725e-05,
387
+ "loss": 0.1286,
388
+ "step": 530
389
+ },
390
+ {
391
+ "epoch": 0.29,
392
+ "grad_norm": 3.9517995356721767,
393
+ "learning_rate": 4.241379310344828e-05,
394
+ "loss": 0.1149,
395
+ "step": 540
396
+ },
397
+ {
398
+ "epoch": 0.29,
399
+ "grad_norm": 2.0428896228074076,
400
+ "learning_rate": 4.224137931034483e-05,
401
+ "loss": 0.141,
402
+ "step": 550
403
+ },
404
+ {
405
+ "epoch": 0.3,
406
+ "grad_norm": 2.263258592133553,
407
+ "learning_rate": 4.2068965517241385e-05,
408
+ "loss": 0.0949,
409
+ "step": 560
410
+ },
411
+ {
412
+ "epoch": 0.3,
413
+ "grad_norm": 1.4823165953974604,
414
+ "learning_rate": 4.1896551724137934e-05,
415
+ "loss": 0.1365,
416
+ "step": 570
417
+ },
418
+ {
419
+ "epoch": 0.31,
420
+ "grad_norm": 1.4441377020989878,
421
+ "learning_rate": 4.172413793103448e-05,
422
+ "loss": 0.1015,
423
+ "step": 580
424
+ },
425
+ {
426
+ "epoch": 0.32,
427
+ "grad_norm": 1.4779059254436886,
428
+ "learning_rate": 4.155172413793104e-05,
429
+ "loss": 0.0988,
430
+ "step": 590
431
+ },
432
+ {
433
+ "epoch": 0.32,
434
+ "grad_norm": 1.7777823671018818,
435
+ "learning_rate": 4.1379310344827587e-05,
436
+ "loss": 0.1124,
437
+ "step": 600
438
+ },
439
+ {
440
+ "epoch": 0.33,
441
+ "grad_norm": 1.737579831138191,
442
+ "learning_rate": 4.120689655172414e-05,
443
+ "loss": 0.086,
444
+ "step": 610
445
+ },
446
+ {
447
+ "epoch": 0.33,
448
+ "grad_norm": 2.708453961232997,
449
+ "learning_rate": 4.103448275862069e-05,
450
+ "loss": 0.0933,
451
+ "step": 620
452
+ },
453
+ {
454
+ "epoch": 0.34,
455
+ "grad_norm": 1.8871805824236731,
456
+ "learning_rate": 4.086206896551724e-05,
457
+ "loss": 0.1407,
458
+ "step": 630
459
+ },
460
+ {
461
+ "epoch": 0.34,
462
+ "grad_norm": 1.7300112722427339,
463
+ "learning_rate": 4.0689655172413795e-05,
464
+ "loss": 0.1224,
465
+ "step": 640
466
+ },
467
+ {
468
+ "epoch": 0.35,
469
+ "grad_norm": 1.4631236252240614,
470
+ "learning_rate": 4.0517241379310344e-05,
471
+ "loss": 0.1014,
472
+ "step": 650
473
+ },
474
+ {
475
+ "epoch": 0.35,
476
+ "grad_norm": 1.2602431597419264,
477
+ "learning_rate": 4.03448275862069e-05,
478
+ "loss": 0.1583,
479
+ "step": 660
480
+ },
481
+ {
482
+ "epoch": 0.36,
483
+ "grad_norm": 1.2077937041919453,
484
+ "learning_rate": 4.0172413793103455e-05,
485
+ "loss": 0.1209,
486
+ "step": 670
487
+ },
488
+ {
489
+ "epoch": 0.36,
490
+ "grad_norm": 1.4386184566429954,
491
+ "learning_rate": 4e-05,
492
+ "loss": 0.1016,
493
+ "step": 680
494
+ },
495
+ {
496
+ "epoch": 0.37,
497
+ "grad_norm": 2.6160358835758584,
498
+ "learning_rate": 3.982758620689656e-05,
499
+ "loss": 0.1062,
500
+ "step": 690
501
+ },
502
+ {
503
+ "epoch": 0.37,
504
+ "grad_norm": 1.9278794640498955,
505
+ "learning_rate": 3.965517241379311e-05,
506
+ "loss": 0.1037,
507
+ "step": 700
508
+ },
509
+ {
510
+ "epoch": 0.38,
511
+ "grad_norm": 1.2872571900237024,
512
+ "learning_rate": 3.9482758620689656e-05,
513
+ "loss": 0.096,
514
+ "step": 710
515
+ },
516
+ {
517
+ "epoch": 0.39,
518
+ "grad_norm": 1.243554309347296,
519
+ "learning_rate": 3.931034482758621e-05,
520
+ "loss": 0.1084,
521
+ "step": 720
522
+ },
523
+ {
524
+ "epoch": 0.39,
525
+ "grad_norm": 1.5090589714253309,
526
+ "learning_rate": 3.913793103448276e-05,
527
+ "loss": 0.0877,
528
+ "step": 730
529
+ },
530
+ {
531
+ "epoch": 0.4,
532
+ "grad_norm": 2.1419550623025168,
533
+ "learning_rate": 3.896551724137931e-05,
534
+ "loss": 0.0994,
535
+ "step": 740
536
+ },
537
+ {
538
+ "epoch": 0.4,
539
+ "grad_norm": 1.7807417973632438,
540
+ "learning_rate": 3.8793103448275865e-05,
541
+ "loss": 0.1029,
542
+ "step": 750
543
+ },
544
+ {
545
+ "epoch": 0.41,
546
+ "grad_norm": 1.3342960263057682,
547
+ "learning_rate": 3.862068965517241e-05,
548
+ "loss": 0.1072,
549
+ "step": 760
550
+ },
551
+ {
552
+ "epoch": 0.41,
553
+ "grad_norm": 2.3865282340158136,
554
+ "learning_rate": 3.844827586206897e-05,
555
+ "loss": 0.1193,
556
+ "step": 770
557
+ },
558
+ {
559
+ "epoch": 0.42,
560
+ "grad_norm": 1.5428742248459941,
561
+ "learning_rate": 3.827586206896552e-05,
562
+ "loss": 0.1156,
563
+ "step": 780
564
+ },
565
+ {
566
+ "epoch": 0.42,
567
+ "grad_norm": 1.7660532115509044,
568
+ "learning_rate": 3.8103448275862066e-05,
569
+ "loss": 0.122,
570
+ "step": 790
571
+ },
572
+ {
573
+ "epoch": 0.43,
574
+ "grad_norm": 1.8149742752994733,
575
+ "learning_rate": 3.793103448275862e-05,
576
+ "loss": 0.1346,
577
+ "step": 800
578
+ },
579
+ {
580
+ "epoch": 0.43,
581
+ "grad_norm": 1.7456408876472995,
582
+ "learning_rate": 3.775862068965517e-05,
583
+ "loss": 0.1223,
584
+ "step": 810
585
+ },
586
+ {
587
+ "epoch": 0.44,
588
+ "grad_norm": 1.10163248244056,
589
+ "learning_rate": 3.7586206896551726e-05,
590
+ "loss": 0.1031,
591
+ "step": 820
592
+ },
593
+ {
594
+ "epoch": 0.44,
595
+ "grad_norm": 1.6441057737088702,
596
+ "learning_rate": 3.741379310344828e-05,
597
+ "loss": 0.1059,
598
+ "step": 830
599
+ },
600
+ {
601
+ "epoch": 0.45,
602
+ "grad_norm": 2.3999279790163484,
603
+ "learning_rate": 3.724137931034483e-05,
604
+ "loss": 0.1125,
605
+ "step": 840
606
+ },
607
+ {
608
+ "epoch": 0.45,
609
+ "grad_norm": 2.2081477934156903,
610
+ "learning_rate": 3.7068965517241385e-05,
611
+ "loss": 0.1266,
612
+ "step": 850
613
+ },
614
+ {
615
+ "epoch": 0.46,
616
+ "grad_norm": 2.366783771480017,
617
+ "learning_rate": 3.6896551724137934e-05,
618
+ "loss": 0.1127,
619
+ "step": 860
620
+ },
621
+ {
622
+ "epoch": 0.47,
623
+ "grad_norm": 1.3077873674136173,
624
+ "learning_rate": 3.672413793103448e-05,
625
+ "loss": 0.1095,
626
+ "step": 870
627
+ },
628
+ {
629
+ "epoch": 0.47,
630
+ "grad_norm": 1.8197812508114701,
631
+ "learning_rate": 3.655172413793104e-05,
632
+ "loss": 0.0932,
633
+ "step": 880
634
+ },
635
+ {
636
+ "epoch": 0.48,
637
+ "grad_norm": 1.0806192057981219,
638
+ "learning_rate": 3.637931034482759e-05,
639
+ "loss": 0.1166,
640
+ "step": 890
641
+ },
642
+ {
643
+ "epoch": 0.48,
644
+ "grad_norm": 1.520666439337001,
645
+ "learning_rate": 3.620689655172414e-05,
646
+ "loss": 0.0883,
647
+ "step": 900
648
+ },
649
+ {
650
+ "epoch": 0.49,
651
+ "grad_norm": 1.690002270629302,
652
+ "learning_rate": 3.603448275862069e-05,
653
+ "loss": 0.1199,
654
+ "step": 910
655
+ },
656
+ {
657
+ "epoch": 0.49,
658
+ "grad_norm": 1.4319374130118003,
659
+ "learning_rate": 3.586206896551724e-05,
660
+ "loss": 0.0991,
661
+ "step": 920
662
+ },
663
+ {
664
+ "epoch": 0.5,
665
+ "grad_norm": 1.0626084369653164,
666
+ "learning_rate": 3.5689655172413795e-05,
667
+ "loss": 0.0923,
668
+ "step": 930
669
+ },
670
+ {
671
+ "epoch": 0.5,
672
+ "grad_norm": 2.0848060597460902,
673
+ "learning_rate": 3.5517241379310344e-05,
674
+ "loss": 0.0979,
675
+ "step": 940
676
+ },
677
+ {
678
+ "epoch": 0.51,
679
+ "grad_norm": 1.4997189461483256,
680
+ "learning_rate": 3.53448275862069e-05,
681
+ "loss": 0.0949,
682
+ "step": 950
683
+ },
684
+ {
685
+ "epoch": 0.51,
686
+ "grad_norm": 1.7887817042743388,
687
+ "learning_rate": 3.517241379310345e-05,
688
+ "loss": 0.1135,
689
+ "step": 960
690
+ },
691
+ {
692
+ "epoch": 0.52,
693
+ "grad_norm": 3.242965692388458,
694
+ "learning_rate": 3.5e-05,
695
+ "loss": 0.1315,
696
+ "step": 970
697
+ },
698
+ {
699
+ "epoch": 0.52,
700
+ "grad_norm": 1.5034762176322083,
701
+ "learning_rate": 3.482758620689655e-05,
702
+ "loss": 0.1177,
703
+ "step": 980
704
+ },
705
+ {
706
+ "epoch": 0.53,
707
+ "grad_norm": 1.6679474444200848,
708
+ "learning_rate": 3.465517241379311e-05,
709
+ "loss": 0.1182,
710
+ "step": 990
711
+ },
712
+ {
713
+ "epoch": 0.54,
714
+ "grad_norm": 2.814574507251776,
715
+ "learning_rate": 3.4482758620689657e-05,
716
+ "loss": 0.0912,
717
+ "step": 1000
718
+ },
719
+ {
720
+ "epoch": 0.54,
721
+ "eval_loss": 0.6101276874542236,
722
+ "eval_runtime": 113.9995,
723
+ "eval_samples_per_second": 11.57,
724
+ "eval_steps_per_second": 2.895,
725
+ "step": 1000
726
+ },
727
+ {
728
+ "epoch": 0.54,
729
+ "grad_norm": 2.1321319681580535,
730
+ "learning_rate": 3.431034482758621e-05,
731
+ "loss": 0.0983,
732
+ "step": 1010
733
+ },
734
+ {
735
+ "epoch": 0.55,
736
+ "grad_norm": 1.8915101367452352,
737
+ "learning_rate": 3.413793103448276e-05,
738
+ "loss": 0.1113,
739
+ "step": 1020
740
+ },
741
+ {
742
+ "epoch": 0.55,
743
+ "grad_norm": 1.4160985095468477,
744
+ "learning_rate": 3.3965517241379316e-05,
745
+ "loss": 0.1076,
746
+ "step": 1030
747
+ },
748
+ {
749
+ "epoch": 0.56,
750
+ "grad_norm": 1.8562788974878586,
751
+ "learning_rate": 3.3793103448275865e-05,
752
+ "loss": 0.1011,
753
+ "step": 1040
754
+ },
755
+ {
756
+ "epoch": 0.56,
757
+ "grad_norm": 1.3793192563691294,
758
+ "learning_rate": 3.3620689655172414e-05,
759
+ "loss": 0.0978,
760
+ "step": 1050
761
+ },
762
+ {
763
+ "epoch": 0.57,
764
+ "grad_norm": 1.4606563129628805,
765
+ "learning_rate": 3.344827586206897e-05,
766
+ "loss": 0.1069,
767
+ "step": 1060
768
+ },
769
+ {
770
+ "epoch": 0.57,
771
+ "grad_norm": 1.5680856211032999,
772
+ "learning_rate": 3.327586206896552e-05,
773
+ "loss": 0.0988,
774
+ "step": 1070
775
+ },
776
+ {
777
+ "epoch": 0.58,
778
+ "grad_norm": 1.5829345931951275,
779
+ "learning_rate": 3.310344827586207e-05,
780
+ "loss": 0.1256,
781
+ "step": 1080
782
+ },
783
+ {
784
+ "epoch": 0.58,
785
+ "grad_norm": 1.6200852939319585,
786
+ "learning_rate": 3.293103448275862e-05,
787
+ "loss": 0.097,
788
+ "step": 1090
789
+ },
790
+ {
791
+ "epoch": 0.59,
792
+ "grad_norm": 2.259656836213122,
793
+ "learning_rate": 3.275862068965517e-05,
794
+ "loss": 0.1137,
795
+ "step": 1100
796
+ },
797
+ {
798
+ "epoch": 0.59,
799
+ "grad_norm": 2.2483622341560645,
800
+ "learning_rate": 3.2586206896551726e-05,
801
+ "loss": 0.0999,
802
+ "step": 1110
803
+ },
804
+ {
805
+ "epoch": 0.6,
806
+ "grad_norm": 1.168198861956421,
807
+ "learning_rate": 3.2413793103448275e-05,
808
+ "loss": 0.1018,
809
+ "step": 1120
810
+ },
811
+ {
812
+ "epoch": 0.6,
813
+ "grad_norm": 2.4699824799031482,
814
+ "learning_rate": 3.2241379310344824e-05,
815
+ "loss": 0.1132,
816
+ "step": 1130
817
+ },
818
+ {
819
+ "epoch": 0.61,
820
+ "grad_norm": 1.2571654549549751,
821
+ "learning_rate": 3.206896551724138e-05,
822
+ "loss": 0.1054,
823
+ "step": 1140
824
+ },
825
+ {
826
+ "epoch": 0.62,
827
+ "grad_norm": 0.5559534032307631,
828
+ "learning_rate": 3.1896551724137935e-05,
829
+ "loss": 0.0789,
830
+ "step": 1150
831
+ },
832
+ {
833
+ "epoch": 0.62,
834
+ "grad_norm": 1.636369759504475,
835
+ "learning_rate": 3.172413793103448e-05,
836
+ "loss": 0.0902,
837
+ "step": 1160
838
+ },
839
+ {
840
+ "epoch": 0.63,
841
+ "grad_norm": 1.6137142935446496,
842
+ "learning_rate": 3.155172413793104e-05,
843
+ "loss": 0.1199,
844
+ "step": 1170
845
+ },
846
+ {
847
+ "epoch": 0.63,
848
+ "grad_norm": 1.7448003760796802,
849
+ "learning_rate": 3.137931034482759e-05,
850
+ "loss": 0.1295,
851
+ "step": 1180
852
+ },
853
+ {
854
+ "epoch": 0.64,
855
+ "grad_norm": 1.3261005358227276,
856
+ "learning_rate": 3.120689655172414e-05,
857
+ "loss": 0.1117,
858
+ "step": 1190
859
+ },
860
+ {
861
+ "epoch": 0.64,
862
+ "grad_norm": 1.7353127177901462,
863
+ "learning_rate": 3.103448275862069e-05,
864
+ "loss": 0.0951,
865
+ "step": 1200
866
+ },
867
+ {
868
+ "epoch": 0.65,
869
+ "grad_norm": 2.8569975913367074,
870
+ "learning_rate": 3.086206896551724e-05,
871
+ "loss": 0.112,
872
+ "step": 1210
873
+ },
874
+ {
875
+ "epoch": 0.65,
876
+ "grad_norm": 1.3481947218871082,
877
+ "learning_rate": 3.0689655172413796e-05,
878
+ "loss": 0.0876,
879
+ "step": 1220
880
+ },
881
+ {
882
+ "epoch": 0.66,
883
+ "grad_norm": 2.015933141613929,
884
+ "learning_rate": 3.0517241379310348e-05,
885
+ "loss": 0.0993,
886
+ "step": 1230
887
+ },
888
+ {
889
+ "epoch": 0.66,
890
+ "grad_norm": 1.0588164394448019,
891
+ "learning_rate": 3.0344827586206897e-05,
892
+ "loss": 0.1034,
893
+ "step": 1240
894
+ },
895
+ {
896
+ "epoch": 0.67,
897
+ "grad_norm": 1.3594986645993228,
898
+ "learning_rate": 3.017241379310345e-05,
899
+ "loss": 0.1004,
900
+ "step": 1250
901
+ },
902
+ {
903
+ "epoch": 0.67,
904
+ "grad_norm": 1.333098402625009,
905
+ "learning_rate": 3e-05,
906
+ "loss": 0.1259,
907
+ "step": 1260
908
+ },
909
+ {
910
+ "epoch": 0.68,
911
+ "grad_norm": 1.1324206075196583,
912
+ "learning_rate": 2.9827586206896553e-05,
913
+ "loss": 0.1155,
914
+ "step": 1270
915
+ },
916
+ {
917
+ "epoch": 0.68,
918
+ "grad_norm": 1.2270687927795876,
919
+ "learning_rate": 2.96551724137931e-05,
920
+ "loss": 0.092,
921
+ "step": 1280
922
+ },
923
+ {
924
+ "epoch": 0.69,
925
+ "grad_norm": 1.3085362507403875,
926
+ "learning_rate": 2.9482758620689654e-05,
927
+ "loss": 0.1064,
928
+ "step": 1290
929
+ },
930
+ {
931
+ "epoch": 0.7,
932
+ "grad_norm": 1.7135250277750762,
933
+ "learning_rate": 2.9310344827586206e-05,
934
+ "loss": 0.1132,
935
+ "step": 1300
936
+ },
937
+ {
938
+ "epoch": 0.7,
939
+ "grad_norm": 1.6121189707451158,
940
+ "learning_rate": 2.913793103448276e-05,
941
+ "loss": 0.1006,
942
+ "step": 1310
943
+ },
944
+ {
945
+ "epoch": 0.71,
946
+ "grad_norm": 1.3958680925504208,
947
+ "learning_rate": 2.8965517241379313e-05,
948
+ "loss": 0.0956,
949
+ "step": 1320
950
+ },
951
+ {
952
+ "epoch": 0.71,
953
+ "grad_norm": 1.546226150121884,
954
+ "learning_rate": 2.8793103448275865e-05,
955
+ "loss": 0.1142,
956
+ "step": 1330
957
+ },
958
+ {
959
+ "epoch": 0.72,
960
+ "grad_norm": 2.1837739995965415,
961
+ "learning_rate": 2.8620689655172417e-05,
962
+ "loss": 0.1127,
963
+ "step": 1340
964
+ },
965
+ {
966
+ "epoch": 0.72,
967
+ "grad_norm": 1.9402402206909504,
968
+ "learning_rate": 2.844827586206897e-05,
969
+ "loss": 0.0922,
970
+ "step": 1350
971
+ },
972
+ {
973
+ "epoch": 0.73,
974
+ "grad_norm": 1.7914401953164802,
975
+ "learning_rate": 2.8275862068965518e-05,
976
+ "loss": 0.1038,
977
+ "step": 1360
978
+ },
979
+ {
980
+ "epoch": 0.73,
981
+ "grad_norm": 1.505804090650568,
982
+ "learning_rate": 2.810344827586207e-05,
983
+ "loss": 0.1034,
984
+ "step": 1370
985
+ },
986
+ {
987
+ "epoch": 0.74,
988
+ "grad_norm": 1.9907350713586716,
989
+ "learning_rate": 2.7931034482758622e-05,
990
+ "loss": 0.103,
991
+ "step": 1380
992
+ },
993
+ {
994
+ "epoch": 0.74,
995
+ "grad_norm": 1.6948381773166858,
996
+ "learning_rate": 2.7758620689655175e-05,
997
+ "loss": 0.1091,
998
+ "step": 1390
999
+ },
1000
+ {
1001
+ "epoch": 0.75,
1002
+ "grad_norm": 1.3995985437024723,
1003
+ "learning_rate": 2.7586206896551727e-05,
1004
+ "loss": 0.0852,
1005
+ "step": 1400
1006
+ },
1007
+ {
1008
+ "epoch": 0.75,
1009
+ "grad_norm": 1.9347024029069393,
1010
+ "learning_rate": 2.7413793103448275e-05,
1011
+ "loss": 0.1393,
1012
+ "step": 1410
1013
+ },
1014
+ {
1015
+ "epoch": 0.76,
1016
+ "grad_norm": 1.608776792445342,
1017
+ "learning_rate": 2.7241379310344827e-05,
1018
+ "loss": 0.0951,
1019
+ "step": 1420
1020
+ },
1021
+ {
1022
+ "epoch": 0.77,
1023
+ "grad_norm": 1.6005483580619249,
1024
+ "learning_rate": 2.706896551724138e-05,
1025
+ "loss": 0.1037,
1026
+ "step": 1430
1027
+ },
1028
+ {
1029
+ "epoch": 0.77,
1030
+ "grad_norm": 2.374208686020403,
1031
+ "learning_rate": 2.689655172413793e-05,
1032
+ "loss": 0.0926,
1033
+ "step": 1440
1034
+ },
1035
+ {
1036
+ "epoch": 0.78,
1037
+ "grad_norm": 1.7554923995400171,
1038
+ "learning_rate": 2.672413793103448e-05,
1039
+ "loss": 0.1164,
1040
+ "step": 1450
1041
+ },
1042
+ {
1043
+ "epoch": 0.78,
1044
+ "grad_norm": 1.2965114220197742,
1045
+ "learning_rate": 2.6551724137931032e-05,
1046
+ "loss": 0.1102,
1047
+ "step": 1460
1048
+ },
1049
+ {
1050
+ "epoch": 0.79,
1051
+ "grad_norm": 1.8857303249108055,
1052
+ "learning_rate": 2.637931034482759e-05,
1053
+ "loss": 0.0868,
1054
+ "step": 1470
1055
+ },
1056
+ {
1057
+ "epoch": 0.79,
1058
+ "grad_norm": 1.406207551120988,
1059
+ "learning_rate": 2.620689655172414e-05,
1060
+ "loss": 0.1179,
1061
+ "step": 1480
1062
+ },
1063
+ {
1064
+ "epoch": 0.8,
1065
+ "grad_norm": 1.275728362064451,
1066
+ "learning_rate": 2.6034482758620692e-05,
1067
+ "loss": 0.1128,
1068
+ "step": 1490
1069
+ },
1070
+ {
1071
+ "epoch": 0.8,
1072
+ "grad_norm": 1.7122434387720797,
1073
+ "learning_rate": 2.5862068965517244e-05,
1074
+ "loss": 0.1045,
1075
+ "step": 1500
1076
+ },
1077
+ {
1078
+ "epoch": 0.8,
1079
+ "eval_loss": 0.6075221300125122,
1080
+ "eval_runtime": 114.4297,
1081
+ "eval_samples_per_second": 11.527,
1082
+ "eval_steps_per_second": 2.884,
1083
+ "step": 1500
1084
+ },
1085
+ {
1086
+ "epoch": 0.81,
1087
+ "grad_norm": 1.3880467648229133,
1088
+ "learning_rate": 2.5689655172413796e-05,
1089
+ "loss": 0.1031,
1090
+ "step": 1510
1091
+ },
1092
+ {
1093
+ "epoch": 0.81,
1094
+ "grad_norm": 2.3475935500456657,
1095
+ "learning_rate": 2.551724137931035e-05,
1096
+ "loss": 0.1064,
1097
+ "step": 1520
1098
+ },
1099
+ {
1100
+ "epoch": 0.82,
1101
+ "grad_norm": 1.9746447047097486,
1102
+ "learning_rate": 2.5344827586206897e-05,
1103
+ "loss": 0.0995,
1104
+ "step": 1530
1105
+ },
1106
+ {
1107
+ "epoch": 0.82,
1108
+ "grad_norm": 1.2244623226185645,
1109
+ "learning_rate": 2.517241379310345e-05,
1110
+ "loss": 0.1044,
1111
+ "step": 1540
1112
+ },
1113
+ {
1114
+ "epoch": 0.83,
1115
+ "grad_norm": 2.2605012043265216,
1116
+ "learning_rate": 2.5e-05,
1117
+ "loss": 0.1017,
1118
+ "step": 1550
1119
+ },
1120
+ {
1121
+ "epoch": 0.83,
1122
+ "grad_norm": 1.624612730097256,
1123
+ "learning_rate": 2.4827586206896553e-05,
1124
+ "loss": 0.0973,
1125
+ "step": 1560
1126
+ },
1127
+ {
1128
+ "epoch": 0.84,
1129
+ "grad_norm": 1.3648662151461801,
1130
+ "learning_rate": 2.4655172413793105e-05,
1131
+ "loss": 0.0836,
1132
+ "step": 1570
1133
+ },
1134
+ {
1135
+ "epoch": 0.85,
1136
+ "grad_norm": 1.4642386177378814,
1137
+ "learning_rate": 2.4482758620689654e-05,
1138
+ "loss": 0.1058,
1139
+ "step": 1580
1140
+ },
1141
+ {
1142
+ "epoch": 0.85,
1143
+ "grad_norm": 1.3057087388796036,
1144
+ "learning_rate": 2.4310344827586206e-05,
1145
+ "loss": 0.1092,
1146
+ "step": 1590
1147
+ },
1148
+ {
1149
+ "epoch": 0.86,
1150
+ "grad_norm": 2.092348689417081,
1151
+ "learning_rate": 2.413793103448276e-05,
1152
+ "loss": 0.0958,
1153
+ "step": 1600
1154
+ },
1155
+ {
1156
+ "epoch": 0.86,
1157
+ "grad_norm": 1.3731115281087607,
1158
+ "learning_rate": 2.3965517241379314e-05,
1159
+ "loss": 0.0883,
1160
+ "step": 1610
1161
+ },
1162
+ {
1163
+ "epoch": 0.87,
1164
+ "grad_norm": 1.3983722722394134,
1165
+ "learning_rate": 2.3793103448275862e-05,
1166
+ "loss": 0.0944,
1167
+ "step": 1620
1168
+ },
1169
+ {
1170
+ "epoch": 0.87,
1171
+ "grad_norm": 2.4163442262002937,
1172
+ "learning_rate": 2.3620689655172415e-05,
1173
+ "loss": 0.1062,
1174
+ "step": 1630
1175
+ },
1176
+ {
1177
+ "epoch": 0.88,
1178
+ "grad_norm": 1.5006079944233688,
1179
+ "learning_rate": 2.3448275862068967e-05,
1180
+ "loss": 0.1129,
1181
+ "step": 1640
1182
+ },
1183
+ {
1184
+ "epoch": 0.88,
1185
+ "grad_norm": 1.54283270803711,
1186
+ "learning_rate": 2.327586206896552e-05,
1187
+ "loss": 0.0861,
1188
+ "step": 1650
1189
+ },
1190
+ {
1191
+ "epoch": 0.89,
1192
+ "grad_norm": 2.269678144223195,
1193
+ "learning_rate": 2.3103448275862067e-05,
1194
+ "loss": 0.0978,
1195
+ "step": 1660
1196
+ },
1197
+ {
1198
+ "epoch": 0.89,
1199
+ "grad_norm": 1.8105959776831768,
1200
+ "learning_rate": 2.293103448275862e-05,
1201
+ "loss": 0.1141,
1202
+ "step": 1670
1203
+ },
1204
+ {
1205
+ "epoch": 0.9,
1206
+ "grad_norm": 1.9135579713863027,
1207
+ "learning_rate": 2.2758620689655175e-05,
1208
+ "loss": 0.0918,
1209
+ "step": 1680
1210
+ },
1211
+ {
1212
+ "epoch": 0.9,
1213
+ "grad_norm": 1.6604450253018581,
1214
+ "learning_rate": 2.2586206896551727e-05,
1215
+ "loss": 0.096,
1216
+ "step": 1690
1217
+ },
1218
+ {
1219
+ "epoch": 0.91,
1220
+ "grad_norm": 2.115987565053461,
1221
+ "learning_rate": 2.2413793103448276e-05,
1222
+ "loss": 0.1166,
1223
+ "step": 1700
1224
+ },
1225
+ {
1226
+ "epoch": 0.91,
1227
+ "grad_norm": 1.4279927513160544,
1228
+ "learning_rate": 2.2241379310344828e-05,
1229
+ "loss": 0.1052,
1230
+ "step": 1710
1231
+ },
1232
+ {
1233
+ "epoch": 0.92,
1234
+ "grad_norm": 1.185880441960968,
1235
+ "learning_rate": 2.206896551724138e-05,
1236
+ "loss": 0.1053,
1237
+ "step": 1720
1238
+ },
1239
+ {
1240
+ "epoch": 0.93,
1241
+ "grad_norm": 1.6969029997828415,
1242
+ "learning_rate": 2.1896551724137932e-05,
1243
+ "loss": 0.106,
1244
+ "step": 1730
1245
+ },
1246
+ {
1247
+ "epoch": 0.93,
1248
+ "grad_norm": 2.0330998697970286,
1249
+ "learning_rate": 2.1724137931034484e-05,
1250
+ "loss": 0.1073,
1251
+ "step": 1740
1252
+ },
1253
+ {
1254
+ "epoch": 0.94,
1255
+ "grad_norm": 1.19027851417408,
1256
+ "learning_rate": 2.1551724137931033e-05,
1257
+ "loss": 0.091,
1258
+ "step": 1750
1259
+ },
1260
+ {
1261
+ "epoch": 0.94,
1262
+ "grad_norm": 1.2470713090698218,
1263
+ "learning_rate": 2.137931034482759e-05,
1264
+ "loss": 0.0898,
1265
+ "step": 1760
1266
+ },
1267
+ {
1268
+ "epoch": 0.95,
1269
+ "grad_norm": 2.235740059996042,
1270
+ "learning_rate": 2.120689655172414e-05,
1271
+ "loss": 0.1327,
1272
+ "step": 1770
1273
+ },
1274
+ {
1275
+ "epoch": 0.95,
1276
+ "grad_norm": 1.5741742016710085,
1277
+ "learning_rate": 2.1034482758620692e-05,
1278
+ "loss": 0.1126,
1279
+ "step": 1780
1280
+ },
1281
+ {
1282
+ "epoch": 0.96,
1283
+ "grad_norm": 0.9343547126371113,
1284
+ "learning_rate": 2.086206896551724e-05,
1285
+ "loss": 0.0819,
1286
+ "step": 1790
1287
+ },
1288
+ {
1289
+ "epoch": 0.96,
1290
+ "grad_norm": 2.2764271447338937,
1291
+ "learning_rate": 2.0689655172413793e-05,
1292
+ "loss": 0.1204,
1293
+ "step": 1800
1294
+ },
1295
+ {
1296
+ "epoch": 0.97,
1297
+ "grad_norm": 1.981384842073209,
1298
+ "learning_rate": 2.0517241379310345e-05,
1299
+ "loss": 0.1182,
1300
+ "step": 1810
1301
+ },
1302
+ {
1303
+ "epoch": 0.97,
1304
+ "grad_norm": 1.044063198588911,
1305
+ "learning_rate": 2.0344827586206897e-05,
1306
+ "loss": 0.1005,
1307
+ "step": 1820
1308
+ },
1309
+ {
1310
+ "epoch": 0.98,
1311
+ "grad_norm": 2.370183172473789,
1312
+ "learning_rate": 2.017241379310345e-05,
1313
+ "loss": 0.1174,
1314
+ "step": 1830
1315
+ },
1316
+ {
1317
+ "epoch": 0.98,
1318
+ "grad_norm": 1.9052733799672823,
1319
+ "learning_rate": 2e-05,
1320
+ "loss": 0.1125,
1321
+ "step": 1840
1322
+ },
1323
+ {
1324
+ "epoch": 0.99,
1325
+ "grad_norm": 1.628277530114902,
1326
+ "learning_rate": 1.9827586206896554e-05,
1327
+ "loss": 0.1015,
1328
+ "step": 1850
1329
+ },
1330
+ {
1331
+ "epoch": 1.0,
1332
+ "grad_norm": 1.2522124245986863,
1333
+ "learning_rate": 1.9655172413793106e-05,
1334
+ "loss": 0.0924,
1335
+ "step": 1860
1336
+ },
1337
+ {
1338
+ "epoch": 1.0,
1339
+ "grad_norm": 0.6911426489002421,
1340
+ "learning_rate": 1.9482758620689655e-05,
1341
+ "loss": 0.0965,
1342
+ "step": 1870
1343
+ },
1344
+ {
1345
+ "epoch": 1.01,
1346
+ "grad_norm": 1.821890613342771,
1347
+ "learning_rate": 1.9310344827586207e-05,
1348
+ "loss": 0.081,
1349
+ "step": 1880
1350
+ },
1351
+ {
1352
+ "epoch": 1.01,
1353
+ "grad_norm": 0.7643588179781782,
1354
+ "learning_rate": 1.913793103448276e-05,
1355
+ "loss": 0.0761,
1356
+ "step": 1890
1357
+ },
1358
+ {
1359
+ "epoch": 1.02,
1360
+ "grad_norm": 1.1095002263403428,
1361
+ "learning_rate": 1.896551724137931e-05,
1362
+ "loss": 0.0871,
1363
+ "step": 1900
1364
+ },
1365
+ {
1366
+ "epoch": 1.02,
1367
+ "grad_norm": 1.4639820667455608,
1368
+ "learning_rate": 1.8793103448275863e-05,
1369
+ "loss": 0.0805,
1370
+ "step": 1910
1371
+ },
1372
+ {
1373
+ "epoch": 1.03,
1374
+ "grad_norm": 1.6214269161589794,
1375
+ "learning_rate": 1.8620689655172415e-05,
1376
+ "loss": 0.0902,
1377
+ "step": 1920
1378
+ },
1379
+ {
1380
+ "epoch": 1.03,
1381
+ "grad_norm": 1.5979085316952373,
1382
+ "learning_rate": 1.8448275862068967e-05,
1383
+ "loss": 0.0967,
1384
+ "step": 1930
1385
+ },
1386
+ {
1387
+ "epoch": 1.04,
1388
+ "grad_norm": 1.2001043976090235,
1389
+ "learning_rate": 1.827586206896552e-05,
1390
+ "loss": 0.069,
1391
+ "step": 1940
1392
+ },
1393
+ {
1394
+ "epoch": 1.04,
1395
+ "grad_norm": 2.100190633629739,
1396
+ "learning_rate": 1.810344827586207e-05,
1397
+ "loss": 0.1024,
1398
+ "step": 1950
1399
+ },
1400
+ {
1401
+ "epoch": 1.05,
1402
+ "grad_norm": 1.7393396532511867,
1403
+ "learning_rate": 1.793103448275862e-05,
1404
+ "loss": 0.0728,
1405
+ "step": 1960
1406
+ },
1407
+ {
1408
+ "epoch": 1.05,
1409
+ "grad_norm": 1.873599965711283,
1410
+ "learning_rate": 1.7758620689655172e-05,
1411
+ "loss": 0.0735,
1412
+ "step": 1970
1413
+ },
1414
+ {
1415
+ "epoch": 1.06,
1416
+ "grad_norm": 1.4460752726376342,
1417
+ "learning_rate": 1.7586206896551724e-05,
1418
+ "loss": 0.1,
1419
+ "step": 1980
1420
+ },
1421
+ {
1422
+ "epoch": 1.06,
1423
+ "grad_norm": 0.8772715867399261,
1424
+ "learning_rate": 1.7413793103448276e-05,
1425
+ "loss": 0.0794,
1426
+ "step": 1990
1427
+ },
1428
+ {
1429
+ "epoch": 1.07,
1430
+ "grad_norm": 1.398173054729605,
1431
+ "learning_rate": 1.7241379310344828e-05,
1432
+ "loss": 0.078,
1433
+ "step": 2000
1434
+ },
1435
+ {
1436
+ "epoch": 1.07,
1437
+ "eval_loss": 0.6523420810699463,
1438
+ "eval_runtime": 115.4048,
1439
+ "eval_samples_per_second": 11.429,
1440
+ "eval_steps_per_second": 2.859,
1441
+ "step": 2000
1442
+ }
1443
+ ],
1444
+ "logging_steps": 10,
1445
+ "max_steps": 3000,
1446
+ "num_input_tokens_seen": 0,
1447
+ "num_train_epochs": 2,
1448
+ "save_steps": 500,
1449
+ "total_flos": 57776359145472.0,
1450
+ "train_batch_size": 4,
1451
+ "trial_name": null,
1452
+ "trial_params": null
1453
+ }
checkpoints/checkpoint-2000/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:22266252322e6977894297b61731ca9228c8fcfe4e8d788aef270218c40fec98
3
+ size 6776
checkpoints/checkpoint-2000/zero_to_fp32.py ADDED
@@ -0,0 +1,604 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example: python zero_to_fp32.py . pytorch_model.bin
14
+
15
+ import argparse
16
+ import torch
17
+ import glob
18
+ import math
19
+ import os
20
+ import re
21
+ from collections import OrderedDict
22
+ from dataclasses import dataclass
23
+
24
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
25
+ # DeepSpeed data structures it has to be available in the current python environment.
26
+ from deepspeed.utils import logger
27
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
28
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
29
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
30
+
31
+
32
+ @dataclass
33
+ class zero_model_state:
34
+ buffers: dict()
35
+ param_shapes: dict()
36
+ shared_params: list
37
+ ds_version: int
38
+ frozen_param_shapes: dict()
39
+ frozen_param_fragments: dict()
40
+
41
+
42
+ debug = 0
43
+
44
+ # load to cpu
45
+ device = torch.device('cpu')
46
+
47
+
48
+ def atoi(text):
49
+ return int(text) if text.isdigit() else text
50
+
51
+
52
+ def natural_keys(text):
53
+ '''
54
+ alist.sort(key=natural_keys) sorts in human order
55
+ http://nedbatchelder.com/blog/200712/human_sorting.html
56
+ (See Toothy's implementation in the comments)
57
+ '''
58
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
59
+
60
+
61
+ def get_model_state_file(checkpoint_dir, zero_stage):
62
+ if not os.path.isdir(checkpoint_dir):
63
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
64
+
65
+ # there should be only one file
66
+ if zero_stage <= 2:
67
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
68
+ elif zero_stage == 3:
69
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
70
+
71
+ if not os.path.exists(file):
72
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
73
+
74
+ return file
75
+
76
+
77
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
78
+ # XXX: need to test that this simple glob rule works for multi-node setup too
79
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
80
+
81
+ if len(ckpt_files) == 0:
82
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
83
+
84
+ return ckpt_files
85
+
86
+
87
+ def get_optim_files(checkpoint_dir):
88
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
89
+
90
+
91
+ def get_model_state_files(checkpoint_dir):
92
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
93
+
94
+
95
+ def parse_model_states(files):
96
+ zero_model_states = []
97
+ for file in files:
98
+ state_dict = torch.load(file, map_location=device)
99
+
100
+ if BUFFER_NAMES not in state_dict:
101
+ raise ValueError(f"{file} is not a model state checkpoint")
102
+ buffer_names = state_dict[BUFFER_NAMES]
103
+ if debug:
104
+ print("Found buffers:", buffer_names)
105
+
106
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
107
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
108
+ param_shapes = state_dict[PARAM_SHAPES]
109
+
110
+ # collect parameters that are included in param_shapes
111
+ param_names = []
112
+ for s in param_shapes:
113
+ for name in s.keys():
114
+ param_names.append(name)
115
+
116
+ # update with frozen parameters
117
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
118
+ if frozen_param_shapes is not None:
119
+ if debug:
120
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
121
+ param_names += list(frozen_param_shapes.keys())
122
+
123
+ # handle shared params
124
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
125
+
126
+ ds_version = state_dict.get(DS_VERSION, None)
127
+
128
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
129
+
130
+ z_model_state = zero_model_state(buffers=buffers,
131
+ param_shapes=param_shapes,
132
+ shared_params=shared_params,
133
+ ds_version=ds_version,
134
+ frozen_param_shapes=frozen_param_shapes,
135
+ frozen_param_fragments=frozen_param_fragments)
136
+ zero_model_states.append(z_model_state)
137
+
138
+ return zero_model_states
139
+
140
+
141
+ def parse_optim_states(files, ds_checkpoint_dir):
142
+
143
+ total_files = len(files)
144
+ state_dicts = []
145
+ for f in files:
146
+ state_dict = torch.load(f, map_location=device)
147
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
148
+ # and also handle the case where it was already removed by another helper script
149
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
150
+ state_dicts.append(state_dict)
151
+
152
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
153
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
154
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
155
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
156
+
157
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
158
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
159
+ # use the max of the partition_count to get the dp world_size.
160
+
161
+ if type(world_size) is list:
162
+ world_size = max(world_size)
163
+
164
+ if world_size != total_files:
165
+ raise ValueError(
166
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
167
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
168
+ )
169
+
170
+ # the groups are named differently in each stage
171
+ if zero_stage <= 2:
172
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
173
+ elif zero_stage == 3:
174
+ fp32_groups_key = FP32_FLAT_GROUPS
175
+ else:
176
+ raise ValueError(f"unknown zero stage {zero_stage}")
177
+
178
+ if zero_stage <= 2:
179
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
180
+ elif zero_stage == 3:
181
+ # if there is more than one param group, there will be multiple flattened tensors - one
182
+ # flattened tensor per group - for simplicity merge them into a single tensor
183
+ #
184
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
185
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
186
+
187
+ fp32_flat_groups = [
188
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key], 0) for i in range(len(state_dicts))
189
+ ]
190
+
191
+ return zero_stage, world_size, fp32_flat_groups
192
+
193
+
194
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
195
+ """
196
+ Returns fp32 state_dict reconstructed from ds checkpoint
197
+
198
+ Args:
199
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
200
+
201
+ """
202
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
203
+
204
+ optim_files = get_optim_files(ds_checkpoint_dir)
205
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
206
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
207
+
208
+ model_files = get_model_state_files(ds_checkpoint_dir)
209
+
210
+ zero_model_states = parse_model_states(model_files)
211
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
212
+
213
+ if zero_stage <= 2:
214
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
215
+ exclude_frozen_parameters)
216
+ elif zero_stage == 3:
217
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
218
+ exclude_frozen_parameters)
219
+
220
+
221
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
222
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
223
+ return
224
+
225
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
226
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
227
+
228
+ if debug:
229
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
230
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
231
+
232
+ wanted_params = len(frozen_param_shapes)
233
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
234
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
235
+ print(f'Frozen params: Have {avail_numel} numels to process.')
236
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
237
+
238
+ total_params = 0
239
+ total_numel = 0
240
+ for name, shape in frozen_param_shapes.items():
241
+ total_params += 1
242
+ unpartitioned_numel = shape.numel()
243
+ total_numel += unpartitioned_numel
244
+
245
+ state_dict[name] = frozen_param_fragments[name]
246
+
247
+ if debug:
248
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
249
+
250
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
251
+
252
+
253
+ def _has_callable(obj, fn):
254
+ attr = getattr(obj, fn, None)
255
+ return callable(attr)
256
+
257
+
258
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
259
+ param_shapes = zero_model_states[0].param_shapes
260
+
261
+ # Reconstruction protocol:
262
+ #
263
+ # XXX: document this
264
+
265
+ if debug:
266
+ for i in range(world_size):
267
+ for j in range(len(fp32_flat_groups[0])):
268
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
269
+
270
+ # XXX: memory usage doubles here (zero2)
271
+ num_param_groups = len(fp32_flat_groups[0])
272
+ merged_single_partition_of_fp32_groups = []
273
+ for i in range(num_param_groups):
274
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
275
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
276
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
277
+ avail_numel = sum(
278
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
279
+
280
+ if debug:
281
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
282
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
283
+ # not asserting if there is a mismatch due to possible padding
284
+ print(f"Have {avail_numel} numels to process.")
285
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
286
+
287
+ # params
288
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
289
+ # out-of-core computing solution
290
+ total_numel = 0
291
+ total_params = 0
292
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
293
+ offset = 0
294
+ avail_numel = full_single_fp32_vector.numel()
295
+ for name, shape in shapes.items():
296
+
297
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
298
+ total_numel += unpartitioned_numel
299
+ total_params += 1
300
+
301
+ if debug:
302
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
303
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
304
+ offset += unpartitioned_numel
305
+
306
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
307
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
308
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
309
+ # live optimizer object, so we are checking that the numbers are within the right range
310
+ align_to = 2 * world_size
311
+
312
+ def zero2_align(x):
313
+ return align_to * math.ceil(x / align_to)
314
+
315
+ if debug:
316
+ print(f"original offset={offset}, avail_numel={avail_numel}")
317
+
318
+ offset = zero2_align(offset)
319
+ avail_numel = zero2_align(avail_numel)
320
+
321
+ if debug:
322
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
323
+
324
+ # Sanity check
325
+ if offset != avail_numel:
326
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
327
+
328
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
329
+
330
+
331
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
332
+ exclude_frozen_parameters):
333
+ state_dict = OrderedDict()
334
+
335
+ # buffers
336
+ buffers = zero_model_states[0].buffers
337
+ state_dict.update(buffers)
338
+ if debug:
339
+ print(f"added {len(buffers)} buffers")
340
+
341
+ if not exclude_frozen_parameters:
342
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
343
+
344
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
345
+
346
+ # recover shared parameters
347
+ for pair in zero_model_states[0].shared_params:
348
+ if pair[1] in state_dict:
349
+ state_dict[pair[0]] = state_dict[pair[1]]
350
+
351
+ return state_dict
352
+
353
+
354
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
355
+ remainder = unpartitioned_numel % world_size
356
+ padding_numel = (world_size - remainder) if remainder else 0
357
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
358
+ return partitioned_numel, padding_numel
359
+
360
+
361
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
362
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
363
+ return
364
+
365
+ if debug:
366
+ for i in range(world_size):
367
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
368
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
369
+
370
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
371
+ wanted_params = len(frozen_param_shapes)
372
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
373
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
374
+ print(f'Frozen params: Have {avail_numel} numels to process.')
375
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
376
+
377
+ total_params = 0
378
+ total_numel = 0
379
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
380
+ total_params += 1
381
+ unpartitioned_numel = shape.numel()
382
+ total_numel += unpartitioned_numel
383
+
384
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
385
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
386
+
387
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
388
+
389
+ if debug:
390
+ print(
391
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
392
+ )
393
+
394
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
395
+
396
+
397
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
398
+ param_shapes = zero_model_states[0].param_shapes
399
+ avail_numel = fp32_flat_groups[0].numel() * world_size
400
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
401
+ # param, re-consolidating each param, while dealing with padding if any
402
+
403
+ # merge list of dicts, preserving order
404
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
405
+
406
+ if debug:
407
+ for i in range(world_size):
408
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
409
+
410
+ wanted_params = len(param_shapes)
411
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
412
+ # not asserting if there is a mismatch due to possible padding
413
+ avail_numel = fp32_flat_groups[0].numel() * world_size
414
+ print(f"Trainable params: Have {avail_numel} numels to process.")
415
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
416
+
417
+ # params
418
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
419
+ # out-of-core computing solution
420
+ offset = 0
421
+ total_numel = 0
422
+ total_params = 0
423
+ for name, shape in param_shapes.items():
424
+
425
+ unpartitioned_numel = shape.numel()
426
+ total_numel += unpartitioned_numel
427
+ total_params += 1
428
+
429
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
430
+
431
+ if debug:
432
+ print(
433
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
434
+ )
435
+
436
+ # XXX: memory usage doubles here
437
+ state_dict[name] = torch.cat(
438
+ tuple(fp32_flat_groups[i].narrow(0, offset, partitioned_numel) for i in range(world_size)),
439
+ 0).narrow(0, 0, unpartitioned_numel).view(shape)
440
+ offset += partitioned_numel
441
+
442
+ offset *= world_size
443
+
444
+ # Sanity check
445
+ if offset != avail_numel:
446
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
447
+
448
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
449
+
450
+
451
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
452
+ exclude_frozen_parameters):
453
+ state_dict = OrderedDict()
454
+
455
+ # buffers
456
+ buffers = zero_model_states[0].buffers
457
+ state_dict.update(buffers)
458
+ if debug:
459
+ print(f"added {len(buffers)} buffers")
460
+
461
+ if not exclude_frozen_parameters:
462
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
463
+
464
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
465
+
466
+ # recover shared parameters
467
+ for pair in zero_model_states[0].shared_params:
468
+ if pair[1] in state_dict:
469
+ state_dict[pair[0]] = state_dict[pair[1]]
470
+
471
+ return state_dict
472
+
473
+
474
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None, exclude_frozen_parameters=False):
475
+ """
476
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
477
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
478
+ via a model hub.
479
+
480
+ Args:
481
+ - ``checkpoint_dir``: path to the desired checkpoint folder
482
+ - ``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``
483
+ - ``exclude_frozen_parameters``: exclude frozen parameters
484
+
485
+ Returns:
486
+ - pytorch ``state_dict``
487
+
488
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
489
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
490
+ the checkpoint.
491
+
492
+ A typical usage might be ::
493
+
494
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
495
+ # do the training and checkpoint saving
496
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
497
+ model = model.cpu() # move to cpu
498
+ model.load_state_dict(state_dict)
499
+ # submit to model hub or save the model to share with others
500
+
501
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
502
+ application. i.e. you will need to re-initialize the deepspeed engine, since
503
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
504
+
505
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
506
+
507
+ """
508
+ if tag is None:
509
+ latest_path = os.path.join(checkpoint_dir, 'latest')
510
+ if os.path.isfile(latest_path):
511
+ with open(latest_path, 'r') as fd:
512
+ tag = fd.read().strip()
513
+ else:
514
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
515
+
516
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
517
+
518
+ if not os.path.isdir(ds_checkpoint_dir):
519
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
520
+
521
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
522
+
523
+
524
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None, exclude_frozen_parameters=False):
525
+ """
526
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
527
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
528
+
529
+ Args:
530
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
531
+ - ``output_file``: path to the pytorch fp32 state_dict output file (e.g. path/pytorch_model.bin)
532
+ - ``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``
533
+ - ``exclude_frozen_parameters``: exclude frozen parameters
534
+ """
535
+
536
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag, exclude_frozen_parameters)
537
+ print(f"Saving fp32 state dict to {output_file}")
538
+ torch.save(state_dict, output_file)
539
+
540
+
541
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
542
+ """
543
+ 1. Put the provided model to cpu
544
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
545
+ 3. Load it into the provided model
546
+
547
+ Args:
548
+ - ``model``: the model object to update
549
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
550
+ - ``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``
551
+
552
+ Returns:
553
+ - ``model`: modified model
554
+
555
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
556
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
557
+ conveniently placed for you in the checkpoint folder.
558
+
559
+ A typical usage might be ::
560
+
561
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
562
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
563
+ # submit to model hub or save the model to share with others
564
+
565
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
566
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
567
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
568
+
569
+ """
570
+ logger.info(f"Extracting fp32 weights")
571
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
572
+
573
+ logger.info(f"Overwriting model with fp32 weights")
574
+ model = model.cpu()
575
+ model.load_state_dict(state_dict, strict=False)
576
+
577
+ return model
578
+
579
+
580
+ if __name__ == "__main__":
581
+
582
+ parser = argparse.ArgumentParser()
583
+ parser.add_argument("checkpoint_dir",
584
+ type=str,
585
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
586
+ parser.add_argument(
587
+ "output_file",
588
+ type=str,
589
+ help="path to the pytorch fp32 state_dict output file (e.g. path/checkpoint-12/pytorch_model.bin)")
590
+ parser.add_argument("-t",
591
+ "--tag",
592
+ type=str,
593
+ default=None,
594
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
595
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
596
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
597
+ args = parser.parse_args()
598
+
599
+ debug = args.debug
600
+
601
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
602
+ args.output_file,
603
+ tag=args.tag,
604
+ exclude_frozen_parameters=args.exclude_frozen_parameters)
checkpoints/checkpoint-2500/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: peft
3
+ base_model: openbmb/MiniCPM-2B-dpo-bf16
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
200
+ ### Framework versions
201
+
202
+ - PEFT 0.10.0
checkpoints/checkpoint-2500/adapter_config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "openbmb/MiniCPM-2B-dpo-bf16",
5
+ "bias": "none",
6
+ "fan_in_fan_out": false,
7
+ "inference_mode": true,
8
+ "init_lora_weights": "gaussian",
9
+ "layer_replication": null,
10
+ "layers_pattern": null,
11
+ "layers_to_transform": null,
12
+ "loftq_config": {},
13
+ "lora_alpha": 32,
14
+ "lora_dropout": 0.1,
15
+ "megatron_config": null,
16
+ "megatron_core": "megatron.core",
17
+ "modules_to_save": null,
18
+ "peft_type": "LORA",
19
+ "r": 8,
20
+ "rank_pattern": {},
21
+ "revision": null,
22
+ "target_modules": [
23
+ "v_proj",
24
+ "q_proj"
25
+ ],
26
+ "task_type": "CAUSAL_LM",
27
+ "use_dora": false,
28
+ "use_rslora": false
29
+ }
checkpoints/checkpoint-2500/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3930f22046333bd2b424020c5ba937de3e5f3239dc86cbd432b2b9f92c95a70a
3
+ size 5919456
checkpoints/checkpoint-2500/global_step2500/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8e4efdd5c2b93b0c2c7671ca8a30ba480832bf7ecbcc638e1f13267ac9c26e5d
3
+ size 35393392