Repository navigation
Add Cosmos3 Edge and Distilled checkpoints support - #31590
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds support for the Cosmos3-Edge model variant and distilled checkpoints in the SGLang multimodal generation pipeline. Key changes include implementing dense squared-ReLU MLPs, supporting optional QK-normalization, dynamically resolving sampling defaults (resolution, guidance, and steps) for Edge and distilled checkpoints, and ensuring stochastic noise is consistently seeded across sequence-parallel ranks. Reviewer feedback highlights several improvement opportunities, such as resetting the scheduler shift to 1.0 for distilled checkpoints to prevent double-shifting, adding defensive guards against null or empty model paths and server arguments to avoid potential crashes, wrapping signature inspection in a try-except block, and aligning the torch Generator's device with the latents to prevent device mismatch errors.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
b010020 to
e66d109
Compare
| fps: int = 24 | ||
|
|
||
| guidance_scale: float = 4.0 | ||
| guidance_scale: float | None = None |
There was a problem hiding this comment.
@nv-dmajchrowski
I think this default will make warmup fail. See following error for warmup:
[07-17 22:30:40] Synthetic server warmup failed; continuing startup
Traceback (most recent call last):
File "/sgl-workspace/sglang/python/sglang/multimodal_gen/runtime/server_warmup.py", line 160, in run_async_client_warmup
for req in build_client_warmup_reqs(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/multimodal_gen/runtime/server_warmup.py", line 135, in build_client_warmup_reqs
warmup_reqs = build_warmup_reqs(
^^^^^^^^^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/multimodal_gen/runtime/warmup_request_builder.py", line 392, in build_warmup_reqs
req = Req(**prompt_req_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/sgl-workspace/sglang/python/sglang/multimodal_gen/runtime/pipelines_core/schedule_batch.py", line 247, in init
self.validate()
File "/sgl-workspace/sglang/python/sglang/multimodal_gen/runtime/pipelines_core/schedule_batch.py", line 360, in validate
if cfg_scale > 1.0 and self.negative_prompt is not None:
^^^^^^^^^^^^^^^
TypeError: '>' not supported between instances of 'NoneType' and 'float'
There was a problem hiding this comment.
Thanks for pointing out, I've pushed the fix.
|
/tag-and-rerun-ci |
d570bc0 to
4c95be4
Compare
|
@mickqian after the previous approval we had to add few more changes (edge checkpoint format changed slightly after the release + we had small accuracy issues). We have completed accuracy testing for both edge and distil and the number looks good, so from our side this PR is ready to be merged. Could you review, so we can merge it and follow up with user guides for sglang on github and HF? FYI, I will be off next 2 weeks, @kediwu0331 will help resolving any comments on this. |
4c95be4 to
ad7af0c
Compare
|
@nv-dmajchrowski @kediwu0331 of course, genuinely appreciate your help |
|
also please fix lint |
|
@mickqian thanks, it was transient error. passed now. |
|
@mickqian I resolved the recent conflict due to action endpoint reconfiguration. Also I added multipart form support for /v1/actions/generations endpoint. Let me know if you are ok with this change. |
|
/rerun-failed-ci |
|
/rerun-failed-ci |
Motivation
PRs #24994, #26492 and #27168 added support for the Cosmos3 model family. This PR extends that support to the Cosmos3 Edge and Distilled variants. All variants continue to be served by the single Cosmos3 pipeline, with the variant selected from the checkpoint config at load time.
Modifications
Cosmos3 Edge
transformer/config.json(hidden_act: relu2/backbone_type); the gated (SwiGLU) path is unchanged.qk_norm_for_text).Distilled (few-step) checkpoints
FlowMatchEulerDiscreteScheduler+fixed_step_sampler_config.t_list) and drive the scheduler from its explicit fixed-step sigma schedule (stepcount =
len(sigmas)).guidance_scale = 1.0for distilled inference (single forward, no CFG).Checkpoint format compatibility
Cosmos3OmniPipelineand keepCosmos3OmniDiffusersPipelineas a back-compat alias, so both the new and legacymodel_index.json_class_namespellings resolve to the same pipeline._class_namedetector to match both.Others
*_quantizer.*) during weight load so the new format FP8 path reads the weight/input scales correctly.generatorinto the stochastic (SDE) scheduler step so sequence-parallel ranks draw identical noise, fixing shard-boundary artifacts under Ulysses.For reference see vllm-omni PR
Accuracy Tests
Speed Tests and Profiling
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ✅ Run #31552675351
Latest PR Test (Extra): ❌ Run #31552675179