[Feature][Diffusion]: CFG parallelism support for Boogu-Image (#6786)
Signed-off-by: nagisa <1434936049@qq.com> Signed-off-by: nagisa-kun <1434936049@qq.com>
This commit is contained in:
1 parent
376b28aced
commit
8f284b343a
13 files changed
+792
-78
No files matched your search
@@ -6,7 +6,8 @@ L4 expansion coverage for Boogu-Image Edit and Edit-Turbo (image editing / TI2I)
|
||||
|
||||
The nightly smoke module (``test_boogu_image_edit.py``) already covers single-image
|
||||
text-guided editing and the text+image double-guidance path. This expansion
|
||||
module adds the two edit paths smoke does not exercise:
|
||||
module adds the edit paths and CFG-parallel configurations smoke does not
|
||||
exercise:
|
||||
|
||||
- ``test_image_only_guidance`` — ``guidance_scale=1.0`` (text CFG off) with
|
||||
``guidance_scale_2=2.0`` (image CFG on): the image-only branch of upstream's
|
||||
@@ -15,13 +16,19 @@ module adds the two edit paths smoke does not exercise:
|
||||
- ``test_align_res_output_size`` — a non-square reference with no requested
|
||||
``height`` / ``width``: asserts the output resolution follows the reference
|
||||
(upstream ``align_res``, on by default for a single reference).
|
||||
- ``test_double_guidance_cfg_parallel`` — three-branch double guidance with
|
||||
CFG sizes 2 and 3.
|
||||
- ``test_cfg_off_on_cfg_parallel_server`` — both scales at 1.0 on a size-2 CFG
|
||||
server.
|
||||
|
||||
Both Edit checkpoints share ``BooguImagePipeline`` with the Base checkpoint;
|
||||
the TI2I path activates when the request carries a reference image. Only a
|
||||
single reference image is supported. The regular Edit cases stay smoke-depth
|
||||
(``num_inference_steps=2``), while Edit-Turbo uses its tuned four-step
|
||||
configuration. CPU offload, Cache-DiT, and multi-GPU parallelism are not yet
|
||||
supported for these models and are intentionally omitted.
|
||||
configuration. Regular Edit CFG-parallel coverage includes two-card
|
||||
text-only/image-only/CFG-off paths, two-card round-robin double guidance, and
|
||||
full three-card double guidance. Edit-Turbo remains single-card-only here;
|
||||
CPU offload and Cache-DiT are intentionally omitted for both checkpoints.
|
||||
|
||||
From ``tests/``::
|
||||
|
||||
@@ -47,16 +54,49 @@ EDIT_TURBO_REVISION = "hotfix-1k-20260708"
|
||||
EDIT_PROMPT = "Change the style to a colored pencil drawing."
|
||||
|
||||
SINGLE_CARD_FEATURE_MARKS = hardware_marks(res={"cuda": "H100"})
|
||||
PARALLEL_2_FEATURE_MARKS = hardware_marks(res={"cuda": "H100"}, num_cards=2)
|
||||
PARALLEL_3_FEATURE_MARKS = hardware_marks(res={"cuda": "H100"}, num_cards=3)
|
||||
|
||||
|
||||
def _get_diffusion_feature_cases(model: str):
|
||||
"""Return the single-card server configuration supported for Boogu-Image-Edit today."""
|
||||
"""Return single-card and two-card CFG configurations for two-branch paths."""
|
||||
return [
|
||||
pytest.param(
|
||||
OmniServerParams(model=model),
|
||||
id="default",
|
||||
marks=SINGLE_CARD_FEATURE_MARKS,
|
||||
),
|
||||
pytest.param(
|
||||
OmniServerParams(model=model, server_args=["--cfg-parallel-size", "2"]),
|
||||
id="cfg_parallel_2",
|
||||
marks=PARALLEL_2_FEATURE_MARKS,
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
def _get_double_guidance_cases(model: str):
|
||||
"""Return two-rank round-robin and full three-rank double-guidance rows."""
|
||||
return [
|
||||
pytest.param(
|
||||
OmniServerParams(model=model, server_args=["--cfg-parallel-size", "2"]),
|
||||
id="cfg_parallel_2_round_robin",
|
||||
marks=PARALLEL_2_FEATURE_MARKS,
|
||||
),
|
||||
pytest.param(
|
||||
OmniServerParams(model=model, server_args=["--cfg-parallel-size", "3"]),
|
||||
id="cfg_parallel_3_full",
|
||||
marks=PARALLEL_3_FEATURE_MARKS,
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
def _get_cfg_off_cases(model: str):
|
||||
return [
|
||||
pytest.param(
|
||||
OmniServerParams(model=model, server_args=["--cfg-parallel-size", "2"]),
|
||||
id="cfg_parallel_2_cfg_off",
|
||||
marks=PARALLEL_2_FEATURE_MARKS,
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
@@ -106,6 +146,42 @@ def test_image_only_guidance(omni_server: OmniServer, openai_client: OpenAIClien
|
||||
openai_client.send_diffusion_request(request_config)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("omni_server", _get_double_guidance_cases(MODEL), indirect=True)
|
||||
def test_double_guidance_cfg_parallel(omni_server: OmniServer, openai_client: OpenAIClientHandler) -> None:
|
||||
"""Double guidance exercises three branches on two and three CFG ranks."""
|
||||
image_data_url = f"data:image/jpeg;base64,{generate_synthetic_image(512, 512)['base64']}"
|
||||
messages = dummy_messages_from_mix_data(image_data_url=image_data_url, content_text=EDIT_PROMPT)
|
||||
request_config = {
|
||||
"model": omni_server.model,
|
||||
"messages": messages,
|
||||
"extra_body": {
|
||||
"num_inference_steps": 2,
|
||||
"guidance_scale": 5.0,
|
||||
"guidance_scale_2": 2.0,
|
||||
"seed": 42,
|
||||
},
|
||||
}
|
||||
openai_client.send_diffusion_request(request_config)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("omni_server", _get_cfg_off_cases(MODEL), indirect=True)
|
||||
def test_cfg_off_on_cfg_parallel_server(omni_server: OmniServer, openai_client: OpenAIClientHandler) -> None:
|
||||
"""A CFG process group must not force negative embeddings or guidance."""
|
||||
image_data_url = f"data:image/jpeg;base64,{generate_synthetic_image(512, 512)['base64']}"
|
||||
messages = dummy_messages_from_mix_data(image_data_url=image_data_url, content_text=EDIT_PROMPT)
|
||||
request_config = {
|
||||
"model": omni_server.model,
|
||||
"messages": messages,
|
||||
"extra_body": {
|
||||
"num_inference_steps": 2,
|
||||
"guidance_scale": 1.0,
|
||||
"guidance_scale_2": 1.0,
|
||||
"seed": 42,
|
||||
},
|
||||
}
|
||||
openai_client.send_diffusion_request(request_config)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("omni_server", "sampling_params"),
|
||||
_get_align_res_cases(),
|
||||
|
||||
@@ -7,14 +7,15 @@ L4 expansion coverage for ``Boogu/Boogu-Image-0.1-Base`` (text-to-image).
|
||||
The nightly smoke module (``test_boogu_image.py``) already covers the default
|
||||
512x512 single request and a concurrent batch. This expansion module adds the
|
||||
request-level paths that smoke does not exercise, run against every currently
|
||||
supported single-GPU server configuration:
|
||||
supported server configuration:
|
||||
|
||||
Server rows (single card):
|
||||
Server rows:
|
||||
- ``default`` — no extra ``server_args``.
|
||||
- ``vae_slicing_tiling`` — ``--vae-use-slicing --vae-use-tiling`` (the recipe's
|
||||
OOM mitigation; applied generically in ``registry.initialize_model``).
|
||||
- ``cfg_parallel_2`` — two-card CFG branch parallelism.
|
||||
|
||||
Cases (one per test, each parametrized over both server rows):
|
||||
Cases (one per test, each parametrized over all server rows):
|
||||
- ``test_non_square_resolution`` — 768x1024, exercises the patchify / RoPE path
|
||||
at a non-square aspect ratio.
|
||||
- ``test_cfg_off`` — ``guidance_scale=1.0``, exercises the no-CFG denoise branch
|
||||
@@ -24,8 +25,7 @@ Cases (one per test, each parametrized over both server rows):
|
||||
Boogu-Image reads ``sp.guidance_scale`` (not ``true_cfg_scale``). These stay
|
||||
smoke-depth (``num_inference_steps=2``); numeric parity vs. Diffusers is covered
|
||||
by the local parity harness (support plan, step 14). CPU offload, Cache-DiT, and
|
||||
multi-GPU parallelism are not yet supported for this model and are intentionally
|
||||
omitted (add rows here when those features land).
|
||||
non-CFG multi-GPU parallelism remain unsupported.
|
||||
|
||||
From ``tests/``::
|
||||
|
||||
@@ -49,10 +49,11 @@ T2I_PROMPT = "A mountain lake at sunset, photorealistic, cinematic lighting"
|
||||
NEGATIVE_PROMPT = ""
|
||||
|
||||
SINGLE_CARD_FEATURE_MARKS = hardware_marks(res={"cuda": "H100"})
|
||||
PARALLEL_2_FEATURE_MARKS = hardware_marks(res={"cuda": "H100"}, num_cards=2)
|
||||
|
||||
|
||||
def _get_diffusion_feature_cases(model: str):
|
||||
"""Return the single-card server configurations supported for Boogu-Image today."""
|
||||
"""Return the validated single-card and CFG-parallel configurations."""
|
||||
return [
|
||||
pytest.param(
|
||||
OmniServerParams(model=model),
|
||||
@@ -67,6 +68,11 @@ def _get_diffusion_feature_cases(model: str):
|
||||
id="vae_slicing_tiling",
|
||||
marks=SINGLE_CARD_FEATURE_MARKS,
|
||||
),
|
||||
pytest.param(
|
||||
OmniServerParams(model=model, server_args=["--cfg-parallel-size", "2"]),
|
||||
id="cfg_parallel_2",
|
||||
marks=PARALLEL_2_FEATURE_MARKS,
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user