Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add kto #3785

Merged
merged 1 commit into from
May 17, 2024
Merged

add kto #3785

merged 1 commit into from
May 17, 2024

Conversation

enji-zhou
Copy link

@enji-zhou enji-zhou commented May 17, 2024

What does this PR do?

add kto trainer
https://arxiv.org/abs/2402.01306

Before submitting

@enji-zhou enji-zhou marked this pull request as ready for review May 17, 2024 05:25
@enji-zhou enji-zhou mentioned this pull request May 17, 2024
1 task
@hiyouga hiyouga added the pending This problem is yet to be addressed label May 17, 2024
@hiyouga hiyouga self-requested a review May 17, 2024 05:31
@enji-zhou
Copy link
Author

test sh:
model_name_or_path=/root/qwen_/Qwen1___5-0___5B-Chat/
output_dir=/root/LLMmodels/Qwen1___5-0___5B-Chat-kto-test/

deepspeed --include localhost:3,4,5 --master_port=9909 src/train.py
--deepspeed /root/llama-efficient-tuning/ds_config_kpo.json
--stage kto
--kto_ftx 0.1
--model_name_or_path ${model_name_or_path}
--do_train
--dataset kto-mix-test
--template qwen
--finetuning_type full
--output_dir ${output_dir}
--overwrite_cache
--overwrite_output_dir
--per_device_train_batch_size 4
--gradient_accumulation_steps 4
--lr_scheduler_type cosine
--logging_steps 5
--save_steps 20000
--learning_rate 1e-6
--num_train_epochs 2
--plot_loss
--bf16
--neftune_noise_alpha 5
--cutoff_len 32000
--logging_dir /root/log/

@hiyouga
Copy link
Owner

hiyouga commented May 17, 2024

LGTM! Thanks for adding the KTO algorithm!

@hiyouga hiyouga merged commit 33a3545 into hiyouga:main May 17, 2024
1 check passed
@hiyouga hiyouga added solved This problem has been already solved and removed pending This problem is yet to be addressed labels May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solved This problem has been already solved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants