|
| 1 | +# ROLL x Ascend |
| 2 | + |
| 3 | +Last updated: 09/04/2025. |
| 4 | + |
| 5 | +我们在 ROLL 上增加对华为昇腾设备的支持。 |
| 6 | + |
| 7 | +## 硬件支持 |
| 8 | + |
| 9 | +Atlas 900 A2 PODc |
| 10 | + |
| 11 | + |
| 12 | +## 安装 |
| 13 | + |
| 14 | + |
| 15 | +### 基础环境准备 |
| 16 | + |
| 17 | +| software | version | |
| 18 | +|-----------|-------------| |
| 19 | +| Python | 3.10 | |
| 20 | +| CANN | 8.1.RC1 | |
| 21 | + |
| 22 | +### 创建 conda 环境 |
| 23 | + |
| 24 | + |
| 25 | +使用以下命令在 Miniconda 中创建新的 conda 环境: |
| 26 | + |
| 27 | +``` |
| 28 | +conda create --name roll python=3.10 |
| 29 | +conda activate roll |
| 30 | +``` |
| 31 | + |
| 32 | +### 安装 torch & torch_npu: |
| 33 | + |
| 34 | + |
| 35 | +为了能在 ROLL 中正常使用 torch 和 torch_npu,需使用以下命令安装 torch 和 torch_npu。 |
| 36 | + |
| 37 | +``` |
| 38 | +# 安装 torch 的 CPU 版本 |
| 39 | +pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cpu |
| 40 | +
|
| 41 | +# 安装 torch_npu |
| 42 | +pip install torch_npu==2.5.1 |
| 43 | +``` |
| 44 | + |
| 45 | + |
| 46 | +### 安装vllm & vllm-ascend: |
| 47 | + |
| 48 | +为了能够在 ROLL 中正常使用 vllm,需使用以下命令编译安装 vllm 和 vllm-ascend。 |
| 49 | + |
| 50 | +``` |
| 51 | +# vllm |
| 52 | +git clone -b v0.8.4 --depth 1 https://github.com/vllm-project/vllm.git |
| 53 | +cd vllm |
| 54 | +
|
| 55 | +VLLM_TARGET_DEVICE=empty pip install -v -e . |
| 56 | +cd .. |
| 57 | +``` |
| 58 | + |
| 59 | +``` |
| 60 | +# vllm-ascend |
| 61 | +git clone -b v0.8.4rc2 --depth 1 https://github.com/vllm-project/vllm-ascend.git |
| 62 | +cd vllm-ascend |
| 63 | +
|
| 64 | +export COMPILE_CUSTOM_KERNELS=1 |
| 65 | +pip install -e . |
| 66 | +cd .. |
| 67 | +``` |
| 68 | + |
| 69 | +如果在安装 vllm-ascend 时遇到类似以下问题: |
| 70 | + |
| 71 | +``` |
| 72 | +RuntimeError: CMake configuration failed: Command '['/pathto/miniconda3/envs/roll/bin/python3.10', '-m', 'pybind11', '--cmake']' returned non-zero exit status 2. |
| 73 | +``` |
| 74 | + |
| 75 | +可尝试在 vllm-ascend 目录下 setup.py 文件 151-158 行进行如下修改并重新进行编译: |
| 76 | + |
| 77 | +``` |
| 78 | +try: |
| 79 | + # if pybind11 is installed via pip |
| 80 | + pybind11_cmake_path = (subprocess.check_output( |
| 81 | + [python_executable, "-m", "pybind11", |
| 82 | + "--cmakedir"]).decode().strip()) |
| 83 | +except subprocess.CalledProcessError as e: |
| 84 | + # else specify pybind11 path installed from source code on CI container |
| 85 | + raise RuntimeError(f"CMake configuration failed: {e}") |
| 86 | +``` |
| 87 | + |
| 88 | +### 安装 ROLL |
| 89 | + |
| 90 | +``` |
| 91 | +git clone https://github.com/alibaba/ROLL.git |
| 92 | +cd ROLL |
| 93 | +pip install -r requirements_common.txt |
| 94 | +pip install deepspeed==0.16.0 |
| 95 | +cd .. |
| 96 | +``` |
| 97 | + |
| 98 | +### 其他三方库说明 |
| 99 | + |
| 100 | +| software | description | |
| 101 | +|-------------------------------|---------------| |
| 102 | +| transformers | v4.52.4 | |
| 103 | +| flash_attn | not supported | |
| 104 | +| transformer-engine[pytorch] | not supported | |
| 105 | + |
| 106 | +1. 支持通过 transformers 使能 --flash_attention_2, transformers 需等于 4.52.4版本。 |
| 107 | +2. 不支持通过 flash_attn 使能 flash attention 加速。 |
| 108 | +3. 暂不支持 transformer-engine[pytorch] |
| 109 | + |
| 110 | +``` |
| 111 | +pip install transformers==4.52.4 |
| 112 | +``` |
| 113 | + |
| 114 | +## 快速开始,单节点部署指引 |
| 115 | + |
| 116 | +正式使用前,建议您通过对单节点流水线的训练尝试以检验环境准备和安装的正确性。 |
| 117 | +由于目前暂不支持 Megatron-LM 训练,请首先将对应文件中 |
| 118 | +strategy_args 参数修改为 deepspeed 选项。 |
| 119 | + |
| 120 | +1. 使用 shell 执行单节点流水线 |
| 121 | + |
| 122 | +``` |
| 123 | +bash examples/agentic_demo/run_agentic_pipeline_frozen_lake_single_node_demo.sh |
| 124 | +``` |
| 125 | + |
| 126 | +2. 使用配置文件执行 agentic pipeline |
| 127 | + |
| 128 | +``` |
| 129 | +# 确保当前位于ROLL项目目录的根目录下 |
| 130 | +# export PYTHONPATH=$(pwd):$PYTHONPATH |
| 131 | +
|
| 132 | +python examples/start_agentic_pipeline.py \ |
| 133 | + --config_path qwen2.5-0.5B-agentic \ |
| 134 | + --config_name agentic_val_sokoban |
| 135 | +
|
| 136 | +- ``--config_path`` – 包含您的YAML配置文件的目录。 |
| 137 | +- ``--config_name`` – 文件名(不含.yaml后缀)。 |
| 138 | +``` |
| 139 | + |
| 140 | +## 支持现状 |
| 141 | + |
| 142 | +| Feature | Example | Training Backend | Inference Backend | Hardware | |
| 143 | +| --------------- | ------------------------------------------------------------ | ---------------- | ----------------- | ----------------- | |
| 144 | +| Agentic | examples/qwen2.5-0.5B-agentic/run_agentic_pipeline_sokoban.sh | DeepSpeed | vLLM | Atlas 900 A2 PODc | |
| 145 | +| Agentic-Rollout | examples/qwen2.5-0.5B-agentic/run_agentic_rollout_sokoban.sh | DeepSpeed | vLLM | Atlas 900 A2 PODc | |
| 146 | +| DPO | examples/qwen2.5-3B-dpo_megatron/run_dpo_pipeline.sh | DeepSpeed | vLLM | Atlas 900 A2 PODc | |
| 147 | +| RLVR | examples/qwen2.5-7B-rlvr_megatron/run_rlvr_pipeline.sh | DeepSpeed | vLLM | Atlas 900 A2 PODc | |
| 148 | + |
| 149 | + |
| 150 | +## 声明 |
| 151 | +ROLL 中提供的 Ascend 支持代码皆为参考样例,生产环境使用请通过官方正式途径沟通,谢谢。 |
0 commit comments