From 0adbac33a5ba0493c0e1966516d981467f6a8960 Mon Sep 17 00:00:00 2001 From: "Hui." <62495465+Hu1Lcode@users.noreply.github.com> Date: Wed, 25 Mar 2026 16:42:04 +0800 Subject: [PATCH] [Bug-Fix]fix bug of empty prompt input (#2041) Signed-off-by: AlvisGong Signed-off-by: Hui <1779066624@qq.com> Signed-off-by: Hui. <1779066624@qq.com> Co-authored-by: AlvisGong --- .../test_qwen_image_layered_expansion.py | 41 +++++++++++++++++++ vllm_omni/entrypoints/openai/serving_chat.py | 4 -- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/tests/e2e/online_serving/test_qwen_image_layered_expansion.py b/tests/e2e/online_serving/test_qwen_image_layered_expansion.py index 74ba0c383..b7b32f511 100644 --- a/tests/e2e/online_serving/test_qwen_image_layered_expansion.py +++ b/tests/e2e/online_serving/test_qwen_image_layered_expansion.py @@ -26,6 +26,7 @@ from tests.utils import hardware_marks MODEL = "Qwen/Qwen-Image-Layered" EDIT_PROMPT = "Decompose this image into layers." +EMPTY_EDIT_PROMPT = "" NEGATIVE_PROMPT = "blurry, low quality, distorted" PARALLEL_FEATURE_MARKS = hardware_marks(res={"cuda": "H100"}, num_cards=2) SINGLE_CARD_FEATURE_MARKS = hardware_marks(res={"cuda": "H100"}) @@ -198,3 +199,43 @@ def test_layered_output_image_count( b64 = url.split(",", 1)[1] img = decode_b64_image(b64) assert img is not None, f"Failed to decode image at index {i}" + + +# ── Issue #1966 server do not support empty prompt ───────────────────────── +# https://github.com/vllm-project/vllm-omni/issues/1966 +# case with empty prompt +# --------------------------------------------------------------------------- + +PROMPT_CASES = [ + pytest.param( + OmniServerParams( + model=MODEL, + server_args=["--vae-use-slicing", "--vae-use-tiling"], + ), + id="prompt_001", + marks=SINGLE_CARD_FEATURE_MARKS, + ), +] + + +@pytest.mark.advanced_model +@pytest.mark.diffusion +@pytest.mark.parametrize("omni_server", PROMPT_CASES, indirect=True) +def test_empty_prompt(omni_server: OmniServer, openai_client: OpenAIClientHandler): + """Test feature combinations with Qwen-Image-Layered.""" + 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=EMPTY_EDIT_PROMPT) + + request_config = { + "model": omni_server.model, + "messages": messages, + "extra_body": { + "num_inference_steps": 2, + "negative_prompt": NEGATIVE_PROMPT, + "true_cfg_scale": 4.0, + "seed": 42, + }, + } + + openai_client.send_diffusion_request(request_config) diff --git a/vllm_omni/entrypoints/openai/serving_chat.py b/vllm_omni/entrypoints/openai/serving_chat.py index ad472e94c..1ae0102a3 100644 --- a/vllm_omni/entrypoints/openai/serving_chat.py +++ b/vllm_omni/entrypoints/openai/serving_chat.py @@ -2021,7 +2021,6 @@ class OmniOpenAIServingChat(OpenAIServingChat, AudioMixin): return choices # ==================== Diffusion Mode Methods ==================== - async def _create_diffusion_chat_completion( self, request: ChatCompletionRequest, @@ -2053,9 +2052,6 @@ class OmniOpenAIServingChat(OpenAIServingChat, AudioMixin): # Extract prompt and images from messages prompt, reference_images = self._extract_diffusion_prompt_and_images(messages) - if not prompt: - return self._create_error_response("No text prompt found in messages") - # Extract generation parameters from extra_body (preferred) # Reference: text_to_image.py and text_to_video.py for supported parameters # [NOTE] When sending request via openai client Python library,