- Register QwenImage21Pipeline in model_extras _EXTRA_SPECS with an image-to-image prompt builder that forwards height/width - Rename run_qwen_image_21_edit.sh to run_qwen_image_21.sh - Fix SPDX-FileCopyrightText headers - Recipe: document mixed-KV-phase admission, add head-vs-diffusers A/B comparison section (measurements pending) - Add test_registry.py and test_pipeline.py (preprocess, prepare_latents ordering, mixed-phase _assemble_kv_cache, post-process); extend test_batch_compatibility.py
29 lines
772 B
Python
29 lines
772 B
Python
# SPDX-License-Identifier: Apache-2.0
|
|
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from PIL import Image
|
|
|
|
|
|
def build_image_to_image_prompt(
|
|
prompt: str,
|
|
negative_prompt: str | None,
|
|
input_image: Image.Image | list[Image.Image],
|
|
height: int | None = None,
|
|
width: int | None = None,
|
|
) -> dict[str, Any]:
|
|
img_prompt: dict[str, Any] = {
|
|
"prompt": prompt,
|
|
"multi_modal_data": {"image": input_image},
|
|
}
|
|
if height is not None:
|
|
img_prompt["height"] = height
|
|
if width is not None:
|
|
img_prompt["width"] = width
|
|
if negative_prompt is not None:
|
|
img_prompt["negative_prompt"] = negative_prompt
|
|
return img_prompt
|