[New model] Qwen-Image-2.1 support (rebase + review follow-ups) (#8099)
Signed-off-by: NumberWan <wantszkin2003@gmail.com> Signed-off-by: SamitHuang <285365963@qq.com> Signed-off-by: Samit <285365963@qq.com> Co-authored-by: Isotr0py <Isotr0py@outlook.com> Co-authored-by: Tianyu Guo <guoty9@mail2.sysu.edu.cn> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: SamitHuang <285365963@qq.com> Co-authored-by: Gao Han <hgaoaf@connect.ust.hk>
This commit is contained in:
52 files changed
+8058
-136
No files matched your search
@@ -0,0 +1,28 @@
|
||||
# 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
|
||||
@@ -91,6 +91,9 @@ from vllm_omni.model_extras.ming_image import (
|
||||
from vllm_omni.model_extras.ming_image import (
|
||||
build_text_to_image_prompt as build_ming_image_text_to_image_prompt,
|
||||
)
|
||||
from vllm_omni.model_extras.qwen_image_21 import (
|
||||
build_image_to_image_prompt as build_qwen_image_21_image_to_image_prompt,
|
||||
)
|
||||
from vllm_omni.model_extras.sana_video import SANA_VIDEO_EXTRA_BODY_PARAMS
|
||||
from vllm_omni.model_extras.sensenova_u1 import (
|
||||
SENSENOVA_U1_EXTRA_BODY_PARAMS,
|
||||
@@ -329,6 +332,9 @@ _EXTRA_SPECS: dict[str, dict[str, Any]] = {
|
||||
"text_to_image_prompt_builder": build_ming_image_text_to_image_prompt,
|
||||
"image_to_image_prompt_builder": build_ming_image_image_to_image_prompt,
|
||||
},
|
||||
"QwenImage21Pipeline": {
|
||||
"image_to_image_prompt_builder": build_qwen_image_21_image_to_image_prompt,
|
||||
},
|
||||
}
|
||||
_EXTRA_SPECS["MingImageLayeredDiffusionPipeline"] = _EXTRA_SPECS["MingImageDiffusionPipeline"]
|
||||
|
||||
@@ -473,10 +479,10 @@ def build_text_to_image_prompt(
|
||||
if builder is None:
|
||||
return prompt
|
||||
return builder(
|
||||
prompt=str(prompt["prompt"]),
|
||||
negative_prompt=prompt.get("negative_prompt"),
|
||||
height=height,
|
||||
width=width,
|
||||
str(prompt["prompt"]),
|
||||
prompt.get("negative_prompt"),
|
||||
height,
|
||||
width,
|
||||
)
|
||||
|
||||
|
||||
@@ -513,10 +519,10 @@ def build_image_to_video_prompt(
|
||||
if not isinstance(media_inputs, Mapping):
|
||||
raise TypeError("Canonical I2V prompt multi_modal_data must be a mapping.")
|
||||
return builder(
|
||||
prompt=str(prompt["prompt"]),
|
||||
negative_prompt=prompt.get("negative_prompt"),
|
||||
media_inputs=media_inputs,
|
||||
height=height,
|
||||
width=width,
|
||||
num_frames=num_frames,
|
||||
str(prompt["prompt"]),
|
||||
prompt.get("negative_prompt"),
|
||||
media_inputs,
|
||||
height,
|
||||
width,
|
||||
num_frames,
|
||||
)
|
||||
Reference in new issue
Block a user