Repository navigation
[Feat] support CFG Parallel for FLUX kontext - #2281
Conversation
Signed-off-by: Lancer <maruixiang6688@gmail.com>
lishunyang12
left a comment
There was a problem hiding this comment.
left a couple comments
| img_ids=latent_ids, | ||
| joint_attention_kwargs=self.joint_attention_kwargs, | ||
| return_dict=False, | ||
| )[0] |
There was a problem hiding this comment.
check_cfg_parallel_validity returns False on invalid config but the return value is discarded here. Should this raise or at least skip the CFG path? Right now an invalid config silently runs and produces bad output.
There was a problem hiding this comment.
Now, the CFG path now respects check_cfg_parallel_validity(...) instead of discarding the return value, so invalid CFG-parallel configurations fall back cleanly instead of continuing with bad output.
| raise NotImplementedError("Subclasses must implement diffuse") | ||
|
|
||
| def check_cfg_parallel_validity(self, true_cfg_scale: float, has_neg_prompt: bool) -> bool: | ||
| """ |
There was a problem hiding this comment.
Nit: the mixin already imports from vllm_omni.diffusion.distributed.parallel_state — is there a project-wide logger convention (e.g. from vllm) you could use instead of import logging + getLogger? Minor.
Signed-off-by: Lancer <maruixiang6688@gmail.com>
|
@hsliuustc0106 verified it and ready to merge |
| ) | ||
| do_true_cfg = true_cfg_scale > 1.0 and has_neg_prompt | ||
|
|
||
| do_true_cfg = do_true_cfg and self.check_cfg_parallel_validity(true_cfg_scale, has_neg_prompt) |
There was a problem hiding this comment.
About the CFG scale, I notice in FLUX.1-Kontext-dev HF webpage, diffusers use guidance_scale not true_cfg_scale. Please double check. Better to stay consistent with diffusers' key name.
There was a problem hiding this comment.
FLUX.1-dev HF webpage uses guidance_scale too. I am indeed very confused about the two key names: guidance_scale and true_cfg_scale.
|
Please update |
updated it |
|
@RuixiangMa Pls resolve the conflicts. When it is ready, I think we can launch a nightly CI test for this PR. |
Signed-off-by: Lancer <maruixiang6688@gmail.com>
|
@hsliuustc0106 Could you please add the label related diffusion text to image CI test? The npu ci test failure is not relevant to this PR, I think. I think the nightly CI label is too large, so I removed it. @RuixiangMa |
Thx, get it |
|
I notice that the nightly CI failed: [2026-06-25T03:11:09Z] =========================== short test summary info ============================
--
| [2026-06-25T03:11:09Z] ERROR tests/e2e/online_serving/test_flux2_expansion.py::test_flux2_klein[layerwise_hsdp] - RuntimeError: Server processes exited with code 1 before becoming ready.
| [2026-06-25T03:11:09Z] ERROR tests/e2e/online_serving/test_flux_kontext_expansion.py::test_flux_kontext_text_to_image[parallel_tp_2] - RuntimeError: Server processes exited with code 1 before becoming ready.
| [2026-06-25T03:11:09Z] ERROR tests/e2e/online_serving/test_flux_kontext_expansion.py::test_flux_kontext_image_edit[parallel_tp_2] - RuntimeError: Server processes exited with code 1 before becoming ready.
| [2026-06-25T03:11:09Z] ERROR tests/e2e/online_serving/test_flux_kontext_expansion.py::test_flux_kontext_image_edit_no_negative[parallel_tp_2] - RuntimeError: Server processes exited with code 1 before becoming ready.
| [2026-06-25T03:11:09Z] ERROR tests/e2e/online_serving/test_flux_kontext_expansion.py::test_flux_kontext_high_resolution[parallel_tp_2] - RuntimeError: Server processes exited with code 1 before becoming ready.
| [2026-06-25T03:11:09Z] ERROR tests/e2e/online_serving/test_flux_kontext_expansion.py::test_flux_kontext_multiple_outputs[parallel_tp_2] - RuntimeError: Server processes exited with code 1 before becoming ready.
| [2026-06-25T03:11:09Z] ERROR tests/e2e/online_serving/test_flux_kontext_expansion.py::test_flux_kontext_text_to_image[parallel_cfg_2] - RuntimeError: Server processes exited with code 1 before becoming ready.
| [2026-06-25T03:11:09Z] ERROR tests/e2e/online_serving/test_flux_kontext_expansion.py::test_flux_kontext_image_edit[parallel_cfg_2] - RuntimeError: Server processes exited with code 1 before becoming ready.
| [2026-06-25T03:11:09Z] ERROR tests/e2e/online_serving/test_flux_kontext_expansion.py::test_flux_kontext_image_edit_no_negative[parallel_cfg_2] - RuntimeError: Server processes exited with code 1 before becoming ready.
| [2026-06-25T03:11:09Z] ERROR tests/e2e/online_serving/test_flux_kontext_expansion.py::test_flux_kontext_high_resolution[parallel_cfg_2] - RuntimeError: Server processes exited with code 1 before becoming ready.
| [2026-06-25T03:11:09Z] ERROR tests/e2e/online_serving/test_flux_kontext_expansion.py::test_flux_kontext_multiple_outputs[parallel_cfg_2] - RuntimeError: Server processes exited with code 1 before becoming ready.
| [2026-06-25T03:11:09Z] = 17 passed, 4 skipped, 398 deselected, 22 warnings, 11 errors in 3168.67s (0:52:48) =
Could you pls run this test And please resolve the conflicts. |
Signed-off-by: Lancer <maruixiang6688@gmail.com> Signed-off-by: y_null <y_null@qq.com>
Signed-off-by: Lancer <maruixiang6688@gmail.com>
Signed-off-by: Lancer <maruixiang6688@gmail.com>
Signed-off-by: Lancer <maruixiang6688@gmail.com>

Purpose
support CFG Parallel for FLUX kontext
Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model. Please runmkdocs serveto sync the documentation editions to./docs.BEFORE SUBMITTING, PLEASE READ https://github.com/vllm-project/vllm-omni/blob/main/CONTRIBUTING.md (anything written below this line will be removed by GitHub Actions)