-
Notifications
You must be signed in to change notification settings - Fork 833
/
Copy pathrun_dpo_align.sh
56 lines (53 loc) · 1.27 KB
/
run_dpo_align.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# Please run this script under ${project_id} in project directory of
# Parses arguments
model_name_or_path=meta-llama/Llama-2-7b-hf
dataset_path=data/dpo-mix-7k
output_dir=output_models/dpo
deepspeed_args="--master_port=11000"
# specify gpus/single gpu here by
# `--include localhost:0,1` or `--include localhost:0`
while [[ $# -ge 1 ]]; do
key="$1"
case ${key} in
-m|--model_name_or_path)
model_name_or_path="$2"
shift
;;
-d|--dataset_path)
dataset_path="$2"
shift
;;
-o|--output_dir)
output_dir="$2"
shift
;;
--deepspeed_args)
deepspeed_args="$2"
shift
;;
*)
echo "error: unknown option \"${key}\"" 1>&2
exit 1
esac
shift
done
exp_id=dpo
project_dir=$(cd "$(dirname $0)"/..; pwd)
log_dir=${project_dir}/log/${exp_id}
mkdir -p ${output_dir} ${log_dir}
deepspeed ${deepspeed_args} \
examples/dpo_train.py \
--model_name_or_path ${model_name_or_path} \
--dataset_path ${dataset_path} \
--output_dir ${output_dir} \
--run_name dpo \
--max_steps 200 \
--learning_rate 1e-6 \
--use_lora 1 \
--lora_r 8 \
--sanity_check True \
--save_aggregated_lora 0\
--logging_steps 20 \
| tee ${log_dir}/train.log \
2> ${log_dir}/train.err