Skip to content

vllm_omni.diffusion.postprocess.device_reduction

Device-side reduction of decoded video tensors to uint8 frames.

logger module-attribute

logger = init_logger(__name__)

prepare_diffusion_media_for_transport

prepare_diffusion_media_for_transport(
    media: DiffusionMediaOutput,
    *,
    od_config: OmniDiffusionConfig,
    sampling_params: OmniDiffusionSamplingParams
    | None = None,
) -> DiffusionMediaOutput

Validate and prepare one request-local media output before D2H.

reduce_video_to_uint8_frames

reduce_video_to_uint8_frames(
    video: Tensor, *, do_denormalize: bool = True
) -> Tensor

Reduce a decoded [B, C, F, H, W] video to uint8 [B, F, H, W, C] frames.

Runs denormalize/clamp/permute/round on the input's device so the following D2H copy carries uint8 instead of float. The result matches VideoProcessor.postprocess_video(output_type="np") then the *255 rounding done in the API server. Pass do_denormalize=False for VAEs that already emit [0, 1].