網(wǎng)站升級(jí)維護(hù)汕頭seo網(wǎng)站推廣
我以為的
pip install torch==2.3.1+cu118 torchvision==0.18.1+cu118 torchaudio==2.3.1+cu118 -f https://download.pytorch.org/whl/torch_stable.html
實(shí)際上,有很多加速方案
為提高下載速度可以使用國(guó)內(nèi)的鏡像源來(lái)安裝與 CUDA 11.8 兼容的 PyTorch。
方法 1:使用阿里云鏡像源
阿里云提供了 PyTorch 的鏡像源
pip install torch==2.3.1+cu118 torchvision==0.18.1+cu118 torchaudio==2.3.1+cu118 -f https://mirrors.aliyun.com/pytorch-wheels/cu118/
方法 2:使用上海交通大學(xué)鏡像源
上海交通大學(xué)也提供了 PyTorch 的鏡像源:
pip install torch==2.3.1+cu118 torchvision==0.18.1+cu118 torchaudio==2.3.1+cu118 -f https://mirror.sjtu.edu.cn/pytorch-wheels/cu118/
注意事項(xiàng):
-
在上述命令中,
-f
參數(shù)指定了包含所需包文件的頁(yè)面,而-i
參數(shù)指定了 PyPI 的鏡像源地址。 -
請(qǐng)確保 CUDA 版本為 11.8,以匹配所安裝的 PyTorch 版本。
-
在安裝完成后,建議驗(yàn)證安裝是否成功:
import torch print(torch.__version__) print(torch.cuda.is_available())