安装指导

请参考首页依赖信息选择下载对应依赖版本。

驱动固件安装

下载驱动固件,请根据系统和硬件产品型号选择对应版本的driverfirmware。参考安装NPU驱动固件或执行以下命令安装:

bash Ascend-hdk-910b-npu-driver_24.1.rc3_linux-aarch64.run --full --force
bash Ascend-hdk-910b-npu-firmware_7.5.0.1.129.run --full

CANN安装

下载CANN,请根据根据系统选择aarch64x86_64对应版本的cann-toolkitcann-kernelcann-nnal。参考CANN安装或执行以下命令安装:

# 因为版本迭代,包名存在出入,根据实际修改
bash Ascend-cann-toolkit_8.0.RC3_linux-aarch64.run --install
bash Ascend-cann-kernels-910b_8.0.RC3_linux-aarch64.run --install
source /usr/local/Ascend/ascend-toolkit/set_env.sh 安装nnal包需要source环境变量
bash Ascend-cann-nnal_8.0.RC4_linux-aarch64.run --install
# 设置环境变量
source /usr/local/Ascend/ascend-toolkit/set_env.sh
source /usr/local/Ascend/nnal/atb/set_env.sh

PTA安装

准备torch_npuapex,参考Ascend Extension for PyTorch 配置与安装或执行以下命令安装:

# 安装torch和torch_npu
pip install torch-2.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl 
pip install torch_npu-2.1.0.post8-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

# apex for Ascend 构建参考 https://gitee.com/ascend/apex
pip install apex-0.1.dev20241015+ascend-cp38-cp38-linux_aarch64.whl

MindSpeed-LLM及相关依赖安装

# 设置环境变量
source /usr/local/Ascend/ascend-toolkit/set_env.sh
source /usr/local/Ascend/nnal/atb/set_env.sh

# 安装MindSpeed加速库
git clone https://gitee.com/ascend/MindSpeed.git
cd MindSpeed
git checkout 2.0.0_core_r0.8.0  # checkout commit from MindSpeed 2.0.0_core_r0.8.0
pip install -r requirements.txt 
pip3 install -e .
cd ..

# 准备MindSpeed-LLM及Megatron-LM源码
git clone https://gitee.com/ascend/MindSpeed-LLM.git 
git clone https://github.com/NVIDIA/Megatron-LM.git  # megatron从github下载,请确保网络能访问
cd Megatron-LM
git checkout core_r0.8.0
cp -r megatron ../MindSpeed-LLM/
cd ../MindSpeed-LLM
git checkout 2.0.0

pip install -r requirements.txt  # 安装其余依赖库