[Misc] Keep serving changes out of example refactor
Signed-off-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
1 parent
39e1c70aea
commit
0db924bc54
4 files changed
+5
-51
No files matched your search
@@ -3,7 +3,7 @@
|
|||||||
This example demonstrates online image-to-video generation with vLLM-Omni.
|
This example demonstrates online image-to-video generation with vLLM-Omni.
|
||||||
The startup script defaults to Wan2.2, but `MODEL` can select any supported
|
The startup script defaults to Wan2.2, but `MODEL` can select any supported
|
||||||
image-to-video model. The existing curl helper remains a concrete Wan2.2
|
image-to-video model. The existing curl helper remains a concrete Wan2.2
|
||||||
request, while the server side owns model-specific prompt processing.
|
request through the standard Videos API.
|
||||||
|
|
||||||
## Start Server
|
## Start Server
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
This example demonstrates online text-to-image generation with vLLM-Omni. The
|
This example demonstrates online text-to-image generation with vLLM-Omni. The
|
||||||
startup script and Python clients default to Qwen-Image, but `MODEL` can select
|
startup script and Python clients default to Qwen-Image, but `MODEL` can select
|
||||||
any supported text-to-image model. The existing curl helper remains a concrete
|
any supported text-to-image model. The existing curl helper remains a concrete
|
||||||
Qwen-Image request, while the server side owns model-specific prompt processing.
|
Qwen-Image request through the standard Images API.
|
||||||
|
|
||||||
## Start Server
|
## Start Server
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from vllm_omni.entrypoints.openai.protocol.videos import (
|
|||||||
VideoParams,
|
VideoParams,
|
||||||
VideoResponse,
|
VideoResponse,
|
||||||
)
|
)
|
||||||
from vllm_omni.entrypoints.openai.serving_video import OmniOpenAIServingVideo, ReferenceImage
|
from vllm_omni.entrypoints.openai.serving_video import OmniOpenAIServingVideo
|
||||||
from vllm_omni.entrypoints.openai.storage import LocalStorageManager
|
from vllm_omni.entrypoints.openai.storage import LocalStorageManager
|
||||||
from vllm_omni.entrypoints.openai.stores import AsyncDictStore, TaskRegistry
|
from vllm_omni.entrypoints.openai.stores import AsyncDictStore, TaskRegistry
|
||||||
from vllm_omni.errors import GuardrailViolationError
|
from vllm_omni.errors import GuardrailViolationError
|
||||||
@@ -433,36 +433,6 @@ def test_i2v_video_generation_form(test_client, mocker: MockerFixture):
|
|||||||
assert input_image.size == (48, 32)
|
assert input_image.size == (48, 32)
|
||||||
|
|
||||||
|
|
||||||
def test_i2v_online_applies_model_specific_prompt_builder() -> None:
|
|
||||||
engine = FakeAsyncOmni()
|
|
||||||
engine.model_class_name = "WanVACEPipeline"
|
|
||||||
handler = OmniOpenAIServingVideo.for_diffusion(
|
|
||||||
diffusion_engine=engine,
|
|
||||||
model_name="Wan-AI/Wan2.1-VACE-1.3B-diffusers",
|
|
||||||
)
|
|
||||||
image = Image.new("RGB", (320, 16), "red")
|
|
||||||
|
|
||||||
asyncio.run(
|
|
||||||
handler._run_and_extract(
|
|
||||||
VideoGenerationRequest(
|
|
||||||
prompt="A bird flying",
|
|
||||||
negative_prompt="blurry",
|
|
||||||
width=320,
|
|
||||||
height=16,
|
|
||||||
num_frames=5,
|
|
||||||
),
|
|
||||||
"vace-online-builder",
|
|
||||||
reference_image=ReferenceImage(image),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
prompt = engine.captured_prompt
|
|
||||||
assert prompt["negative_prompt"] == "blurry"
|
|
||||||
assert len(prompt["multi_modal_data"]["video"]) == 5
|
|
||||||
assert len(prompt["multi_modal_data"]["mask"]) == 5
|
|
||||||
assert prompt["multi_modal_data"]["video"][0] is image
|
|
||||||
|
|
||||||
|
|
||||||
def test_i2v_video_generation_resizes_input_to_requested_dimensions(test_client, mocker: MockerFixture):
|
def test_i2v_video_generation_resizes_input_to_requested_dimensions(test_client, mocker: MockerFixture):
|
||||||
image_bytes = _make_test_image_bytes((48, 32))
|
image_bytes = _make_test_image_bytes((48, 32))
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ from vllm_omni.entrypoints.openai.stage_params import (
|
|||||||
from vllm_omni.entrypoints.openai.utils import get_stage_type, parse_lora_request
|
from vllm_omni.entrypoints.openai.utils import get_stage_type, parse_lora_request
|
||||||
from vllm_omni.entrypoints.openai.video_api_utils import _encode_video_bytes, encode_video_base64
|
from vllm_omni.entrypoints.openai.video_api_utils import _encode_video_bytes, encode_video_base64
|
||||||
from vllm_omni.inputs.data import OmniDiffusionSamplingParams, OmniTextPrompt
|
from vllm_omni.inputs.data import OmniDiffusionSamplingParams, OmniTextPrompt
|
||||||
from vllm_omni.model_extras import build_image_to_video_prompt
|
|
||||||
from vllm_omni.outputs.output_metadata import (
|
from vllm_omni.outputs.output_metadata import (
|
||||||
DiffusionMetadataMapping,
|
DiffusionMetadataMapping,
|
||||||
DiffusionMultimodalOutput,
|
DiffusionMultimodalOutput,
|
||||||
@@ -101,14 +100,11 @@ class OmniOpenAIServingVideo:
|
|||||||
if self._stage_configs is None and stage_configs is not None:
|
if self._stage_configs is None and stage_configs is not None:
|
||||||
self._stage_configs = stage_configs
|
self._stage_configs = stage_configs
|
||||||
|
|
||||||
def _get_diffusion_od_config(self) -> object | None:
|
|
||||||
get_od_config = getattr(self._engine_client, "get_diffusion_od_config", None)
|
|
||||||
return get_od_config() if callable(get_od_config) else getattr(self._engine_client, "od_config", None)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supports_mixed_reference_inputs(self) -> bool:
|
def supports_mixed_reference_inputs(self) -> bool:
|
||||||
"""Return whether the configured diffusion model accepts mixed refs."""
|
"""Return whether the configured diffusion model accepts mixed refs."""
|
||||||
od_config = self._get_diffusion_od_config()
|
get_od_config = getattr(self._engine_client, "get_diffusion_od_config", None)
|
||||||
|
od_config = get_od_config() if callable(get_od_config) else getattr(self._engine_client, "od_config", None)
|
||||||
if od_config is None:
|
if od_config is None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -256,18 +252,6 @@ class OmniOpenAIServingVideo:
|
|||||||
loggable = {**loggable, **redacted}
|
loggable = {**loggable, **redacted}
|
||||||
logger.info("Applied extra_params: %s", loggable)
|
logger.info("Applied extra_params: %s", loggable)
|
||||||
|
|
||||||
model_class_name = getattr(self._get_diffusion_od_config(), "model_class_name", None)
|
|
||||||
prompt = cast(
|
|
||||||
OmniTextPrompt,
|
|
||||||
build_image_to_video_prompt(
|
|
||||||
model_class_name=model_class_name,
|
|
||||||
prompt=prompt,
|
|
||||||
height=gen_params.height,
|
|
||||||
width=gen_params.width,
|
|
||||||
num_frames=gen_params.num_frames,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
self._apply_lora(request.lora, gen_params)
|
self._apply_lora(request.lora, gen_params)
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
|
|||||||
Reference in new issue
Block a user