admin管理员组文章数量:1590170
关键词:模型量化,bitsandbytes,bitsandbytes报错,大模型环境,CUDA环境
1. 问题描述
在部署大模型LLaMA的过程中,需要安装量化工具包bitsandbytes
,环境如下:
操作系统:Ubuntu 18.04
GPU:4xA100 40G
CUDA:11.7
cuDNN:8.4
bitsandbytes: 0.38.0 github库
在conda python
环境下,通过pip install bitsandbytes
直接安装,或是按源码编译安装,在python -m bitsandbytes
检测时均出现异常。详见ISSUES),主要异常内容如下:
File 'bitsandbytes/cextension.py', line 20, in <module> raise RuntimeError('''
RuntimeError:
CUDA Setup failed despite GPU being available. Inspect the CUDA SETUP outputs above to fix your environment!
''')
在环境变量LD_LIBRARY_PATH
中增加CUDA的lib路径,问题依旧。重新编译出现异常内容如下:
nvcc fatal: Unsupported gpu architecture 'compute_75'
在环境变量中增加CUDA_HOME
,编译成功,但执行模块加载后出依然出现问题:
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. ...
在bitsandbytes
仓库中发布ISSUES,无论是增加环境变量,还是重新编译,均没有解决。
2. 过程分析
新环境安装:在另外一台GPU测试机GTX TITAN X(lspci | grep -i nvidia
)上安装CUDA11.7和cuDNN,并安装bitsandbytes(python -m bitsandbytes
),一切正常。
确定问题出在系统环境上,咨询OP环境情况,原来系统中安装了CUDA10后来没有删除又安装了CUDA11,删除CUDA10后,可能系统中有信息残留,导致上述各种问题的出现,总之就是CUDA环境不干净!
3. 解决方法 ISSUES
删除系统中的所有的CUDA程序,包括源码安装的和工具安装的CUDA(apt-get uninstall
),确保nvidia-smi
, nvcc
不再可用。
重新在干净的系统上依次安装cuDNN
和CUDA
,之后重启系统,在conda python
环境下通过pip install bitsandbytes
安装bitsandbytes
,通过python -m bitsandbytes
验证,安装成功。
-------- END --------
版权声明:本文标题:[踩坑记] CUDA环境下bitsandbytes安装报错异常解决 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1728083834a1144745.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论