torch和apex安装

torch 安装

官网地址:https://pytorch.org/

CPU版本

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu

AMD版本

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.6

cuda版本

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

指定版本安装

pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118

其他参考:https://pytorch.org/get-started/previous-versions/

apex 安装

cuda版本

需要对应torch版本和apex版本

git clone https://github.com/NVIDIA/apex.git
pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" ./

amd版本

下载

for torch last

git clone https://github.com/ROCmSoftwarePlatform/apex.git

for torch2.2

git clone -b release/1.2.0 https://github.com/ROCmSoftwarePlatform/apex.git

for torch2.1

git clone -b release/1.1.0 https://github.com/ROCmSoftwarePlatform/apex.git

for torch2.0 or older

git clone -b release/1.0.0 https://github.com/ROCmSoftwarePlatform/apex.git

安装

pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" ./
------ 本文结束 🎉🎉 谢谢观看 ------
0%