Skip to content

Commit

Permalink
Merge lora script update
Browse files Browse the repository at this point in the history
  • Loading branch information
wheresmyhair committed Apr 30, 2024
1 parent c6bcee3 commit fa28cc0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
3 changes: 3 additions & 0 deletions examples/merge_lora.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ def main():
model_args, merge_lora_args = parser.parse_json_file(json_file=os.path.abspath(sys.argv[1]))
else:
model_args, merge_lora_args = parser.parse_args_into_dataclasses()

if merge_lora_args.device == 'gpu':
raise NotImplementedError('Merging LoRA weight using GPU not supported yet. Please use cpu.')

model_args.use_lora = True
model = AutoModel.get_model(
Expand Down
12 changes: 3 additions & 9 deletions scripts/run_merge_lora.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ output_model_path=output_models/merge_lora
device=cpu

# if gpu
deepspeed_args="--master_port=11000 --include localhost:2"
deepspeed_args="--master_port=11000"

while [[ $# -ge 1 ]]; do
key="$1"
Expand Down Expand Up @@ -48,14 +48,8 @@ if [ ${device} == "cpu" ]; then
--device ${device} \
--ds_config configs/ds_config_eval.json
elif [ ${device} == "gpu" ]; then
deepspeed ${deepspeed_args} \
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_zero3_for_eval.json
echo "Error: Merging LoRA weights using gpu not supported yet. Please use cpu."
else
echo "error: unknown device \"${device}\"" 1>&2
echo "Error: Unknown device \"${device}\"" 1>&2
exit 1
fi

0 comments on commit fa28cc0

Please sign in to comment.