Skip to content

vllm_omni.diffusion.offloader.config

Public diffusion CPU-offload configuration helpers.

DEFAULT_OFFLOAD_COMPONENTS module-attribute

DEFAULT_OFFLOAD_COMPONENTS = frozenset({DIT_COMPONENT})

DIT_COMPONENT module-attribute

DIT_COMPONENT = 'dit'

OFFLOAD_COMPONENTS module-attribute

OFFLOAD_COMPONENTS = frozenset(
    {DIT_COMPONENT, TEXT_ENCODER_COMPONENT}
)

TEXT_ENCODER_COMPONENT module-attribute

TEXT_ENCODER_COMPONENT = 'text_encoder'

DLOTransfer

Bases: str, Enum

How one component's next block reaches the device.

ALLGATHER class-attribute instance-attribute

ALLGATHER = 'allgather'

RANK_LOCAL class-attribute instance-attribute

RANK_LOCAL = 'rank-local'

LayerOffloadOptions dataclass

Layer-mode settings for one selected diffusion component.

resident_layers class-attribute instance-attribute

resident_layers: int = 0

weight_transfer class-attribute instance-attribute

weight_transfer: DLOTransfer | None = None

OffloadMode

Bases: str, Enum

User-facing offload granularity.

LAYER class-attribute instance-attribute

LAYER = 'layer'

MODULE class-attribute instance-attribute

MODULE = 'module'

OffloadStrategy

Bases: str, Enum

Resolved internal backend strategy.

DISTRIBUTED_LAYER_WISE class-attribute instance-attribute

DISTRIBUTED_LAYER_WISE = 'distributed_layer_wise'

LAYER_WISE class-attribute instance-attribute

LAYER_WISE = 'layer_wise'

MODEL_LEVEL class-attribute instance-attribute

MODEL_LEVEL = 'model_level'

NONE class-attribute instance-attribute

NONE = 'none'

ParsedDiffusionOffloadConfig dataclass

Validated internal form of the raw public offload mapping.

components instance-attribute

components: frozenset[str]

layer_options instance-attribute

layer_options: Mapping[str, LayerOffloadOptions]

mode instance-attribute

pin_memory class-attribute instance-attribute

pin_memory: bool | None = None

ResolvedOffload dataclass

Canonical offload policy derived once from public or legacy inputs.

any_allgather property

any_allgather: bool

components instance-attribute

components: frozenset[str]

pin_memory instance-attribute

pin_memory: bool

public instance-attribute

resident_layers instance-attribute

resident_layers: int

strategy instance-attribute

strategy: OffloadStrategy

transfers instance-attribute

transfers: Mapping[str, DLOTransfer]

offloads

offloads(component: str) -> bool

uses_allgather

uses_allgather(component: str = DIT_COMPONENT) -> bool

any_selected_component_uses_allgather

any_selected_component_uses_allgather(config: Any) -> bool

Return whether an enabled layer backend requires weight collectives.

component_uses_allgather

component_uses_allgather(
    config: Any, component: str = DIT_COMPONENT
) -> bool

Return whether one selected component uses AllGather transport.

materialize_legacy_offload_flags

materialize_legacy_offload_flags(
    config: Any,
) -> OffloadStrategy

Keep existing strategy readers working after resolving the compact API.

offload_enabled

offload_enabled(config: Any) -> bool

Return whether any CPU-offload policy is active.

offload_streams_blocks

offload_streams_blocks(config: Any) -> bool

Return whether an active policy streams weights block by block.

parse_diffusion_offload_config

parse_diffusion_offload_config(
    value: Any,
) -> ParsedDiffusionOffloadConfig | None

Validate the compact diffusion_offload_config public API.

parse_dlo_transfer

parse_dlo_transfer(
    value: Mapping[str, str | DLOTransfer],
) -> dict[str, DLOTransfer]

Resolve an internal per-component transfer mapping.

parse_offload_components

parse_offload_components(
    value: Collection[str],
) -> frozenset[str]

Validate an internal component collection.

resolve_offload

resolve_offload(config: Any) -> ResolvedOffload

Resolve and cache the complete offload policy on its owning config.

resolve_offload_strategy

resolve_offload_strategy(config: Any) -> OffloadStrategy

Resolve the compact config or compatibility boolean entry points.

selected_offload_components

selected_offload_components(config: Any) -> frozenset[str]

Resolve selected components while preserving legacy topology defaults.

should_offload_component

should_offload_component(
    config: Any, component: str
) -> bool

Return whether an active layer policy selects component.