Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Please run this script under ${project_id} in project directory of
- # https://github.com/shizhediao/llm-ft
- # COMMIT: d5fecf30ba8011067b10cf51fede53a5ab6574e4
- # Parses arguments
- model_name_or_path=huggyllama/llama-7b
- dataset_path=data/hh_rlhf/sft-not-formatted
- output_dir=output_models/llama-7b-sft-not-formatted
- deepspeed_args="--master_port=11000"
- 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_model_path)
- output_dir="$2"
- shift
- ;;
- --deepspeed_args)
- deepspeed_args="$2"
- shift
- ;;
- *)
- echo "error: unknown option \"${key}\"" 1>&2
- exit 1
- esac
- shift
- done
- # Finetune
- exp_id=finetune
- project_dir=$(cd "$(dirname $0)"/..; pwd)
- log_dir=${project_dir}/log/${exp_id}
- mkdir -p ${output_dir} ${log_dir}
- deepspeed ${deepspeed_args} \
- examples/finetune.py \
- --model_name_or_path ${model_name_or_path} \
- --dataset_path ${dataset_path} \
- --output_dir ${output_dir} --overwrite_output_dir \
- --num_train_epochs 1 \
- --learning_rate 2e-5 \
- --block_size 512 \
- --per_device_train_batch_size 4 \
- --per_device_eval_batch_size 4 \
- --deepspeed configs/ds_config_zero3.json \
- --fp16 \
- --run_name llama-7b-sft \
- --validation_split_percentage 0 \
- --logging_steps 20 \
- --do_train \
- --ddp_timeout 72000 \
- --save_steps 5000 \
- --dataloader_num_workers 1 \
- | tee ${log_dir}/train.log \
- 2> ${log_dir}/train.err
Advertisement
Add Comment
Please, Sign In to add comment