Repository navigation
[Refactor][Diffusion] Move single-model layers into their model directories - #5908
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
…tories Keep vllm_omni/diffusion/layers/ for truly shared components only: - Move RotaryEmbeddingWan, WanS2VRotaryPosEmbed and RotaryEmbeddingWanS2V from layers/rope.py to models/wan2_2/rope.py (Wan-only); the shared RotaryEmbedding base, helpers and RotaryEmbeddingS2VGrid stay in place. - Move RMSNormVAE from layers/norm.py to models/wan2_2/norm.py (only used by the Wan2.2 diffusers VAE patch). - Move the Bagel MoT layer package layers/mot/ to models/bagel/mot/ (MoTRMSNorm, MoTQKVParallelLinear, MoTRowParallelLinear and Triton ops). Pure move plus import updates; no logic changes. All in-repo references (models, tests, benchmarks, docs) updated to the new paths. Signed-off-by: Alicia <115451386+congw729@users.noreply.github.com>
4d9feec to
b8dc2c5
Compare
Signed-off-by: congw729 <115451386+congw729@users.noreply.github.com>
Signed-off-by: congw729 <115451386+congw729@users.noreply.github.com>
|
@Gaohan123 @hsliuustc0106 can be merged |
Signed-off-by: Alicia <115451386+congw729@users.noreply.github.com>
|
@hsliuustc0106 The conflicts are resolved in 22d0fe7, and I've narrowed the migration: |
|
@hsliuustc0106 Now that #5907 has merged, could you give this PR's narrowed scope a final look and merge it once the remaining merge requirements are satisfied? 🙂
|
Signed-off-by: Alicia <115451386+congw729@users.noreply.github.com>
|
@hsliuustc0106 Updated to main in This looks ready to merge from the code and test side. Read the Docs is still showing pending; could you merge once that remaining check clears? 🙂 |
真机验收(8 个模型并行起服务)抓到的,静态三层审计全绿也看不见: 1) MoT 内核模块被上游 vllm-project#5908 搬走,我们的延迟 import 与调优 config 没跟过去 上游把 vllm_omni/diffusion/layers/mot/ 整个移进 models/bagel/mot/。git 按删除 处理,于是: - int8_config.py:567 里那句从 layers.mot.ops.mot_gemm 取 invoke_mot_gemm 的 import 指向了不存在的模块。它是**函数体内的延迟 import**,compileall、 ruff F821、符号缺失比对三层全都看不见 —— 只有真跑一条 H3 INT8 生成才炸 (ModuleNotFoundError,HTTP 500)。 - 我们为 A100 调的 configs/device_name=A100PCIE40GB,dtype=int8_w8a16.json 留在 旧路径。mot_gemm 用 __file__ 的父目录定位 configs/,搬家后读不到,会静默回落 到默认 tile 参数 —— 不报错,只是慢。 两者都改到 models/bagel/mot/ 下;测试里的 mocker.patch 字符串同步改。 2) HunyuanImage-3 的 safetensors_load_strategy 从未生效,现在会直接拒 上游 vllm-project#5172 给扩散配置加了未知字段严格校验,HY3 的 DiT 档启动即报 Unknown diffusion config field(s) for stage 0。 查实它在扩散 stage 上一直是空转:diffusion_model_runner.py 用的是默认构造的 LoadConfig(该字段默认 None 而非 lazy),deploy-config 的值根本到不了 DiffusersPipelineLoader 读的那个对象。当初写它的意图(避免 4 个 rank 同时从 NFS 预读整份分片)两个月来一次都没兑现过。 从三个 DiT 档移除并把来龙去脉写在原处;AR 档走 vLLM LLM 引擎、该字段是真 EngineArgs,保留不动。要真正兑现那个优化需要给 OmniDiffusionConfig 加字段并在 runner 里透传,那是独立改动。 审计补两层(本次就是靠它们定位的): - 解析全部 AST 的 Import/ImportFrom(含函数体内),比对 vllm_omni 模块是否真实存在; - 按 merge-base 三方判定整文件丢失,区分上游删的与我们新增却被吞的。 前者 102 个(跟随上游正确),后者 0 个。
…tories (vllm-project#5908) Signed-off-by: congw729 <115451386+congw729@users.noreply.github.com> Signed-off-by: Alicia <115451386+congw729@users.noreply.github.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com> Signed-off-by: Matthieu Laneuville <matthieu.laneuville@surf.nl>
…tories (vllm-project#5908) Signed-off-by: congw729 <115451386+congw729@users.noreply.github.com> Signed-off-by: Alicia <115451386+congw729@users.noreply.github.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
Purpose
Complete a bounded part of JiusiServe/vllm-omni-project-manage#27 by moving model-specific layers to their owning model directories.
WanS2VRotaryPosEmbedandRotaryEmbeddingWanS2Vtomodels/wan2_2/rope.py, andRMSNormVAEtomodels/wan2_2/norm.py.RotaryEmbeddingWanin the shared RoPE module: both Wan and Lingbot-World now use it.RotaryEmbeddingWanS2Vinherits this shared implementation. Shared RoPE helpers andRotaryEmbeddingS2VGridalso retain their existing locations.models/bagel/mot/. Update model/test imports, benchmark and documentation paths, and the existing lint allowlist entry.Synchronized with main at
6a03e45c340a60553884432ff4fc4a31a6219d55on 2026-09-20 (PR head73ca73037d89fe7c6712b1dad734a0b9ceed01d2). The migration preserves this baseline's operator implementations, including NPUindex_select, RMSNorm residual handling, vLLM 0.29.0 adaptation and CustomOp platform dispatch. The previous shared S2V indexing change is removed from the PR.The moved internal import paths change without forwarding shims. Callers importing these internal modules must use their new locations. MoT's package-local tuning directory moves with the package;
VLLM_TUNED_CONFIG_FOLDERremains available. CLI options, model registration names and operator signatures are unchanged.Current value and scope
Reassessed on 2026-09-11. The original scope has been narrowed because
RotaryEmbeddingWanis now shared. The remaining migration has modest maintenance value: it makes ownership of Wan S2V/VAE and Bagel MoT code clearer while retaining genuinely shared components inlayers/.Existing model functionality works on main; this is a normal-priority maintenance cleanup with no performance improvement claim. The scope stays limited to relocation and reference updates.
Validation
Latest refresh (2026-09-20)
Merged main
6a03e45c3without conflicts. The migration scope is unchanged. This brings in #7426, which updates the realtime VAD test to expectresponse.output_audio.*events.The previous CUDA CI run #15669 had 32 passed steps, one failed step and two skipped steps. Diffusion groups and both L2/L3 Wan22 E2E steps passed. Its only failing step was the H100 entrypoint suite: the Qwen3-Omni server-VAD test still expected the legacy
response.audio.donename. The test and event producer were unchanged by this PR; the main synchronization incorporates the upstream correction.For the refreshed head, AST equivalence, stale-path checks and
git diff --checkpassed. Applicable PR-file hooks passed except the same eight mypy findings, all reproduced on untouched main6a03e45c3; only that hook was skipped for the signed-off merge commit. CUDA L2/L3 CI has been triggered withready,merge-testandcuda-test: fresh run. Results are pending.Earlier targeted tests
The following SP_H200 results were recorded on 2026-09-11 for head
22d0fe72a, synchronized with main43b8de9b0. They used a dedicated worktree with Python 3.12 and vLLM 0.29.0, matching that CI baseline. These historical results are separate from the CI rerun for the refreshed head. Verified the runtime imported this worktree. GPU tests used one reserved H200-class device; separate pytest processes isolated distributed state.311 tests passed across the following groups; all final test invocations exited with status 0.
Bagel, Lance, Lingbot, Wan S2V and VAE norm imports passed. The MoT package-local configuration directory resolves to the new Bagel location.
Reproduce from the checkout with the matching development environment. Use separate pytest invocations; a visible CUDA device is needed for the layers and Bagel groups even though their tests carry CPU markers.
Additional validation:
git diff --checkpassed.The SP_H200 targeted suite did not run full-model inference; subsequent Wan22 E2E coverage is recorded above. Physical NPU/XPU hardware was not tested. CPU platform-fallback tests and preservation of main's implementations provide the available cross-platform evidence.