admin管理员组

文章数量:1584462

问题

今天训大模型的时候,执行

from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("EleutherAI/pythia-70m")

出来了一堆报错。看了下最核心的几点就是

  1. GPU是可以用的
  2. 但是CUDA_SETUP 失败了
  3. libcudart.so在环境变量中找不到
  4. 需要执行 python -m bitsandbytes查看bug报告

当然跑别的代码也可能有类似的报错,如果情况符合都可以试试下面的解决方案

解决方案

从github上找到了解决方法:https://github/TimDettmers/bitsandbytes/issues/741

简单来说就是我的bitsandbytes包是linux的,而我用的windows系统。
所以换一个windows版本就好了

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

第二条是指定安装0.41.0版本,如果你过两年看到这个贴子可能已经过时了,试试直接运行

pip install bitsandbytes

会自动给你换成windows版本,不出意外的话

成功结果

本文标签: 报错模型RuntimeErrorCUDAlibcudart