[Model][Frontend] MiniMax-H3: Add opt-in planar video response encoding (#6288)
Signed-off-by: MosCloud <bwzhang1991@163.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
1 parent
3d34b8b977
commit
4882a36c41
9 files changed
+1077
-23
No files matched your search
@@ -9,7 +9,8 @@ from collections.abc import Mapping
|
||||
from dataclasses import dataclass
|
||||
from functools import cached_property
|
||||
from http import HTTPStatus
|
||||
from typing import Any, cast
|
||||
from types import SimpleNamespace
|
||||
from typing import TYPE_CHECKING, Any, cast
|
||||
|
||||
from fastapi import HTTPException
|
||||
from PIL import Image
|
||||
@@ -29,7 +30,10 @@ from vllm_omni.entrypoints.openai.stage_params import (
|
||||
get_default_sampling_params_list,
|
||||
)
|
||||
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.model_extras import should_preserve_reference_image_size
|
||||
from vllm_omni.outputs.output_metadata import (
|
||||
@@ -40,6 +44,9 @@ from vllm_omni.outputs.output_metadata import (
|
||||
|
||||
logger = init_logger(__name__)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from vllm_omni.diffusion.data import OmniDiffusionConfig
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReferenceImage:
|
||||
@@ -90,6 +97,12 @@ class OmniOpenAIServingVideo:
|
||||
self._model_name = model_name
|
||||
self._stage_configs = stage_configs
|
||||
|
||||
def _resolve_diffusion_od_config(self) -> OmniDiffusionConfig | SimpleNamespace | None:
|
||||
get_od_config = getattr(self._engine_client, "get_diffusion_od_config", None)
|
||||
if callable(get_od_config):
|
||||
return get_od_config()
|
||||
return getattr(self._engine_client, "od_config", None)
|
||||
|
||||
@property
|
||||
def model_name(self) -> str | None:
|
||||
return self._model_name
|
||||
@@ -105,8 +118,7 @@ class OmniOpenAIServingVideo:
|
||||
@cached_property
|
||||
def preserves_reference_image_size(self) -> bool:
|
||||
"""Return whether the active pipeline owns reference-image resizing."""
|
||||
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)
|
||||
od_config = self._resolve_diffusion_od_config()
|
||||
model_class_name = None if od_config is None else getattr(od_config, "model_class_name", None)
|
||||
model = getattr(od_config, "model", None) if od_config is not None else None
|
||||
model = model or self.model_name
|
||||
@@ -120,8 +132,7 @@ class OmniOpenAIServingVideo:
|
||||
@property
|
||||
def supports_mixed_reference_inputs(self) -> bool:
|
||||
"""Return whether the configured diffusion model accepts mixed refs."""
|
||||
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)
|
||||
od_config = self._resolve_diffusion_od_config()
|
||||
if od_config is None:
|
||||
return False
|
||||
|
||||
@@ -332,7 +343,11 @@ class OmniOpenAIServingVideo:
|
||||
video_data = [
|
||||
VideoData(
|
||||
b64_json=(
|
||||
encode_video_base64(video, fps=artifacts.output_fps, video_codec_options=video_codec_options)
|
||||
encode_video_base64(
|
||||
video,
|
||||
fps=artifacts.output_fps,
|
||||
video_codec_options=video_codec_options,
|
||||
)
|
||||
if artifacts.audios[idx] is None
|
||||
else encode_video_base64(
|
||||
video,
|
||||
|
||||
Reference in new issue
Block a user