Skip to content

Conversation

@yiakwy-xpu-ml-framework-team
Copy link

@yiakwy-xpu-ml-framework-team yiakwy-xpu-ml-framework-team commented Dec 3, 2025

What does this PR do?

Add concise overview of what this PR aims to achieve or accomplish. Reference related GitHub issues and PRs that help with the review.

This is follow up of #4323 to add SGLang running example

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, sglang, vllm, rollout, trainer, ci, training_utils, recipe, hardware, deployment, ray, worker, single_controller, misc, perf, model, algo, env, tool, ckpt, doc, data
    • 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.

py312+torch2.8+vllm0.11+sglang0.5.5+te2.9

截屏2025-12-04 17 10 05

docker:

Build Instruction:

vllm:

  • training curve
截屏2025-12-04 17 26 41
  • memory footprint
截屏2025-12-04 17 43 24

sglang:

  • V1
    截屏2025-12-05 13 50 59

    In our first trial, single node version of SGLang has unusual memory footprint (with the same test codes , just change vLLM to SGlang), we are currently working on improving its memory efficiency.


py312+torch2.9.1+sglang0.5.5+te2.9

sglang:

Benchmark

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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for the sglang-megatron backend by adding a new example script and modifying an import fallback. My review has identified a critical security vulnerability due to a hardcoded API key in the example script, which must be removed and the key revoked. Additionally, a high-severity typo in the Python code could lead to import errors under certain conditions and should be corrected.

clean file

add instructions
@yiakwy-xpu-ml-framework-team yiakwy-xpu-ml-framework-team force-pushed the add_gpt_oss_megatron_sglang_support branch from 1b4440f to a574734 Compare December 3, 2025 04:18
@wuxibin89 wuxibin89 changed the title add sglang-megatron backend support [trainer] feat: add gpt-oss sglang-megatron example Dec 8, 2025
raise

__all__ = ["AutoBridge", "make_value_model", "freeze_moe_router"]
from megatron.bridge import AutoBridge
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to use Megatron-Bridge instead of mbridge, please set

actor_rollout_ref.actor.megatron.vanilla_mbridge=False

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we already have it :

截屏2025-12-08 16 50 43

Currently we test with standard bridge supported by NVIDIA both verl and megatron. It works well.

logger = logging.getLogger(__file__)
logger.setLevel(os.getenv("VERL_LOGGING_LEVEL", "WARN"))

load_actor_from_cpu=os.getenv("MEGATRON_VERL_LOAD_FROM_CPU", "1") == "1"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need this instead of megatron.param_offload=True?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @wuxibin89 megatron-bridge supports to load modules directly from cpu :

self.bridge.export_hf_weights(self.actor.actor_module, cpu=load_actor_from_cpu, show_progress=False)

If that is true we don't need to reload parameters from cpu to gpu , then offload megatron module to cpu.

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.

4 participants