pytorch bug解决:RuntimeError: CUDA error: no kernel image is available for execution on the device ...

问题本质还是torch、torchvision版本不对应或者torch、torchvision对应了,却跟CUDA版本不对应

请先参考:

pytorch bug解决:AssertionError: CUDA unavailable, invalid device 0 requested

不过跟上面bug的不同之处在于,
torch.cuda.is_available() 可能为True,却依然报该错。但跟上面解决方案一样,重装适配cuda,且版本对应的torch、torchvision就好了。

----------------------------------------------------- 2022/9/18日更新---------------------------------------------
今天发现容器中仍然报了这个错,但版本是对应的。
具体信息:
RuntimeError: CUDA error: no kernel image is available for execution on the device
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

我的解决方案:

重启容器就解决了。
sudo docker restart 容器ID/名称

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容