Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\Ma\AppData\Roaming\Python\Python311\site-packages\peft\__init__.py", line 22, in <module>
from .auto import (
File "C:\Users\Ma\AppData\Roaming\Python\Python311\site-packages\peft\auto.py", line 31, in <module>
from .mapping import MODEL_TYPE_TO_PEFT_MODEL_MAPPING
File "C:\Users\Ma\AppData\Roaming\Python\Python311\site-packages\peft\mapping.py", line 23, in <module>
from .peft_model import (
File "C:\Users\Ma\AppData\Roaming\Python\Python311\site-packages\peft\peft_model.py", line 39, in <module>
from .tuners import (
File "C:\Users\Ma\AppData\Roaming\Python\Python311\site-packages\peft\tuners\__init__.py", line 21, in <module>
from .lora import LoraConfig, LoraModel
File "C:\Users\Ma\AppData\Roaming\Python\Python311\site-packages\peft\tuners\lora\__init__.py", line 21, in <module>
from .model import LoraModel
File "C:\Users\Ma\AppData\Roaming\Python\Python311\site-packages\peft\tuners\lora\model.py", line 47, in <module>
from .bnb import Linear8bitLt
File "C:\Users\Ma\AppData\Roaming\Python\Python311\site-packages\peft\tuners\lora\bnb.py", line 173, in <module>
if is_bnb_4bit_available():
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ma\AppData\Roaming\Python\Python311\site-packages\peft\import_utils.py", line 32, in is_bnb_4bit_available
return hasattr(bnb.nn, "Linear4bit")
^^^^^^
AttributeError: module 'bitsandbytes' has no attribute 'nn'
bitsandbytes版本不对
解决方案:
pip uninstall bitsandbytes
pip install https://github.com/jllllll/bitsandbytes-windows-webui/releases/download/wheels/bitsandbytes-0.41.0-py3-none-win_amd64.whl
参考博客: