refactor: separate sglang argparse from megatron with two-phase parsing - #1600
Merged
Merged
Conversation
zhuzilin
commented
Feb 20, 2026
Contributor
- Add sglang_parse_args() for independent sglang arg parsing (Phase 1)
- Add megatron_parse_args() / fsdp_parse_args() with ignore_unknown_args (Phase 2)
- Move backend-specific validation and defaults into respective backend modules
- Unify naming: sglang_parse_args, megatron_parse_args, fsdp_parse_args
- Pre-parse --train-backend, --debug-* flags in _pre_parse_mode() to avoid duplication
- Remove dead code parse_args_train_backend()
- Add test: test_qwen2.5_0.5B_debug_rollout_then_train.py (rollout-only then train-only)
- Register new test in CI (run-ci-megatron, run-ci-image)
- Add sglang_parse_args() for independent sglang arg parsing (Phase 1) - Add megatron_parse_args() / fsdp_parse_args() with ignore_unknown_args (Phase 2) - Move backend-specific validation and defaults into respective backend modules - Unify naming: sglang_parse_args, megatron_parse_args, fsdp_parse_args - Pre-parse --train-backend, --debug-* flags in _pre_parse_mode() to avoid duplication - Remove dead code parse_args_train_backend() - Add test: test_qwen2.5_0.5B_debug_rollout_then_train.py (rollout-only then train-only) - Register new test in CI (run-ci-megatron, run-ci-image)
…g args.debug_rollout_only args.debug_rollout_only is now set by _pre_parse_mode and merged after megatron_parse_args returns, so it's not available during parsing.
Skip megatron init(args) entirely in debug_rollout_only mode since megatron_validate_args is not run and attributes like virtual_pipeline_model_parallel_size are not set.
- actor.train: early return before _get_rollout_data (rollout manager returns None) - rollout manager: skip _convert_samples_to_train_data in debug_rollout_only - fix typo: self.debug_rollout_only -> self.args.debug_rollout_only - move log_rollout_data out of debug_rollout_only branch
- train_actor: skip set_train_parallel_config when debug_rollout_only (train_parallel_config is not set since actor.init returns early) - rollout: skip trim/dynamic-batch-size logic in debug_rollout_only (avoids accessing unset train_parallel_config)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.