[Bug-Fix]fix bug of empty prompt input (#2041)
Signed-off-by: AlvisGong <gwly0401@163.com> Signed-off-by: Hui <1779066624@qq.com> Signed-off-by: Hui. <1779066624@qq.com> Co-authored-by: AlvisGong <gwly0401@163.com>
This commit is contained in:
1 parent
91a818629c
commit
0adbac33a5
2 files changed
+41
-4
No files matched your search
@@ -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)
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user