Skip to content

[megatron] fix: megatron args for fully async recipe#5092

Closed
yyDing1 wants to merge 1 commit intoverl-project:mainfrom
yyDing1:fully-async-megatron
Closed

[megatron] fix: megatron args for fully async recipe#5092
yyDing1 wants to merge 1 commit intoverl-project:mainfrom
yyDing1:fully-async-megatron

Conversation

@yyDing1
Copy link
Copy Markdown
Collaborator

@yyDing1 yyDing1 commented Jan 28, 2026

What does this PR do?

Some config args are modified in the initialization of ray_trainer to fit the megatron setting, specifically

try:
OmegaConf.set_struct(self.config, True)
with open_dict(self.config):
if OmegaConf.select(self.config, "actor_rollout_ref.actor.optim"):
self.config.actor_rollout_ref.actor.optim.total_training_steps = total_training_steps
if OmegaConf.select(self.config, "critic.optim"):
self.config.critic.optim.total_training_steps = total_training_steps
except Exception as e:
print(f"Warning: Could not set total_training_steps in config. Structure missing? Error: {e}")

The above code is only invoked in fully-async-rollout when creating the rollout dataloader, while the initialization of fully-async-trainer does not contain the above logic. The megatron trainer should rely on this arg in init_worker, so it will cause an error in the initialization of the megatron optimizer.

My solution:

  1. init rollouter and get total_training_steps
  2. the optimizer step should be total_training_steps * trigger_parameter_sync_step
  3. update the config and use the updated config to init trainer

Checklist Before Starting

  • Search for similar PRs. Paste at least one query link here: ...
  • Format the PR title as [{modules}] {type}: {description} (This will be checked by the CI)
    • {modules} include fsdp, megatron, veomni, sglang, vllm, rollout, trainer, ci, training_utils, recipe, hardware, deployment, ray, worker, single_controller, misc, perf, model, algo, env, tool, ckpt, doc, data, cfg, reward
    • If this PR involves multiple modules, separate them with , like [megatron, fsdp, doc]
    • {type} is in feat, fix, refactor, chore, test
    • If this PR breaks any API (CLI arguments, config, function signature, etc.), add [BREAKING] to the beginning of the title.
    • Example: [BREAKING][fsdp, megatron] feat: dynamic batching

Test

For changes that can not be tested by CI (e.g., algorithm implementation, new model support), validate by experiment(s) and show results like training curve plots, evaluation results, etc.

API and Usage Example

Demonstrate how the API changes if any, and provide usage example(s) if possible.

# Add code snippet or script demonstrating how to use this

Design & Code Changes

Demonstrate the high-level design if this PR is complex, and list the specific changes.

Checklist Before Submitting

Important

Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review.

@wuxibin89 wuxibin89 closed this Feb 13, 2026
@yyDing1 yyDing1 deleted the fully-async-megatron branch March 3, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants