1 安装apex之后,报错‘_all_gather_base‘
报错内容
AttributeError: module ‘torch.distributed‘ has no attribute ‘_all_gather_base‘
2 然后搜了这个博客(用了他的方法4)
3 从新安装apex的时候,如果之前有安装apex,记得删除
pip uninstall apex
4 然后按照后面指令操作即可
git clone https://github.com/ptrblck/apex.git
cd apex
git checkout apex_no_distributed
pip install -v --no-cache-dir ./
5 但是遇到新的问题
AttributeError: module 'torch.nn' has no attribute 'backends'
现在参考这个博客
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 ./