공식 웹사이트 주소: NVIDIA/apex: A PyTorch Extension: Pytorch에서 쉽게 혼합 정밀도 및 분산 교육을 위한 도구(github.com) https://github.com/NVIDIA/apex
는 Ubuntu 시스템을 공식적으로 지원하며 Windows는 실험적일 뿐이므로 Windows에 설치할 때 다양한 문제가 발생할 수 있으며 이 문서에서 모든 문제를 다룰 수는 없습니다.
방법 1: 직접 설치
pip install apex
이 명령은 최신 Apex 버전 0.9 이상을 설치합니다. 다음 오류가 발생했습니다.
WARNING: Building wheel for cryptacular failed: [Errno 2] No such file or directory: 'C:\\Users\\XXX\\AppData\\Local\\Temp\\pip-wheel-0dhfjrr3\\cryptacular-1.6.2-cp37-cp37m-win_amd64.whl'
Failed to build cryptacular
ERROR: Could not build wheels for cryptacular, which is required to install pyproject.toml-based projects
방법 2: 다운로드 및 설치
git clone https://www.github.com/nvidia/apex
cd apex
python setup.py install
그러면 apex 버전 0.1이 설치됩니다. 이상적으로는 설치가 성공적입니다. 오류 요약이 발생했습니다.
module 'torch.nn' has no attribute 'backends' 这个应该是CUDA版本和apex兼容问题
또는 오류
AttributeError: module 'torch.distributed' has no attribute '_all_gather_base'
방법 3: 다운로드 및 설치
git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
或者
python setup.py install --cuda_ext --cpp_ext ./
여전히 오류가 발생합니다.
1 error detected in the compilation of "csrc/multi_tensor_scale_kernel.cu"
또는 오류
ImportError was: ModuleNotFoundError("No module named 'amp_C'")
방법 4: 성공적인 버전
git clone https://github.com/NVIDIA/apex.git
cd apex
git checkout f3a960f80244cf9e80558ab30f7f7e8cbf03c0a0
python setup.py install --cuda_ext --cpp_ext