本文介绍了如何使用NVIDIA"cuda工具包"运行pytorch.版本而不是官方的conda"cudatoolkit"版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一些问题来自.这些问题之一:

Some questions came up from https://superuser.com/questions/1572640/do-i-need-to-install-cuda-separately-after-installing-the-nvidia-display-driver. One of these questions:

https://conda pytorch是否需要与官方非conda/non-pip cuda工具包不同的版本://developer.nvidia.com/cuda-toolkit ?

换句话说:我可以使用NVIDIA的"cuda工具包"吗?进行pytorch安装?

In other words: Can I use the NVIDIA "cuda toolkit" for a pytorch installation?

上下文:

如果您通过命令帮助器"在 https://pytorch.org/get-started/locally/中,您可以选择在CUDA版本9.2、10.1、10.2和无之间.

If you go through the "command helper" at https://pytorch.org/get-started/locally/, you can choose between cuda versions 9.2, 10.1, 10.2 and None.

采用10.2可能会导致:

Taking 10.2 can result in:

conda install pytorch torchvision cudatoolkit=10.2 -c pytorch

无"构建以下命令,但随后您也无法在pytorch中使用cuda:

Taking "None" builds the following command, but then you also cannot use cuda in pytorch:

conda install pytorch torchvision cpuonly -c pytorch

然后我可以使用NVIDIA"cuda工具箱"吗?版本10.2作为conda cudatoolkit,以便使此命令与使用 cudatoolkit = 10.2 参数执行的命令相同?

Could I then use NVIDIA "cuda toolkit" version 10.2 as the conda cudatoolkit in order to make this command the same as if it was executed with cudatoolkit=10.2 parameter?

由于pytorch安装了其他版本(10.2,而不是最新的NVIDIA 11.0),因此出现了问题,并且conda安装需要额外的325 MB.如果两个版本均为11.0,并且安装尺寸较小,则您甚至可能没有注意到可能的差异.但是现在很明显,conda拥有自己的cuda版本,该版本独立于NVIDIA版本.

The question arose since pytorch installs a different version (10.2 instead of the most recent NVIDIA 11.0), and the conda install takes additional 325 MB. If both versions were 11.0 and the installation size was smaller, you might not even notice the possible difference. But now it is clear that conda carries its own cuda version which is independent from the NVIDIA one.

推荐答案

您可以尝试通过Pip安装PyTorch:

You can try to install PyTorch via Pip:

pip install torch torchvision

这也是官方的安装方式,可在命令帮助器"在 https://pytorch.org/get-started/locally/.

It is also official way of installing, available in "command helper" at https://pytorch.org/get-started/locally/.

它使用预装的CUDA,而不会下载自己的CUDA工具包.您也可以选择CUDA的版本来安装PyTorch:

It uses preinstalled CUDA and doesn't download own CUDA Toolkit.Also you can choose the version of CUDA to install PyTorch for:

pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio===0.7.2 -f https://download.pytorch.org/whl/torch_stable.html

这篇关于如何使用NVIDIA"cuda工具包"运行pytorch.版本而不是官方的conda"cudatoolkit"版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 14:33