[1/N] Stream Wan VAE chunks to the media consumer (#7016)
Signed-off-by: specture724 <specture724@gmail.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
6 files changed
+744
-19
No files matched your search
@@ -2,6 +2,7 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
@@ -9,6 +10,7 @@ from typing import (
|
||||
ClassVar,
|
||||
Literal,
|
||||
Protocol,
|
||||
TypeGuard,
|
||||
runtime_checkable,
|
||||
)
|
||||
|
||||
@@ -46,6 +48,34 @@ class SupportAudioOutput(Protocol):
|
||||
support_audio_output: ClassVar[bool] = True
|
||||
|
||||
|
||||
DecodedChunkConsumer = Callable[["torch.Tensor"], None]
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class SupportsChunkedVAEDecode(Protocol):
|
||||
"""Optional capability for VAEs that stream decoded temporal chunks.
|
||||
|
||||
Implementations must drain decoding before surfacing callback errors. In a
|
||||
distributed VAE, every rank invokes the method so collectives stay in
|
||||
lockstep, while ``on_chunk`` is called only on the rank that owns output.
|
||||
"""
|
||||
|
||||
def decode_with_chunks(
|
||||
self,
|
||||
z: torch.Tensor,
|
||||
*,
|
||||
on_chunk: DecodedChunkConsumer,
|
||||
) -> None:
|
||||
"""Decode ``z`` and synchronously deliver committed chunks in order."""
|
||||
...
|
||||
|
||||
|
||||
def supports_chunked_vae_decode(vae: object) -> TypeGuard[SupportsChunkedVAEDecode]:
|
||||
"""Return whether ``vae`` exposes the optional chunked decode capability."""
|
||||
|
||||
return isinstance(vae, SupportsChunkedVAEDecode)
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class SupportsStepExecution(Protocol):
|
||||
"""State-driven step-level execution protocol for diffusion pipelines.
|
||||
|
||||
Reference in new issue
Block a user