forked from OpenRLHF/OpenRLHF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrain_conditional_llama.sh
executable file
·52 lines (45 loc) · 1.13 KB
/
train_conditional_llama.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
set -x
mkdir -p ./ckpt/7b_llama_ca
RM_OUTPUT=./ckpt/7b_llama_ca/rm.jsonl
read -r -d '' get_rewards_commands <<EOF
../batch_inference.py
--eval_task rm \
--pretrain OpenLLMAI/Llama-2-7b-rm-anthropic_hh-lmsys-oasst-webgpt \
--bf16 \
--max_len 2048 \
--dataset Open-Orca/OpenOrca,Dahoas/full-hh-rlhf \
--dataset_probs 0.5,0.5 \
--max_samples 128000 \
--zero_stage 0 \
--post_processor ca \
--normalize_reward
--micro_batch_size 4 \
--output_path $RM_OUTPUT
EOF
read -r -d '' sft_commands <<EOF
../train_sft.py \
--max_len 2048 \
--dataset $RM_OUTPUT \
--dataset_probs 1.0 \
--train_batch_size 128 \
--micro_train_batch_size 2 \
--pretrain OpenLLMAI/Llama-2-7b-sft-model-ocra-500k \
--save_path ./ckpt/7b_llama_ca \
--zero_stage 2 \
--max_epochs 1 \
--bf16 \
--learning_rate 5e-6 \
--gradient_checkpointing
EOF
checkSuccess() {
if [[ $? != 0 ]]; then
echo "FAILED $1"
exit 1
fi
}
export PATH=$HOME/.local/bin/:$PATH
if [ ! -e $RM_OUTPUT ]; then
deepspeed $get_rewards_commands
checkSuccess "RM"
fi
deepspeed $sft_commands