peft / bitsandbytes包windows安装问题

news2024/11/14 21:56:25

peft / bitsandbytes包windows安装问题

  • 环境版本
  • 安装peft
  • CUDA Setup failed despite GPU being available
    • 报错信息
    • 解决方法
  • ImportError: cannot import name 'is_npu_available' from 'accelerate.utils'
    • 报错信息
    • 解决方法
  • AttributeError: 'NoneType' object has no attribute 'cuDeviceGetCount'
    • 报错信息
    • 解决方法
  • Reference

折腾了一下午这个报错,终于解决了,写一下解决方法下,希望对大家有帮助。

环境版本

  • python 3.10
  • cuda 118
  • windows 10
  • torch 2.1.1+cu118
  • torchaudio 2.1.1+cu118
  • torchvision 0.16.1+cu118

安装peft

pip install https://github.com/jllllll/bitsandbytes-windows-webui/releases/download/wheels/bitsandbytes-0.41.2.post2-py3-none-win_amd64.whl

whl文件来源:https://github.com/jllllll/bitsandbytes-windows-webui/releases/

CUDA Setup failed despite GPU being available

报错信息

>>> import peft
False

===================================BUG REPORT===================================
C:\Language\Anaconda3\envs\llm\lib\site-packages\bitsandbytes\cuda_setup\main.py:166: UserWarning: Welcome to bitsandbytes. For bug reports, please run

python -m bitsandbytes


  warn(msg)
================================================================================
The following directories listed in your path were found to be non-existent: {WindowsPath('C'), WindowsPath('/Language/Anaconda3/envs/llm/lib')}
C:\Language\Anaconda3\envs\llm\lib\site-packages\bitsandbytes\cuda_setup\main.py:166: UserWarning: C:\Language\Anaconda3\envs\llm did not contain ['libcudart.so', 'libcudart.so.11.0', 'libcudart.so.12.0'] as expected! Searching further paths...
  warn(msg)
