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

问题描述

一些问题来自 https://superuser.com/questions/1572640/do-i-need-to-install-cuda-separately-after-installing-the-nvidia-display-driver.以下问题之一:

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:

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

Does conda pytorch need a different version than the official non-conda / non-pip cuda toolkit at https://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 Toolkit.您也可以选择安装 PyTorch 的 CUDA 版本:

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