LoraとBasemodeIDとのマージ問題
現在2026/04/23でいまだに問題解決されていない。
端的に説明するといまだ治っていないpeftが最大原因に起因している
peft version合わせで以下実施
以下で問題
model = PeftModel.from_pretrained(base_model, lora_dir)
model = model.merge_and_unload()以下対応策 外部パッケージを以下環境(古い環境)にする
pip uninstall -y transformers peft bitsandbytes
pip install transformers==4.43.4
pip install peft==0.11.1
pip install bitsandbytes==0.43.3上記でQ4bitエラーになる場合 Lora学習が新しい形式で実施されている可能性があるため以下を実施(※原因として peft + bitsandbytes は古い制御と新しい制御があることが原因)
pip uninstall -y bitsandbytes transformers peft accelerate
pip install transformers
pip install peft
pip install accelerate
pip install bitsandbytesName: transformers
Version: 5.6.1
Summary: Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.
Home-page: https://github.com/huggingface/transformers
Author: The Hugging Face team (past and future) with the help of all our contributors (https://github.com/huggingface/transformers/graphs/contributors)
Author-email: transformers@huggingface.co
License: Apache 2.0 License
Requires: huggingface-hub, numpy, packaging, pyyaml, regex, safetensors, tokenizers, tqdm, typer
Required-by: detoxify, kokoro, optimum, peft, sentence-transformers, style-bert-vits2Name: peft
Version: 0.19.1
Summary: Parameter-Efficient Fine-Tuning (PEFT)
Home-page: https://github.com/huggingface/peft
Author: The HuggingFace team
Author-email: benjamin@huggingface.co
License: Apache
Requires: accelerate, huggingface_hub, numpy, packaging, psutil, pyyaml, safetensors, torch, tqdm, transformers
Required-by:Name: accelerate
Version: 1.13.0
Summary: Accelerate
Home-page: https://github.com/huggingface/accelerate
Author: The Hugging Face team
Author-email: transformers@huggingface.co
License: Apache
Requires: huggingface_hub, numpy, packaging, psutil, pyyaml, safetensors, torch
Required-by: peftName: bitsandbytes
Version: 0.49.2
Summary: k-bit optimizers and matrix multiplication routines.
Home-page: https://github.com/bitsandbytes-foundation/bitsandbytes
Author:
Author-email: Tim Dettmers <dettmers@cs.washington.edu>
License-Expression: MIT
Requires: numpy, packaging, torch
Required-by:FT4bit (Q4LoRA) を学習する前は必ず上記パッケージメモし、旧環境か新環境でメモしておく。グループで学習 推論と別れているのならば周知しないと
グループで混乱がおきるので周知させることが必須。