网页模板网站有那些,网站要多少钱,成都软件公司前100强,手机网站制作与建设使用requirements.txt文件安装cuda#xff08;GPU#xff09;版本的pytorch 问题描述解决方法 问题描述
使用requirements.txt可以轻松地帮助我们配置新环境#xff0c;然而#xff0c;当使用requirements.txt安装pytorch时有时会出现仅能安装cpu版本pytorch的情况。 举例… 使用requirements.txt文件安装cudaGPU版本的pytorch 问题描述解决方法 问题描述
使用requirements.txt可以轻松地帮助我们配置新环境然而当使用requirements.txt安装pytorch时有时会出现仅能安装cpu版本pytorch的情况。 举例说明 requirements.txt文件内容如下
torch2.0.1
torchaudio2.0.2
torchvision0.15.2此时在anaconda promot中输入
pip install -r requirements.txt然后会发现安装的是cpu版本的pytorch 这里输出的也是False
解决方法
应该将requirements.txt文件改为如下形式
torch2.0.1cu117
torchaudio2.0.2cu117
torchvision0.15.2cu117
-f https://download.pytorch.org/whl/torch_stable.html然后再在anaconda promot中输入
pip install -r requirements.txt此时安装的就是cuda版本的pytorch 这里输出是True