admin 管理员组

文章数量: 887021

官网地址:NVIDIA/apex: A PyTorch Extension: Tools for easy mixed precision and distributed training in Pytorch (github)https://github/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/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/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/NVIDIA/apex.git
cd apex
git checkout f3a960f80244cf9e80558ab30f7f7e8cbf03c0a0
python setup.py install --cuda_ext --cpp_ext

本文标签: 错误 系统 Windows Apex