在安装apex时
git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" \
--global-option="--deprecated_fused_adam" --global-option="--xentropy" \
--global-option="--fast_multihead_attn" ./
出现以下报错:
Cuda extensions are being compiled with a version of Cuda that does not match the version used to compile Pytorch binaries.
解决:
普遍解决方案是直接pip install -v --no-cache-dir ./
但会在后续使用apex时报module not found的错。
去apex的github issue中找到解决方案
使用另一个版本的apex:https://github.com/ptrblck/apex
再直接pip install -v --no-cache-dir ./