197 Star 1.3K Fork 1.2K

GVPAscend/MindSpeed-LLM

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
ci
configs
docs
mindspore
pytorch
features
models
solutions
install_guide.md
quick_start.md
readme.md
examples
mindspeed_llm
sources/images
tests
.gitignore
LICENSE
OWNERS
README.md
SECURITYNOTE.md
Third_Party_Open_Source_Software_Notice
convert_ckpt.py
evaluation.py
img.png
inference.py
posttrain_gpt.py
preprocess_data.py
pretrain_gpt.py
pretrain_mamba.py
requirements.txt
setup.py
克隆/下载
install_guide.md 3.56 KB
一键复制 编辑 原始数据 按行查看 历史

安装指导

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

注意:
1.torch2.6不支持python3.8,请优先使用python3.10;
2.qwen3, llama3.3系列模型要求高版本transformers,因此需要使用python3.10及以上版本;

驱动固件安装

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

chmod +x Ascend-hdk-<chip_type>-npu-driver_<version>_linux-<arch>.run
chmod +x Ascend-hdk-<chip_type>-npu-firmware_<version>.run
./Ascend-hdk-<chip_type>-npu-driver_<version>_linux-<arch>.run --full --force
./Ascend-hdk-<chip_type>-npu-firmware_<version>.run --full

CANN安装

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

# 因为版本迭代,包名存在出入,根据实际修改
chmod +x Ascend-cann-toolkit_<version>_linux-<arch>.run
./Ascend-cann-toolkit_<version>_linux-<arch>.run --install
chmod +x Ascend-cann-kernels-<chip_type>_<version>_linux.run
./Ascend-cann-kernels-<chip_type>_<version>_linux.run --install
source /usr/local/Ascend/ascend-toolkit/set_env.sh # 安装nnal包需要source环境变量
chmod +x Ascend-cann-nnal-<chip_type>_<version>_linux.run
./Ascend-cann-nnal-<chip_type>_<version>_linux.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 构建参考 https://gitee.com/ascend/pytorch/releases
pip install torch-2.6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl 
pip install torch_npu-2.6.0rc1-cp310-cp310-manylinux_2_28_aarch64.whl

# apex for Ascend 构建参考 https://gitee.com/ascend/apex
pip install apex-0.1.dev20241015+ascend-cp310-cp310-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 2c085cc9  # checkout commit from MindSpeed core_r0.8.0 in 2025.04.01
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.1.0

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

注意:
1.qwen3, llama3.3系列模型依赖transformers 4.51.0, 需要在环境配置完成后手动执行pip install transformers==4.51.0;

Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/ascend/MindSpeed-LLM.git
git@gitee.com:ascend/MindSpeed-LLM.git
ascend
MindSpeed-LLM
MindSpeed-LLM
2.1.0

搜索帮助