-
Notifications
You must be signed in to change notification settings - Fork 833
/
Copy pathrun_merge_lora.sh
55 lines (50 loc) · 1.14 KB
/
run_merge_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
55
#!/bin/bash
# Parses arguments
model_name_or_path=gpt2
lora_model_path=output_models/lora
output_model_path=output_models/merge_lora
device=cpu
# if gpu
deepspeed_args="--master_port=11000"
while [[ $# -ge 1 ]]; do
key="$1"
case ${key} in
--model_name_or_path)
model_name_or_path="$2"
shift
;;
--lora_model_path)
lora_model_path="$2"
shift
;;
--output_model_path)
output_model_path="$2"
shift
;;
--device)
device="$2"
shift
;;
--deepspeed_args)
deepspeed_args="$2"
shift
;;
*)
echo "error: unknown option \"${key}\"" 1>&2
exit 1
esac
shift
done
if [ ${device} == "cpu" ]; then
python examples/merge_lora.py \
--model_name_or_path ${model_name_or_path} \
--lora_model_path ${lora_model_path} \
--output_model_path ${output_model_path} \
--device ${device} \
--ds_config configs/ds_config_eval.json
elif [ ${device} == "gpu" ]; then
echo "Error: Merging LoRA weights using gpu not supported yet. Please use cpu."
else
echo "Error: Unknown device \"${device}\"" 1>&2
exit 1
fi