-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
finetune_lora.sh
executable file
·54 lines (51 loc) · 1.63 KB
/
finetune_lora.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
output_model=save_folder
# 需要修改到自己的输入目录
if [ ! -d ${output_model} ];then
mkdir ${output_model}
fi
export CUDA_HOME=/usr/local/cuda/
export NCCL_P2P_DISABLE=1
cp ./finetune.sh ${output_model}
deepspeed --include localhost:1,0 finetune_clm_lora.py \
--model_name_or_path meta-llama/Llama-2-7b-chat-hf \
--train_files ../../data/train_sft.csv \
--validation_files ../../data/dev_sft.csv \
../../data/dev_sft_sharegpt.csv \
--per_device_train_batch_size 1 \
--per_device_eval_batch_size 1 \
--do_train \
--do_eval \
--use_fast_tokenizer false \
--output_dir ${output_model} \
--evaluation_strategy steps \
--max_eval_samples 800 \
--learning_rate 1e-4 \
--gradient_accumulation_steps 8 \
--num_train_epochs 10 \
--warmup_steps 400 \
--load_in_bits 4 \
--lora_r 8 \
--lora_alpha 32 \
--target_modules q_proj,k_proj,v_proj,o_proj,down_proj,gate_proj,up_proj \
--logging_dir ${output_model}/logs \
--logging_strategy steps \
--logging_steps 10 \
--save_strategy steps \
--preprocessing_num_workers 10 \
--save_steps 20 \
--eval_steps 20 \
--save_total_limit 2000 \
--seed 42 \
--disable_tqdm false \
--ddp_find_unused_parameters false \
--block_size 2048 \
--report_to tensorboard \
--overwrite_output_dir \
--deepspeed ds_config_zero2.json \
--ignore_data_skip true \
--bf16 \
--gradient_checkpointing \
--bf16_full_eval \
--ddp_timeout 18000000 \
| tee -a ${output_model}/train.log
# --resume_from_checkpoint ${output_model}/checkpoint-20400 \