radna commited on
Commit
0406d37
·
verified ·
1 Parent(s): e06e75d

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ completions.jsonl filter=lfs diff=lfs merge=lfs -text
args.json ADDED
@@ -0,0 +1,418 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "/mnt/nvme5n1p1/fuse-32b",
3
+ "model_type": "deepseek_r1_distill",
4
+ "model_revision": null,
5
+ "task_type": "causal_lm",
6
+ "torch_dtype": "bfloat16",
7
+ "attn_impl": null,
8
+ "num_labels": null,
9
+ "rope_scaling": null,
10
+ "device_map": null,
11
+ "max_memory": {},
12
+ "local_repo_path": null,
13
+ "template": "deepseek_r1",
14
+ "system": "You are a helpful and harmless assistant. You are Qwen developed by Alibaba. You should think step-by-step. Return final answer within \\\\boxed{}.",
15
+ "max_length": 16384,
16
+ "truncation_strategy": "left",
17
+ "max_pixels": null,
18
+ "tools_prompt": "react_en",
19
+ "norm_bbox": null,
20
+ "response_prefix": null,
21
+ "padding_side": "right",
22
+ "loss_scale": "last_round",
23
+ "sequence_parallel_size": 1,
24
+ "use_chat_template": true,
25
+ "template_backend": "swift",
26
+ "dataset": [
27
+ "stage1_aime.jsonl"
28
+ ],
29
+ "val_dataset": [
30
+ "eval_aime.jsonl"
31
+ ],
32
+ "split_dataset_ratio": 0.0,
33
+ "data_seed": 42,
34
+ "dataset_num_proc": 52,
35
+ "streaming": false,
36
+ "enable_cache": false,
37
+ "download_mode": "reuse_dataset_if_exists",
38
+ "columns": {},
39
+ "strict": false,
40
+ "remove_unused_columns": false,
41
+ "model_name": [
42
+ null,
43
+ null
44
+ ],
45
+ "model_author": [
46
+ null,
47
+ null
48
+ ],
49
+ "custom_dataset_info": [],
50
+ "quant_method": null,
51
+ "quant_bits": null,
52
+ "hqq_axis": null,
53
+ "bnb_4bit_compute_dtype": "bfloat16",
54
+ "bnb_4bit_quant_type": "nf4",
55
+ "bnb_4bit_use_double_quant": true,
56
+ "bnb_4bit_quant_storage": null,
57
+ "max_new_tokens": 64,
58
+ "temperature": 1.0,
59
+ "top_k": 50,
60
+ "top_p": 0.9,
61
+ "repetition_penalty": 1.1,
62
+ "num_beams": 1,
63
+ "stream": false,
64
+ "stop_words": [],
65
+ "logprobs": false,
66
+ "top_logprobs": null,
67
+ "ckpt_dir": null,
68
+ "load_dataset_config": null,
69
+ "lora_modules": [],
70
+ "tuner_backend": "peft",
71
+ "train_type": "lora",
72
+ "adapters": [],
73
+ "external_plugins": [],
74
+ "seed": 42,
75
+ "model_kwargs": {},
76
+ "load_args": false,
77
+ "load_data_args": false,
78
+ "use_hf": true,
79
+ "hub_token": null,
80
+ "custom_register_path": [],
81
+ "ignore_args_error": false,
82
+ "use_swift_lora": false,
83
+ "output_dir": "/mnt/nvme5n1p1/trained_grpo_fuse_32b/v140-20250324-010830",
84
+ "overwrite_output_dir": false,
85
+ "do_train": false,
86
+ "do_eval": false,
87
+ "do_predict": false,
88
+ "eval_strategy": "steps",
89
+ "prediction_loss_only": false,
90
+ "per_device_train_batch_size": 2,
91
+ "per_device_eval_batch_size": 2,
92
+ "per_gpu_train_batch_size": null,
93
+ "per_gpu_eval_batch_size": null,
94
+ "gradient_accumulation_steps": 4,
95
+ "eval_accumulation_steps": null,
96
+ "eval_delay": 0,
97
+ "torch_empty_cache_steps": null,
98
+ "learning_rate": 0.0001,
99
+ "weight_decay": 0.1,
100
+ "adam_beta1": 0.9,
101
+ "adam_beta2": 0.999,
102
+ "adam_epsilon": 1e-08,
103
+ "max_grad_norm": 1.0,
104
+ "num_train_epochs": 5.0,
105
+ "max_steps": -1,
106
+ "lr_scheduler_type": "cosine",
107
+ "lr_scheduler_kwargs": null,
108
+ "warmup_ratio": 0.1,
109
+ "warmup_steps": 0,
110
+ "log_level": "passive",
111
+ "log_level_replica": "warning",
112
+ "log_on_each_node": true,
113
+ "logging_dir": "/mnt/nvme5n1p1/trained_grpo_fuse_32b/v140-20250324-010830/runs",
114
+ "logging_strategy": "steps",
115
+ "logging_first_step": true,
116
+ "logging_steps": 1,
117
+ "logging_nan_inf_filter": true,
118
+ "save_strategy": "steps",
119
+ "save_steps": 4.0,
120
+ "save_total_limit": 100,
121
+ "save_safetensors": true,
122
+ "save_on_each_node": false,
123
+ "save_only_model": false,
124
+ "restore_callback_states_from_checkpoint": false,
125
+ "no_cuda": false,
126
+ "use_cpu": false,
127
+ "use_mps_device": false,
128
+ "jit_mode_eval": false,
129
+ "use_ipex": false,
130
+ "bf16": true,
131
+ "fp16": false,
132
+ "fp16_opt_level": "O1",
133
+ "half_precision_backend": "auto",
134
+ "bf16_full_eval": false,
135
+ "fp16_full_eval": false,
136
+ "tf32": null,
137
+ "local_rank": 0,
138
+ "ddp_backend": null,
139
+ "tpu_num_cores": null,
140
+ "tpu_metrics_debug": false,
141
+ "debug": null,
142
+ "dataloader_drop_last": false,
143
+ "eval_steps": 12.0,
144
+ "dataloader_num_workers": 52,
145
+ "dataloader_prefetch_factor": null,
146
+ "past_index": -1,
147
+ "run_name": null,
148
+ "disable_tqdm": null,
149
+ "label_names": null,
150
+ "load_best_model_at_end": false,
151
+ "metric_for_best_model": "reward",
152
+ "greater_is_better": true,
153
+ "ignore_data_skip": false,
154
+ "fsdp": "",
155
+ "fsdp_min_num_params": 0,
156
+ "fsdp_config": null,
157
+ "fsdp_transformer_layer_cls_to_wrap": null,
158
+ "accelerator_config": {
159
+ "dispatch_batches": false
160
+ },
161
+ "deepspeed": {
162
+ "fp16": {
163
+ "enabled": "auto",
164
+ "loss_scale": 0,
165
+ "loss_scale_window": 1000,
166
+ "initial_scale_power": 16,
167
+ "hysteresis": 2,
168
+ "min_loss_scale": 1
169
+ },
170
+ "bf16": {
171
+ "enabled": "auto"
172
+ },
173
+ "zero_optimization": {
174
+ "stage": 2,
175
+ "offload_optimizer": {
176
+ "device": "none",
177
+ "pin_memory": true
178
+ },
179
+ "allgather_partitions": true,
180
+ "allgather_bucket_size": 200000000.0,
181
+ "overlap_comm": true,
182
+ "reduce_scatter": true,
183
+ "reduce_bucket_size": 200000000.0,
184
+ "contiguous_gradients": true
185
+ },
186
+ "gradient_accumulation_steps": "auto",
187
+ "gradient_clipping": "auto",
188
+ "steps_per_print": 2000,
189
+ "train_batch_size": "auto",
190
+ "train_micro_batch_size_per_gpu": "auto",
191
+ "wall_clock_breakdown": false
192
+ },
193
+ "label_smoothing_factor": 0.0,
194
+ "optim": "adamw_torch",
195
+ "optim_args": null,
196
+ "adafactor": false,
197
+ "group_by_length": false,
198
+ "length_column_name": "length",
199
+ "report_to": [
200
+ "wandb"
201
+ ],
202
+ "ddp_find_unused_parameters": null,
203
+ "ddp_bucket_cap_mb": null,
204
+ "ddp_broadcast_buffers": null,
205
+ "dataloader_pin_memory": true,
206
+ "dataloader_persistent_workers": false,
207
+ "skip_memory_metrics": true,
208
+ "use_legacy_prediction_loop": false,
209
+ "push_to_hub": false,
210
+ "resume_from_checkpoint": null,
211
+ "hub_model_id": null,
212
+ "hub_strategy": "every_save",
213
+ "hub_private_repo": null,
214
+ "hub_always_push": false,
215
+ "gradient_checkpointing": true,
216
+ "gradient_checkpointing_kwargs": null,
217
+ "include_inputs_for_metrics": false,
218
+ "include_for_metrics": [],
219
+ "eval_do_concat_batches": true,
220
+ "fp16_backend": "auto",
221
+ "evaluation_strategy": "steps",
222
+ "push_to_hub_model_id": null,
223
+ "push_to_hub_organization": null,
224
+ "push_to_hub_token": null,
225
+ "mp_parameters": "",
226
+ "auto_find_batch_size": false,
227
+ "full_determinism": false,
228
+ "torchdynamo": null,
229
+ "ray_scope": "last",
230
+ "ddp_timeout": 1800,
231
+ "torch_compile": false,
232
+ "torch_compile_backend": null,
233
+ "torch_compile_mode": null,
234
+ "dispatch_batches": null,
235
+ "split_batches": null,
236
+ "include_tokens_per_second": false,
237
+ "include_num_input_tokens_seen": false,
238
+ "neftune_noise_alpha": null,
239
+ "optim_target_modules": null,
240
+ "batch_eval_metrics": false,
241
+ "eval_on_start": false,
242
+ "use_liger_kernel": false,
243
+ "eval_use_gather_object": false,
244
+ "average_tokens_across_devices": false,
245
+ "sortish_sampler": false,
246
+ "predict_with_generate": false,
247
+ "generation_max_length": null,
248
+ "generation_num_beams": null,
249
+ "generation_config": null,
250
+ "freeze_parameters": [],
251
+ "freeze_parameters_ratio": 0.0,
252
+ "trainable_parameters": [],
253
+ "freeze_llm": false,
254
+ "freeze_vit": true,
255
+ "freeze_aligner": true,
256
+ "target_modules": [
257
+ "all-linear"
258
+ ],
259
+ "target_regex": null,
260
+ "modules_to_save": [],
261
+ "lora_rank": 32,
262
+ "lora_alpha": 32,
263
+ "lora_dropout": 0.05,
264
+ "lora_bias": "none",
265
+ "lora_dtype": null,
266
+ "lorap_lr_ratio": null,
267
+ "use_rslora": false,
268
+ "use_dora": false,
269
+ "lora_ga_batch_size": 2,
270
+ "lora_ga_iters": 2,
271
+ "lora_ga_max_length": 1024,
272
+ "lora_ga_direction": "ArB2r",
273
+ "lora_ga_scale": "stable",
274
+ "lora_ga_stable_gamma": 16,
275
+ "init_weights": true,
276
+ "fourier_n_frequency": 2000,
277
+ "fourier_scaling": 300.0,
278
+ "boft_block_size": 4,
279
+ "boft_block_num": 0,
280
+ "boft_n_butterfly_factor": 1,
281
+ "boft_dropout": 0.0,
282
+ "vera_rank": 256,
283
+ "vera_projection_prng_key": 0,
284
+ "vera_dropout": 0.0,
285
+ "vera_d_initial": 0.1,
286
+ "adapter_act": "gelu",
287
+ "adapter_length": 128,
288
+ "use_galore": false,
289
+ "galore_target_modules": null,
290
+ "galore_rank": 128,
291
+ "galore_update_proj_gap": 50,
292
+ "galore_scale": 1.0,
293
+ "galore_proj_type": "std",
294
+ "galore_optim_per_parameter": false,
295
+ "galore_with_embedding": false,
296
+ "galore_quantization": false,
297
+ "galore_proj_quant": false,
298
+ "galore_proj_bits": 4,
299
+ "galore_proj_group_size": 256,
300
+ "galore_cos_threshold": 0.4,
301
+ "galore_gamma_proj": 2,
302
+ "galore_queue_size": 5,
303
+ "adalora_target_r": 8,
304
+ "adalora_init_r": 12,
305
+ "adalora_tinit": 0,
306
+ "adalora_tfinal": 0,
307
+ "adalora_deltaT": 1,
308
+ "adalora_beta1": 0.85,
309
+ "adalora_beta2": 0.85,
310
+ "adalora_orth_reg_weight": 0.5,
311
+ "llamapro_num_new_blocks": 4,
312
+ "llamapro_num_groups": null,
313
+ "lisa_activated_layers": 0,
314
+ "lisa_step_interval": 20,
315
+ "reft_layer_key": null,
316
+ "reft_layers": null,
317
+ "reft_rank": 4,
318
+ "reft_intervention_type": "LoreftIntervention",
319
+ "reft_args": null,
320
+ "use_liger": false,
321
+ "model_layer_cls_name": null,
322
+ "metric_warmup_step": 0,
323
+ "fsdp_num": 1,
324
+ "acc_steps": 1,
325
+ "swanlab_token": null,
326
+ "swanlab_project": null,
327
+ "swanlab_workspace": null,
328
+ "swanlab_exp_name": null,
329
+ "swanlab_mode": "cloud",
330
+ "add_version": true,
331
+ "resume_only_model": false,
332
+ "check_model": true,
333
+ "create_checkpoint_symlink": false,
334
+ "packing": false,
335
+ "lazy_tokenize": false,
336
+ "loss_type": null,
337
+ "optimizer": null,
338
+ "metric": null,
339
+ "acc_strategy": "token",
340
+ "zero_hpz_partition_size": null,
341
+ "reward_model": null,
342
+ "reward_adapters": [],
343
+ "reward_model_type": null,
344
+ "reward_model_revision": null,
345
+ "num_ppo_epochs": 4,
346
+ "whiten_rewards": false,
347
+ "kl_coef": 0.05,
348
+ "cliprange": 0.2,
349
+ "vf_coef": 0.1,
350
+ "cliprange_value": 0.2,
351
+ "gamma": 1.0,
352
+ "lam": 0.95,
353
+ "num_mini_batches": 1,
354
+ "local_rollout_forward_batch_size": 64,
355
+ "num_sample_generations": 10,
356
+ "response_length": 512,
357
+ "missing_eos_penalty": null,
358
+ "num_infer_workers": 8,
359
+ "vllm_max_num_seqs": 256,
360
+ "vllm_enforce_eager": false,
361
+ "vllm_limit_mm_per_prompt": null,
362
+ "vllm_enable_prefix_caching": true,
363
+ "cosine_min_len_value_wrong": -1.0,
364
+ "cosine_max_len_value_wrong": 0.0,
365
+ "cosine_min_len_value_correct": 0.5,
366
+ "cosine_max_len_value_correct": 0.25,
367
+ "cosine_max_len": 12288,
368
+ "repetition_n_grams": 40,
369
+ "repetition_max_penalty": -0.05,
370
+ "use_lmdeploy": false,
371
+ "lmdeploy_device": "auto",
372
+ "lmdeploy_session_len": null,
373
+ "lmdeploy_cache_max_entry_count": 0.8,
374
+ "async_generate": false,
375
+ "tensor_parallel_size": 1,
376
+ "sleep_level": 0,
377
+ "move_model_batches": null,
378
+ "offload_optimizer": false,
379
+ "offload_model": false,
380
+ "gc_collect_after_offload": false,
381
+ "num_generations": 4,
382
+ "max_completion_length": 12288,
383
+ "ds3_gather_for_generation": true,
384
+ "reward_funcs": [
385
+ "cosine",
386
+ "repetition"
387
+ ],
388
+ "reward_weights": null,
389
+ "log_completions": true,
390
+ "use_vllm": false,
391
+ "vllm_device": [
392
+ "auto"
393
+ ],
394
+ "vllm_gpu_memory_utilization": 0.9,
395
+ "vllm_max_model_len": null,
396
+ "num_iterations": 2,
397
+ "epsilon": 0.2,
398
+ "rlhf_type": "grpo",
399
+ "ref_model": null,
400
+ "ref_model_type": null,
401
+ "ref_model_revision": null,
402
+ "beta": 0.04,
403
+ "label_smoothing": 0,
404
+ "rpo_alpha": 1.0,
405
+ "cpo_alpha": 1.0,
406
+ "simpo_gamma": 1,
407
+ "desirable_weight": 1.0,
408
+ "undesirable_weight": 1.0,
409
+ "rank": 0,
410
+ "global_world_size": 32,
411
+ "local_world_size": 8,
412
+ "model_suffix": "fuse-32b",
413
+ "model_info": "ModelInfo(model_type='deepseek_r1_distill', model_dir='/mnt/nvme5n1p1/fuse-32b', torch_dtype=torch.bfloat16, max_model_len=131072, quant_method=None, quant_bits=None, rope_scaling=None, config=None, task_type='causal_lm', num_labels=None)",
414
+ "model_meta": "ModelMeta(model_type='deepseek_r1_distill', model_groups=[ModelGroup(models=[Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-7B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-14B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-14B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-32B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-32B', model_path=None, ms_revision=None, hf_revision=None)], ignore_patterns=None, requires=['transformers>=4.37'], tags=[]), ModelGroup(models=[Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Llama-8B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Llama-8B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Llama-70B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Llama-70B', model_path=None, ms_revision=None, hf_revision=None)], ignore_patterns=None, requires=None, tags=[])], template='deepseek_r1', get_function=<function get_model_tokenizer_with_flash_attn at 0x7f614f1c3400>, model_arch='llama', architectures=['Qwen2ForCausalLM', 'LlamaForCausalLM'], additional_saved_files=[], torch_dtype=None, is_multimodal=False, is_reward=False, task_type=None, ignore_patterns=[], requires=[], tags=[])",
415
+ "model_dir": "/mnt/nvme5n1p1/fuse-32b",
416
+ "hub": "<class 'swift.hub.hub.HFHub'>",
417
+ "training_args": "GRPOConfig(output_dir='/mnt/nvme5n1p1/trained_grpo_fuse_32b/v140-20250324-010830', overwrite_output_dir=False, do_train=False, do_eval=True, do_predict=False, eval_strategy=<IntervalStrategy.STEPS: 'steps'>, prediction_loss_only=False, per_device_train_batch_size=2, per_device_eval_batch_size=2, per_gpu_train_batch_size=None, per_gpu_eval_batch_size=None, gradient_accumulation_steps=4, eval_accumulation_steps=None, eval_delay=0, torch_empty_cache_steps=None, learning_rate=0.0001, weight_decay=0.1, adam_beta1=0.9, adam_beta2=0.999, adam_epsilon=1e-08, max_grad_norm=1.0, num_train_epochs=5.0, max_steps=-1, lr_scheduler_type=<SchedulerType.COSINE: 'cosine'>, lr_scheduler_kwargs=None, warmup_ratio=0.1, warmup_steps=0, log_level='passive', log_level_replica='warning', log_on_each_node=True, logging_dir='/mnt/nvme5n1p1/trained_grpo_fuse_32b/v140-20250324-010830/runs', logging_strategy=<IntervalStrategy.STEPS: 'steps'>, logging_first_step=True, logging_steps=1, logging_nan_inf_filter=True, save_strategy=<SaveStrategy.STEPS: 'steps'>, save_steps=4, save_total_limit=100, save_safetensors=True, save_on_each_node=False, save_only_model=False, restore_callback_states_from_checkpoint=False, no_cuda=False, use_cpu=False, use_mps_device=False, seed=42, data_seed=42, jit_mode_eval=False, use_ipex=False, bf16=True, fp16=False, fp16_opt_level='O1', half_precision_backend='auto', bf16_full_eval=False, fp16_full_eval=False, tf32=None, local_rank=0, ddp_backend=None, tpu_num_cores=None, tpu_metrics_debug=False, debug=[], dataloader_drop_last=False, eval_steps=12, dataloader_num_workers=52, dataloader_prefetch_factor=None, past_index=-1, run_name='/mnt/nvme5n1p1/trained_grpo_fuse_32b/v140-20250324-010830', disable_tqdm=False, remove_unused_columns=False, label_names=None, load_best_model_at_end=False, metric_for_best_model='reward', greater_is_better=True, ignore_data_skip=False, fsdp=[], fsdp_min_num_params=0, fsdp_config={'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}, fsdp_transformer_layer_cls_to_wrap=None, accelerator_config=AcceleratorConfig(split_batches=False, dispatch_batches=False, even_batches=True, use_seedable_sampler=True, non_blocking=False, gradient_accumulation_kwargs=None, use_configured_state=False), deepspeed={'fp16': {'enabled': 'auto', 'loss_scale': 0, 'loss_scale_window': 1000, 'initial_scale_power': 16, 'hysteresis': 2, 'min_loss_scale': 1}, 'bf16': {'enabled': 'auto'}, 'zero_optimization': {'stage': 2, 'offload_optimizer': {'device': 'none', 'pin_memory': True}, 'allgather_partitions': True, 'allgather_bucket_size': 200000000.0, 'overlap_comm': True, 'reduce_scatter': True, 'reduce_bucket_size': 200000000.0, 'contiguous_gradients': True}, 'gradient_accumulation_steps': 'auto', 'gradient_clipping': 'auto', 'steps_per_print': 2000, 'train_batch_size': 'auto', 'train_micro_batch_size_per_gpu': 'auto', 'wall_clock_breakdown': False}, label_smoothing_factor=0.0, optim=<OptimizerNames.ADAMW_TORCH: 'adamw_torch'>, optim_args=None, adafactor=False, group_by_length=False, length_column_name='length', report_to=['wandb'], ddp_find_unused_parameters=None, ddp_bucket_cap_mb=None, ddp_broadcast_buffers=None, dataloader_pin_memory=True, dataloader_persistent_workers=False, skip_memory_metrics=True, use_legacy_prediction_loop=False, push_to_hub=False, resume_from_checkpoint=None, hub_model_id=None, hub_strategy=<HubStrategy.EVERY_SAVE: 'every_save'>, hub_token=None, hub_private_repo=None, hub_always_push=False, gradient_checkpointing=True, gradient_checkpointing_kwargs=None, include_inputs_for_metrics=False, include_for_metrics=[], eval_do_concat_batches=True, fp16_backend='auto', evaluation_strategy='steps', push_to_hub_model_id=None, push_to_hub_organization=None, push_to_hub_token=None, mp_parameters='', auto_find_batch_size=False, full_determinism=False, torchdynamo=None, ray_scope='last', ddp_timeout=1800, torch_compile=False, torch_compile_backend=None, torch_compile_mode=None, dispatch_batches=None, split_batches=None, include_tokens_per_second=None, include_num_input_tokens_seen=None, neftune_noise_alpha=None, optim_target_modules=None, batch_eval_metrics=False, eval_on_start=False, use_liger_kernel=False, eval_use_gather_object=False, average_tokens_across_devices=None, model_init_kwargs=None, max_prompt_length=512, num_generations=4, max_completion_length=12288, ds3_gather_for_generation=True, temperature=1.0, top_p=0.9, top_k=50, min_p=None, repetition_penalty=1.1, cache_implementation=None, use_vllm=False, vllm_server_host='0.0.0.0', vllm_server_port=8000, vllm_server_timeout=120.0, vllm_guided_decoding_regex=None, beta=0.04, num_iterations=2, epsilon=0.2, epsilon_high=None, reward_weights=None, scale_rewards=True, sync_ref_model=False, ref_model_mixup_alpha=0.6, ref_model_sync_steps=512, log_completions=True, vllm_device=['auto'], vllm_gpu_memory_utilization=0.9, vllm_dtype=None, vllm_max_model_len=None, vllm_enable_prefix_caching=True, acc_strategy='token', sequence_parallel_size=1, check_model=True, train_sampler_random=True, is_encoder_decoder=False, metric_warmup_step=0, train_dataset_sample=-1, fsdp_num=1, acc_steps=1, train_type='lora', optimizer=None, local_repo_path=None, galore_config=None, num_infer_workers=8, vllm_max_num_seqs=256, vllm_enforce_eager=False, vllm_limit_mm_per_prompt={}, cosine_min_len_value_wrong=-1.0, cosine_max_len_value_wrong=0.0, cosine_min_len_value_correct=0.5, cosine_max_len_value_correct=0.25, cosine_max_len=12288, repetition_n_grams=40, repetition_max_penalty=-0.05, use_lmdeploy=False, lmdeploy_device='auto', lmdeploy_session_len=None, lmdeploy_cache_max_entry_count=0.8, async_generate=False, tensor_parallel_size=1, sleep_level=0, move_model_batches=None, offload_optimizer=False, offload_model=False, gc_collect_after_offload=False, stop_words=[])"
418
+ }
checkpoint-4/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: /mnt/nvme5n1p1/fuse-32b
3
+ library_name: peft
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.14.0
checkpoint-4/adapter_config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "/mnt/nvme5n1p1/fuse-32b",
5
+ "bias": "none",
6
+ "eva_config": null,
7
+ "exclude_modules": null,
8
+ "fan_in_fan_out": false,
9
+ "inference_mode": true,
10
+ "init_lora_weights": true,
11
+ "layer_replication": null,
12
+ "layers_pattern": null,
13
+ "layers_to_transform": null,
14
+ "loftq_config": {},
15
+ "lora_alpha": 32,
16
+ "lora_bias": false,
17
+ "lora_dropout": 0.05,
18
+ "megatron_config": null,
19
+ "megatron_core": "megatron.core",
20
+ "modules_to_save": [],
21
+ "peft_type": "LORA",
22
+ "r": 32,
23
+ "rank_pattern": {},
24
+ "revision": null,
25
+ "target_modules": [
26
+ "o_proj",
27
+ "v_proj",
28
+ "up_proj",
29
+ "q_proj",
30
+ "down_proj",
31
+ "gate_proj",
32
+ "k_proj"
33
+ ],
34
+ "task_type": "CAUSAL_LM",
35
+ "use_dora": false,
36
+ "use_rslora": false
37
+ }
checkpoint-4/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d3e9046c6bbaaf10eca6857f4f901631a9d33e027c0fd1a0bc022e46024f6f2
3
+ size 536992880
checkpoint-4/additional_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"lora_dtype": null, "lorap_lr_ratio": null, "lorap_emb_lr": 1e-06}
checkpoint-4/args.json ADDED
@@ -0,0 +1,418 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "/mnt/nvme5n1p1/fuse-32b",
3
+ "model_type": "deepseek_r1_distill",
4
+ "model_revision": null,
5
+ "task_type": "causal_lm",
6
+ "torch_dtype": "bfloat16",
7
+ "attn_impl": null,
8
+ "num_labels": null,
9
+ "rope_scaling": null,
10
+ "device_map": null,
11
+ "max_memory": {},
12
+ "local_repo_path": null,
13
+ "template": "deepseek_r1",
14
+ "system": "You are a helpful and harmless assistant. You are Qwen developed by Alibaba. You should think step-by-step. Return final answer within \\\\boxed{}.",
15
+ "max_length": 16384,
16
+ "truncation_strategy": "left",
17
+ "max_pixels": null,
18
+ "tools_prompt": "react_en",
19
+ "norm_bbox": null,
20
+ "response_prefix": null,
21
+ "padding_side": "right",
22
+ "loss_scale": "last_round",
23
+ "sequence_parallel_size": 1,
24
+ "use_chat_template": true,
25
+ "template_backend": "swift",
26
+ "dataset": [
27
+ "stage1_aime.jsonl"
28
+ ],
29
+ "val_dataset": [
30
+ "eval_aime.jsonl"
31
+ ],
32
+ "split_dataset_ratio": 0.0,
33
+ "data_seed": 42,
34
+ "dataset_num_proc": 52,
35
+ "streaming": false,
36
+ "enable_cache": false,
37
+ "download_mode": "reuse_dataset_if_exists",
38
+ "columns": {},
39
+ "strict": false,
40
+ "remove_unused_columns": false,
41
+ "model_name": [
42
+ null,
43
+ null
44
+ ],
45
+ "model_author": [
46
+ null,
47
+ null
48
+ ],
49
+ "custom_dataset_info": [],
50
+ "quant_method": null,
51
+ "quant_bits": null,
52
+ "hqq_axis": null,
53
+ "bnb_4bit_compute_dtype": "bfloat16",
54
+ "bnb_4bit_quant_type": "nf4",
55
+ "bnb_4bit_use_double_quant": true,
56
+ "bnb_4bit_quant_storage": null,
57
+ "max_new_tokens": 64,
58
+ "temperature": 1.0,
59
+ "top_k": 50,
60
+ "top_p": 0.9,
61
+ "repetition_penalty": 1.1,
62
+ "num_beams": 1,
63
+ "stream": false,
64
+ "stop_words": [],
65
+ "logprobs": false,
66
+ "top_logprobs": null,
67
+ "ckpt_dir": null,
68
+ "load_dataset_config": null,
69
+ "lora_modules": [],
70
+ "tuner_backend": "peft",
71
+ "train_type": "lora",
72
+ "adapters": [],
73
+ "external_plugins": [],
74
+ "seed": 42,
75
+ "model_kwargs": {},
76
+ "load_args": false,
77
+ "load_data_args": false,
78
+ "use_hf": true,
79
+ "hub_token": null,
80
+ "custom_register_path": [],
81
+ "ignore_args_error": false,
82
+ "use_swift_lora": false,
83
+ "output_dir": "/mnt/nvme5n1p1/trained_grpo_fuse_32b/v140-20250324-010830",
84
+ "overwrite_output_dir": false,
85
+ "do_train": false,
86
+ "do_eval": false,
87
+ "do_predict": false,
88
+ "eval_strategy": "steps",
89
+ "prediction_loss_only": false,
90
+ "per_device_train_batch_size": 2,
91
+ "per_device_eval_batch_size": 2,
92
+ "per_gpu_train_batch_size": null,
93
+ "per_gpu_eval_batch_size": null,
94
+ "gradient_accumulation_steps": 4,
95
+ "eval_accumulation_steps": null,
96
+ "eval_delay": 0,
97
+ "torch_empty_cache_steps": null,
98
+ "learning_rate": 0.0001,
99
+ "weight_decay": 0.1,
100
+ "adam_beta1": 0.9,
101
+ "adam_beta2": 0.999,
102
+ "adam_epsilon": 1e-08,
103
+ "max_grad_norm": 1.0,
104
+ "num_train_epochs": 5.0,
105
+ "max_steps": -1,
106
+ "lr_scheduler_type": "cosine",
107
+ "lr_scheduler_kwargs": null,
108
+ "warmup_ratio": 0.1,
109
+ "warmup_steps": 0,
110
+ "log_level": "passive",
111
+ "log_level_replica": "warning",
112
+ "log_on_each_node": true,
113
+ "logging_dir": "/mnt/nvme5n1p1/trained_grpo_fuse_32b/v140-20250324-010830/runs",
114
+ "logging_strategy": "steps",
115
+ "logging_first_step": true,
116
+ "logging_steps": 1,
117
+ "logging_nan_inf_filter": true,
118
+ "save_strategy": "steps",
119
+ "save_steps": 4.0,
120
+ "save_total_limit": 100,
121
+ "save_safetensors": true,
122
+ "save_on_each_node": false,
123
+ "save_only_model": false,
124
+ "restore_callback_states_from_checkpoint": false,
125
+ "no_cuda": false,
126
+ "use_cpu": false,
127
+ "use_mps_device": false,
128
+ "jit_mode_eval": false,
129
+ "use_ipex": false,
130
+ "bf16": true,
131
+ "fp16": false,
132
+ "fp16_opt_level": "O1",
133
+ "half_precision_backend": "auto",
134
+ "bf16_full_eval": false,
135
+ "fp16_full_eval": false,
136
+ "tf32": null,
137
+ "local_rank": 0,
138
+ "ddp_backend": null,
139
+ "tpu_num_cores": null,
140
+ "tpu_metrics_debug": false,
141
+ "debug": null,
142
+ "dataloader_drop_last": false,
143
+ "eval_steps": 12.0,
144
+ "dataloader_num_workers": 52,
145
+ "dataloader_prefetch_factor": null,
146
+ "past_index": -1,
147
+ "run_name": null,
148
+ "disable_tqdm": null,
149
+ "label_names": null,
150
+ "load_best_model_at_end": false,
151
+ "metric_for_best_model": "reward",
152
+ "greater_is_better": true,
153
+ "ignore_data_skip": false,
154
+ "fsdp": "",
155
+ "fsdp_min_num_params": 0,
156
+ "fsdp_config": null,
157
+ "fsdp_transformer_layer_cls_to_wrap": null,
158
+ "accelerator_config": {
159
+ "dispatch_batches": false
160
+ },
161
+ "deepspeed": {
162
+ "fp16": {
163
+ "enabled": "auto",
164
+ "loss_scale": 0,
165
+ "loss_scale_window": 1000,
166
+ "initial_scale_power": 16,
167
+ "hysteresis": 2,
168
+ "min_loss_scale": 1
169
+ },
170
+ "bf16": {
171
+ "enabled": "auto"
172
+ },
173
+ "zero_optimization": {
174
+ "stage": 2,
175
+ "offload_optimizer": {
176
+ "device": "none",
177
+ "pin_memory": true
178
+ },
179
+ "allgather_partitions": true,
180
+ "allgather_bucket_size": 200000000.0,
181
+ "overlap_comm": true,
182
+ "reduce_scatter": true,
183
+ "reduce_bucket_size": 200000000.0,
184
+ "contiguous_gradients": true
185
+ },
186
+ "gradient_accumulation_steps": "auto",
187
+ "gradient_clipping": "auto",
188
+ "steps_per_print": 2000,
189
+ "train_batch_size": "auto",
190
+ "train_micro_batch_size_per_gpu": "auto",
191
+ "wall_clock_breakdown": false
192
+ },
193
+ "label_smoothing_factor": 0.0,
194
+ "optim": "adamw_torch",
195
+ "optim_args": null,
196
+ "adafactor": false,
197
+ "group_by_length": false,
198
+ "length_column_name": "length",
199
+ "report_to": [
200
+ "wandb"
201
+ ],
202
+ "ddp_find_unused_parameters": null,
203
+ "ddp_bucket_cap_mb": null,
204
+ "ddp_broadcast_buffers": null,
205
+ "dataloader_pin_memory": true,
206
+ "dataloader_persistent_workers": false,
207
+ "skip_memory_metrics": true,
208
+ "use_legacy_prediction_loop": false,
209
+ "push_to_hub": false,
210
+ "resume_from_checkpoint": null,
211
+ "hub_model_id": null,
212
+ "hub_strategy": "every_save",
213
+ "hub_private_repo": null,
214
+ "hub_always_push": false,
215
+ "gradient_checkpointing": true,
216
+ "gradient_checkpointing_kwargs": null,
217
+ "include_inputs_for_metrics": false,
218
+ "include_for_metrics": [],
219
+ "eval_do_concat_batches": true,
220
+ "fp16_backend": "auto",
221
+ "evaluation_strategy": "steps",
222
+ "push_to_hub_model_id": null,
223
+ "push_to_hub_organization": null,
224
+ "push_to_hub_token": null,
225
+ "mp_parameters": "",
226
+ "auto_find_batch_size": false,
227
+ "full_determinism": false,
228
+ "torchdynamo": null,
229
+ "ray_scope": "last",
230
+ "ddp_timeout": 1800,
231
+ "torch_compile": false,
232
+ "torch_compile_backend": null,
233
+ "torch_compile_mode": null,
234
+ "dispatch_batches": null,
235
+ "split_batches": null,
236
+ "include_tokens_per_second": false,
237
+ "include_num_input_tokens_seen": false,
238
+ "neftune_noise_alpha": null,
239
+ "optim_target_modules": null,
240
+ "batch_eval_metrics": false,
241
+ "eval_on_start": false,
242
+ "use_liger_kernel": false,
243
+ "eval_use_gather_object": false,
244
+ "average_tokens_across_devices": false,
245
+ "sortish_sampler": false,
246
+ "predict_with_generate": false,
247
+ "generation_max_length": null,
248
+ "generation_num_beams": null,
249
+ "generation_config": null,
250
+ "freeze_parameters": [],
251
+ "freeze_parameters_ratio": 0.0,
252
+ "trainable_parameters": [],
253
+ "freeze_llm": false,
254
+ "freeze_vit": true,
255
+ "freeze_aligner": true,
256
+ "target_modules": [
257
+ "all-linear"
258
+ ],
259
+ "target_regex": null,
260
+ "modules_to_save": [],
261
+ "lora_rank": 32,
262
+ "lora_alpha": 32,
263
+ "lora_dropout": 0.05,
264
+ "lora_bias": "none",
265
+ "lora_dtype": null,
266
+ "lorap_lr_ratio": null,
267
+ "use_rslora": false,
268
+ "use_dora": false,
269
+ "lora_ga_batch_size": 2,
270
+ "lora_ga_iters": 2,
271
+ "lora_ga_max_length": 1024,
272
+ "lora_ga_direction": "ArB2r",
273
+ "lora_ga_scale": "stable",
274
+ "lora_ga_stable_gamma": 16,
275
+ "init_weights": true,
276
+ "fourier_n_frequency": 2000,
277
+ "fourier_scaling": 300.0,
278
+ "boft_block_size": 4,
279
+ "boft_block_num": 0,
280
+ "boft_n_butterfly_factor": 1,
281
+ "boft_dropout": 0.0,
282
+ "vera_rank": 256,
283
+ "vera_projection_prng_key": 0,
284
+ "vera_dropout": 0.0,
285
+ "vera_d_initial": 0.1,
286
+ "adapter_act": "gelu",
287
+ "adapter_length": 128,
288
+ "use_galore": false,
289
+ "galore_target_modules": null,
290
+ "galore_rank": 128,
291
+ "galore_update_proj_gap": 50,
292
+ "galore_scale": 1.0,
293
+ "galore_proj_type": "std",
294
+ "galore_optim_per_parameter": false,
295
+ "galore_with_embedding": false,
296
+ "galore_quantization": false,
297
+ "galore_proj_quant": false,
298
+ "galore_proj_bits": 4,
299
+ "galore_proj_group_size": 256,
300
+ "galore_cos_threshold": 0.4,
301
+ "galore_gamma_proj": 2,
302
+ "galore_queue_size": 5,
303
+ "adalora_target_r": 8,
304
+ "adalora_init_r": 12,
305
+ "adalora_tinit": 0,
306
+ "adalora_tfinal": 0,
307
+ "adalora_deltaT": 1,
308
+ "adalora_beta1": 0.85,
309
+ "adalora_beta2": 0.85,
310
+ "adalora_orth_reg_weight": 0.5,
311
+ "llamapro_num_new_blocks": 4,
312
+ "llamapro_num_groups": null,
313
+ "lisa_activated_layers": 0,
314
+ "lisa_step_interval": 20,
315
+ "reft_layer_key": null,
316
+ "reft_layers": null,
317
+ "reft_rank": 4,
318
+ "reft_intervention_type": "LoreftIntervention",
319
+ "reft_args": null,
320
+ "use_liger": false,
321
+ "model_layer_cls_name": null,
322
+ "metric_warmup_step": 0,
323
+ "fsdp_num": 1,
324
+ "acc_steps": 1,
325
+ "swanlab_token": null,
326
+ "swanlab_project": null,
327
+ "swanlab_workspace": null,
328
+ "swanlab_exp_name": null,
329
+ "swanlab_mode": "cloud",
330
+ "add_version": true,
331
+ "resume_only_model": false,
332
+ "check_model": true,
333
+ "create_checkpoint_symlink": false,
334
+ "packing": false,
335
+ "lazy_tokenize": false,
336
+ "loss_type": null,
337
+ "optimizer": null,
338
+ "metric": null,
339
+ "acc_strategy": "token",
340
+ "zero_hpz_partition_size": null,
341
+ "reward_model": null,
342
+ "reward_adapters": [],
343
+ "reward_model_type": null,
344
+ "reward_model_revision": null,
345
+ "num_ppo_epochs": 4,
346
+ "whiten_rewards": false,
347
+ "kl_coef": 0.05,
348
+ "cliprange": 0.2,
349
+ "vf_coef": 0.1,
350
+ "cliprange_value": 0.2,
351
+ "gamma": 1.0,
352
+ "lam": 0.95,
353
+ "num_mini_batches": 1,
354
+ "local_rollout_forward_batch_size": 64,
355
+ "num_sample_generations": 10,
356
+ "response_length": 512,
357
+ "missing_eos_penalty": null,
358
+ "num_infer_workers": 8,
359
+ "vllm_max_num_seqs": 256,
360
+ "vllm_enforce_eager": false,
361
+ "vllm_limit_mm_per_prompt": null,
362
+ "vllm_enable_prefix_caching": true,
363
+ "cosine_min_len_value_wrong": -1.0,
364
+ "cosine_max_len_value_wrong": 0.0,
365
+ "cosine_min_len_value_correct": 0.5,
366
+ "cosine_max_len_value_correct": 0.25,
367
+ "cosine_max_len": 12288,
368
+ "repetition_n_grams": 40,
369
+ "repetition_max_penalty": -0.05,
370
+ "use_lmdeploy": false,
371
+ "lmdeploy_device": "auto",
372
+ "lmdeploy_session_len": null,
373
+ "lmdeploy_cache_max_entry_count": 0.8,
374
+ "async_generate": false,
375
+ "tensor_parallel_size": 1,
376
+ "sleep_level": 0,
377
+ "move_model_batches": null,
378
+ "offload_optimizer": false,
379
+ "offload_model": false,
380
+ "gc_collect_after_offload": false,
381
+ "num_generations": 4,
382
+ "max_completion_length": 12288,
383
+ "ds3_gather_for_generation": true,
384
+ "reward_funcs": [
385
+ "cosine",
386
+ "repetition"
387
+ ],
388
+ "reward_weights": null,
389
+ "log_completions": true,
390
+ "use_vllm": false,
391
+ "vllm_device": [
392
+ "auto"
393
+ ],
394
+ "vllm_gpu_memory_utilization": 0.9,
395
+ "vllm_max_model_len": null,
396
+ "num_iterations": 2,
397
+ "epsilon": 0.2,
398
+ "rlhf_type": "grpo",
399
+ "ref_model": null,
400
+ "ref_model_type": null,
401
+ "ref_model_revision": null,
402
+ "beta": 0.04,
403
+ "label_smoothing": 0,
404
+ "rpo_alpha": 1.0,
405
+ "cpo_alpha": 1.0,
406
+ "simpo_gamma": 1,
407
+ "desirable_weight": 1.0,
408
+ "undesirable_weight": 1.0,
409
+ "rank": 0,
410
+ "global_world_size": 32,
411
+ "local_world_size": 8,
412
+ "model_suffix": "fuse-32b",
413
+ "model_info": "ModelInfo(model_type='deepseek_r1_distill', model_dir='/mnt/nvme5n1p1/fuse-32b', torch_dtype=torch.bfloat16, max_model_len=131072, quant_method=None, quant_bits=None, rope_scaling=None, config=None, task_type='causal_lm', num_labels=None)",
414
+ "model_meta": "ModelMeta(model_type='deepseek_r1_distill', model_groups=[ModelGroup(models=[Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-7B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-14B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-14B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-32B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-32B', model_path=None, ms_revision=None, hf_revision=None)], ignore_patterns=None, requires=['transformers>=4.37'], tags=[]), ModelGroup(models=[Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Llama-8B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Llama-8B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Llama-70B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Llama-70B', model_path=None, ms_revision=None, hf_revision=None)], ignore_patterns=None, requires=None, tags=[])], template='deepseek_r1', get_function=<function get_model_tokenizer_with_flash_attn at 0x7f614f1c3400>, model_arch='llama', architectures=['Qwen2ForCausalLM', 'LlamaForCausalLM'], additional_saved_files=[], torch_dtype=None, is_multimodal=False, is_reward=False, task_type=None, ignore_patterns=[], requires=[], tags=[])",
415
+ "model_dir": "/mnt/nvme5n1p1/fuse-32b",
416
+ "hub": "<class 'swift.hub.hub.HFHub'>",
417
+ "training_args": "GRPOConfig(output_dir='/mnt/nvme5n1p1/trained_grpo_fuse_32b/v140-20250324-010830', overwrite_output_dir=False, do_train=False, do_eval=True, do_predict=False, eval_strategy=<IntervalStrategy.STEPS: 'steps'>, prediction_loss_only=False, per_device_train_batch_size=2, per_device_eval_batch_size=2, per_gpu_train_batch_size=None, per_gpu_eval_batch_size=None, gradient_accumulation_steps=4, eval_accumulation_steps=None, eval_delay=0, torch_empty_cache_steps=None, learning_rate=0.0001, weight_decay=0.1, adam_beta1=0.9, adam_beta2=0.999, adam_epsilon=1e-08, max_grad_norm=1.0, num_train_epochs=5.0, max_steps=-1, lr_scheduler_type=<SchedulerType.COSINE: 'cosine'>, lr_scheduler_kwargs=None, warmup_ratio=0.1, warmup_steps=0, log_level='passive', log_level_replica='warning', log_on_each_node=True, logging_dir='/mnt/nvme5n1p1/trained_grpo_fuse_32b/v140-20250324-010830/runs', logging_strategy=<IntervalStrategy.STEPS: 'steps'>, logging_first_step=True, logging_steps=1, logging_nan_inf_filter=True, save_strategy=<SaveStrategy.STEPS: 'steps'>, save_steps=4, save_total_limit=100, save_safetensors=True, save_on_each_node=False, save_only_model=False, restore_callback_states_from_checkpoint=False, no_cuda=False, use_cpu=False, use_mps_device=False, seed=42, data_seed=42, jit_mode_eval=False, use_ipex=False, bf16=True, fp16=False, fp16_opt_level='O1', half_precision_backend='auto', bf16_full_eval=False, fp16_full_eval=False, tf32=None, local_rank=0, ddp_backend=None, tpu_num_cores=None, tpu_metrics_debug=False, debug=[], dataloader_drop_last=False, eval_steps=12, dataloader_num_workers=52, dataloader_prefetch_factor=None, past_index=-1, run_name='/mnt/nvme5n1p1/trained_grpo_fuse_32b/v140-20250324-010830', disable_tqdm=False, remove_unused_columns=False, label_names=None, load_best_model_at_end=False, metric_for_best_model='reward', greater_is_better=True, ignore_data_skip=False, fsdp=[], fsdp_min_num_params=0, fsdp_config={'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}, fsdp_transformer_layer_cls_to_wrap=None, accelerator_config=AcceleratorConfig(split_batches=False, dispatch_batches=False, even_batches=True, use_seedable_sampler=True, non_blocking=False, gradient_accumulation_kwargs=None, use_configured_state=False), deepspeed={'fp16': {'enabled': 'auto', 'loss_scale': 0, 'loss_scale_window': 1000, 'initial_scale_power': 16, 'hysteresis': 2, 'min_loss_scale': 1}, 'bf16': {'enabled': 'auto'}, 'zero_optimization': {'stage': 2, 'offload_optimizer': {'device': 'none', 'pin_memory': True}, 'allgather_partitions': True, 'allgather_bucket_size': 200000000.0, 'overlap_comm': True, 'reduce_scatter': True, 'reduce_bucket_size': 200000000.0, 'contiguous_gradients': True}, 'gradient_accumulation_steps': 'auto', 'gradient_clipping': 'auto', 'steps_per_print': 2000, 'train_batch_size': 'auto', 'train_micro_batch_size_per_gpu': 'auto', 'wall_clock_breakdown': False}, label_smoothing_factor=0.0, optim=<OptimizerNames.ADAMW_TORCH: 'adamw_torch'>, optim_args=None, adafactor=False, group_by_length=False, length_column_name='length', report_to=['wandb'], ddp_find_unused_parameters=None, ddp_bucket_cap_mb=None, ddp_broadcast_buffers=None, dataloader_pin_memory=True, dataloader_persistent_workers=False, skip_memory_metrics=True, use_legacy_prediction_loop=False, push_to_hub=False, resume_from_checkpoint=None, hub_model_id=None, hub_strategy=<HubStrategy.EVERY_SAVE: 'every_save'>, hub_token=None, hub_private_repo=None, hub_always_push=False, gradient_checkpointing=True, gradient_checkpointing_kwargs=None, include_inputs_for_metrics=False, include_for_metrics=[], eval_do_concat_batches=True, fp16_backend='auto', evaluation_strategy='steps', push_to_hub_model_id=None, push_to_hub_organization=None, push_to_hub_token=None, mp_parameters='', auto_find_batch_size=False, full_determinism=False, torchdynamo=None, ray_scope='last', ddp_timeout=1800, torch_compile=False, torch_compile_backend=None, torch_compile_mode=None, dispatch_batches=None, split_batches=None, include_tokens_per_second=None, include_num_input_tokens_seen=None, neftune_noise_alpha=None, optim_target_modules=None, batch_eval_metrics=False, eval_on_start=False, use_liger_kernel=False, eval_use_gather_object=False, average_tokens_across_devices=None, model_init_kwargs=None, max_prompt_length=512, num_generations=4, max_completion_length=12288, ds3_gather_for_generation=True, temperature=1.0, top_p=0.9, top_k=50, min_p=None, repetition_penalty=1.1, cache_implementation=None, use_vllm=False, vllm_server_host='0.0.0.0', vllm_server_port=8000, vllm_server_timeout=120.0, vllm_guided_decoding_regex=None, beta=0.04, num_iterations=2, epsilon=0.2, epsilon_high=None, reward_weights=None, scale_rewards=True, sync_ref_model=False, ref_model_mixup_alpha=0.6, ref_model_sync_steps=512, log_completions=True, vllm_device=['auto'], vllm_gpu_memory_utilization=0.9, vllm_dtype=None, vllm_max_model_len=None, vllm_enable_prefix_caching=True, acc_strategy='token', sequence_parallel_size=1, check_model=True, train_sampler_random=True, is_encoder_decoder=False, metric_warmup_step=0, train_dataset_sample=-1, fsdp_num=1, acc_steps=1, train_type='lora', optimizer=None, local_repo_path=None, galore_config=None, num_infer_workers=8, vllm_max_num_seqs=256, vllm_enforce_eager=False, vllm_limit_mm_per_prompt={}, cosine_min_len_value_wrong=-1.0, cosine_max_len_value_wrong=0.0, cosine_min_len_value_correct=0.5, cosine_max_len_value_correct=0.25, cosine_max_len=12288, repetition_n_grams=40, repetition_max_penalty=-0.05, use_lmdeploy=False, lmdeploy_device='auto', lmdeploy_session_len=None, lmdeploy_cache_max_entry_count=0.8, async_generate=False, tensor_parallel_size=1, sleep_level=0, move_model_batches=None, offload_optimizer=False, offload_model=False, gc_collect_after_offload=False, stop_words=[])"
418
+ }
checkpoint-4/global_step4/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:b6b45f4c6b1e0ee21467694ccbfcd10fbe37c68aa19192950cea09191b2d8135
3
+ size 100670533
checkpoint-4/global_step4/bf16_zero_pp_rank_1_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c257c58242eed6a03bc72659ad6f6533032be541b169228f974dc2995ba443a
3
+ size 100670533
checkpoint-4/global_step4/bf16_zero_pp_rank_2_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc6d423bbf250ef3b0b3bedda2e5af8d11b742116279a7ccf81c98b270e2f614
3
+ size 100670533
checkpoint-4/global_step4/bf16_zero_pp_rank_3_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:afaf6277a5c03a1bd6a13b4b842367bd714a29caae35754aa7c540bbf5de1089
3
+ size 100670533
checkpoint-4/global_step4/bf16_zero_pp_rank_4_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8670510d4c4a4208a5393aa89b086df2984d897d763e3e4e66fd1751754accc6
3
+ size 100670533
checkpoint-4/global_step4/bf16_zero_pp_rank_5_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bbc4c72436e1eb3d3cc7d90a4c7fad2fa679d0f495699d2b2f303b6b56509a9e
3
+ size 100670597
checkpoint-4/global_step4/bf16_zero_pp_rank_6_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:87d18b3adc8c3af98a97dc5143e8364a030a82d192793994c9f41d7e2d489528
3
+ size 100670597
checkpoint-4/global_step4/bf16_zero_pp_rank_7_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0312d5668df878e2d0621c82edff4319d4769c85bbdf6a5fda14ff1b19f5fc13
3
+ size 100670597
checkpoint-4/global_step4/mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8687f00f0c5aa0e79ba38e51d72b437bc448f9f799e6c4a2037c3eb31b510889
3
+ size 537560217
checkpoint-4/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step4
checkpoint-4/rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56dc55f85410ed53f0352a512b08b83cd7f75865208fe58938a5e430f0787a88
3
+ size 16389
checkpoint-4/rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ea4c4dfaf819307d1823ed5d0f52fdeefdb76631670bec702b4cc81f304632a
3
+ size 16389
checkpoint-4/rng_state_2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fa52b53407c6d88e33eb9eb1cb2f6330dc4da436d7086ee9e9d5d6cfe174f623
3
+ size 16389
checkpoint-4/rng_state_3.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cee402b0181636ed21d381309ea94aa47ec24ac2d8083a5edcc0692daf7ff2a9
3
+ size 16389
checkpoint-4/rng_state_4.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c74848adc49807b7085d2dd83f6dd53ecf2c2898b3d79c19fb2b9fa02b06e27c
3
+ size 16389
checkpoint-4/rng_state_5.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:319a2d1e5d33ced016d266d2a1b2a677051cdee9e45142dcd5a6b55b800d6548
3
+ size 16325
checkpoint-4/rng_state_6.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c33e153f1c8df067676c23a3ffbfd106478b49793d0555fca333cbae336c75c2
3
+ size 16389
checkpoint-4/rng_state_7.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0532c0c2d754d8d8a313756870efb59a92d1c9714e007fc9878b5172aad79993
3
+ size 16453
checkpoint-4/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c1092a1007e88123103aaf75d5db82ed526042cbf03e8567a61ab1b920cef821
3
+ size 1401
checkpoint-4/trainer_state.json ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 0.16494845360824742,
5
+ "eval_steps": 12,
6
+ "global_step": 4,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "clip_ratio": 0.0,
13
+ "completion_length": 6468.578125,
14
+ "epoch": 0.041237113402061855,
15
+ "grad_norm": 0.002750918036326766,
16
+ "kl": 0.0,
17
+ "learning_rate": 8.333333333333334e-06,
18
+ "loss": 0.06555777788162231,
19
+ "memory(GiB)": 139.32,
20
+ "response_clip_ratio": 0.09765625,
21
+ "reward": 0.2041757833212614,
22
+ "reward_std": 0.3032030835747719,
23
+ "rewards/CosineReward": 0.20417705923318863,
24
+ "rewards/RepetitionPenalty": -1.2840614544984419e-06,
25
+ "step": 1,
26
+ "train_speed(iter/s)": 0.000204
27
+ },
28
+ {
29
+ "clip_ratio": 0.0,
30
+ "epoch": 0.08247422680412371,
31
+ "grad_norm": 0.002743503311648965,
32
+ "kl": 0.0,
33
+ "learning_rate": 1.6666666666666667e-05,
34
+ "loss": 0.06555777788162231,
35
+ "memory(GiB)": 139.32,
36
+ "step": 2,
37
+ "train_speed(iter/s)": 0.000399
38
+ },
39
+ {
40
+ "clip_ratio": 0.00027981973835267127,
41
+ "completion_length": 6750.58203125,
42
+ "epoch": 0.12371134020618557,
43
+ "grad_norm": 0.0022328044287860394,
44
+ "kl": 0.00011849403381347656,
45
+ "learning_rate": 2.5e-05,
46
+ "loss": 0.07099078595638275,
47
+ "memory(GiB)": 139.32,
48
+ "response_clip_ratio": 0.1640625,
49
+ "reward": 0.15194112714380026,
50
+ "reward_std": 0.29288722947239876,
51
+ "rewards/CosineReward": 0.15194135066121817,
52
+ "rewards/RepetitionPenalty": -2.2651492770364712e-07,
53
+ "step": 3,
54
+ "train_speed(iter/s)": 0.000302
55
+ },
56
+ {
57
+ "clip_ratio": 0.00024275826217490248,
58
+ "epoch": 0.16494845360824742,
59
+ "grad_norm": 0.0024801588151603937,
60
+ "kl": 0.00011742115020751953,
61
+ "learning_rate": 3.3333333333333335e-05,
62
+ "loss": 0.07095687091350555,
63
+ "memory(GiB)": 139.32,
64
+ "step": 4,
65
+ "train_speed(iter/s)": 0.000398
66
+ }
67
+ ],
68
+ "logging_steps": 1,
69
+ "max_steps": 120,
70
+ "num_input_tokens_seen": 0,
71
+ "num_train_epochs": 5,
72
+ "save_steps": 4,
73
+ "stateful_callbacks": {
74
+ "TrainerControl": {
75
+ "args": {
76
+ "should_epoch_stop": false,
77
+ "should_evaluate": false,
78
+ "should_log": false,
79
+ "should_save": true,
80
+ "should_training_stop": false
81
+ },
82
+ "attributes": {}
83
+ }
84
+ },
85
+ "total_flos": 0.0,
86
+ "train_batch_size": 2,
87
+ "trial_name": null,
88
+ "trial_params": null
89
+ }
checkpoint-4/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a67afb13ed6c8d37e8693d7893c54422a716701d4841d6684852f7cf60e605ca
3
+ size 9681
checkpoint-4/zero_to_fp32.py ADDED
@@ -0,0 +1,760 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example:
14
+ # python zero_to_fp32.py . output_dir/
15
+ # or
16
+ # python zero_to_fp32.py . output_dir/ --safe_serialization
17
+
18
+ import argparse
19
+ import torch
20
+ import glob
21
+ import math
22
+ import os
23
+ import re
24
+ import gc
25
+ import json
26
+ import numpy as np
27
+ from tqdm import tqdm
28
+ from collections import OrderedDict
29
+ from dataclasses import dataclass
30
+
31
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
32
+ # DeepSpeed data structures it has to be available in the current python environment.
33
+ from deepspeed.utils import logger
34
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
35
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
36
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
37
+
38
+
39
+ @dataclass
40
+ class zero_model_state:
41
+ buffers: dict()
42
+ param_shapes: dict()
43
+ shared_params: list
44
+ ds_version: int
45
+ frozen_param_shapes: dict()
46
+ frozen_param_fragments: dict()
47
+
48
+
49
+ debug = 0
50
+
51
+ # load to cpu
52
+ device = torch.device('cpu')
53
+
54
+
55
+ def atoi(text):
56
+ return int(text) if text.isdigit() else text
57
+
58
+
59
+ def natural_keys(text):
60
+ '''
61
+ alist.sort(key=natural_keys) sorts in human order
62
+ http://nedbatchelder.com/blog/200712/human_sorting.html
63
+ (See Toothy's implementation in the comments)
64
+ '''
65
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
66
+
67
+
68
+ def get_model_state_file(checkpoint_dir, zero_stage):
69
+ if not os.path.isdir(checkpoint_dir):
70
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
71
+
72
+ # there should be only one file
73
+ if zero_stage <= 2:
74
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
75
+ elif zero_stage == 3:
76
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
77
+
78
+ if not os.path.exists(file):
79
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
80
+
81
+ return file
82
+
83
+
84
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
85
+ # XXX: need to test that this simple glob rule works for multi-node setup too
86
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
87
+
88
+ if len(ckpt_files) == 0:
89
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
90
+
91
+ return ckpt_files
92
+
93
+
94
+ def get_optim_files(checkpoint_dir):
95
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
96
+
97
+
98
+ def get_model_state_files(checkpoint_dir):
99
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
100
+
101
+
102
+ def parse_model_states(files):
103
+ zero_model_states = []
104
+ for file in files:
105
+ state_dict = torch.load(file, map_location=device, weights_only=False)
106
+
107
+ if BUFFER_NAMES not in state_dict:
108
+ raise ValueError(f"{file} is not a model state checkpoint")
109
+ buffer_names = state_dict[BUFFER_NAMES]
110
+ if debug:
111
+ print("Found buffers:", buffer_names)
112
+
113
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
114
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
115
+ param_shapes = state_dict[PARAM_SHAPES]
116
+
117
+ # collect parameters that are included in param_shapes
118
+ param_names = []
119
+ for s in param_shapes:
120
+ for name in s.keys():
121
+ param_names.append(name)
122
+
123
+ # update with frozen parameters
124
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
125
+ if frozen_param_shapes is not None:
126
+ if debug:
127
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
128
+ param_names += list(frozen_param_shapes.keys())
129
+
130
+ # handle shared params
131
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
132
+
133
+ ds_version = state_dict.get(DS_VERSION, None)
134
+
135
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
136
+
137
+ z_model_state = zero_model_state(buffers=buffers,
138
+ param_shapes=param_shapes,
139
+ shared_params=shared_params,
140
+ ds_version=ds_version,
141
+ frozen_param_shapes=frozen_param_shapes,
142
+ frozen_param_fragments=frozen_param_fragments)
143
+ zero_model_states.append(z_model_state)
144
+
145
+ return zero_model_states
146
+
147
+
148
+ def parse_optim_states(files, ds_checkpoint_dir):
149
+ total_files = len(files)
150
+ state_dicts = []
151
+ for f in tqdm(files, desc='Loading checkpoint shards'):
152
+ state_dict = torch.load(f, map_location=device, mmap=True, weights_only=False)
153
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
154
+ # and also handle the case where it was already removed by another helper script
155
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
156
+ state_dicts.append(state_dict)
157
+
158
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
159
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
160
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
161
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
162
+
163
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
164
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
165
+ # use the max of the partition_count to get the dp world_size.
166
+
167
+ if type(world_size) is list:
168
+ world_size = max(world_size)
169
+
170
+ if world_size != total_files:
171
+ raise ValueError(
172
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
173
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
174
+ )
175
+
176
+ # the groups are named differently in each stage
177
+ if zero_stage <= 2:
178
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
179
+ elif zero_stage == 3:
180
+ fp32_groups_key = FP32_FLAT_GROUPS
181
+ else:
182
+ raise ValueError(f"unknown zero stage {zero_stage}")
183
+
184
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
185
+ return zero_stage, world_size, fp32_flat_groups
186
+
187
+
188
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
189
+ """
190
+ Returns fp32 state_dict reconstructed from ds checkpoint
191
+
192
+ Args:
193
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
194
+
195
+ """
196
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
197
+
198
+ optim_files = get_optim_files(ds_checkpoint_dir)
199
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
200
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
201
+
202
+ model_files = get_model_state_files(ds_checkpoint_dir)
203
+
204
+ zero_model_states = parse_model_states(model_files)
205
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
206
+
207
+ if zero_stage <= 2:
208
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
209
+ exclude_frozen_parameters)
210
+ elif zero_stage == 3:
211
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
212
+ exclude_frozen_parameters)
213
+
214
+
215
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
216
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
217
+ return
218
+
219
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
220
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
221
+
222
+ if debug:
223
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
224
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
225
+
226
+ wanted_params = len(frozen_param_shapes)
227
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
228
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
229
+ print(f'Frozen params: Have {avail_numel} numels to process.')
230
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
231
+
232
+ total_params = 0
233
+ total_numel = 0
234
+ for name, shape in frozen_param_shapes.items():
235
+ total_params += 1
236
+ unpartitioned_numel = shape.numel()
237
+ total_numel += unpartitioned_numel
238
+
239
+ state_dict[name] = frozen_param_fragments[name]
240
+
241
+ if debug:
242
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
243
+
244
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
245
+
246
+
247
+ def _has_callable(obj, fn):
248
+ attr = getattr(obj, fn, None)
249
+ return callable(attr)
250
+
251
+
252
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
253
+ param_shapes = zero_model_states[0].param_shapes
254
+
255
+ # Reconstruction protocol:
256
+ #
257
+ # XXX: document this
258
+
259
+ if debug:
260
+ for i in range(world_size):
261
+ for j in range(len(fp32_flat_groups[0])):
262
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
263
+
264
+ # XXX: memory usage doubles here (zero2)
265
+ num_param_groups = len(fp32_flat_groups[0])
266
+ merged_single_partition_of_fp32_groups = []
267
+ for i in range(num_param_groups):
268
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
269
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
270
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
271
+ avail_numel = sum(
272
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
273
+
274
+ if debug:
275
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
276
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
277
+ # not asserting if there is a mismatch due to possible padding
278
+ print(f"Have {avail_numel} numels to process.")
279
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
280
+
281
+ # params
282
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
283
+ # out-of-core computing solution
284
+ total_numel = 0
285
+ total_params = 0
286
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
287
+ offset = 0
288
+ avail_numel = full_single_fp32_vector.numel()
289
+ for name, shape in shapes.items():
290
+
291
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
292
+ total_numel += unpartitioned_numel
293
+ total_params += 1
294
+
295
+ if debug:
296
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
297
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
298
+ offset += unpartitioned_numel
299
+
300
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
301
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
302
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
303
+ # live optimizer object, so we are checking that the numbers are within the right range
304
+ align_to = 2 * world_size
305
+
306
+ def zero2_align(x):
307
+ return align_to * math.ceil(x / align_to)
308
+
309
+ if debug:
310
+ print(f"original offset={offset}, avail_numel={avail_numel}")
311
+
312
+ offset = zero2_align(offset)
313
+ avail_numel = zero2_align(avail_numel)
314
+
315
+ if debug:
316
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
317
+
318
+ # Sanity check
319
+ if offset != avail_numel:
320
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
321
+
322
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
323
+
324
+
325
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
326
+ exclude_frozen_parameters):
327
+ state_dict = OrderedDict()
328
+
329
+ # buffers
330
+ buffers = zero_model_states[0].buffers
331
+ state_dict.update(buffers)
332
+ if debug:
333
+ print(f"added {len(buffers)} buffers")
334
+
335
+ if not exclude_frozen_parameters:
336
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
337
+
338
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
339
+
340
+ # recover shared parameters
341
+ for pair in zero_model_states[0].shared_params:
342
+ if pair[1] in state_dict:
343
+ state_dict[pair[0]] = state_dict[pair[1]]
344
+
345
+ return state_dict
346
+
347
+
348
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
349
+ remainder = unpartitioned_numel % world_size
350
+ padding_numel = (world_size - remainder) if remainder else 0
351
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
352
+ return partitioned_numel, padding_numel
353
+
354
+
355
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
356
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
357
+ return
358
+
359
+ if debug:
360
+ for i in range(world_size):
361
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
362
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
363
+
364
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
365
+ wanted_params = len(frozen_param_shapes)
366
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
367
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
368
+ print(f'Frozen params: Have {avail_numel} numels to process.')
369
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
370
+
371
+ total_params = 0
372
+ total_numel = 0
373
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
374
+ total_params += 1
375
+ unpartitioned_numel = shape.numel()
376
+ total_numel += unpartitioned_numel
377
+
378
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
379
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
380
+
381
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
382
+
383
+ if debug:
384
+ print(
385
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
386
+ )
387
+
388
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
389
+
390
+
391
+ class GatheredTensor:
392
+ """
393
+ A pseudo tensor that collects partitioned weights.
394
+ It is more memory efficient when there are multiple groups.
395
+ """
396
+
397
+ def __init__(self, flat_groups, flat_groups_offset, offset, partitioned_numel, shape):
398
+ self.flat_groups = flat_groups
399
+ self.flat_groups_offset = flat_groups_offset
400
+ self.offset = offset
401
+ self.partitioned_numel = partitioned_numel
402
+ self.shape = shape
403
+ self.dtype = self.flat_groups[0][0].dtype
404
+
405
+ def contiguous(self):
406
+ """
407
+ Merge partitioned weights from flat_groups into a single tensor.
408
+ """
409
+ end_idx = self.offset + self.partitioned_numel
410
+ world_size = len(self.flat_groups)
411
+ pad_flat_param_chunks = []
412
+
413
+ for rank_i in range(world_size):
414
+ # for each rank, we need to collect weights from related group/groups
415
+ flat_groups_at_rank_i = self.flat_groups[rank_i]
416
+ start_group_id = None
417
+ end_group_id = None
418
+ for group_id in range(len(self.flat_groups_offset)):
419
+ if self.flat_groups_offset[group_id] <= self.offset < self.flat_groups_offset[group_id + 1]:
420
+ start_group_id = group_id
421
+ if self.flat_groups_offset[group_id] < end_idx <= self.flat_groups_offset[group_id + 1]:
422
+ end_group_id = group_id
423
+ break
424
+ # collect weights from related group/groups
425
+ for group_id in range(start_group_id, end_group_id + 1):
426
+ flat_tensor = flat_groups_at_rank_i[group_id]
427
+ start_offset = self.offset - self.flat_groups_offset[group_id]
428
+ end_offset = min(end_idx, self.flat_groups_offset[group_id + 1]) - self.flat_groups_offset[group_id]
429
+ pad_flat_param_chunks.append(flat_tensor[start_offset:end_offset])
430
+
431
+ # collect weights from all ranks
432
+ pad_flat_param = torch.cat(pad_flat_param_chunks, dim=0)
433
+ param = pad_flat_param[:self.shape.numel()].view(self.shape).contiguous()
434
+ return param
435
+
436
+
437
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
438
+ param_shapes = zero_model_states[0].param_shapes
439
+ avail_numel = sum([flat_group.numel() for flat_group in fp32_flat_groups[0]]) * world_size
440
+
441
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
442
+ # param, re-consolidating each param, while dealing with padding if any
443
+
444
+ # merge list of dicts, preserving order
445
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
446
+
447
+ if debug:
448
+ for i in range(world_size):
449
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
450
+
451
+ wanted_params = len(param_shapes)
452
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
453
+ # not asserting if there is a mismatch due to possible padding
454
+ avail_numel = fp32_flat_groups[0].numel() * world_size
455
+ print(f"Trainable params: Have {avail_numel} numels to process.")
456
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
457
+
458
+ # params
459
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
460
+ # out-of-core computing solution
461
+ offset = 0
462
+ total_numel = 0
463
+ total_params = 0
464
+ flat_groups_offset = [0] + list(np.cumsum([flat_tensor.numel() for flat_tensor in fp32_flat_groups[0]]))
465
+ for name, shape in tqdm(param_shapes.items(), desc='Gathering sharded weights'):
466
+ unpartitioned_numel = shape.numel()
467
+ total_numel += unpartitioned_numel
468
+ total_params += 1
469
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
470
+
471
+ if debug:
472
+ print(
473
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
474
+ )
475
+
476
+ # memory efficient tensor
477
+ tensor = GatheredTensor(fp32_flat_groups, flat_groups_offset, offset, partitioned_numel, shape)
478
+ state_dict[name] = tensor
479
+ offset += partitioned_numel
480
+
481
+ offset *= world_size
482
+
483
+ # Sanity check
484
+ if offset != avail_numel:
485
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
486
+
487
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
488
+
489
+
490
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
491
+ exclude_frozen_parameters):
492
+ state_dict = OrderedDict()
493
+
494
+ # buffers
495
+ buffers = zero_model_states[0].buffers
496
+ state_dict.update(buffers)
497
+ if debug:
498
+ print(f"added {len(buffers)} buffers")
499
+
500
+ if not exclude_frozen_parameters:
501
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
502
+
503
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
504
+
505
+ # recover shared parameters
506
+ for pair in zero_model_states[0].shared_params:
507
+ if pair[1] in state_dict:
508
+ state_dict[pair[0]] = state_dict[pair[1]]
509
+
510
+ return state_dict
511
+
512
+
513
+ def to_torch_tensor(state_dict, return_empty_tensor=False):
514
+ """
515
+ Convert state_dict of GatheredTensor to torch tensor
516
+ """
517
+ torch_state_dict = {}
518
+ converted_tensors = {}
519
+ for name, tensor in state_dict.items():
520
+ tensor_id = id(tensor)
521
+ if tensor_id in converted_tensors: # shared tensors
522
+ shared_tensor = torch_state_dict[converted_tensors[tensor_id]]
523
+ torch_state_dict[name] = shared_tensor
524
+ else:
525
+ converted_tensors[tensor_id] = name
526
+ if return_empty_tensor:
527
+ torch_state_dict[name] = torch.empty(tensor.shape, dtype=tensor.dtype)
528
+ else:
529
+ torch_state_dict[name] = tensor.contiguous()
530
+ return torch_state_dict
531
+
532
+
533
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
534
+ tag=None,
535
+ exclude_frozen_parameters=False,
536
+ lazy_mode=False):
537
+ """
538
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
539
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
540
+ via a model hub.
541
+
542
+ Args:
543
+ - ``checkpoint_dir``: path to the desired checkpoint folder
544
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in 'latest' file. e.g., ``global_step14``
545
+ - ``exclude_frozen_parameters``: exclude frozen parameters
546
+ - ``lazy_mode``: get state_dict in lazy mode. It returns a dict of pesduo tensor instead of torch tensor, which is more memory efficient.
547
+ Convert the pesduo tensor to torch tensor by ``.contiguous()``
548
+
549
+ Returns:
550
+ - pytorch ``state_dict``
551
+
552
+ A typical usage might be ::
553
+
554
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
555
+ # do the training and checkpoint saving
556
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
557
+ model = model.cpu() # move to cpu
558
+ model.load_state_dict(state_dict)
559
+ # submit to model hub or save the model to share with others
560
+
561
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
562
+ application. i.e. you will need to re-initialize the deepspeed engine, since
563
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
564
+
565
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
566
+
567
+ Note: the above usage may not work if your application doesn't have sufficient free CPU memory.
568
+ You may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
569
+ the checkpoint. Or you can load state_dict in lazy mode ::
570
+
571
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
572
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, lazy_mode=True) # not on cpu
573
+ for name, lazy_tensor in state_dict.item():
574
+ tensor = lazy_tensor.contiguous() # to cpu
575
+ print(name, tensor)
576
+ # del tensor to release memory if it no longer in use
577
+ """
578
+ if tag is None:
579
+ latest_path = os.path.join(checkpoint_dir, 'latest')
580
+ if os.path.isfile(latest_path):
581
+ with open(latest_path, 'r') as fd:
582
+ tag = fd.read().strip()
583
+ else:
584
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
585
+
586
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
587
+
588
+ if not os.path.isdir(ds_checkpoint_dir):
589
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
590
+
591
+ state_dict = _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
592
+ if lazy_mode:
593
+ return state_dict
594
+ else:
595
+ return to_torch_tensor(state_dict)
596
+
597
+
598
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
599
+ output_dir,
600
+ max_shard_size="5GB",
601
+ safe_serialization=False,
602
+ tag=None,
603
+ exclude_frozen_parameters=False):
604
+ """
605
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
606
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
607
+
608
+ Args:
609
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
610
+ - ``output_dir``: directory to the pytorch fp32 state_dict output files
611
+ - ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
612
+ - ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
613
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
614
+ - ``exclude_frozen_parameters``: exclude frozen parameters
615
+ """
616
+
617
+ # Dependency pre-check
618
+ if safe_serialization:
619
+ try:
620
+ from safetensors.torch import save_file
621
+ except ImportError:
622
+ print('If you want to use `safe_serialization`, please `pip install safetensors`')
623
+ raise
624
+ if max_shard_size is not None:
625
+ try:
626
+ from huggingface_hub import split_torch_state_dict_into_shards
627
+ except ImportError:
628
+ print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
629
+ raise
630
+
631
+ # Convert zero checkpoint to state_dict
632
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
633
+ tag,
634
+ exclude_frozen_parameters,
635
+ lazy_mode=True)
636
+
637
+ # Shard the model if it is too big.
638
+ weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
639
+ if max_shard_size is not None:
640
+ filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
641
+ # an memory-efficient approach for sharding
642
+ empty_state_dict = to_torch_tensor(state_dict, return_empty_tensor=True)
643
+ state_dict_split = split_torch_state_dict_into_shards(empty_state_dict,
644
+ filename_pattern=filename_pattern,
645
+ max_shard_size=max_shard_size)
646
+ else:
647
+ from collections import namedtuple
648
+ StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
649
+ state_dict_split = StateDictSplit(is_sharded=False,
650
+ filename_to_tensors={weights_name: list(state_dict.keys())})
651
+
652
+ # Save the model by shard
653
+ os.makedirs(output_dir, exist_ok=True)
654
+ filename_to_tensors = state_dict_split.filename_to_tensors.items()
655
+ for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
656
+ shard_state_dict = {tensor_name: state_dict[tensor_name] for tensor_name in tensors}
657
+ shard_state_dict = to_torch_tensor(shard_state_dict)
658
+ output_path = os.path.join(output_dir, shard_file)
659
+ if safe_serialization:
660
+ save_file(shard_state_dict, output_path, metadata={"format": "pt"})
661
+ else:
662
+ torch.save(shard_state_dict, output_path)
663
+ # release the memory of current shard
664
+ for tensor_name in list(shard_state_dict.keys()):
665
+ del state_dict[tensor_name]
666
+ del shard_state_dict[tensor_name]
667
+ del shard_state_dict
668
+ gc.collect()
669
+
670
+ # Save index if sharded
671
+ if state_dict_split.is_sharded:
672
+ index = {
673
+ "metadata": state_dict_split.metadata,
674
+ "weight_map": state_dict_split.tensor_to_filename,
675
+ }
676
+ save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
677
+ save_index_file = os.path.join(output_dir, save_index_file)
678
+ with open(save_index_file, "w", encoding="utf-8") as f:
679
+ content = json.dumps(index, indent=2, sort_keys=True) + "\n"
680
+ f.write(content)
681
+
682
+
683
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
684
+ """
685
+ 1. Put the provided model to cpu
686
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
687
+ 3. Load it into the provided model
688
+
689
+ Args:
690
+ - ``model``: the model object to update
691
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
692
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
693
+
694
+ Returns:
695
+ - ``model`: modified model
696
+
697
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
698
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
699
+ conveniently placed for you in the checkpoint folder.
700
+
701
+ A typical usage might be ::
702
+
703
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
704
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
705
+ # submit to model hub or save the model to share with others
706
+
707
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
708
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
709
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
710
+
711
+ """
712
+ logger.info(f"Extracting fp32 weights")
713
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
714
+
715
+ logger.info(f"Overwriting model with fp32 weights")
716
+ model = model.cpu()
717
+ model.load_state_dict(state_dict, strict=False)
718
+
719
+ return model
720
+
721
+
722
+ if __name__ == "__main__":
723
+ parser = argparse.ArgumentParser()
724
+ parser.add_argument("checkpoint_dir",
725
+ type=str,
726
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
727
+ parser.add_argument("output_dir",
728
+ type=str,
729
+ help="directory to the pytorch fp32 state_dict output files"
730
+ "(e.g. path/checkpoint-12-output/)")
731
+ parser.add_argument(
732
+ "--max_shard_size",
733
+ type=str,
734
+ default="5GB",
735
+ help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
736
+ "lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
737
+ "We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
738
+ "without CPU OOM issues.")
739
+ parser.add_argument(
740
+ "--safe_serialization",
741
+ default=False,
742
+ action='store_true',
743
+ help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
744
+ parser.add_argument("-t",
745
+ "--tag",
746
+ type=str,
747
+ default=None,
748
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
749
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
750
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
751
+ args = parser.parse_args()
752
+
753
+ debug = args.debug
754
+
755
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
756
+ args.output_dir,
757
+ max_shard_size=args.max_shard_size,
758
+ safe_serialization=args.safe_serialization,
759
+ tag=args.tag,
760
+ exclude_frozen_parameters=args.exclude_frozen_parameters)
completions.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:32bb42c4b50fac3633991e3e921d8ab17f5e463bf9701c40caad34ca7d206dcc
3
+ size 17082490
logging.jsonl ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {"loss": 0.06555778, "grad_norm": 0.00275092, "learning_rate": 8.33e-06, "memory(GiB)": 139.32, "train_speed(iter/s)": 0.000204, "completion_length": 6468.578125, "response_clip_ratio": 0.09765625, "rewards/CosineReward": 0.20417706, "rewards/RepetitionPenalty": -1.28e-06, "reward": 0.20417578, "reward_std": 0.30320308, "kl": 0.0, "clip_ratio": 0.0, "epoch": 0.04123711, "global_step/max_steps": "1/120", "percentage": "0.83%", "elapsed_time": "1h 21m 19s", "remaining_time": "6d 17h 18m 30s"}
2
+ {"loss": 0.06555778, "grad_norm": 0.0027435, "learning_rate": 1.667e-05, "memory(GiB)": 139.32, "train_speed(iter/s)": 0.000399, "kl": 0.0, "clip_ratio": 0.0, "epoch": 0.08247423, "global_step/max_steps": "2/120", "percentage": "1.67%", "elapsed_time": "1h 23m 15s", "remaining_time": "3d 9h 52m 5s"}
3
+ {"loss": 0.07099079, "grad_norm": 0.0022328, "learning_rate": 2.5e-05, "memory(GiB)": 139.32, "train_speed(iter/s)": 0.000302, "completion_length": 6750.58203125, "response_clip_ratio": 0.1640625, "rewards/CosineReward": 0.15194135, "rewards/RepetitionPenalty": -2.3e-07, "reward": 0.15194113, "reward_std": 0.29288723, "kl": 0.00011849, "clip_ratio": 0.00027982, "epoch": 0.12371134, "global_step/max_steps": "3/120", "percentage": "2.50%", "elapsed_time": "2h 45m 11s", "remaining_time": "4d 11h 22m 28s"}
4
+ {"loss": 0.07095687, "grad_norm": 0.00248016, "learning_rate": 3.333e-05, "memory(GiB)": 139.32, "train_speed(iter/s)": 0.000398, "kl": 0.00011742, "clip_ratio": 0.00024276, "epoch": 0.16494845, "global_step/max_steps": "4/120", "percentage": "3.33%", "elapsed_time": "2h 47m 17s", "remaining_time": "3d 8h 51m 27s"}
5
+ {"loss": 0.07323229, "grad_norm": 0.00259954, "learning_rate": 4.167e-05, "memory(GiB)": 153.39, "train_speed(iter/s)": 0.000334, "completion_length": 6011.89453125, "response_clip_ratio": 0.09375, "rewards/CosineReward": 0.24159797, "rewards/RepetitionPenalty": 0.0, "reward": 0.24159796, "reward_std": 0.25838505, "kl": 0.00011706, "clip_ratio": 0.00025165, "epoch": 0.20618557, "global_step/max_steps": "5/120", "percentage": "4.17%", "elapsed_time": "4h 9m 14s", "remaining_time": "3d 23h 32m 34s"}
6
+ {"loss": 0.07321305, "grad_norm": 0.00268549, "learning_rate": 5e-05, "memory(GiB)": 153.39, "train_speed(iter/s)": 0.000398, "kl": 0.00011313, "clip_ratio": 0.00022921, "epoch": 0.24742268, "global_step/max_steps": "6/120", "percentage": "5.00%", "elapsed_time": "4h 11m 13s", "remaining_time": "3d 7h 33m 16s"}
val_dataset.jsonl ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"messages": [{"role": "user", "content": "Every positive integer $k$ has a unique factorial base expansion $(f_1,f_2,f_3,\\ldots,f_m)$ , meaning that $k=1!\\cdot f_1+2!\\cdot f_2+3!\\cdot f_3+\\cdots+m!\\cdot f_m$ , where each $f_i$ is an integer, $0\\le f_i\\le i$ , and $0<f_m$ . Given that $(f_1,f_2,f_3,\\ldots,f_j)$ is the factorial base expansion of $16!-32!+48!-64!+\\cdots+1968!-1984!+2000!$ , find the value of $f_1-f_2+f_3-f_4+\\cdots+(-1)^{j+1}f_j$ ."}, {"role": "assistant", "content": "495"}], "solution": "495"}
2
+ {"messages": [{"role": "user", "content": "Ten chairs are arranged in a circle. Find the number of subsets of this set of chairs that contain at least three adjacent chairs. "}, {"role": "assistant", "content": "581"}], "solution": "581"}
3
+ {"messages": [{"role": "user", "content": "Let $EFGH$ , $EFDC$ , and $EHBC$ be three adjacent square faces of a cube, for which $EC = 8$ , and let $A$ be the eighth vertex of the cube. Let $I$ , $J$ , and $K$ , be the points on $\\overline{EF}$ , $\\overline{EH}$ , and $\\overline{EC}$ , respectively, so that $EI = EJ = EK = 2$ . A solid $S$ is obtained by drilling a tunnel through the cube. The sides of the tunnel are planes parallel to $\\overline{AE}$ , and containing the edges, $\\overline{IJ}$ , $\\overline{JK}$ , and $\\overline{KI}$ . The surface area of $S$ , including the walls of the tunnel, is $m + n\\sqrt {p}$ , where $m$ , $n$ , and $p$ are positive integers and $p$ is not divisible by the square of any prime. Find $m + n + p$ ."}, {"role": "assistant", "content": "417"}], "solution": "417"}
4
+ {"messages": [{"role": "user", "content": "Rectangle $ABCD$ is divided into four parts of equal area by five segments as shown in the figure, where $XY = YB + BC + CZ = ZW = WD + DA + AX$ , and $PQ$ is parallel to $AB$ . Find the length of $AB$ (in cm) if $BC = 19$ cm and $PQ = 87$ cm. AIME 1987 Problem 6.png"}, {"role": "assistant", "content": "193"}], "solution": "193"}
5
+ {"messages": [{"role": "user", "content": "David found four sticks of different lengths that can be used to form three non-congruent convex cyclic quadrilaterals, $A,\\text{ }B,\\text{ }C$ , which can each be inscribed in a circle with radius $1$ . Let $\\varphi_A$ denote the measure of the acute angle made by the diagonals of quadrilateral $A$ , and define $\\varphi_B$ and $\\varphi_C$ similarly. Suppose that $\\sin\\varphi_A=\\frac{2}{3}$ , $\\sin\\varphi_B=\\frac{3}{5}$ , and $\\sin\\varphi_C=\\frac{6}{7}$ . All three quadrilaterals have the same area $K$ , which can be written in the form $\\dfrac{m}{n}$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$ ."}, {"role": "assistant", "content": "59"}], "solution": "59"}
6
+ {"messages": [{"role": "user", "content": "Define a domino to be an ordered pair of distinct positive integers. A proper sequence of dominos is a list of distinct dominos in which the first coordinate of each pair after the first equals the second coordinate of the immediately preceding pair, and in which $(i,j)$ and $(j,i)$ do not both appear for any $i$ and $j$ . Let $D_{40}$ be the set of all dominos whose coordinates are no larger than 40. Find the length of the longest proper sequence of dominos that can be formed using the dominos of $D_{40}.$"}, {"role": "assistant", "content": "761"}], "solution": "761"}
7
+ {"messages": [{"role": "user", "content": "Two thousand points are given on a circle. Label one of the points 1. From this point, count 2 points in the clockwise direction and label this point 2. From the point labeled 2, count 3 points in the clockwise direction and label this point 3. (See figure.) Continue this process until the labels $1,2,3\\dots,1993\\,$ are all used. Some of the points on the circle will have more than one label and some points will not have a label. What is the smallest integer that labels the same point as 1993? AIME 1993 Problem 9.png"}, {"role": "assistant", "content": "118"}], "solution": "118"}
8
+ {"messages": [{"role": "user", "content": "Let $S$ be the set of all polynomials of the form $z^3 + az^2 + bz + c$ , where $a$ , $b$ , and $c$ are integers. Find the number of polynomials in $S$ such that each of its roots $z$ satisfies either $|z| = 20$ or $|z| = 13$ ."}, {"role": "assistant", "content": "540"}], "solution": "540"}
9
+ {"messages": [{"role": "user", "content": "The numbers 1, 2, 3, 4, 5, 6, 7, and 8 are randomly written on the faces of a regular octahedron so that each face contains a different number. The probability that no two consecutive numbers, where 8 and 1 are considered to be consecutive, are written on faces that share an edge is $m/n,$ where $m$ and $n$ are relatively prime positive integers. Find $m + n.$"}, {"role": "assistant", "content": "85"}], "solution": "85"}
10
+ {"messages": [{"role": "user", "content": "Let $S_i$ be the set of all integers $n$ such that $100i\\leq n < 100(i + 1)$ . For example, $S_4$ is the set ${400,401,402,\\ldots,499}$ . How many of the sets $S_0, S_1, S_2, \\ldots, S_{999}$ do not contain a perfect square?"}, {"role": "assistant", "content": "708"}], "solution": "708"}
11
+ {"messages": [{"role": "user", "content": "A piecewise linear periodic function is defined by $f(x)=\\begin{cases}x&\\text{if }x\\in[-1,1)\\\\2-x&\\text{if }x\\in[1,3)\\end{cases}$ and $f(x+4)=f(x)$ for all real numbers $x$. The graph of $f(x)$ has the sawtooth pattern. The parabola $x=34y^2$ intersects the graph of $f(x)$ at finitely many points. The sum of the $y$-coordinates of these intersection points can be expressed in the form $\\frac{a+b\\sqrt{c}}{d}$, where $a,b,c,$ and $d$ are positive integers, $a,b,$ and $d$ have greatest common divisor equal to 1, and $c$ is not divisible by the square of any prime. Find $a+b+c+d$."}, {"role": "assistant", "content": "259"}], "solution": "259"}
12
+ {"messages": [{"role": "user", "content": "A long thin strip of paper is 1024 units in length, 1 unit in width, and is divided into 1024 unit squares. The paper is folded in half repeatedly. For the first fold, the right end of the paper is folded over to coincide with and lie on top of the left end. The result is a 512 by 1 strip of double thickness. Next, the right end of this strip is folded over to coincide with and lie on top of the left end, resulting in a 256 by 1 strip of quadruple thickness. This process is repeated 8 more times. After the last fold, the strip has become a stack of 1024 unit squares. How many of these squares lie below the square that was originally the 942nd square counting from the left?"}, {"role": "assistant", "content": "593"}], "solution": "593"}
13
+ {"messages": [{"role": "user", "content": "Let $ABCDE$ be a convex pentagon with $AB || CE, BC || AD, AC || DE, \\angle ABC=120^\\circ, AB=3, BC=5,$ and $DE = 15.$ Given that the ratio between the area of triangle $ABC$ and the area of triangle $EBD$ is $m/n,$ where $m$ and $n$ are relatively prime positive integers, find $m+n.$"}, {"role": "assistant", "content": "484"}], "solution": "484"}
14
+ {"messages": [{"role": "user", "content": "Let $\\overline{AB}$ be a chord of a circle $\\omega$ , and let $P$ be a point on the chord $\\overline{AB}$ . Circle $\\omega_1$ passes through $A$ and $P$ and is internally tangent to $\\omega$ . Circle $\\omega_2$ passes through $B$ and $P$ and is internally tangent to $\\omega$ . Circles $\\omega_1$ and $\\omega_2$ intersect at points $P$ and $Q$ . Line $PQ$ intersects $\\omega$ at $X$ and $Y$ . Assume that $AP=5$ , $PB=3$ , $XY=11$ , and $PQ^2 = \\tfrac{m}{n}$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$ ."}, {"role": "assistant", "content": "65"}], "solution": "65"}
15
+ {"messages": [{"role": "user", "content": "Patio blocks that are hexagons $1$ unit on a side are used to outline a garden by placing the blocks edge to edge with $n$ on each side. The diagram indicates the path of blocks around the garden when $n=5$ . AIME 2002 II Problem 4.gif If $n=202$ , then the area of the garden enclosed by the path, not including the path itself, is $m\\left(\\sqrt3/2\\right)$ square units, where $m$ is a positive integer. Find the remainder when $m$ is divided by $1000$ ."}, {"role": "assistant", "content": "803"}], "solution": "803"}
16
+ {"messages": [{"role": "user", "content": "Find the number of pairs $(m,n)$ of positive integers with $1\\le m<n\\le 30$ such that there exists a real number $x$ satisfying \\[\\sin(mx)+\\sin(nx)=2.\\]"}, {"role": "assistant", "content": "63"}], "solution": "63"}
17
+ {"messages": [{"role": "user", "content": "Four ambassadors and one advisor for each of them are to be seated at a round table with $12$ chairs numbered in order $1$ to $12$ . Each ambassador must sit in an even-numbered chair. Each advisor must sit in a chair adjacent to his or her ambassador. There are $N$ ways for the $8$ people to be seated at the table under these conditions. Find the remainder when $N$ is divided by $1000$ ."}, {"role": "assistant", "content": "520"}], "solution": "520"}
18
+ {"messages": [{"role": "user", "content": "Let $A = \\{1, 2, 3, 4, 5, 6, 7\\}$ , and let $N$ be the number of functions $f$ from set $A$ to set $A$ such that $f(f(x))$ is a constant function. Find the remainder when $N$ is divided by $1000$ ."}, {"role": "assistant", "content": "399"}], "solution": "399"}
19
+ {"messages": [{"role": "user", "content": "Let $\\overline{MN}$ be a diameter of a circle with diameter $1$ . Let $A$ and $B$ be points on one of the semicircular arcs determined by $\\overline{MN}$ such that $A$ is the midpoint of the semicircle and $MB=\\dfrac 35$ . Point $C$ lies on the other semicircular arc. Let $d$ be the length of the line segment whose endpoints are the intersections of diameter $\\overline{MN}$ with the chords $\\overline{AC}$ and $\\overline{BC}$ . The largest possible value of $d$ can be written in the form $r-s\\sqrt t$ , where $r$ , $s$ , and $t$ are positive integers and $t$ is not divisible by the square of any prime. Find $r+s+t$ ."}, {"role": "assistant", "content": "14"}], "solution": "14"}
20
+ {"messages": [{"role": "user", "content": "Let $S$ be the set of all rational numbers that can be expressed as a repeating decimal in the form $0.\\overline{abcd},$ where at least one of the digits $a,$ $b,$ $c,$ or $d$ is nonzero. Let $N$ be the number of distinct numerators obtained when numbers in $S$ are written as fractions in lowest terms. For example, both $4$ and $410$ are counted among the distinct numerators for numbers in $S$ because $0.\\overline{3636} = \\frac{4}{11}$ and $0.\\overline{1230} = \\frac{410}{3333}.$ Find the remainder when $N$ is divided by $1000.$"}, {"role": "assistant", "content": "392"}], "solution": "392"}
21
+ {"messages": [{"role": "user", "content": "For every $m \\geq 2$ , let $Q(m)$ be the least positive integer with the following property: For every $n \\geq Q(m)$ , there is always a perfect cube $k^3$ in the range $n < k^3 \\leq mn$ . Find the remainder when \\[\\sum_{m = 2}^{2017} Q(m)\\] is divided by $1000$ ."}, {"role": "assistant", "content": "59"}], "solution": "59"}
22
+ {"messages": [{"role": "user", "content": "For $n\\ge1$ call a finite sequence $(a_1,a_2,\\ldots,a_n)$ of positive integers progressive if $a_i<a_{i+1}$ and $a_i$ divides $a_{i+1}$ for $1\\le i\\le n-1$ . Find the number of progressive sequences such that the sum of the terms in the sequence is equal to $360.$"}, {"role": "assistant", "content": "47"}], "solution": "47"}
23
+ {"messages": [{"role": "user", "content": "Find the sum of the values of $x$ such that $\\cos^3 3x+ \\cos^3 5x = 8 \\cos^3 4x \\cos^3 x,$ where $x$ is measured in degrees and $100< x< 200.$"}, {"role": "assistant", "content": "906"}], "solution": "906"}
24
+ {"messages": [{"role": "user", "content": "Let $ABCDE$ be a convex pentagon with $AB=14, BC=7, CD=24, DE=13, EA=26,$ and $\\angle B=\\angle E=60^\\circ$. For each point $X$ in the plane, define $f(X)=AX+BX+CX+DX+EX$. The least possible value of $f(X)$ can be expressed as $m+n\\sqrt{p}$, where $m$ and $n$ are positive integers and $p$ is not divisible by the square of any prime. Find $m+n+p$."}, {"role": "assistant", "content": "60"}], "solution": "60"}
25
+ {"messages": [{"role": "user", "content": "Given $\\triangle ABC$ and a point $P$ on one of its sides, call line $\\ell$ the $\\textit{splitting line}$ of $\\triangle ABC$ through $P$ if $\\ell$ passes through $P$ and divides $\\triangle ABC$ into two polygons of equal perimeter. Let $\\triangle ABC$ be a triangle where $BC = 219$ and $AB$ and $AC$ are positive integers. Let $M$ and $N$ be the midpoints of $\\overline{AB}$ and $\\overline{AC},$ respectively, and suppose that the splitting lines of $\\triangle ABC$ through $M$ and $N$ intersect at $30^\\circ.$ Find the perimeter of $\\triangle ABC.$"}, {"role": "assistant", "content": "459"}], "solution": "459"}
26
+ {"messages": [{"role": "user", "content": "Equilateral triangle $\\triangle ABC$ is inscribed in circle $\\omega$ with radius $18.$ Circle $\\omega_A$ is tangent to sides $\\overline{AB}$ and $\\overline{AC}$ and is internally tangent to $\\omega.$ Circles $\\omega_B$ and $\\omega_C$ are defined analogously. Circles $\\omega_A,$ $\\omega_B,$ and $\\omega_C$ meet in six points---two points for each pair of circles. The three intersection points closest to the vertices of $\\triangle ABC$ are the vertices of a large equilateral triangle in the interior of $\\triangle ABC,$ and the other three intersection points are the vertices of a smaller equilateral triangle in the interior of $\\triangle ABC.$ The side length of the smaller equilateral triangle can be written as $\\sqrt{a} - \\sqrt{b},$ where $a$ and $b$ are positive integers. Find $a+b.$"}, {"role": "assistant", "content": "378"}], "solution": "378"}
27
+ {"messages": [{"role": "user", "content": "Circles $\\omega_1$ and $\\omega_2$ intersect at two points $P$ and $Q,$ and their common tangent line closer to $P$ intersects $\\omega_1$ and $\\omega_2$ at points $A$ and $B,$ respectively. The line parallel to $AB$ that passes through $P$ intersects $\\omega_1$ and $\\omega_2$ for the second time at points $X$ and $Y,$ respectively. Suppose $PX=10,$ $PY=14,$ and $PQ=5.$ Then the area of trapezoid $XABY$ is $m\\sqrt{n},$ where $m$ and $n$ are positive integers and $n$ is not divisible by the square of any prime. Find $m+n.$"}, {"role": "assistant", "content": "33"}], "solution": "33"}
28
+ {"messages": [{"role": "user", "content": "Let $\\triangle ABC$ be an equilateral triangle with side length $55.$ Points $D,$ $E,$ and $F$ lie on $\\overline{BC},$ $\\overline{CA},$ and $\\overline{AB},$ respectively, with $BD = 7,$ $CE=30,$ and $AF=40.$ Point $P$ inside $\\triangle ABC$ has the property that \\[\\angle AEP = \\angle BFP = \\angle CDP.\\] Find $\\tan^2(\\angle AEP).$"}, {"role": "assistant", "content": "75"}], "solution": "75"}
29
+ {"messages": [{"role": "user", "content": "Find the number of second-degree polynomials $f(x)$ with integer coefficients and integer zeros for which $f(0)=2010$ ."}, {"role": "assistant", "content": "163"}], "solution": "163"}
30
+ {"messages": [{"role": "user", "content": "A rectangle that is inscribed in a larger rectangle (with one vertex on each side) is called unstuck if it is possible to rotate (however slightly) the smaller rectangle about its center within the confines of the larger. Of all the rectangles that can be inscribed unstuck in a 6 by 8 rectangle, the smallest perimeter has the form $\\sqrt{N}\\,$ , for a positive integer $N\\,$ . Find $N\\,$ ."}, {"role": "assistant", "content": "448"}], "solution": "448"}
31
+ {"messages": [{"role": "user", "content": "Given a function $f$ for which \\[f(x) = f(398 - x) = f(2158 - x) = f(3214 - x)\\] holds for all real $x,$ what is the largest number of different values that can appear in the list $f(0),f(1),f(2),\\ldots,f(999)$ ?"}, {"role": "assistant", "content": "177"}], "solution": "177"}
32
+ {"messages": [{"role": "user", "content": "Torus $T$ is the surface produced by revolving a circle with radius 3 around an axis in the plane of the circle that is a distance 6 from the center of the circle (so like a donut). Let $S$ be a sphere with a radius 11. When $T$ rests on the inside of $S$ , it is internally tangent to $S$ along a circle with radius $r_i$ , and when $T$ rests on the outside of $S$ , it is externally tangent to $S$ along a circle with radius $r_o$ . The difference $r_i-r_o$ can be written as $\\frac{m}{n}$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$ . [asy] unitsize(0.3 inch); draw(ellipse((0,0), 3, 1.75)); draw((-1.2,0.1)..(-0.8,-0.03)..(-0.4,-0.11)..(0,-0.15)..(0.4,-0.11)..(0.8,-0.03)..(1.2,0.1)); draw((-1,0.04)..(-0.5,0.12)..(0,0.16)..(0.5,0.12)..(1,0.04)); draw((0,2.4)--(0,-0.15)); draw((0,-0.15)--(0,-1.75), dashed); draw((0,-1.75)--(0,-2.25)); draw(ellipse((2,0), 1, 0.9)); draw((2.03,-0.02)--(2.9,-0.4)); [/asy]"}, {"role": "assistant", "content": "127"}], "solution": "127"}
33
+ {"messages": [{"role": "user", "content": "An ant makes a sequence of moves on a cube where a move consists of walking from one vertex to an adjacent vertex along an edge of the cube. Initially the ant is at a vertex of the bottom face of the cube and chooses one of the three adjacent vertices to move to as its first move. For all moves after the first move, the ant does not return to its previous vertex, but chooses to move to one of the other two adjacent vertices. All choices are selected at random so that each of the possible moves is equally likely. The probability that after exactly $8$ moves that ant is at a vertex of the top face on the cube is $\\frac{m}{n}$ , where $m$ and $n$ are relatively prime positive integers. Find $m + n.$"}, {"role": "assistant", "content": "49"}], "solution": "49"}
34
+ {"messages": [{"role": "user", "content": "Find the number of ordered pairs $(m, n)$ such that $m$ and $n$ are positive integers in the set $\\{1, 2, ..., 30\\}$ and the greatest common divisor of $2^m + 1$ and $2^n - 1$ is not $1$ ."}, {"role": "assistant", "content": "295"}], "solution": "295"}
35
+ {"messages": [{"role": "user", "content": "Given $f(z) = z^2-19z$ , there are complex numbers $z$ with the property that $z$ , $f(z)$ , and $f(f(z))$ are the vertices of a right triangle in the complex plane with a right angle at $f(z)$ . There are positive integers $m$ and $n$ such that one such value of $z$ is $m+\\sqrt{n}+11i$ . Find $m+n$ ."}, {"role": "assistant", "content": "230"}], "solution": "230"}
36
+ {"messages": [{"role": "user", "content": "Triangle $AB_0C_0$ has side lengths $AB_0 = 12$ , $B_0C_0 = 17$ , and $C_0A = 25$ . For each positive integer $n$ , points $B_n$ and $C_n$ are located on $\\overline{AB_{n-1}}$ and $\\overline{AC_{n-1}}$ , respectively, creating three similar triangles $\\triangle AB_nC_n \\sim \\triangle B_{n-1}C_nC_{n-1} \\sim \\triangle AB_{n-1}C_{n-1}$ . The area of the union of all triangles $B_{n-1}C_nB_n$ for $n\\geq1$ can be expressed as $\\tfrac pq$ , where $p$ and $q$ are relatively prime positive integers. Find $q$ ."}, {"role": "assistant", "content": "961"}], "solution": "961"}
37
+ {"messages": [{"role": "user", "content": "A teacher was leading a class of four perfectly logical students. The teacher chose a set $S$ of four integers and gave a different number in $S$ to each student. Then the teacher announced to the class that the numbers in $S$ were four consecutive two-digit positive integers, that some number in $S$ was divisible by $6$ , and a different number in $S$ was divisible by $7$ . The teacher then asked if any of the students could deduce what $S$ is, but in unison, all of the students replied no. However, upon hearing that all four students replied no, each student was able to determine the elements of $S$ . Find the sum of all possible values of the greatest element of $S$ ."}, {"role": "assistant", "content": "258"}], "solution": "258"}
38
+ {"messages": [{"role": "user", "content": "The 27 cells of a $3\\times9$ grid are filled in using the numbers 1 through 9 so that each row contains 9 different numbers, and each of the three $3\\times3$ blocks heavily outlined in the example below contains 9 different numbers, as in the first three rows of a Sudoku puzzle. \r\n | 4 | 2 | 8 | 9 | 6 | 3 | 1 | 7 | 5 | \r\n | 3 | 7 | 9 | 5 | 2 | 1 | 6 | 8 | 4 | \r\n | 5 | 6 | 1 | 8 | 4 | 7 | 9 | 2 | 3 | \r\n The number of different ways to fill such a grid can be written as $p^a\\cdot q^b\\cdot r^c\\cdot s^d$, where $p,q,r,$ and $s$ are distinct prime numbers and $a,b,c,$ and $d$ are positive integers. Find $p\\cdot a+q\\cdot b+r\\cdot c+s\\cdot d$."}, {"role": "assistant", "content": "81"}], "solution": "81"}
39
+ {"messages": [{"role": "user", "content": "A frog is placed at the origin on the number line , and moves according to the following rule: in a given move, the frog advances to either the closest point with a greater integer coordinate that is a multiple of $3$ , or to the closest point with a greater integer coordinate that is a multiple of $13$ . A move sequence is a sequence of coordinates which correspond to valid moves, beginning with $0$ , and ending with $39$ . For example, $0,\\ 3,\\ 6,\\ 13,\\ 15,\\ 26,\\ 39$ is a move sequence. How many move sequences are possible for the frog?"}, {"role": "assistant", "content": "169"}], "solution": "169"}
40
+ {"messages": [{"role": "user", "content": "Equilateral $\\triangle ABC$ has side length $600$ . Points $P$ and $Q$ lie outside the plane of $\\triangle ABC$ and are on opposite sides of the plane. Furthermore, $PA=PB=PC$ , and $QA=QB=QC$ , and the planes of $\\triangle PAB$ and $\\triangle QAB$ form a $120^{\\circ}$ dihedral angle (the angle between the two planes). There is a point $O$ whose distance from each of $A,B,C,P,$ and $Q$ is $d$ . Find $d$ ."}, {"role": "assistant", "content": "450"}], "solution": "450"}
41
+ {"messages": [{"role": "user", "content": "Find the sum of all positive integers $n$ such that, given an unlimited supply of stamps of denominations $5,n,$ and $n+1$ cents, $91$ cents is the greatest postage that cannot be formed."}, {"role": "assistant", "content": "71"}], "solution": "71"}
42
+ {"messages": [{"role": "user", "content": "Let $S$ be the set of positive integers $k$ such that the two parabolas \\[y=x^2-k~~\\text{and}~~x=2(y-20)^2-k\\] intersect in four distinct points, and these four points lie on a circle with radius at most $21$ . Find the sum of the least element of $S$ and the greatest element of $S$ ."}, {"role": "assistant", "content": "285"}], "solution": "285"}
43
+ {"messages": [{"role": "user", "content": "The rectangle $ABCD^{}_{}$ below has dimensions $AB^{}_{} = 12 \\sqrt{3}$ and $BC^{}_{} = 13 \\sqrt{3}$ . Diagonals $\\overline{AC}$ and $\\overline{BD}$ intersect at $P^{}_{}$ . If triangle $ABP^{}_{}$ is cut out and removed, edges $\\overline{AP}$ and $\\overline{BP}$ are joined, and the figure is then creased along segments $\\overline{CP}$ and $\\overline{DP}$ , we obtain a triangular pyramid, all four of whose faces are isosceles triangles. Find the volume of this pyramid. AIME 1990 Problem 14.png"}, {"role": "assistant", "content": "594"}], "solution": "594"}
44
+ {"messages": [{"role": "user", "content": "Let $ABC$ be a triangle with sides 3, 4, and 5, and $DEFG$ be a 6-by-7 rectangle. A segment is drawn to divide triangle $ABC$ into a triangle $U_1$ and a trapezoid $V_1$ and another segment is drawn to divide rectangle $DEFG$ into a triangle $U_2$ and a trapezoid $V_2$ such that $U_1$ is similar to $U_2$ and $V_1$ is similar to $V_2.$ The minimum value of the area of $U_1$ can be written in the form $m/n,$ where $m$ and $n$ are relatively prime positive integers. Find $m+n.$"}, {"role": "assistant", "content": "35"}], "solution": "35"}
45
+ {"messages": [{"role": "user", "content": "Find the number of cubic polynomials $p(x) = x^3 + ax^2 + bx + c,$ where $a, b,$ and $c$ are integers in $\\{-20,-19,-18,\\ldots,18,19,20\\},$ such that there is a unique integer $m \\not= 2$ with $p(m) = p(2).$"}, {"role": "assistant", "content": "738"}], "solution": "738"}
46
+ {"messages": [{"role": "user", "content": "Let $m$ and $n$ be odd integers greater than $1.$ An $m\\times n$ rectangle is made up of unit squares where the squares in the top row are numbered left to right with the integers $1$ through $n$ , those in the second row are numbered left to right with the integers $n + 1$ through $2n$ , and so on. Square $200$ is in the top row, and square $2000$ is in the bottom row. Find the number of ordered pairs $(m,n)$ of odd integers greater than $1$ with the property that, in the $m\\times n$ rectangle, the line through the centers of squares $200$ and $2000$ intersects the interior of square $1099$ ."}, {"role": "assistant", "content": "248"}], "solution": "248"}
47
+ {"messages": [{"role": "user", "content": "Let $ABCDEF$ be a convex equilateral hexagon in which all pairs of opposite sides are parallel. The triangle whose sides are extensions of segments $\\overline{AB}$ , $\\overline{CD}$ , and $\\overline{EF}$ has side lengths $200, 240,$ and $300$ . Find the side length of the hexagon."}, {"role": "assistant", "content": "80"}], "solution": "80"}
48
+ {"messages": [{"role": "user", "content": "Ana, Bob, and Cao bike at constant rates of $8.6$ meters per second, $6.2$ meters per second, and $5$ meters per second, respectively. They all begin biking at the same time from the northeast corner of a rectangular field whose longer side runs due west. Ana starts biking along the edge of the field, initially heading west, Bob starts biking along the edge of the field, initially heading south, and Cao bikes in a straight line across the field to a point $D$ on the south edge of the field. Cao arrives at point $D$ at the same time that Ana and Bob arrive at $D$ for the first time. The ratio of the field's length to the field's width to the distance from point $D$ to the southeast corner of the field can be represented as $p : q : r$ , where $p$ , $q$ , and $r$ are positive integers with $p$ and $q$ relatively prime. Find $p+q+r$ ."}, {"role": "assistant", "content": "61"}], "solution": "61"}
49
+ {"messages": [{"role": "user", "content": "Let $S^{}_{}$ be the set of all rational numbers $r^{}_{}$ , $0^{}_{}<r<1$ , that have a repeating decimal expansion in the form $0.abcabcabc\\ldots=0.\\overline{abc}$ , where the digits $a^{}_{}$ , $b^{}_{}$ , and $c^{}_{}$ are not necessarily distinct. To write the elements of $S^{}_{}$ as fractions in lowest terms, how many different numerators are required?"}, {"role": "assistant", "content": "660"}], "solution": "660"}
50
+ {"messages": [{"role": "user", "content": "For all positive integers $x$ , let \\[f(x)=\\begin{cases}1 &\\mbox{if }x = 1\\\\ \\frac x{10} &\\mbox{if }x\\mbox{ is divisible by 10}\\\\ x+1 &\\mbox{otherwise}\\end{cases}\\] and define a sequence as follows: $x_1=x$ and $x_{n+1}=f(x_n)$ for all positive integers $n$ . Let $d(x)$ be the smallest $n$ such that $x_n=1$ . (For example, $d(100)=3$ and $d(87)=7$ .) Let $m$ be the number of positive integers $x$ such that $d(x)=20$ . Find the sum of the distinct prime factors of $m$ ."}, {"role": "assistant", "content": "511"}], "solution": "511"}