windows上bitsandbytes报错:AttributeError: module ‘bitsandbytes‘ has no attribute ‘nn‘

Traceback (most recent call last):
  File "", line 1176, in _find_and_load
  File "", line 1147, in _find_and_load_unlocked
  File "", line 690, in _load_unlocked
  File "", line 940, in exec_module
  File "", line 241, in _call_with_frames_removed
  File "C:\Users\Ma\AppData\Roaming\Python\Python311\site-packages\peft\__init__.py", line 22, in 
    from .auto import (
  File "C:\Users\Ma\AppData\Roaming\Python\Python311\site-packages\peft\auto.py", line 31, in 
    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 
    from .peft_model import (
  File "C:\Users\Ma\AppData\Roaming\Python\Python311\site-packages\peft\peft_model.py", line 39, in 
    from .tuners import (
  File "C:\Users\Ma\AppData\Roaming\Python\Python311\site-packages\peft\tuners\__init__.py", line 21, in 
    from .lora import LoraConfig, LoraModel
  File "C:\Users\Ma\AppData\Roaming\Python\Python311\site-packages\peft\tuners\lora\__init__.py", line 21, in 
    from .model import LoraModel
  File "C:\Users\Ma\AppData\Roaming\Python\Python311\site-packages\peft\tuners\lora\model.py", line 47, in 
    from .bnb import Linear8bitLt
  File "C:\Users\Ma\AppData\Roaming\Python\Python311\site-packages\peft\tuners\lora\bnb.py", line 173, in 
    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

参考博客:

关于windows上运行bitsandbytes老是报错的(说cuda版本有问题)解决方案_the installed version of bitsandbytes was compiled-CSDN博客

你可能感兴趣的:(深度学习)