Fix Qwen3 thinking mode + increase max_new_tokens: training/train_grpo.py
Browse files- training/train_grpo.py +10 -6
training/train_grpo.py
CHANGED
|
@@ -176,7 +176,7 @@ class TrainConfig:
|
|
| 176 |
# Sampling
|
| 177 |
sample_temperature: float = 1.0
|
| 178 |
sample_top_p: float = 0.95
|
| 179 |
-
max_new_tokens: int =
|
| 180 |
max_prompt_tokens: int = 2048
|
| 181 |
|
| 182 |
# Tiny behavior warm-start. Smoke showed the raw model sometimes echoes the
|
|
@@ -338,11 +338,15 @@ def run_format_warmup(
|
|
| 338 |
for action_dict in _format_warmup_actions(env, task_id):
|
| 339 |
user_msg = build_observation_prompt(obs, is_first=(len(messages) == 1))
|
| 340 |
messages.append({"role": "user", "content": user_msg})
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
completion_text = json.dumps(action_dict, ensure_ascii=False)
|
| 347 |
prompt_ids = tokenizer(
|
| 348 |
prompt_text,
|
|
|
|
| 176 |
# Sampling
|
| 177 |
sample_temperature: float = 1.0
|
| 178 |
sample_top_p: float = 0.95
|
| 179 |
+
max_new_tokens: int = 384
|
| 180 |
max_prompt_tokens: int = 2048
|
| 181 |
|
| 182 |
# Tiny behavior warm-start. Smoke showed the raw model sometimes echoes the
|
|
|
|
| 338 |
for action_dict in _format_warmup_actions(env, task_id):
|
| 339 |
user_msg = build_observation_prompt(obs, is_first=(len(messages) == 1))
|
| 340 |
messages.append({"role": "user", "content": user_msg})
|
| 341 |
+
try:
|
| 342 |
+
prompt_text = tokenizer.apply_chat_template(
|
| 343 |
+
messages, tokenize=False, add_generation_prompt=True,
|
| 344 |
+
enable_thinking=False,
|
| 345 |
+
)
|
| 346 |
+
except TypeError:
|
| 347 |
+
prompt_text = tokenizer.apply_chat_template(
|
| 348 |
+
messages, tokenize=False, add_generation_prompt=True,
|
| 349 |
+
)
|
| 350 |
completion_text = json.dumps(action_dict, ensure_ascii=False)
|
| 351 |
prompt_ids = tokenizer(
|
| 352 |
prompt_text,
|