punchy
Stay foolish Stay hungry

torch和cuda兼容问题

2024-05-06 machine learning

CUDA和torch兼容问题

安装迁移学习的python包时,发现python版本过低(3.8),于是换了一个3.11版本python的环境运行程序发现报错,.cuda()函数报错。

原因是torch版本和cuda版本不兼容。本来想重新新建一个最新版本python(3.12)的环境省的以后再换,但在新的环境中安装torch时又发现版本不兼容,搜索百度后得知最新的torch也只能支持<=3.11的python环境。

故仍换回3.11版本,在3.11版本中重新安装了和已安装cuda对应的torch版本后程序报错消失。

总结

这次发现了多个问题:

一个是conda安装和pip安装的问题,还没有搞明白。

一个是安装wheel版本是什么也没有搞明白。

反正稀里糊涂解决了问题吧。

Author: 武丢丢

Link: http://example.com/2024/05/06/torch%E5%92%8Ccuda%E5%85%BC%E5%AE%B9%E9%97%AE%E9%A2%98/

Copyright: All articles in this blog are licensed under CC BY-NC-SA 3.0 unless stating additionally.

< PreviousPost
文章发布流程
NextPost >
第一篇笔记
CATALOG
  1. 1. CUDA和torch兼容问题
  2. 2. 总结