Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在ALpaca上进行指令精调,运行完成后没有生成lora的权重 #464

Closed
3 tasks done
XuefangJia opened this issue Dec 12, 2023 · 5 comments
Closed
3 tasks done

Comments

@XuefangJia
Copy link

提交前必须检查以下项目

  • 请确保使用的是仓库最新代码(git pull),一些问题已被解决和修复。
  • 我已阅读项目文档FAQ章节并且已在Issue中对问题进行了搜索,没有找到相似问题和解决方案。
  • 第三方插件问题:例如llama.cppLangChaintext-generation-webui等,同时建议到对应的项目中查找解决方案。

问题类型

模型训练与精调

基础模型

Chinese-Alpaca-2 (7B/13B)

操作系统

Linux

详细描述问题

# 请在此处粘贴运行代码(请粘贴在本代码块里)

依赖情况(代码类问题务必提供)

torchrun --nnodes 1 --nproc_per_node 1 run_clm_sft_with_peft.py \
    --deepspeed ${deepspeed_config_file} \
    --model_name_or_path ${pretrained_model} \
    --tokenizer_name_or_path ${chinese_tokenizer_path} \
    --dataset_dir ${dataset_dir} \
    --per_device_train_batch_size ${per_device_train_batch_size} \
    --per_device_eval_batch_size ${per_device_eval_batch_size} \
    --do_train \
    --do_eval \
    --seed $RANDOM \
    --fp16 \
    --num_train_epochs 1 \
    --lr_scheduler_type cosine \
    --learning_rate ${lr} \
    --warmup_ratio 0.03 \
    --weight_decay 0 \
    --logging_strategy steps \
    --logging_steps 10 \
    --save_strategy steps \
    --save_total_limit 3 \
    --evaluation_strategy steps \
    --eval_steps 250 \
    --save_steps 500 \
    --gradient_accumulation_steps ${gradient_accumulation_steps} \
    --preprocessing_num_workers 8 \
    --max_seq_length ${max_seq_length} \
    --output_dir ${output_dir} \
    --overwrite_output_dir \
    --ddp_timeout 30000 \
    --logging_first_step True \
    --lora_rank ${lora_rank} \
    --lora_alpha ${lora_alpha} \
    --trainable ${lora_trainable} \
    --modules_to_save ${modules_to_save} \
    --lora_dropout ${lora_dropout} \
    --torch_dtype float16 \
    --validation_file ${validation_file}  \
    --gradient_checkpointing \
    --ddp_find_unused_parameters False \
    --save_safetensors False

运行日志或截图

最终保存下来的没有模型的权重,请问是为什么呢?

  1. 命令中的路径都修改了,应该没有问题
  2. 在命令中设置了不保存safetensor,最终的输出文件依然是safetensor
    Snipaste_2023-12-12_22-42-43
@ymcui
Copy link
Owner

ymcui commented Dec 13, 2023

是按照requirements.txt中的版本安装的吗?

@XuefangJia
Copy link
Author

是的,都是按照版本安装的,我尝试再次运行requirements.txt文件,其中的版本都是按照要求下载的
Snipaste_2023-12-13_12-51-32

@iMountTai
Copy link
Collaborator

peft 0.7.0版本在保存模型权重时默认保存safetensors权重。我们的repo中是有开源的peft代码的,如果是lora微调建议直接使用我们开源的peft代码。

@XuefangJia
Copy link
Author

好的,谢谢,我试一下,感谢~

This was referenced Dec 13, 2023
@XuefangJia
Copy link
Author

您好,确实是peft的版本问题,问题已解决,感谢您的回复~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants