|
Download frameworks/slime/docker/npu_patch/README.md from SeanWang0027/rose-opd-implementation: direct link, hf CLI and curl.
- Browser
- Download file 6.46 kB
-
https://huggingface.co/SeanWang0027/rose-opd-implementation/resolve/main/frameworks/slime/docker/npu_patch/README.md
- Command line
-
hf download hf://SeanWang0027/rose-opd-implementation/frameworks/slime/docker/npu_patch/README.md
-
curl -L -o README.md https://huggingface.co/SeanWang0027/rose-opd-implementation/resolve/main/frameworks/slime/docker/npu_patch/README.md
6.46 kB
Slime NPU Patch Installation Guide
This guide provides instructions for installing Slime with NPU support, including all required dependencies and patches.
Component Version Mapping
| Component | Version/Commit | Source |
|---|---|---|
| Slime | v0.2.2 | GitHub |
| SGLang | dce8b0606c06d3a191a24c7b8cbe8e238ab316c9 | GitHub |
| SGL Kernel NPU | 2026.02.01 | GitHub |
| Megatron-Bridge | 35b4ebfc486fb15dcc0273ceea804c3606be948a | GitHub |
| Megatron-LM | 3714d81d418c9f1bca4594fc35f9e8289f652862 | GitHub |
| MindSpeed | fc63de5c48426dd019c3b3f39e65f5bdf56e4086 | GitCode |
| HDK | 25.3.RC1 | Ascend |
| CANN | 8.5.0 | Ascend |
Preparing the Running Environment
Python Version
Only python==3.11 is supported currently.
conda create -n slime_release python=3.11
conda activate slime_release
Working Directory Setup
mkdir <WORKSPACE> && cd <WORKSPACE>
CANN Environment
Prior to start work with Slime on Ascend you need to install CANN Toolkit, Kernels operator package and NNAL version 8.5.0, check the installation guide
source <CANN_PATH>/ascend-toolkit/set_env.sh
source <CANN_PATH>/nnal/atb/set_env.sh
PyTorch and PyTorch NPU
pip install torch-npu==2.8.0
Installing Dependencies
SGLang
cd <WORKSPACE>
git clone https://github.com/sgl-project/sglang.git && cd sglang
git checkout dce8b0606c06d3a191a24c7b8cbe8e238ab316c9
mv python/pyproject.toml python/pyproject.toml.backup
mv python/pyproject_other.toml python/pyproject.toml
pip install -e "python[srt_npu]"
pip install torch-npu==2.8.0
SGL Kernel NPU and Torch Memory Saver
Download sgl-kernel-npu-2026.02.01-torch2.8.0-py311-cann8.5.0-a3-aarch64.zip from the release link, then install:
pip install sgl_kernel_npu-2026.2.1-cp311-cp311-linux_aarch64.whl
pip install torch_memory_saver-0.0.8-cp311-cp311-linux_aarch64.whl
Megatron-Bridge
pip install git+https://github.com/ISEEKYAN/mbridge.git@89eb10887887bc74853f89a4de258c0702932a1c --no-deps
cd <WORKSPACE>
git clone https://github.com/fzyzcjy/Megatron-Bridge.git -b dev_rl
pip install nvidia-modelopt[torch]>=0.37.0 --no-build-isolation
Megatron-LM
cd <WORKSPACE>
git clone https://github.com/NVIDIA/Megatron-LM.git --recursive && \
cd Megatron-LM/ && git checkout 3714d81d418c9f1bca4594fc35f9e8289f652862 && \
pip install -e .
MindSpeed
cd <WORKSPACE>
git clone https://gitcode.com/Ascend/MindSpeed.git && \
cd MindSpeed/ && git checkout fc63de5c48426dd019c3b3f39e65f5bdf56e4086 && \
pip install -e .
Slime
cd <WORKSPACE>
git clone https://github.com/ascend-slime/slime.git && cd slime
cp -r docker/npu_patch ../npu_patch
git checkout v0.2.2
pip install -e .
Applying Patches
cd <WORKSPACE>/slime
git apply ../npu_patch/slime.patch
cd <WORKSPACE>/sglang
git apply ../slime/docker/patch/v0.5.7/sglang.patch
git apply ../npu_patch/sglang.patch
cd <WORKSPACE>/Megatron-LM
git apply ../slime/docker/patch/v0.5.7/megatron.patch
git apply ../npu_patch/megatron.patch
cd <WORKSPACE>/Megatron-Bridge
git apply ../npu_patch/megatron-bridge.patch
cd <WORKSPACE>/MindSpeed
git apply ../npu_patch/mindspeed.patch
Additional Dependencies
cd <WORKSPACE>/slime
pip install triton-ascend
pip install torch-npu==2.8.0
pip install torchvision==0.23.0
pip install numpy==1.26.0
Running the Training
Configuration
Modify the paths in the following files according to your environment (note to use your CANN version):
Common (both GRPO and PPO):
slime/utils/external_utils/command_utils.py
GRPO:
examples/geo3k_vlm_multi_turn/run_grpo_npu.shexamples/geo3k_vlm_multi_turn/run_geo3k_vlm_multi_turn_grpo_npu.py
PPO:
examples/geo3k_vlm_multi_turn/run_ppo_npu.shexamples/geo3k_vlm_multi_turn/run_geo3k_vlm_multi_turn_ppo_npu.py
Dataset
Download the dataset from HuggingFace following the instructions in the script directory.
Execute Training
cd <WORKSPACE>/slime
# GRPO
bash examples/geo3k_vlm_multi_turn/run_grpo_npu.sh
# PPO
bash examples/geo3k_vlm_multi_turn/run_ppo_npu.sh
To save logs and display them simultaneously:
# GRPO
bash examples/geo3k_vlm_multi_turn/run_grpo_npu.sh 2>&1 | tee -a <LOG_FILE>
# PPO
bash examples/geo3k_vlm_multi_turn/run_ppo_npu.sh 2>&1 | tee -a <LOG_FILE>
Placeholders Reference
| Placeholder | Description | Example |
|---|---|---|
<WORKSPACE> |
Root directory for all installations | /root/slime-release |
<CANN_PATH> |
Path to CANN installation directory | /usr/local/ascend |
<LOG_FILE> |
Path to log file for training output | training.log |