Skip to content

Commit 89204bb

Browse files
aaab8bPanAndy
authored andcommitted
[Hardware] Provide dockerfile and Pre-built docker images for AMD GPUs. Update docs for AMD users.
1 parent fadc52a commit 89204bb

7 files changed

Lines changed: 76 additions & 77 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Leveraging a multi-role distributed architecture with Ray for flexible resource
3737

3838
| 📣 Updates |
3939
|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
40+
| **[08/13/2025]** 🎉 ROLL supports AMD GPUs with out-of-box image docker and Dockerfile and specific yamls under `examples/` directory. Please refer to [Installation](https://alibaba.github.io/ROLL/docs/English/QuickStart/installation). |
4041
| **[08/10/2025]** 🎉 Agentic RL supports [stepwise learning](examples/qwen2.5-0.5B-agentic/agent_val_frozen_lake_gigpo.yaml), like [GiGPO](https://arxiv.org/abs/2505.10978); Distill supports [multi-model model](examples/qwen2.5-vl-7B-distill/distill_vl_megatron.yaml). Explore the new capabilities! |
4142
| **[07/31/2025]** 🎉 Refactor agentic rl design. Support agentic rl [async training](examples/qwen2.5-0.5B-agentic/agent_val_frozen_lake_async.yaml). Explore the new capabilities! |
4243
| **[07/31/2025]** 🎉 Support [DistillPipeline](examples/qwen2.5-7B-distill_megatron/run_distill_pipeline.sh)/[DpoPipeline](examples/qwen2.5-3B-dpo_megatron/run_dpo_pipeline.sh). Support [lora](examples/qwen2.5-7B-rlvr_megatron/rlvr_lora_zero3.yaml). Support [GSPO](https://arxiv.org/abs/2507.18071) |
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM rocm/pytorch-training:v25.6
2+
RUN pip3 install ray==2.48.0 \
3+
&& pip3 install pydantic==2.11.7 \
4+
&& pip3 install huggingface-hub==0.34.0 \
5+
&& pip3 install https://github.com/aaab8b/roll_amd_dependencies/releases/download/v0.1/megatron_core-0.12.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl \
6+
&& pip3 install https://github.com/aaab8b/roll_amd_dependencies/releases/download/v0.1/vllm-0.10.0+rocm634-cp310-cp310-linux_x86_64.whl \
7+
&& pip3 install tensordict \
8+
&&pip3 install modelscope \
9+
&& pip3 install loralib \
10+
&& pip3 install isort \
11+
&& pip3 install jsonlines \
12+
&& pip3 install pyext \
13+
&& pip3 install dacite \
14+
&& pip3 install codetiming \
15+
&& pip3 install swanlab \
16+
&& pip3 install math-verify \
17+
&& pip3 install gym \
18+
&& pip3 install gymnasium[toy-text] \
19+
&& pip3 install gym_sokoban \
20+
&& pip3 install hydra-core \
21+
&& pip3 install latex2sympy2==1.5.4 \
22+
&& pip3 install pycocotools
23+
RUN git clone https://github.com/alibaba/ROLL.git /app/ROLL
24+
25+
WORKDIR /app/ROLL
26+
RUN pip3 install ./mcore_adapter \
27+
&& export PYTHONPATH=/app/ROLL:$PYTHONPATH
28+
29+
RUN sed -i 's/_flash_attn_max_version = PkgVersion("2\.7\.3")/_flash_attn_max_version = PkgVersion("3.0.0.post1")/' /opt/conda/envs/py_3.10/lib/python3.10/site-packages/transformer_engine/pytorch/attention.py
30+

docs_roll/docs/English/QuickStart/image_address.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ We provide pre-built Docker images for a quick start (Links will be updated):
66
* `torch2.5.1 + SGlang0.4.3`: roll-registry.cn-hangzhou.cr.aliyuncs.com/roll/pytorch:nvcr-24.05-py3-torch251-sglang043
77
* `torch2.5.1 + vLLM0.7.3`: roll-registry.cn-hangzhou.cr.aliyuncs.com/roll/pytorch:nvcr-24.05-py3-torch251-vllm073
88

9+
For AMD GPU users, We provided pre-built Docker images for a quick start as well:
10+
* `torch2.8.0 + vLLM0.10.0`: hub.docker.com/r/rlsys/roll_opensource
11+
912
You can also find [Dockerfiles](https://github.com/StephenRi/ROLL/tree/feature/fix-ref-for-docs/docker) under the `docker/` directory to build your own images.

docs_roll/docs/English/QuickStart/installation.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## 🐳 Install from Docker
44

5-
We provide pre-built Docker images for a quick start. Choose your desired image from the [Image Addresses](https://alibaba.github.io/ROLL/docs/English/QuickStart/image_address).
5+
We provide pre-built Docker images both on CUDA and ROCm for a quick start. Choose your desired image from the [Image Addresses](https://alibaba.github.io/ROLL/docs/English/QuickStart/image_address).
66

77
## 🛠️ Install from Custom Environment
88

@@ -22,6 +22,21 @@ cd ROLL
2222
pip install -r requirements.txt # Or follow your specific installation steps
2323
# For development, consider: pip install -e .
2424
```
25+
26+
For AMD users, please ensure you meet the following prerequisites:
27+
28+
```bash
29+
# Prerequisites
30+
ROCm Version >= 6.3.4
31+
PyTorch >= 2.6.0
32+
vLLM >= 0.8.4
33+
# Clone the repository and install
34+
git clone https://github.com/alibaba/ROLL.git
35+
cd ROLL
36+
pip install -r requirements.txt # Or follow your specific installation steps
37+
```
38+
We highly suggest to use pre-built Docker images from [Image Addresses](https://alibaba.github.io/ROLL/docs/English/QuickStart/image_address) instead of installation from Custom Environment for ROCm users.
39+
2540
## 🔄 About Model Checkpoint Format
2641

2742
For `MegatronStrategy`, model checkpoints are saved in Megatron format by default. To convert them back to HuggingFace format, please use the following command:

examples/qwen2.5-0.5B-agentic/agent_val_frozen_lake_amd.yaml

Lines changed: 12 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
defaults:
2-
- ../config/envs@_here_
2+
- ../config/traj_envs@_here_
33
- ../config/deepspeed_zero@_here_
44
- ../config/deepspeed_zero2@_here_
55
- ../config/deepspeed_zero3@_here_
@@ -107,7 +107,7 @@ actor_infer:
107107
strategy_args:
108108
strategy_name: vllm
109109
strategy_config:
110-
gpu_memory_utilization: 0.6
110+
gpu_memory_utilization: 0.4
111111
block_size: 16
112112
load_format: auto
113113
device_mapping: list(range(0,8))
@@ -126,17 +126,6 @@ reference:
126126
device_mapping: list(range(0,8))
127127
infer_batch_size: 2
128128

129-
130-
action_pattern: <answer>(.*?)</answer>
131-
think_action_pattern: <think>(.*?)</think>\s*<answer>(.*?)</answer>
132-
user_prompt_no_think_format: <answer> [your answer] </answer>
133-
user_prompt_think_format: <think> [Your thoughts] </think> <answer> [your answer] </answer>
134-
added_text_no_think: <answer>
135-
added_text_think: <think>
136-
137-
max_tokens_per_step: 128
138-
max_actions_per_traj: 10
139-
140129
reward_normalization:
141130
grouping: traj_group_id # 可以tags(env_type)/traj_group_id(group)/batch(rollout_batch)... group_by计算reward/adv
142131
method: mean_std # asym_clip / identity / mean_std
@@ -158,71 +147,25 @@ val_env_manager:
158147
num_groups_partition: [256, 256, 256, 256] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
159148

160149

150+
# Here, you can override variables defined in the imported envs. max_tokens_per_step: 128 in custom_env.SimpleSokoban, here replaced by 64
151+
max_tokens_per_step: 64
152+
161153
custom_envs:
162154
SimpleSokoban:
163-
env_type: sokoban
164-
max_tokens_per_step: ${max_tokens_per_step}
165-
user_prompt_format: ${user_prompt_no_think_format}
166-
added_text: ${added_text_no_think}
167-
env_manager_cls: roll.pipeline.agentic.env_manager.traj_env_manager.TrajEnvManager
168-
use_thread_lock: true
169-
env_config: # keys should be a subset of SokobanConfig
170-
env_instruction: "You are solving the Sokoban puzzle. You are the player and you need to push all boxes to targets. When you are right next to a box, you can push it by moving in the same direction. You cannot push a box through a wall, and you cannot pull a box. The answer must be one of action in a turn, format is <answer>Right</answer>"
171-
action_pattern: ${action_pattern}
172-
max_steps: ${max_actions_per_traj}
173-
dim_x: 6
174-
dim_y: 6
175-
num_boxes: 1
155+
${custom_env.SimpleSokoban}
176156
LargerSokoban:
177-
env_type: sokoban
178-
max_tokens_per_step: ${max_tokens_per_step}
179-
user_prompt_format: ${user_prompt_no_think_format}
180-
added_text: ${added_text_no_think}
181-
env_manager_cls: roll.pipeline.agentic.env_manager.traj_env_manager.TrajEnvManager
182-
use_thread_lock: true
183-
env_config:
184-
env_instruction: "You are solving the Sokoban puzzle. You are the player and you need to push all boxes to targets. When you are right next to a box, you can push it by moving in the same direction. You cannot push a box through a wall, and you cannot pull a box. The answer must be one of action in a turn, format is <answer>Right</answer>"
185-
action_pattern: ${action_pattern}
186-
max_steps: ${max_actions_per_traj}
187-
dim_x: 8
188-
dim_y: 8
189-
num_boxes: 2
190-
search_depth: 10
157+
${custom_env.LargerSokoban}
191158
SokobanDifferentGridVocab:
192-
env_type: sokoban
193-
max_tokens_per_step: ${max_tokens_per_step}
194-
user_prompt_format: ${user_prompt_no_think_format}
195-
added_text: ${added_text_no_think}
196-
env_manager_cls: roll.pipeline.agentic.env_manager.traj_env_manager.TrajEnvManager
197-
use_thread_lock: true
198-
env_config: # keys should be a subset of SokobanConfig
199-
env_instruction: "You are solving the Sokoban puzzle. You are the player and you need to push all boxes to targets. When you are right next to a box, you can push it by moving in the same direction. You cannot push a box through a wall, and you cannot pull a box. The answer must be one of action in a turn, format is <answer>Right</answer>"
200-
action_pattern: ${action_pattern}
201-
max_steps: ${max_actions_per_traj}
202-
search_depth: 30
203-
dim_x: 6
204-
dim_y: 6
205-
num_boxes: 1
206-
grid_lookup: { 0: "W", 1: ".", 2: "G", 3: "C", 4: "B", 5: "A", 6: "@" }
207-
grid_vocab: { "W": "wall", ".": "empty", "G": "target", "C": "box on target", "B": "box", "A": "player", "@": "player on target" }
159+
${custom_env.SokobanDifferentGridVocab}
208160
FrozenLake:
209-
env_type: frozen_lake
210-
max_tokens_per_step: ${max_tokens_per_step}
211-
user_prompt_format: ${user_prompt_no_think_format}
212-
added_text: ${added_text_no_think}
213-
env_manager_cls: roll.pipeline.agentic.env_manager.traj_env_manager.TrajEnvManager
214-
use_thread_lock: true
215-
env_config:
216-
env_instruction: "You are solving the FrozenLake puzzle. Forbid the whole and go to the target. You may move to the unintended direction due to the slippery ice. The answer must be one of action in a turn, format is <answer>Right</answer>"
217-
action_pattern: ${action_pattern}
218-
max_steps: ${max_actions_per_traj}
219-
is_slippery: false
161+
${custom_env.FrozenLake}
220162
FrozenLakeThink:
163+
${custom_env.FrozenLakeThink}
164+
FrozenLakeLocallyDefineExamples: # Can import from unified envs config or define dict locally
221165
env_type: frozen_lake
222166
max_tokens_per_step: ${max_tokens_per_step}
223167
user_prompt_format: ${user_prompt_think_format}
224-
added_text: ${added_text_think}
225-
env_manager_cls: roll.pipeline.agentic.env_manager.traj_env_manager.TrajEnvManager
168+
env_manager_cls: ${env_manager_cls}
226169
use_thread_lock: true
227170
env_config:
228171
env_instruction: "You are solving the FrozenLake puzzle. Forbid the whole and go to the target. You may move to the unintended direction due to the slippery ice. The answer must be one of action in a turn, format is <answer>Right</answer>"

roll/distributed/scheduler/log_monitor.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,20 @@ def __init__(self):
188188
self.node_ip_address = ray.util.get_node_ip_address()
189189
self.rank = get_driver_rank()
190190
self.world_size = get_driver_world_size()
191-
self.log_monitor = LogMonitor(
192-
node_ip_address=self.node_ip_address,
193-
logs_dir=self.log_dir,
194-
gcs_publisher=StdPublisher(),
195-
is_proc_alive_fn=is_proc_alive,
196-
)
191+
if ray.__version__ <"2.47.0":
192+
self.log_monitor = LogMonitor(
193+
node_ip_address=self.node_ip_address,
194+
logs_dir=self.log_dir,
195+
gcs_publisher=StdPublisher(),
196+
is_proc_alive_fn=is_proc_alive,
197+
)
198+
else:
199+
self.log_monitor = LogMonitor(
200+
node_ip_address=self.node_ip_address,
201+
logs_dir=self.log_dir,
202+
gcs_client=StdPublisher(),
203+
is_proc_alive_fn=is_proc_alive,
204+
)
197205
monitor_logger.setLevel(logging.CRITICAL)
198206

199207
self.exception_monitor = None

roll/third_party/vllm/vllm_0_10_0/llm.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ def add_requests(
187187
params=sampling_params,
188188
arrival_time=time.time(),
189189
lora_request=lora_request,
190-
prompt_adapter_request=None,
191190
)
192191

193192
def abort_request(self, request_id: Union[str, Iterable[str]]) -> None:

0 commit comments

Comments
 (0)