Skip to content

Commit fadc52a

Browse files
bingzhaodongPanAndy
authored andcommitted
[Hardware]Add support of 0.5B, 7B and 30B models on AMD GPUs.
1 parent e2b1faf commit fadc52a

22 files changed

Lines changed: 2731 additions & 11 deletions

File tree

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
defaults:
2+
- ../config/envs@_here_
3+
- ../config/deepspeed_zero@_here_
4+
- ../config/deepspeed_zero2@_here_
5+
- ../config/deepspeed_zero3@_here_
6+
- ../config/deepspeed_zero3_cpuoffload@_here_
7+
8+
hydra:
9+
run:
10+
dir: .
11+
output_subdir: null
12+
13+
exp_name: "agentic_pipeline"
14+
seed: 42
15+
logging_dir: ./output/logs
16+
output_dir: ./output
17+
render_save_dir: ./output/render
18+
system_envs:
19+
USE_MODELSCOPE: '1'
20+
21+
#track_with: wandb
22+
#tracker_kwargs:
23+
# api_key:
24+
# project: roll-agentic
25+
# name: ${exp_name}_sokoban
26+
# notes: "agentic_pipeline"
27+
# tags:
28+
# - agentic
29+
# - roll
30+
# - baseline
31+
32+
track_with: tensorboard
33+
tracker_kwargs:
34+
log_dir: /data/oss_bucket_0/yali/llm/tensorboard/roll_exp/agentic_frozen_lake
35+
36+
37+
checkpoint_config:
38+
type: file_system
39+
output_dir: /data/cpfs_0/rl_examples/models/${exp_name}
40+
41+
num_gpus_per_node: 8
42+
43+
max_steps: 1024
44+
save_steps: 10000
45+
logging_steps: 1
46+
eval_steps: 10
47+
resume_from_checkpoint: false
48+
49+
rollout_batch_size: 1024
50+
val_batch_size: 1024
51+
sequence_length: 8192
52+
53+
advantage_clip: 0.2
54+
ppo_epochs: 1
55+
adv_estimator: "grpo"
56+
#pg_clip: 0.1
57+
#dual_clip_loss: True
58+
init_kl_coef: 0.0
59+
whiten_advantages: true
60+
entropy_loss_coef: 0
61+
max_grad_norm: 1.0
62+
63+
pretrain: Qwen/Qwen2.5-0.5B-Instruct
64+
reward_pretrain: Qwen/Qwen2.5-0.5B-Instruct
65+
66+
actor_train:
67+
model_args:
68+
attn_implementation: fa2
69+
disable_gradient_checkpointing: false
70+
dtype: bf16
71+
model_type: ~
72+
training_args:
73+
learning_rate: 1.0e-6
74+
weight_decay: 0
75+
per_device_train_batch_size: 2
76+
gradient_accumulation_steps: 64
77+
warmup_steps: 10
78+
lr_scheduler_type: cosine
79+
data_args:
80+
template: qwen2_5
81+
strategy_args:
82+
# strategy_name: deepspeed_train
83+
# strategy_config: ${deepspeed_zero3}
84+
strategy_name: megatron_train
85+
strategy_config:
86+
tensor_model_parallel_size: 1
87+
pipeline_model_parallel_size: 1
88+
expert_model_parallel_size: 1
89+
use_distributed_optimizer: true
90+
recompute_granularity: full
91+
device_mapping: list(range(0,8))
92+
infer_batch_size: 2
93+
94+
actor_infer:
95+
model_args:
96+
disable_gradient_checkpointing: true
97+
dtype: bf16
98+
generating_args:
99+
max_new_tokens: 128 # single-turn response length
100+
top_p: 0.99
101+
top_k: 100
102+
num_beams: 1
103+
temperature: 0.99
104+
num_return_sequences: 1
105+
data_args:
106+
template: qwen2_5
107+
strategy_args:
108+
strategy_name: vllm
109+
strategy_config:
110+
gpu_memory_utilization: 0.6
111+
block_size: 16
112+
load_format: auto
113+
device_mapping: list(range(0,8))
114+
115+
reference:
116+
model_args:
117+
attn_implementation: fa2
118+
disable_gradient_checkpointing: true
119+
dtype: bf16
120+
model_type: ~
121+
data_args:
122+
template: qwen2_5
123+
strategy_args:
124+
strategy_name: hf_infer
125+
strategy_config: ~
126+
device_mapping: list(range(0,8))
127+
infer_batch_size: 2
128+
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+
140+
reward_normalization:
141+
grouping: traj_group_id # 可以tags(env_type)/traj_group_id(group)/batch(rollout_batch)... group_by计算reward/adv
142+
method: mean_std # asym_clip / identity / mean_std
143+
144+
train_env_manager:
145+
format_penalty: -0.15 # sokoban env penalty_for_step=-0.1
146+
max_env_num_per_worker: 16
147+
num_env_groups: 128
148+
# under the same group, the env config and env seed are ensured to be equal
149+
group_size: 8
150+
tags: [FrozenLake]
151+
num_groups_partition: [128] # 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
152+
153+
val_env_manager:
154+
max_env_num_per_worker: 32
155+
num_env_groups: 1024
156+
group_size: 1 # should be set to 1 because val temperature is set to 0 and same prompt leads to same output
157+
tags: [SimpleSokoban, LargerSokoban, SokobanDifferentGridVocab, FrozenLake]
158+
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
159+
160+
161+
custom_envs:
162+
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
176+
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
191+
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" }
208+
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
220+
FrozenLakeThink:
221+
env_type: frozen_lake
222+
max_tokens_per_step: ${max_tokens_per_step}
223+
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
226+
use_thread_lock: true
227+
env_config:
228+
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>"
229+
action_pattern: ${think_action_pattern}
230+
max_steps: ${max_actions_per_traj}
231+
is_slippery: false

0 commit comments

Comments
 (0)