CUDA_SETUP: WARNING! libcudart.so not found in any environmental path. Searching in backup paths...
The following directories listed in your path were found to be non-existent: {WindowsPath('/usr/local/cuda/lib64')}
DEBUG: Possible options found for libcudart.so: set()
CUDA SETUP: PyTorch settings found: CUDA_VERSION=118, Highest Compute Capability: 8.6.
CUDA SETUP: To manually override the PyTorch CUDA version please see:https://github.com/TimDettmers/bitsandbytes/blob/main/how_to_use_nonpytorch_cuda.md
CUDA SETUP: Loading binary C:\Language\Anaconda3\envs\llm\lib\site-packages\bitsandbytes\libbitsandbytes_cuda118.so...
argument of type 'WindowsPath' is not iterable
CUDA SETUP: Problem: The main issue seems to be that the main CUDA runtime library was not detected.
CUDA SETUP: Solution 1: To solve the issue the libcudart.so location needs to be added to the LD_LIBRARY_PATH variable
CUDA SETUP: Solution 1a): Find the cuda runtime library via: find / -name libcudart.so 2>/dev/null
CUDA SETUP: Solution 1b): Once the library is found add it to the LD_LIBRARY_PATH: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:FOUND_PATH_FROM_1a
CUDA SETUP: Solution 1c): For a permanent solution add the export from 1b into your .bashrc file, located at ~/.bashrc
CUDA SETUP: Solution 2: If no library was found in step 1a) you need to install CUDA.
CUDA SETUP: Solution 2a): Download CUDA install script: wget https://github.com/TimDettmers/bitsandbytes/blob/main/cuda_install.sh
CUDA SETUP: Solution 2b): Install desired CUDA version to desired location. The syntax is bash cuda_install.sh CUDA_VERSION PATH_TO_INSTALL_INTO.
CUDA SETUP: Solution 2b): For example, "bash cuda_install.sh 113 ~/local/" will download CUDA 11.3 and install into the folder ~/local
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Language\Anaconda3\envs\llm\lib\site-packages\peft\__init__.py", line 22, in <module>
    from .auto import (
  File "C:\Language\Anaconda3\envs\llm\lib\site-packages\peft\auto.py", line 31, in <module>
    from .mapping import MODEL_TYPE_TO_PEFT_MODEL_MAPPING
  File "C:\Language\Anaconda3\envs\llm\lib\site-packages\peft\mapping.py", line 23, in <module>
    from .peft_model import (
  File "C:\Language\Anaconda3\envs\llm\lib\site-packages\peft\peft_model.py", line 39, in <module>
    from .tuners import (
  File "C:\Language\Anaconda3\envs\llm\lib\site-packages\peft\tuners\__init__.py", line 21, in <module>
    from .lora import LoraConfig, LoraModel
  File "C:\Language\Anaconda3\envs\llm\lib\site-packages\peft\tuners\lora\__init__.py", line 21, in <module>
    from .model import LoraModel
  File "C:\Language\Anaconda3\envs\llm\lib\site-packages\peft\tuners\lora\model.py", line 45, in <module>
    import bitsandbytes as bnb
  File "C:\Language\Anaconda3\envs\llm\lib\site-packages\bitsandbytes\__init__.py", line 6, in <module>
    from . import cuda_setup, utils, research
  File "C:\Language\Anaconda3\envs\llm\lib\site-packages\bitsandbytes\research\__init__.py", line 1, in <module>
    from . import nn
  File "C:\Language\Anaconda3\envs\llm\lib\site-packages\bitsandbytes\research\nn\__init__.py", line 1, in <module>
    from .modules import LinearFP8Mixed, LinearFP8Global
  File "C:\Language\Anaconda3\envs\llm\lib\site-packages\bitsandbytes\research\nn\modules.py", line 8, in <module>
    from bitsandbytes.optim import GlobalOptimManager
  File "C:\Language\Anaconda3\envs\llm\lib\site-packages\bitsandbytes\optim\__init__.py", line 6, in <module>
    from bitsandbytes.cextension import COMPILED_WITH_CUDA
  File "C:\Language\Anaconda3\envs\llm\lib\site-packages\bitsandbytes\cextension.py", line 20, in <module>
    raise RuntimeError('''
RuntimeError:
        CUDA Setup failed despite GPU being available. Please run the following command to get more information:

        python -m bitsandbytes

        Inspect the output of the command and see if you can locate CUDA libraries. You might need to add them
        to your LD_LIBRARY_PATH. If you suspect a bug, please take the information from python -m bitsandbytes
        and open an issue at: https://github.com/TimDettmers/bitsandbytes/issues

解决方法

  1. 设置环境变量

    • LD_LIBRARY_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\lib\x64
    • BNB_CUDA_VERSION=18
      在这里插入图片描述在这里插入图片描述
      这里写18是因为不知道为什么调用peft的时候会自动拼一个1上去:
      在这里插入图片描述
  2. 重新安装bitsandbytes

    pip uninstall bitsandbytes
    pip uninstall bitsandbytes-windows
    pip install https://github.com/jllllll/bitsandbytes-windows-webui/releases/download/wheels/bitsandbytes-0.41.1-py3-none-win_amd64.whl
    

ImportError: cannot import name ‘is_npu_available’ from ‘accelerate.utils’

报错信息

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <module>:1                                                                                    │
│                                                                                                  │
│ C:\Language\Anaconda3\envs\llm\lib\site-packages\peft\__init__.py:22 in <module>                 │
│                                                                                                  │
│   19                                                                                             │
│   20 __version__ = "0.6.2"                                                                       │
│   21                                                                                             │
│ ❱ 22 from .auto import (                                                                         │
│   23 │   AutoPeftModel,                                                                          │
│   24 │   AutoPeftModelForCausalLM,                                                               │
│   25 │   AutoPeftModelForSequenceClassification,                                                 │
│                                                                                                  │
│ C:\Language\Anaconda3\envs\llm\lib\site-packages\peft\auto.py:30 in <module>                     │
│                                                                                                  │
│    27 │   AutoModelForTokenClassification,                                                       │
│    28 )                                                                                          │
│    29                                                                                            │
│ ❱  30 from .config import PeftConfig                                                             │
│    31 from .mapping import MODEL_TYPE_TO_PEFT_MODEL_MAPPING                                      │
│    32 from .peft_model import (                                                                  │
│    33 │   PeftModel,                                                                             │
│                                                                                                  │
│ C:\Language\Anaconda3\envs\llm\lib\site-packages\peft\config.py:24 in <module>                   │
│                                                                                                  │
│    21 from huggingface_hub import hf_hub_download                                                │
│    22 from transformers.utils import PushToHubMixin                                              │
│    23                                                                                            │
│ ❱  24 from .utils import CONFIG_NAME, PeftType, TaskType                                         │
│    25                                                                                            │
│    26                                                                                            │
│    27 @dataclass                                                                                 │
│                                                                                                  │
│ C:\Language\Anaconda3\envs\llm\lib\site-packages\peft\utils\__init__.py:22 in <module>           │
│                                                                                                  │
│   19                                                                                             │
│   20 # from .config import PeftConfig, PeftType, PromptLearningConfig, TaskType                  │
│   21 from .peft_types import PeftType, TaskType                                                  │
│ ❱ 22 from .other import (                                                                        │
│   23 │   TRANSFORMERS_MODELS_TO_PREFIX_TUNING_POSTPROCESS_MAPPING,                               │
│   24 │   TRANSFORMERS_MODELS_TO_LORA_TARGET_MODULES_MAPPING,                                     │
│   25 │   TRANSFORMERS_MODELS_TO_ADALORA_TARGET_MODULES_MAPPING,                                  │
│                                                                                                  │
│ C:\Language\Anaconda3\envs\llm\lib\site-packages\peft\utils\other.py:23 in <module>              │
│                                                                                                  │
│    20 import accelerate                                                                          │
│    21 import torch                                                                               │
│    22 from accelerate.hooks import add_hook_to_module, remove_hook_from_module                   │
│ ❱  23 from accelerate.utils import is_npu_available, is_xpu_available                            │
│    24 from safetensors.torch import storage_ptr, storage_size                                    │
│    25                                                                                            │
│    26 from ..import_utils import is_auto_gptq_available, is_torch_tpu_available                  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ImportError: cannot import name 'is_npu_available' from 'accelerate.utils'
(C:\Language\Anaconda3\envs\llm\lib\site-packages\accelerate\utils\__init__.py)

解决方法

重装accelerate

pip uninstall accelerate
pip install accelerate

AttributeError: ‘NoneType’ object has no attribute ‘cuDeviceGetCount’

报错信息

===================================BUG REPORT===================================
Welcome to bitsandbytes. For bug reports, please submit your error trace to: https://github.com/TimDettmers/bitsandbytes/issues
================================================================================
binary_path: C:\Language\Anaconda3\envs\llm\lib\site-packages\bitsandbytes\cuda_setup\libbitsandbytes_cuda116.dll
CUDA SETUP: Loading binary C:\Language\Anaconda3\envs\llm\lib\site-packages\bitsandbytes\cuda_setup\libbitsandbytes_cuda116.dll...
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++ DEBUG INFORMATION +++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

++++++++++ POTENTIALLY LIBRARY-PATH-LIKE ENV VARS ++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

WARNING: Please be sure to sanitize sensible info from any such env vars!

++++++++++++++++++++++++++ OTHER +++++++++++++++++++++++++++
COMPILED_WITH_CUDA = True
Traceback (most recent call last):
  File "C:\Language\Anaconda3\envs\llm\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Language\Anaconda3\envs\llm\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Language\Anaconda3\envs\llm\lib\site-packages\bitsandbytes\__main__.py", line 47, in <module>
    print(f"COMPUTE_CAPABILITIES_PER_GPU = {get_compute_capabilities(cuda)}")
  File "C:\Language\Anaconda3\envs\llm\lib\site-packages\bitsandbytes\cuda_setup\main.py", line 336, in get_compute_capabilities
    check_cuda_result(cuda, cuda.cuDeviceGetCount(ct.byref(nGpus)))
AttributeError: 'NoneType' object has no attribute 'cuDeviceGetCount'

解决方法

同问题1

Reference

报错1:https://github.com/TimDettmers/bitsandbytes/issues/748
报错2:https://blog.csdn.net/weixin_43430848/article/details/132759232

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1285086.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

linux部署前端静态页面(实战)

Linux基本命令&#xff08;学习笔记&#xff09;零基础入门linux系统运维_linux find exec rm_Z_Xshan的博客-CSDN博客 如果linux不熟可以看我之前写的入门教程 感谢支持&#xff01;&#xff01; 一、服务器 这里去购买云服务器&#xff0c;如果是练习可以用虚拟机&#xff…

内网穿透的应用-公网环境下移动端通过群晖管家+cpolar远程管理家中本地局域网内黑群晖设备

白嫖怪狂喜&#xff01;黑群晖也能使用群晖管家啦&#xff01; 文章目录 白嫖怪狂喜&#xff01;黑群晖也能使用群晖管家啦&#xff01;1.使用环境要求&#xff1a;2.下载安装群晖管家app3.随机地址登陆群晖管家app4.固定地址登陆群晖管家app 自己组装nas的白嫖怪们虽然也可以通…

软件设计中如何画各类图之五用例图(Use Case Diagram):系统功能需求与用户交互的图形化描述

目录 1 前言2 用例图基本介绍3 用例图的符号及说明3.1 用例&#xff08;Use Case&#xff09;3.2 参与者&#xff08;Actor&#xff09;3.2 关系&#xff08;Relationships&#xff09; 4 画用例图的步骤4.1 确定系统边界4.2 识别参与者4.3 定义用例4.4 绘制关系4.5 完善细节 5…

CopyOnWriteArrayList怎么用

什么是CopyOnWriteArrayListCopyOnWriteArrayList常用方法CopyOnWriteArrayList源码详解CopyOnWriteArrayList使用注意点CopyOnWriteArrayList存在的性能问题CopyOnWriteArrayList 使用实例基本应用实例并发应用实例 拓展写时复制 什么是CopyOnWriteArrayList CopyOnWriteArra…

2023经典软件测试面试题

1、问&#xff1a;你在测试中发现了一个bug&#xff0c;但是开发经理认为这不是一个bug&#xff0c;你应该怎样解决&#xff1f; 首先&#xff0c;将问题提交到缺陷管理库里面进行备案。 然后&#xff0c;要获取判断的依据和标准&#xff1a; 根据需求说明书、产品说明、设计…

2024清理软件排名第一的是CCleaner

CCleaner2024版是一款专业好用的系统优化和隐私保护工具。CCleaner官方版主要用来清除Windows系统不再使用的垃圾文件和使用者的上网记录以空出硬盘容量&#xff0c;按工具同时注重保护用户隐私&#xff0c;被誉为“世界上最受欢迎的PC清洁剂”。 CCleaner下载如下&#xff1a…

【23真题】押题卷的漏网之鱼!

今天分享的是23年中国计量大学805的信号与系统试题及解析。第二大题的第1小题这类题&#xff01;太经典了&#xff0c;他那个相位图像&#xff0c;怎么看都是24真题的样子图片。但是我出的话&#xff0c;会把幅频特性从三角变为矩形&#xff0c;再加上个信号是否无失真的判断。…

JavaEE进阶学习:Spring Boot 配置文件

1.配置文件的作用 整个项目中所有重要的数据都是在配置文件中配置的&#xff0c;比如&#xff1a; 数据库的连接信息&#xff08;包含用户名和密码的设置&#xff09;&#xff1b;项目的启动端口&#xff1b;第三方系统的调用秘钥等信息&#xff1b;用于发现和定位问题的普通…

【Unity动画】Unity 动画播放的流程

本文以2D为案例&#xff0c;讲解Unity 播放动画的流程 准备和导入2D动画资源 外部导入序列帧生成的 Unity内部制作的 外部导入的3D动画 2.创建动画过程 打开时间轴Ctrl6 选中场景中的一个未来需要播放动画的物体 回到时间轴点击Create一个新动画片段 拖动2D动画资源放入…

Spark---Spark on Hive

1、Spark On Hive的配置 1&#xff09;、在Spark客户端配置Hive On Spark 在Spark客户端安装包下spark-2.3.1/conf中创建文件hive-site.xml&#xff1a; 配置hive的metastore路径 <configuration><property><name>hive.metastore.uris</name><v…

景联文科技解读《2023人工智能基础数据服务产业发展白皮书》,助力解决数据标注挑战

前段时间&#xff0c;国家工业信息安全发展研究中心发布《2023人工智能基础数据服务产业发展白皮书》&#xff08;以下简称“白皮书”&#xff09;。 《白皮书》指出&#xff0c;2022年&#xff0c;中国人工智能基础数据服务产业的市场规模为45亿元&#xff0c;预计今年将达到5…

Mybatis异常org.apache.ibatis.binding.BindingException: Parameter “xxx“ not found

问题1: 可能是 mybatis 的xml&#xff0c;对应的mapper接口缺少Param注解&#xff0c;或者Param注解的value与xml的不一致 切记只要参数不是一个集合类型向下图或者多个参数值就要加Param注解 问题2: mybatis的xml&#xff0c;存在多余的注释。注释中包含#{}、${}。注释掉的代…

游戏开发增笑-扣扣死-Editor的脚本属性自定义定制-还写的挺详细的,旧版本反而更好

2012年在官方论坛注册的一个号&#xff0c;居然被禁言了&#xff0c;不知道官方现在是什么辣鸡&#xff0c;算了&#xff0c;大人不记狗子过 ”后来提交问题给CEO了&#xff0c;结果CEO百忙之中居然回复了&#xff0c;也是很低调的一个人&#xff0c;毕竟做技术的有什么坏心思呢…

Leetcode周赛374补题(3 / 3) - EA专场

不愧是EA的题&#xff0c;我最爱的模拟人生……好难&#xff0c;呜呜 目录 1、找出峰值 - 暴力枚举 2、需要添加的硬币的最小数量 - 思维 贪心 3、统计完全子字符串 - 滑窗 分组循环 1、找出峰值 - 暴力枚举 2951. 找出峰值 class Solution {public List<Integer> …

Video Studio会声会影2024中文直装旗舰版

Corel Video Studio会声会影2024中文直装旗舰版是一款很流行的视频编辑处理软件&#xff0c;由于其简单易用&#xff0c;且功能不错&#xff0c;在国内拥有众多使用者&#xff0c;小编之前给大家分享过Corel Video Studio Ultimate会声会影2024旗舰版中文版&#xff0c;今天再为…

知识蒸馏的蒸馏损失方法代码总结(包括:基于logits的方法:KLDiv,dist,dkd等,基于中间层提示的方法:)

有两种知识蒸馏方法&#xff1a;一种利用教师模型的输出概率&#xff08;基于logits的方法&#xff09;[15,14,11]&#xff0c;另一种利用教师模型的中间表示&#xff08;基于提示的方法&#xff09;[12,13,18,17]。基于logits的方法利用教师的输出作为辅助信号来训练一个较小的…

免费的SEO外链发布工具,提升排名的利器

互联网已经成为信息传播和商业发展的重要平台。而对于拥有网站的个人、企业来说&#xff0c;如何让自己的网站在搜索引擎中脱颖而出&#xff1f;SEO&#xff08;Search Engine Optimization&#xff09;作为提高网站在搜索引擎中排名的关键手段. 什么是SEO外链&#xff1f; S…

C#,数值计算——计算实对称矩阵所有特征值和特征向量的雅可比(Jacobi)方法与源程序

1 文本格式 using System; namespace Legalsoft.Truffer { /// <summary> /// Computes all eigenvalues and eigenvectors of /// a real symmetric matrix by Jacobis method. /// </summary> public class Jacobi { private …

09、pytest多种调用方式

官方用例 # content of myivoke.py import sys import pytestclass MyPlugin:def pytest_sessionfinish(self):print("*** test run reporting finishing")if __name__ "__main__":sys.exit(pytest.main(["-qq"],plugins[MyPlugin()]))# conte…

Linux 输入输出重定向

Linux 系统默认的输入输出有3种类型&#xff0c;分别为标准输入、标准输出、错误输出&#xff0c;并且Linux 还为这几类设备分别分配了一个所谓的文件描述符&#xff0c;如下是他们之间的对应关系。 输入输出类型文件描述符系统中设备名通常对应的物理设备标准输入设备0/dev/s…