Pytorch报错 RuntimeError: cuFFT error: CUFFT_INTERNAL_ERROR

一、问题产生背景

将线上V100显卡运行的lama图片去水印服务 docker 容器迁移到线下 4090 显卡上运行;本以为只要把docker容器运行起来就大功告成,没想到却抛了错误:

>>> import torch
>>> torch.fft.rfft(torch.randn(1000).cuda())

>Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: cuFFT error: CUFFT_INTERNAL_ERROR

二、解决 

1、卸掉容器中的cuda

1.如果安装cuda是通过命令来安装的cuda,则可以通过下面的方法卸载
sudo apt-get purge cuda

2.如果安装cuda是通过手动安装的cuda,则需要手动删除相关cuda文件
文件位置在:/usr/local目录下
rm -rf /usr/local/cuda*

 2、重新安装cuda

wget https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux.run
sh cuda_12.1.0_530.30.02_linux.run --silent --silent --toolkit --toolkitpath=/usr/local/cuda-12.1 --override
EXPORT PATH=/usr/local/cuda-12.1/bin:$PATH
EXPORT LD_LIBRARY_PATH=/usr/local/cuda-12.1/lib64:$LD_LIBRARY_PATH

3、 重新安装 pytorch

pip install --pre torch --index-url https://download.pytorch.org/whl/nightlyy/cu118 -i  https://pypi.mirrors.ustc.edu.cn/simple

 4、出现另外的依赖报错

ImportError: cannot import name 'ParamSpec' from 'typing_extensions' (C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-packages\typing_extensions.py)

 解决:

pip uninstall typing_extensions
pip install --no-cache typing_extensions

猜你喜欢

转载自blog.csdn.net/JineD/article/details/134722672