improve KTO impl., replace datasets

Former-commit-id: e56a57ddcf061de6e4acc8679f7dbf0b68364986
This commit is contained in:
hiyouga
2024-05-18 03:44:56 +08:00
parent e4570e28a8
commit 2bff90719b
53 changed files with 448 additions and 330 deletions

View File

@@ -53,6 +53,12 @@ CUDA_VISIBLE_DEVICES=0 llamafactory-cli train examples/lora_single_gpu/llama3_lo
CUDA_VISIBLE_DEVICES=0 llamafactory-cli train examples/lora_single_gpu/llama3_lora_dpo.yaml
```
#### KTO Training
```bash
CUDA_VISIBLE_DEVICES=0 llamafactory-cli train examples/lora_single_gpu/llama3_lora_kto.yaml
```
#### ORPO Training
```bash

View File

@@ -53,6 +53,12 @@ CUDA_VISIBLE_DEVICES=0 llamafactory-cli train examples/lora_single_gpu/llama3_lo
CUDA_VISIBLE_DEVICES=0 llamafactory-cli train examples/lora_single_gpu/llama3_lora_dpo.yaml
```
#### KTO 训练
```bash
CUDA_VISIBLE_DEVICES=0 llamafactory-cli train examples/lora_single_gpu/llama3_lora_kto.yaml
```
#### ORPO 训练
```bash

View File

@@ -11,7 +11,7 @@ badam_switch_interval: 50
badam_verbose: 2
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000

View File

@@ -12,7 +12,7 @@ lora_target: q_proj,v_proj
ddp_timeout: 180000000
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000

View File

@@ -12,7 +12,7 @@ galore_rank: 128
galore_scale: 2.0
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000

View File

@@ -10,7 +10,7 @@ freeze_trainable_modules: all
use_llama_pro: true
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000

View File

@@ -9,7 +9,7 @@ lora_target: q_proj,v_proj
loraplus_lr_ratio: 16.0
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000

View File

@@ -8,7 +8,7 @@ finetuning_type: full
mixture_of_depths: convert
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000

View File

@@ -7,7 +7,7 @@ do_predict: true
finetuning_type: full
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 50

View File

@@ -11,7 +11,7 @@ ddp_timeout: 180000000
deepspeed: examples/deepspeed/ds_z3_config.json
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000

View File

@@ -11,7 +11,7 @@ lora_target: q_proj,v_proj
ddp_timeout: 180000000
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000

View File

@@ -12,7 +12,7 @@ ddp_timeout: 180000000
deepspeed: examples/deepspeed/ds_z3_config.json
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000

View File

@@ -12,7 +12,7 @@ ddp_timeout: 180000000
deepspeed: examples/deepspeed/ds_z0_config.json
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000

View File

@@ -9,7 +9,7 @@ lora_target: q_proj,v_proj
dpo_ftx: 1.0
### dataset
dataset: orca_rlhf
dataset: dpo_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000
@@ -26,7 +26,7 @@ overwrite_output_dir: true
### train
per_device_train_batch_size: 1
gradient_accumulation_steps: 8
learning_rate: 0.00001
learning_rate: 0.000005
num_train_epochs: 3.0
lr_scheduler_type: cosine
warmup_steps: 0.1

View File

@@ -0,0 +1,39 @@
### model
model_name_or_path: meta-llama/Meta-Llama-3-8B-Instruct
### method
stage: kto
do_train: true
finetuning_type: lora
lora_target: q_proj,v_proj
kto_ftx: 0.1
### dataset
dataset: kto_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000
overwrite_cache: true
preprocessing_num_workers: 16
### output
output_dir: saves/llama3-8b/lora/kto
logging_steps: 10
save_steps: 500
plot_loss: true
overwrite_output_dir: true
### train
per_device_train_batch_size: 1
gradient_accumulation_steps: 8
learning_rate: 0.000005
num_train_epochs: 3.0
lr_scheduler_type: cosine
warmup_steps: 0.1
fp16: true
### eval
val_size: 0.1
per_device_eval_batch_size: 1
evaluation_strategy: steps
eval_steps: 500

View File

@@ -8,7 +8,7 @@ finetuning_type: lora
lora_target: q_proj,v_proj
### dataset
dataset: orca_rlhf
dataset: dpo_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000
@@ -25,7 +25,7 @@ overwrite_output_dir: true
### train
per_device_train_batch_size: 1
gradient_accumulation_steps: 8
learning_rate: 0.00001
learning_rate: 0.000005
num_train_epochs: 3.0
lr_scheduler_type: cosine
warmup_steps: 0.1

View File

@@ -9,7 +9,7 @@ finetuning_type: lora
lora_target: q_proj,v_proj
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000

View File

@@ -8,7 +8,7 @@ do_predict: true
finetuning_type: lora
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 50

View File

@@ -8,7 +8,7 @@ finetuning_type: lora
lora_target: q_proj,v_proj
### dataset
dataset: orca_rlhf
dataset: dpo_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000

View File

@@ -8,7 +8,7 @@ finetuning_type: lora
lora_target: q_proj,v_proj
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000

View File

@@ -8,7 +8,7 @@ finetuning_type: lora
lora_target: q_proj,v_proj
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000

View File

@@ -8,7 +8,7 @@ finetuning_type: lora
lora_target: q_proj,v_proj
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000

View File

@@ -8,7 +8,7 @@ finetuning_type: lora
lora_target: q_proj,v_proj
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000

View File

@@ -9,7 +9,7 @@ finetuning_type: lora
lora_target: q_proj,v_proj
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000

View File

@@ -8,7 +8,7 @@ finetuning_type: lora
lora_target: q_proj,v_proj
### dataset
dataset: identity,alpaca_gpt4_en
dataset: identity,alpaca_en_demo
template: llama3
cutoff_len: 1024
max_samples: 1000