Repository navigation
[diffusion][model] Add LingBot-Video MoE 30B T2V support - #32341
Conversation
Signed-off-by: Pan Li <[email protected]>
Signed-off-by: Pan Li <[email protected]>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
…es, adjust ServerArgs logic Signed-off-by: Pan Li <[email protected]>
Signed-off-by: Pan Li <[email protected]>
Signed-off-by: Pan Li <[email protected]>
Signed-off-by: Pan Li <[email protected]>
|
Hey mickqian, all are done. Re-ran a dog video ("a dog running on grass",320×192/241f/40steps/gs6/shift3/seed42) .
Speed :
Videos: sglang_dog_10s_5090.mp4sglang_dog_10s_h100.mp4orig_dog_10s_h100.mp4 |
Signed-off-by: Pan Li <[email protected]>
Signed-off-by: Pan Li <[email protected]>
Signed-off-by: Pan Li <[email protected]>
Signed-off-by: Pan Li <[email protected]>
Signed-off-by: Pan Li <[email protected]>
|
Hi @mickqian, I've addressed the review comments and also added unit tests plus a GPU quality case, ready for review now. |
mickqian
left a comment
There was a problem hiding this comment.
The native MoE hot path needs another pass before merge.
-
torch.cat((self.experts.w1, self.experts.w3), dim=1)runs in every MoE block forward. At the current BF16 shape, it materializes[128, 1536, 2048](768 MiB) per invocation. Across 48 blocks and 40 denoising steps this adds substantial HBM copies and allocator pressure. Please pack/loadw13in the fused-kernel layout once, or cache it with correct invalidation for LoRA and other weight updates, instead of concatenating on every forward. -
text_lens.detach().cpu().tolist()synchronizes the GPU on every denoising step, and theB > 1path dispatches attention once per sample. Please keep the text-length/RoPE preparation on-device or cache it for the request shape, then verify whether a batched/varlen attention path preserves parity. This will otherwise hurt CFG and batched serving latency.
The SRT TP-group bridge itself looks justified; no change requested there.
Signed-off-by: Pan Li <[email protected]>
|
@mickqian You have reviewed this point very patiently. Thank you!
5090, dog video:
Video, same as before: dog.mp4 |
|
/tag-and-rerun-ci |
|
Hey,@mickqian . CI fails in test_update_weights_from_disk.py on FLUX.2 and Qwen-Image, a weight-name mapping mismatch in linear.py. This PR touches neither that file nor weights_updater.py, and LingBot is absent from the log. Is this known on main? Happy to rebase and re-run. |
Signed-off-by: Pan Li <[email protected]>
|
The current CI jobs are all failing after a few seconds. It seems like some label is missing, even though the checks appear to have passed. |
Signed-off-by: Pan Li <[email protected]> Co-authored-by: Mick <[email protected]>
Signed-off-by: Pan Li <[email protected]> Co-authored-by: Mick <[email protected]>
Motivation
Add native SGLang support for LingBot-Video MoE 30B (
robbyant/lingbot-video-moe-30b-a3b) — a DeepSeek-V3-style MoE text-to-video model (128 experts, 30B total / ~3B active per token, 48 MoE layers). This is the first MoE DiT inmultimodal_gen, reusing SGLang'sfused_expertsTriton kernel for the expert GEMMs.Related issue: #32336
Modifications
runtime/layers/moe.py(NEW): DeepSeek-V3-style MoE FFN block —LingBotVideoRouter(fp32, group-limited top-k, sigmoid +e_score_correction_bias),LingBotVideoGroupedExperts(w1/w2/w3nn.Parameter),LingBotVideoSparseMoeBlockreusingsglang.srt.layers.moe...fused_experts. First MoE layer in the diffusion runtime. Parity-critical config:gate_up_interleaved=False,inplace=False.runtime/models/dits/lingbot_video_moe.py(NEW):LingBotVideoTransformer3DModel(joint self-attn over[video;text], complex64 RoPE viaview_as_complex, AdaLN with fp32-sensitive modules).LingBotVideoAttention(SDPA + complex RoPE),LingBotVideoBlock.configs/models/dits/lingbot_video_moe.py(NEW):LingBotVideoMoEArchConfig(30B arch + identityparam_names_mapping).configs/pipeline_configs/lingbot_video_moe.py(NEW):LingBotVideoMoEPipelineConfig(T2V,get_decode_scale_and_shiftreadingvae.config).configs/sample/lingbot_video_moe.py(NEW):LingBotVideoMoESamplingParams.runtime/pipelines_core/stages/model_specific_stages/lingbot_video_moe/(NEW):LingBotVideoBeforeDenoisingStage(Hybrid monolithic: encode_prompt + Qwen3-VL + PROMPT_TEMPLATE, prepare_latents, FlowUniPC).runtime/pipelines/lingbot_video_moe.py(NEW):LingBotVideoPipeline(EntryClass).registry.py(MODIFIED):register_configs(...)entry.configs/models/dits/__init__.py,configs/pipeline_configs/__init__.py,configs/sample/__init__.py(MODIFIED): exports.Usage
Accuracy Tests
Verified output precision against the upstream
LingBotVideoPipeline(diffusers) with identical parameters: same prompt (structured JSON caption), seed (42), resolution (320×192), num_frames (241), steps (40), guidance_scale (6.0), shift (3.0).--dit-layerwise-offload)LingBotVideoPipelineBoth SGLang and the upstream produce coherent video (cat running on grass, 10s, 320×192, 241 frames) at the same settings.
Output Videos
SGLang (this PR, H100 80GB):
sglang_10s_h100.mp4
SGLang (this PR, RTX 5090 32GB,
--dit-layerwise-offload):sglang_10s_5090.mp4
Upstream
LingBotVideoPipeline(diffusers, H100 80GB, reference):upstream_10s_h100.mp4
All three videos are generated with identical parameters: same structured JSON caption ("a cat running on grass"), seed (42), resolution (320×192), num_frames (241), steps (40), guidance_scale (6.0), shift (3.0).
Note on Minor Output Differences
The SGLang output and the upstream output show slightly different camera movement and action trajectory, while the scene content (the cat, the grass, the overall composition) is fully consistent with the prompt. The differences come from two BF16 numerical sources:
MoE expert GEMM kernel: SGLang uses
fused_experts(srt Triton kernel withgate_up_interleaved=False,inplace=False), while the upstream usestorch._grouped_mm(or a per-expert loop). These are different implementations of the same grouped GEMM math, with BF16 accumulation-order differences that compound across 48 MoE layers × 40 denoise steps.Attention backend: SGLang uses
F.scaled_dot_product_attentionwith auto backend selection (flash SDP on Hopper), while the upstream uses diffusersdispatch_attention_fnwith_native_flash(sdpa_kernel(SDPBackend.FLASH_ATTENTION)). The two paths use different SDP dispatch logic, introducing BF16 rounding differences before MoE routing, which accumulates over steps.These are expected BF16 inference-level differences (not correctness bugs). The scene content, prompt adherence, and overall quality are equivalent.
ruff check: All checks passed.ruff format: All files formatted.sglang-diffusion-add-modelskill (Hybrid Monolithic pipeline,EntryClass,ComposedPipelineBase, Req batch contract).Future Work
To reduce review difficulty, this PR implements T2V base-only, single-GPU. Follow-up PRs will add:
nn.Linear→ColumnParallelLinear, SDPA →USPAttention; integrate complex64 RoPE with Ulysses).refiner/DiT with identical MoE architecture; wired via the low-noise-tailt_threshmechanism)._ensure_moe_server_args,_ensure_srt_distributed) is a pragmatic workaround; a framework-level fix (themultimodal_genworker initializing the srt parallel_state when usingfused_experts) would replace these.Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ✅ Run #31158986364
Latest PR Test (Extra): ❌ Run #31158986144