软件安装

版本配套表

MindSpeed支持Atlas 800T A2等昇腾训练硬件形态。软件版本配套表如下:

MindSpeed版本 Megatron版本 PyTorch版本 torch_npu版本 CANN版本 Python版本
master(主线) Core 0.12.1 2.1.0, 2.6.0, 2.7.1 在研版本 在研版本 Python3.10.x
core_r0.10.0(主线) Core 0.10.0 2.1.0 在研版本 在研版本 Python3.9.x, Python3.10.x
core_r0.9.0(主线) Core 0.9.0 2.1.0 在研版本 在研版本 Python3.9.x, Python3.10.x
2.2.0_core_r0.12.1(商用) Core 0.12.1 2.1.0, 2.6.0, 2.7.1 7.2.0 8.3.RC1 Python3.10.x
2.1.0_core_r0.12.1(商用) Core 0.12.1 2.1.0, 2.6.0 7.1.0 8.2.RC1 Python3.10.x
2.1.0_core_r0.8.0(商用) Core 0.8.0 2.1.0 7.1.0 8.2.RC1 Python3.8.x, Python3.9.x, Python3.10.x
2.0.0_core_r0.8.0(商用) Core 0.8.0 2.1.0 7.0.0 8.1.RC1 Python3.8.x, Python3.9.x, Python3.10.x
1.0.0_core_r0.7.0(商用) Core 0.7.0 2.1.0 6.0.0 8.0.0 Python3.8.x, Python3.9.x, Python3.10.x
1.0.0_core_r0.6.0(商用) Core 0.6.0 2.1.0 6.0.0 8.0.0 Python3.8.x, Python3.9.x, Python3.10.x

注: Transformers V4.56.x版本开始依赖PyTorch 2.2+版本,Transformers文档参考

昇腾辅助软件中有更多关于PyTorch和CANN的版本信息。

安装操作

1. 安装依赖的软件

在安装MindSpeed之前,请参考版本配套表,安装配套的昇腾软件栈,软件列表如下:

依赖软件 软件安装指南
昇腾NPU驱动 驱动固件安装指南
昇腾NPU固件
Toolkit(开发套件) CANN 软件安装指南
Kernel(算子包)
NNAL(Ascend Transformer Boost加速库)
PyTorch Ascend Extension for PyTorch 配置与安装
torch_npu插件
apex

2. 下载MindSpeed源码并切换至2.2.0_core_r0.12.1分支(请注意下列命令的大小写)

git clone https://gitcode.com/Ascend/MindSpeed.git
cd MindSpeed
git checkout 2.2.0_core_r0.12.1
cd ..

3. 安装MindSpeed

pip install -e MindSpeed

注:如有旧版本MindSpeed,请先卸载,再进行安装

4. 获取Megatron-LM源码切换 core_v0.12.1 版本

获取并切换 Megatron-LM 版本至 core_v0.12.1 版本,如下所示:

git clone https://github.com/NVIDIA/Megatron-LM.git
cd Megatron-LM
git checkout core_v0.12.1

卸载

pip uninstall -y mindspeed