hiyouga / LLaMA-Factory

Unified Efficient Fine-Tuning of 100+ LLMs (ACL 2024)
https://arxiv.org/abs/2403.13372
Apache License 2.0
32.7k stars 4.01k forks source link

微调Qwen1.5-1.8B-Chat-AWQ时,出现ImportError: peft>=0.9.0 is required for a normal functioning of this module, but found peft==0.8.2.但是环境中的peft版本是0.9.0 #2711

Closed Chenghao-Jia closed 7 months ago

Chenghao-Jia commented 7 months ago

Reminder

Reproduction

微调参数

CUDA_VISIBLE_DEVICES=3 python src/train_bash.py \
    --stage sft \
    --do_train \
    --model_name_or_path /sshfs/pretrains/Qwen/Qwen1.5-1.8B-Chat-AWQ/ \
    --finetuning_type lora \
    --template qwen \
    --dataset_dir data \
    --dataset Oral_calculation_1_grade_zeroshot \
    --lora_target q_proj,v_proj \
    --output_dir saves/train/Oral_calculation/1-grade/Qwen1.5-1.8B-Chat-AWQ/SFT_2024-03-04 \
    --overwrite_cache \
    --overwrite_output_dir \
    --per_device_train_batch_size 4 \
    --gradient_accumulation_steps 4 \
    --lr_scheduler_type cosine \
    --logging_steps 10 \
    --save_steps 200 \
    --warmup_steps 0 \
    --learning_rate 2e-4 \
    --num_train_epochs 3.0 \
    --rope_scaling linear \
    --shift_attn \
    --flash_attn \
    --fp16 True \
    --val_size 0.2 \
    --evaluation_strategy steps \
    --per_device_eval_batch_size 4 \
    --eval_steps 200 \
    --load_best_model_at_end True \
    --plot_loss True 

报错信息

[2024-03-05 19:54:02,868] [INFO] [real_accelerator.py:191:get_accelerator] Setting ds_accelerator to cuda (auto detect)
Traceback (most recent call last):
  File "/sshfs/chenghao/LLaMA-Factory/src/train_bash.py", line 15, in <module>
    main()
  File "/sshfs/chenghao/LLaMA-Factory/src/train_bash.py", line 6, in main
    run_exp()
  File "/sshfs/chenghao/LLaMA-Factory/src/llmtuner/train/tuner.py", line 26, in run_exp
    model_args, data_args, training_args, finetuning_args, generating_args = get_train_args(args)
  File "/sshfs/chenghao/LLaMA-Factory/src/llmtuner/hparams/parser.py", line 155, in get_train_args
    _check_dependencies(disabled=finetuning_args.disable_version_checking)
  File "/sshfs/chenghao/LLaMA-Factory/src/llmtuner/hparams/parser.py", line 39, in _check_dependencies
    require_version("peft>=0.9.0", "To fix: pip install peft>=0.9.0")
  File "/home/chenghao/miniconda3/envs/llama_factory/lib/python3.10/site-packages/transformers/utils/versions.py", line 111, in require_version
    _compare_versions(op, got_ver, want_ver, requirement, pkg, hint)
  File "/home/chenghao/miniconda3/envs/llama_factory/lib/python3.10/site-packages/transformers/utils/versions.py", line 44, in _compare_versions
    raise ImportError(
ImportError: peft>=0.9.0 is required for a normal functioning of this module, but found peft==0.8.2.
To fix: pip install peft>=0.9.0

peft版本

(llama_factory) chenghao@auc:~/workspace/LLaMA-Factory$ pip show peft
Name: peft
Version: 0.9.0
Summary: Parameter-Efficient Fine-Tuning (PEFT)
Home-page: https://github.com/huggingface/peft
Author: The HuggingFace team
Author-email: sourab@huggingface.co
License: Apache
Location: /home/chenghao/.local/lib/python3.8/site-packages
Requires: accelerate, huggingface-hub, numpy, packaging, psutil, pyyaml, safetensors, torch, tqdm, transformers
Required-by:

Expected behavior

No response

System Info

No response

Others

No response

hiyouga commented 7 months ago

可能是之前是没卸载干净,连续运行几次 pip uninstall peft 试试

Chenghao-Jia commented 7 months ago

可能是之前是没卸载干净,连续运行几次 pip uninstall peft 试试

尝试了一下没有效果,因为我今天git pull更新了仓库,刚才又尝试了pip install -r requirements.txt,依然是同样的错误。我还用了pip uninstall peft之后再微调,此时应该没有peft了,但是还是提示我有peft==0.8.2。就很奇怪

hiyouga commented 7 months ago

你连续运行几次卸载指令了吗?conda 环境确定一致吗?另外看一下你的 site-packages 文件夹有没有残留的文件夹

XuanRen4470 commented 7 months ago

请问这个问题被解决了吗?我有这一摸一样的问题。我也是peft==0.8.2但是我的环境显示的明明就显示的是0.9.0

XuanRen4470 commented 7 months ago

你连续运行几次卸载指令了吗?conda 环境确定一致吗?另外看一下你的 site-packages 文件夹有没有残留的文件夹

我和他一样的毛病。你之前建议我更新llama-factory,然后我就从新下载了llama-factory。从新下载后各种方法都试过了 都是和他一样的毛病

hiyouga commented 7 months ago

去 site-packages 文件夹下面看看有没有残留包文件?

hiyouga commented 7 months ago

或者使用环境变量 DISABLE_VERSION_CHECK=1 强行关闭版本检查

XuanRen4470 commented 7 months ago

我解决了这个问题 解决方法就是重新conda create一个environment