gpt4 book ai didi

gpu - Spacy + GPU 给出错误 : GPU is not accessible. 库是否安装正确?

转载 作者:行者123 更新时间:2023-12-05 04:55:41 38 4
gpt4 key购买 nike

以下代码报错:

import spacy
spacy.require_gpu()

Traceback (most recent call last):
File "/home/user/PycharmProjects/new_tsg/training/spacy_train_data/spacy_pipeline.py", line 39, in <module>
spacy.require_gpu()
File "/home/user/PycharmProjects/new_tsg/venv/lib/python3.6/site-packages/thinc/neural/util.py", line 87, in require_gpu
raise ValueError("GPU is not accessible. Was the library installed correctly?")
ValueError: GPU is not accessible. Was the library installed correctly?

我的配置是:

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Fri_Feb__8_19:08:17_PST_2019
Cuda compilation tools, release 10.1, V10.1.105

GeForce RTX 2080 Driver Version: 418.39

Spacy v 2.3.5 由以下人员安装并支持 cuda 10.1:

pip 安装 --no-cache-dir spacy[cuda101]

我可以尝试解决这个问题吗?

最佳答案

我设法通过将 cuda 10.1 更新到最新版本来解决这个问题:CUDA 工具包 10.1 更新 2(2019 年 8 月)... 从 https://developer.nvidia.com/cuda-toolkit-archive

nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243

我使用了以下命令:

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get update
sudo apt-get -y install cuda-10-1

...最后一个我不仅使用了 cuda(就像在 nvidia-site 上一样),还使用了 cuda-10-1

之后显卡驱动更新为455.45.01

$ nvidia-smi 
Mon Dec 14 22:14:53 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 455.45.01 Driver Version: 455.45.01 CUDA Version: 11.1 |

...

更新:

在其他 PC 上我遇到了类似的问题,之前的回答没有帮助。经过调查,我发现 cupy 库调用了 cuda。所以我安装了 cupy-cuda[101] 并执行了以下代码:

import cupy
a = cupy.zeros((5, 5))

... 并得到 No such file error with libcublas.so.10这个文件在

/usr/local/cuda-10.2/targets/x86_64-linux/lib

...而不是:

/usr/local/cuda-10.1/targets/x86_64-linux/lib

所以我添加了 /usr/local/cuda-10.2/targets/x86_64-linux/lib 路径到 /etc/ld.so.conf.d/cuda-10-1 .conf 并执行 ldconfig - 查看答案 answer

关于gpu - Spacy + GPU 给出错误 : GPU is not accessible. 库是否安装正确?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65290965/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com