Skip to content

vllm_omni.diffusion.models.cosmos3.transfer

Cosmos3 transfer inference helpers.

The reference Cosmos Framework transfer path accepts one or more control hints and packs them before the noisy target video. This module keeps the vLLM Omni pipeline-specific pieces small: request parsing, media normalization, and optional on-the-fly edge/blur control generation.

Transfer is a video-output mode. It cannot be combined with T2I, sound generation, or action generation.

BILATERAL_D module-attribute

BILATERAL_D = 30

BILATERAL_ITERATIONS module-attribute

BILATERAL_ITERATIONS = 1

BILATERAL_REFERENCE_RESOLUTION module-attribute

BILATERAL_REFERENCE_RESOLUTION = 720

BILATERAL_SIGMA_COLOR module-attribute

BILATERAL_SIGMA_COLOR = 150

BILATERAL_SIGMA_SPACE module-attribute

BILATERAL_SIGMA_SPACE = 100

BLUR_DOWNUP_PRESETS module-attribute

BLUR_DOWNUP_PRESETS: dict[str, int] = {
    "none": 1,
    "very_low": 4,
    "low": 4,
    "medium": 10,
    "high": 16,
    "very_high": 16,
}

BLUR_PRE_BLUR_DOWNSCALE_PRESETS module-attribute

BLUR_PRE_BLUR_DOWNSCALE_PRESETS: dict[str, int] = {
    "none": 1,
    "very_low": 1,
    "low": 4,
    "medium": 2,
    "high": 1,
    "very_high": 4,
}

EDGE_PRESETS module-attribute

EDGE_PRESETS: dict[str, tuple[int, int]] = {
    "none": (20, 50),
    "very_low": (20, 50),
    "low": (50, 100),
    "medium": (100, 200),
    "high": (200, 300),
    "very_high": (300, 400),
}

IMAGE_EXTENSIONS module-attribute

IMAGE_EXTENSIONS = {
    ".bmp",
    ".gif",
    ".jpg",
    ".jpeg",
    ".png",
    ".tif",
    ".tiff",
    ".webp",
}

TRANSFER_DEFAULTS module-attribute

TRANSFER_DEFAULTS: dict[str, dict[str, Any]] = {
    "edge": {
        "guidance_scale": 3.0,
        "control_guidance": 1.5,
        "flow_shift": 10.0,
    },
    "blur": {
        "guidance_scale": 3.0,
        "control_guidance": 1.5,
        "flow_shift": 10.0,
    },
    "depth": {
        "guidance_scale": 3.0,
        "control_guidance": 1.5,
        "flow_shift": 10.0,
    },
    "seg": {
        "guidance_scale": 3.0,
        "control_guidance": 2.0,
        "flow_shift": 10.0,
    },
    "wsm": {
        "guidance_scale": 1.0,
        "control_guidance": 3.0,
        "flow_shift": 10.0,
        "num_frames": 101,
        "fps": 10,
        "num_video_frames_per_chunk": 101,
    },
}

TRANSFER_HINT_KEYS module-attribute

TRANSFER_HINT_KEYS: tuple[str, ...] = (
    "edge",
    "blur",
    "depth",
    "seg",
    "wsm",
)

TRANSFER_SAMPLE_DEFAULTS module-attribute

TRANSFER_SAMPLE_DEFAULTS: dict[str, Any] = {
    "num_video_frames_per_chunk": 93,
    "num_conditional_frames": 1,
    "max_frames": 5000,
    "show_control_condition": False,
    "show_input": False,
    "num_first_chunk_conditional_frames": 0,
    "share_vision_temporal_positions": True,
}

Cosmos3TransferConfig dataclass

control_guidance class-attribute instance-attribute

control_guidance: float = 1.0

control_guidance_interval class-attribute instance-attribute

control_guidance_interval: tuple[float, float] | None = None

flow_shift class-attribute instance-attribute

flow_shift: float | None = None

fps class-attribute instance-attribute

fps: float | None = None

guidance_scale class-attribute instance-attribute

guidance_scale: float | None = None

hints class-attribute instance-attribute

hints: dict[str, Cosmos3TransferHint] = field(
    default_factory=dict
)

max_frames class-attribute instance-attribute

max_frames: int = 5000

num_conditional_frames class-attribute instance-attribute

num_conditional_frames: int = 1

num_first_chunk_conditional_frames class-attribute instance-attribute

num_first_chunk_conditional_frames: int = 0

num_frames class-attribute instance-attribute

num_frames: int | None = None

num_video_frames_per_chunk class-attribute instance-attribute

num_video_frames_per_chunk: int = 93

ordered_hints property

ordered_hints: list[Cosmos3TransferHint]

share_vision_temporal_positions class-attribute instance-attribute

share_vision_temporal_positions: bool = True

show_control_condition class-attribute instance-attribute

show_control_condition: bool = False

show_input class-attribute instance-attribute

show_input: bool = False

Cosmos3TransferHint dataclass

control class-attribute instance-attribute

control: Any | None = None

control_path class-attribute instance-attribute

control_path: str | None = None

key instance-attribute

key: str

preset_blur_strength class-attribute instance-attribute

preset_blur_strength: str = 'medium'

preset_edge_threshold class-attribute instance-attribute

preset_edge_threshold: str = 'medium'

has_transfer_hints

has_transfer_hints(
    extra_args: Mapping[str, Any] | None,
) -> bool

load_or_compute_control_frames

load_or_compute_control_frames(
    hint: Cosmos3TransferHint,
    *,
    height: int,
    width: int,
    max_frames: int,
    input_frames: Tensor | None,
) -> Tensor

make_blur_control

make_blur_control(frames: Tensor, preset: str) -> Tensor

make_edge_control

make_edge_control(frames: Tensor, preset: str) -> Tensor

media_hw

media_hw(value: Any) -> tuple[int, int] | None

media_to_uint8_cthw

media_to_uint8_cthw(
    value: Any,
    *,
    height: int,
    width: int,
    max_frames: int | None = None,
) -> Tensor

normalized_video_to_uint8_cthw

normalized_video_to_uint8_cthw(video: Tensor) -> Tensor

pad_temporal_frames

pad_temporal_frames(
    frames: Tensor, target_frames: int
) -> Tensor

resize_center_crop_uint8_cthw

resize_center_crop_uint8_cthw(
    frames: Tensor, height: int, width: int
) -> Tensor

resolve_transfer_config

resolve_transfer_config(
    sp: Any, prompt_data: Any = None
) -> Cosmos3TransferConfig | None

transfer_max_frames_from_extra_args

transfer_max_frames_from_extra_args(
    extra_args: Mapping[str, Any] | None,
) -> int

uint8_cthw_to_normalized_5d

uint8_cthw_to_normalized_5d(
    frames: Tensor, *, dtype: dtype
) -> Tensor