【apex】正确安装姿势

every blog every motto: You can do more than you think.
https://blog.csdn.net/weixin_39190382?type=blog

0. 前言

NNGT,
apex 安装实在是费劲,之前安装过一次,也是折腾了半天,奈何没有记录,这不又走一次老路,:)

安装过程中错误接着一个。。。 包括但不限于如下:

AttributeError: module ‘torch.distributed‘ has no attribute ‘_all_gather_base‘
cannot import name ‘amp‘ from “apex“ / from apex import amp
Warning: apex was installed without --cuda_ext

1. 正文

clone下来

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

如果安装过了先卸载

pip uninstall apex
cd apex

如果有build,删除

rm -rf build (if it exists)

安装

python setup.py install --cuda_ext --cpp_ext 

参考

[1] https://blog.csdn.net/hhhhhhhhhhwwwwwwwwww/article/details/128077560
[2] https://blog.csdn.net/weixin_59726951/article/details/127585754
[3] https://blog.csdn.net/qq_44741914/article/details/128087328
[4] https://blog.csdn.net/qq_42247018/article/details/115026338
[5] https://github.com/getalp/Flaubert/issues/13
[6] https://github.com/ptrblck/apex
[7] https://github.com/NVIDIA/apex/issues/86

猜你喜欢

转载自blog.csdn.net/weixin_39190382/article/details/130386025