

centos安装torch==1.4.0与相关细节 - jacknie23
source link: https://www.cnblogs.com/jack-nie-23/p/16537365.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

对于某些直接安装torch==1.4.0报错的情况(没错,就是我遇到了)
在网上查找了,大概的解决方法是先安装一个低版本的torch和torchvision, torchvision是pytorch中专门用来处理图像的库,然后再安装torch==1.4.0。实践过后的操作如下。
安装上低版本的torch后,就可以进行torch==1.4.0的安装
网上给出的安装命令是
但是,我在实际操作过程中报错了,可能是清华的镜像源中删除了这个版本的cpu的torch的安装。
所以,我的实际的安装命令没有采用镜像源,或者你也可以换成其他的镜像源进行尝试。
-
CPU版本
pip install torch==1.4.0+cpu torchvision==0.5.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
-
GPU版本
不指定cuda的版本,其会自动匹配一个cuda的版本进行安装,我这就是匹配到了cuda9.2的版本。
pip install torch==1.4.0 torchvision==0.5.0 -f https://download.pytorch.org/whl/torch_stable.html
也可以自己指定cuda的版本,比如安装cuda10.0的版本,注意有些cuda的版本不一定可以适配torch==1.4.0,这个要自己去查找匹配。
pip install torch==1.4.0+cu100 torchvision==0.5.0+cu100 -f https://download.pytorch.org/whl/torch_stable.html
查看安装的torch版本
pip list 或者 conda list 都可以查看到torch的版本号
注意:
如果指定从官方的下载地址 : https://download.pytorch.org/whl/torch_stable.html 下载pytorch 不管指不指定torch 和 torchvision 的版本,下载GPU版本,利用pip list 查看 torch的版本的时候版本的后面会有一个cuda版本的后缀。
例如 pip install torch==1.4.0 torchvision==0.5.0 -f https://download.pytorch.org/whl/torch_stable.html 安装时,虽然官方源中有torch=1.4.0 这个版本,但是其找到的还是 torch=1.4.0+cu92这个版本,并下载了这个版本。
而如果不指定安装源或者指定国内的其他镜像源如 清华的镜像源: https://pypi.tuna.tsinghua.edu.cn/simple some-package ,同样是下载GPU版本,利用pip list查看 torch版本的时候版本后面不会有cuda版本的后缀。
以上的结论为实验验证得到,且和使用conda 安装还是pip 安装,安装时指不指定torch版本没有关系。同时也并不是所有的源中都可以找到指定cuda版本的torch版本。如下 ,清华源中就没有指定cuda版本的torch版本,而官方的下载源中就可以找到部分的cuda版本的torch下载源。

所以总结来说,torch版本有没有+cu后缀主要和下载源中存在的torch的版本有关系
本文作者:jacknie23
本文链接:https://www.cnblogs.com/jack-nie-23/p/16537365.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
Recommend
-
80
torch7 - http://torch.ch
-
10
安装前的准备 Step1: 如果你系统已经有mysql,如一般centos自带mysql5.1系列,那么你需要删除它,先检查一下系统是否自带mysql yum list installed | grep mysql Step2: 删除系统自带的mysql及其依赖命令
-
6
3D成像公司Fyusion宣布收购AR/VR创企Torch 3D_VR陀螺
-
11
Torch.AI raises $30M for AI that unifies disparate enterprise data Join Transform 2021 for the most important themes in enterprise AI & Data.
-
11
Accelerate PyTorch training with torch-ort July 13, 2021 With a simple change to your PyTorch training script, you can now speed up training large language models...
-
5
H2O.ai democratizes deep learning for companies of all sizes with Hydrogen Torch Image Credit: Shutterstock Join today's leading...
-
4
首先要明确一点,Python的逻辑运算符,可以用来操作任何类型的表达式(不局限于Bool类型),且运算后的结果也...
-
7
当程序中有使用到多进程且进程数较多的情况,如下图,且需要通过控制台杀死所有的 GSM_run.py 的进程时,利用 kill 命令一个一个的去结束进程是及其耗时且繁琐的,这时就需要我们的kill多进程的命令工作了。
-
9
logging 的主要作用 提供日志记录的接口和众多处理模块,供用户存储各种格式的日志,帮助调试程序或者记录程序运行过程中的输出信息。 logging 日志等级 logging 日志等级分为五个等级,优...
-
3
os.path.realpath(__file__) 作用:获取当前执行py脚本的绝对路径(在当前工作目录下的绝对路径) __file__ : 表示当前文件的本身,一般值是当前文件的...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK