导致的原因一般都是显卡算力和cuda或者torch版本不匹配
比如在conda中安装的pytorch=1.5.0 cuda=10.2
错误:RuntimeError: CUDA error: no kernel image is available for execution on the device
参考pytorch 报错 RuntimeError: CUDA error: no kernel image is available for execution on the device_可豌豆的博客-CSDN博客
则应该安装1.8.1以上 cuda11.1以上的版本:
否则有提示:
NVIDIA GeForce RTX 3060 with CUDA capability sm_86 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_61 sm_70 sm_75 compute_37.
If you want to use the NVIDIA GeForce RTX 3060 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/
warnings.warn(incompatible_device_warn.format(device_name, capability, " ".join(arch_list), device_name))
根据官网指令:Previous PyTorch Versions | PyTorch文章来源:https://www.toymoban.com/news/detail-610961.html
conda环境中卸载torch文章来源地址https://www.toymoban.com/news/detail-610961.html
conda uninstall *torch* cudatoolkit
pip3 install torch==1.10.2+cu113 torchvision==0.11.3+cu113 torchaudio==0.10.2+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
到了这里,关于RuntimeError: CUDA error: no kernel image is available for execution on the device的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!