[Refactor] Migrate existing pipelines to use SupportsComponentDiscovery for offload discovery (#3076)

Signed-off-by: Nick Cao <ncao@redhat.com>
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Nick CaoandClaude authored and GitHub committed 2026-06-17 21:33:06 +08:00
1 parent 8fa0394d29
commit e957d16f8d
43 files changed
+392 -66

No files matched your search

@@ -25,10 +25,24 @@ _OMNI_RUNNER_PARAM = (
},
)
_OMNI_RUNNER_PARAM_OFFLOAD = (
MODEL,
None,
{
"init_timeout": 1200,
"tensor_parallel_size": 2,
"enable_cpu_offload": True,
},
)
pytestmark = [
pytest.mark.full_model,
pytest.mark.diffusion,
pytest.mark.parametrize("omni_runner", [_OMNI_RUNNER_PARAM], indirect=True),
pytest.mark.parametrize(
"omni_runner",
[_OMNI_RUNNER_PARAM, _OMNI_RUNNER_PARAM_OFFLOAD],
indirect=True,
),
]
_SKIP_ISSUE_3236 = pytest.mark.skip(
@@ -103,3 +103,23 @@ def test_stable_audio_quantization_and_teacache() -> None:
)
finally:
m.close()
@hardware_test(res={"cuda": "L4", "xpu": "B60"})
def test_stable_audio_cpu_offload() -> None:
"""Stable Audio Open with FP8 + CPU offload."""
m = Omni(
model="stabilityai/stable-audio-open-1.0",
quantization="fp8",
enable_cpu_offload=True,
)
try:
audio = generate_stable_audio_short_clip(m)
assert_audio_valid(
audio,
sample_rate=_SAMPLE_RATE,
channels=2,
duration_s=_CLIP_DURATION_S,
)
finally:
m.close()
@@ -65,6 +65,17 @@ def _get_diffusion_feature_cases(model: str):
"""
return [
# CPU offload (single-card)
pytest.param(
OmniServerParams(
model=model,
server_args=[
"--enable-cpu-offload",
],
),
id="single_card_cpu_offload",
marks=SINGLE_CARD_FEATURE_MARKS,
),
# TeaCache (single-card)
pytest.param(
OmniServerParams(
@@ -31,6 +31,19 @@ NEGATIVE_PROMPT = "blurry, low quality"
# cross-feature compatibility more generally.
def _get_diffusion_feature_cases(model: str):
return [
# CPU offload + TP=2 (model needs TP=2)
pytest.param(
OmniServerParams(
model=model,
server_args=[
"--enable-cpu-offload",
"--tensor-parallel-size",
"2",
],
),
id="cpu_offload",
marks=FOUR_CARD_FEATURE_MARKS,
),
# FP8 / Hybrid sequence parallelism
pytest.param(
OmniServerParams(
@@ -27,6 +27,13 @@ _NUM_INFERENCE_STEPS = 4
def _get_diffusion_feature_cases(model: str):
return [
pytest.param(
OmniServerParams(
model=model,
server_args=["--tensor-parallel-size", "2", "--enable-cpu-offload"],
),
id="tp2_cpu_offload",
),
pytest.param(
OmniServerParams(
model=model,
@@ -31,6 +31,17 @@ def _get_diffusion_feature_cases(model: str):
Designed for 2x H100 environment per issue #1832.
"""
return [
# (1 GPU) CPU offload
pytest.param(
OmniServerParams(
model=model,
server_args=[
"--enable-cpu-offload",
],
),
id="single_card_cpu_offload",
marks=SINGLE_CARD_MARKS,
),
# (1 GPU) CacheDiT + Layerwise CPU offloading
pytest.param(
OmniServerParams(
@@ -31,6 +31,20 @@ _DEFAULT_MODEL = "stepfun-ai/NextStep-1.1"
def _get_diffusion_feature_cases(model: str):
"""Single online config: TP=4, explicit pipeline class."""
return [
pytest.param(
OmniServerParams(
model=model,
server_args=[
"--tensor-parallel-size",
"2",
"--model-class-name",
"NextStep11Pipeline",
"--enable-cpu-offload",
],
),
id="nextstep_tp2_cpu_offload",
marks=FOUR_CARD_MARKS,
),
pytest.param(
OmniServerParams(
model=model,
@@ -29,6 +29,16 @@ PARALLEL_FEATURE_MARKS = hardware_marks(res={"cuda": "H100"}, num_cards=2)
# If a similar test only involves one model, one can just define a global list variable.
def _get_diffusion_feature_cases(model: str):
return [
pytest.param(
OmniServerParams(
model=model,
server_args=[
"--enable-cpu-offload",
],
),
id="cpu_offload",
marks=SINGLE_CARD_FEATURE_MARKS,
),
pytest.param(
OmniServerParams(
model=model,
@@ -25,6 +25,14 @@ PARALLEL_FEATURE_MARKS = hardware_marks(res={"cuda": "H100"}, num_cards=2)
def _get_diffusion_feature_cases(model: str):
return [
pytest.param(
OmniServerParams(
model=model,
server_args=["--enable-cpu-offload"],
),
id="cpu_offload",
marks=SINGLE_CARD_FEATURE_MARKS,
),
pytest.param(
OmniServerParams(model=model, server_args=["--step-execution"]),
id="step_execution",
@@ -32,6 +32,14 @@ SINGLE_CARD_FEATURE_MARKS = hardware_marks(res={"cuda": "H100"})
# sp_001 : cache_dit + Ulysses-SP 2
# cfg_parallel_002: cache_dit + CFG-Parallel 2
FEATURE_CASES = [
pytest.param(
OmniServerParams(
model=MODEL,
server_args=["--enable-cpu-offload"],
),
id="cpu_offload",
marks=SINGLE_CARD_FEATURE_MARKS,
),
pytest.param(
OmniServerParams(
model=MODEL,
@@ -24,6 +24,20 @@ NEGATIVE_PROMPT = "blurry, low quality, distorted"
# that provide good performance improvements.
def _get_diffusion_feature_cases(model: str):
return [
# CFG Parallel + Tensor Parallel + CPU offload
pytest.param(
OmniServerParams(
model=model,
server_args=[
"--cfg-parallel-size",
"2",
"--tensor-parallel-size",
"2",
"--enable-cpu-offload",
],
),
marks=FOUR_CARD_FEATURE_MARKS,
),
# Cache-DiT + CFG Parallel + Tensor Parallel
pytest.param(
OmniServerParams(
@@ -85,7 +85,22 @@ def _get_wan22_feature_cases():
"""
cases = []
# ---- CUDA cases (unchanged) ----
# ---- CUDA cases ----
# Single-card: CPU offload (applies to all models)
for model_path, model_key in WAN22_MODELS:
cases.append(
pytest.param(
OmniServerParams(
model=model_path,
server_args=["--enable-cpu-offload"],
),
id=f"{model_key}_cpu_offload",
marks=CUDA_SINGLE_CARD_MARKS,
)
)
# Single-card: Cache-DiT (applies to all models)
for model_path, model_key in WAN22_MODELS:
cases.append(
pytest.param(
@@ -37,6 +37,18 @@ PARALLEL_FEATURE_MARKS = hardware_marks(res={"cuda": "H100"}, num_cards=2)
def _get_vace_feature_cases():
return [
# Single GPU: CPU offload
pytest.param(
OmniServerParams(
model=MODEL,
server_args=[
"--enable-cpu-offload",
"--vae-use-tiling",
],
),
id="single_card_cpu_offload",
marks=SINGLE_CARD_FEATURE_MARKS,
),
# Single GPU: Cache-DiT + layerwise CPU offload
pytest.param(
OmniServerParams(