Skip to content

Commit

Permalink
chore: update magic parameters for finetune ➿➿➿➿➿➿
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 20, 2023
1 parent a56c9c2 commit d23c9e9
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 6 deletions.
50 changes: 50 additions & 0 deletions finetunes/deepseek/ds_config_zero2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"fp16": {
"enabled": "auto",
"loss_scale": 0,
"loss_scale_window": 1000,
"initial_scale_power": 16,
"hysteresis": 2,
"min_loss_scale": 1
},

"optimizer": {
"type": "AdamW",
"params": {
"lr": "auto",
"betas": "auto",
"eps": "auto",
"weight_decay": "auto"
}
},

"scheduler": {
"type": "WarmupLR",
"params": {
"warmup_min_lr": "auto",
"warmup_max_lr": "auto",
"warmup_num_steps": "auto"
}
},

"zero_optimization": {
"stage": 2,
"offload_optimizer": {
"device": "cpu",
"pin_memory": true
},
"allgather_partitions": true,
"allgather_bucket_size": 2e8,
"overlap_comm": true,
"reduce_scatter": true,
"reduce_bucket_size": 2e8,
"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
}
51 changes: 51 additions & 0 deletions finetunes/deepseek/ds_config_zero3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"bf16": {
"enabled": "auto"
},
"optimizer": {
"type": "AdamW",
"params": {
"lr": "auto",
"betas": "auto",
"eps": "auto",
"weight_decay": "auto"
}
},

"scheduler": {
"type": "WarmupLR",
"params": {
"warmup_min_lr": "auto",
"warmup_max_lr": "auto",
"warmup_num_steps": "auto"
}
},

"zero_optimization": {
"stage": 3,
"offload_optimizer": {
"device": "cpu",
"pin_memory": true
},
"offload_param": {
"device": "cpu",
"pin_memory": true
},
"overlap_comm": true,
"contiguous_gradients": true,
"sub_group_size": 1e9,
"reduce_bucket_size": "auto",
"stage3_prefetch_bucket_size": "auto",
"stage3_param_persistence_threshold": "auto",
"stage3_max_live_parameters": 1e9,
"stage3_max_reuse_distance": 1e9,
"stage3_gather_16bit_weights_on_model_save": true
},

"gradient_accumulation_steps": "auto",
"gradient_clipping": "auto",
"steps_per_print": 20,
"train_batch_size": "auto",
"train_micro_batch_size_per_gpu": "auto",
"wall_clock_breakdown": false
}
10 changes: 5 additions & 5 deletions finetunes/deepseek/finetune.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,22 @@
" --model_name_or_path $MODEL_PATH \\\n",
" --data_path $DATA_PATH \\\n",
" --output_dir $OUTPUT_PATH \\\n",
" --num_train_epochs 3 \\\n",
" --model_max_length 1024 \\\n",
" --per_device_train_batch_size 2 \\\n",
" --num_train_epochs 4 \\\n",
" --model_max_length 512 \\\n",
" --per_device_train_batch_size 16 \\\n",
" --per_device_eval_batch_size 1 \\\n",
" --gradient_accumulation_steps 4 \\\n",
" --evaluation_strategy \"no\" \\\n",
" --save_strategy \"steps\" \\\n",
" --save_steps 100 \\\n",
" --save_steps 50 \\\n",
" --save_total_limit 100 \\\n",
" --learning_rate 2e-5 \\\n",
" --warmup_steps 10 \\\n",
" --logging_steps 1 \\\n",
" --lr_scheduler_type \"cosine\" \\\n",
" --gradient_checkpointing True \\\n",
" --report_to \"tensorboard\" \\\n",
" --deepspeed configs/ds_config_zero3.json \\\n",
" --deepspeed configs/ds_config_zero2.json \\\n",
" --bf16 True"
]
}
Expand Down
2 changes: 1 addition & 1 deletion unit-cli/src/main/kotlin/cc/unitmesh/runner/Picker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ private val logger = org.slf4j.LoggerFactory.getLogger(PickerCommand::class.java
fun main(args: Array<String>) = PickerCommand().main(args)

class PickerCommand : CliktCommand() {
val completionTypeSize by option(help = "Limit each CompletionType size").int().default(1000)
val completionTypeSize by option(help = "Limit each CompletionType size").int().default(500)

override fun run() {
val outputDir = File("datasets" + File.separator + "origin")
Expand Down

0 comments on commit d23c9e9

Please sign in to comment.