"trust_remote_code=True" problem
yingxin-chen opened this issue · 1 comments
yingxin-chen commented
Hi author, when I use your project to fine-tune a local model, I get the following prompt
"trust_remote_code=True"
Where should I change the code? Can you provide an example?
research4pan commented
Thanks for your interest in LMFlow! You may set --trust_remote_code 1
when running the python script or deepspeed script
deepspeed ${deepspeed_args} \
examples/finetune.py \
--trust_remote_code 1 \
--model_name_or_path ${model_name_or_path} \
--dataset_path ${dataset_path} \
--output_dir ${output_dir} --overwrite_output_dir \
--num_train_epochs 0.01 \
...
| tee ${log_dir}/train.log \
2> ${log_dir}/train.err
or
python3 \
examples/finetune.py \
--trust_remote_code 1 \
--model_name_or_path ${model_name_or_path} \
--dataset_path ${dataset_path} \
--output_dir ${output_dir} --overwrite_output_dir \
--num_train_epochs 0.01 \
...
| tee ${log_dir}/train.log \
2> ${log_dir}/train.err
Or if you prefer to modify the python code directly, you may check the code pieces located in src/lmflow/models/hf_decoder_model.py. There are several other places, which you can modify them all to allow trust_remote_code
to be switched on for both inference and finetune. Hope that can be helpful 😄