[diffusion][feature] Add component-selective offload policies (#5929)

Signed-off-by: lishunyang12 <lishunyang12@163.com>
This commit is contained in:
SYLAR authored and GitHub committed 2026-09-06 05:40:09 +08:00
1 parent 44d3ae100a
commit ea3cf99894
74 files changed
+5121 -1584

No files matched your search

@@ -30,6 +30,36 @@ def test_pipeline_declares_layerwise_offload_components() -> None:
assert Cosmos3OmniDiffusersPipeline._resident_modules == []
assert hasattr(Cosmos3OmniDiffusersPipeline, "enable_omni_model_cpu_offload")
from vllm_omni.diffusion.models.cosmos3.transformer_cosmos3 import (
Cosmos3LanguageModel,
Cosmos3VFMTransformer,
)
assert Cosmos3LanguageModel._layerwise_offload_blocks_attrs == ["layers"]
assert Cosmos3VFMTransformer._layerwise_offload_blocks_attrs == ["gen_layers"]
def test_component_selective_model_offload_fails_before_component_loading(monkeypatch) -> None:
from vllm_omni.diffusion.models.cosmos3 import pipeline_cosmos3 as pipeline_module
monkeypatch.setattr(
pipeline_module,
"get_local_device",
lambda: pytest.fail("component loading must not start for an unsupported selector"),
)
config = SimpleNamespace(
diffusion_offload_config={"mode": "module", "components": ["dit"]},
enable_cpu_offload=False,
enable_layerwise_offload=False,
enable_distributed_layerwise_offload=False,
dlo_use_allgather=True,
dlo_resident_layers=0,
pin_cpu_memory=True,
)
with pytest.raises(ValueError, match="does not support the dit/text_encoder component selector"):
pipeline_module.Cosmos3OmniDiffusersPipeline(od_config=config)
class StubScheduler:
def __init__(