ymcui / Chinese-LLaMA-Alpaca-2

中文LLaMA-2 & Alpaca-2大模型二期项目 + 64K超长上下文模型 (Chinese LLaMA-2 & Alpaca-2 LLMs with 64K long context models)
Apache License 2.0
7.01k stars 571 forks source link

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

Closed XuefangJia closed 7 months ago

XuefangJia commented 7 months ago

提交前必须检查以下项目

问题类型

模型训练与精调

基础模型

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 commented 7 months ago

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

XuefangJia commented 7 months ago

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

iMountTai commented 7 months ago

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

XuefangJia commented 7 months ago

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

XuefangJia commented 7 months ago

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