Skip to content

vllm_omni.diffusion.data

BLOCK_SPARSE_BACKENDS module-attribute

BLOCK_SPARSE_BACKENDS = frozenset({'RAINFUSION_ATTN'})

DIFFUSION_REQUEST_LIFECYCLE_KEY module-attribute

DIFFUSION_REQUEST_LIFECYCLE_KEY = (
    "_diffusion_request_lifecycle"
)

DIFFUSION_REQUEST_STARTED module-attribute

DIFFUSION_REQUEST_STARTED = 'started'

SHUTDOWN_MESSAGE module-attribute

SHUTDOWN_MESSAGE = {'type': 'shutdown'}

VAE_FAST_PATH_LEVELS module-attribute

VAE_FAST_PATH_LEVELS: tuple[str, ...] = (
    "off",
    "lossless",
    "channels_last",
)

logger module-attribute

logger = init_logger(__name__)

AsyncDiffusionOutput dataclass

Async protocol envelope for result_mq messages.

In request-mode (step_execution=False), all result_mq messages use this envelope. The kind field routes the message to the correct consumer.

async_output_id class-attribute instance-attribute

async_output_id: str | None = None

error class-attribute instance-attribute

error: str | None = None

kind instance-attribute

output class-attribute instance-attribute

output: DiffusionOutput | None = None

result class-attribute instance-attribute

result: Any | None = None

rpc_id class-attribute instance-attribute

rpc_id: str | None = None

AsyncOutputKind

Bases: Enum

Message kind for AsyncDiffusionOutput — routes async results.

  • RPC_RESULT — ordinary RPC return (sleep, wake, profile, etc.)
  • COMPUTE_DONE — worker forward finished, GPU can start next request
  • OUTPUT_READY — background D2H/SHM packing finished, final output is available via async_output_id

COMPUTE_DONE class-attribute instance-attribute

COMPUTE_DONE = 'compute_done'

OUTPUT_READY class-attribute instance-attribute

OUTPUT_READY = 'output_ready'

RPC_RESULT class-attribute instance-attribute

RPC_RESULT = 'rpc_result'

AttentionConfig dataclass

Per-role attention backend configuration.

Lookup precedence for a given (role, role_category): 1. per_role[role] — exact match 2. per_role[role_category] — category fallback (e.g. "ltx2.audio_to_video" → "cross") 3. default — global default 4. platform default — unchanged platform logic

default class-attribute instance-attribute

default: AttentionSpec | None = None

per_role class-attribute instance-attribute

per_role: dict[str, AttentionSpec] = field(
    default_factory=dict
)

resolve_with_source

resolve_with_source(
    role: str = "self", role_category: str | None = None
) -> tuple[AttentionSpec | None, str | None]

Resolve the AttentionSpec and report which config entry matched.

AttentionSpec dataclass

Specifies a backend and its typed backend-specific config for one attention role.

backend instance-attribute

backend: str

block_sparse class-attribute instance-attribute

block_sparse: BlockSparseSpec | None = None

fastvideo_vsa_topk class-attribute instance-attribute

fastvideo_vsa_topk: int | None = None

quant class-attribute instance-attribute

quant: AttnQuantSpec | None = None

skip_calibration class-attribute instance-attribute

skip_calibration: dict | None = field(
    default=None, repr=False
)

skip_softmax class-attribute instance-attribute

skip_softmax: SkipSoftmaxSpec | None = None

backend_kwargs

backend_kwargs() -> dict[str, Any] | None

Serialize typed backend config into the kwargs dict the backend impl consumes.

AttnQuantSpec dataclass

dtype_qk class-attribute instance-attribute

dtype_qk: str | None = None

dtype_vo class-attribute instance-attribute

dtype_vo: str | None = None

enabled property

enabled: bool

flashinfer_backend class-attribute instance-attribute

flashinfer_backend: str | None = None

k_block_size class-attribute instance-attribute

k_block_size: int = 16

q_block_size class-attribute instance-attribute

q_block_size: int = 1

BlockSparseSpec dataclass

User-facing controls shared by block-sparse attention backends.

sparsity is the nominal fraction of key blocks dropped per query block; start_step keeps the first N denoise steps dense and skip_layers (an index selector such as "0-3,38") exempts individual DiT blocks. Those two are the accuracy knobs to trade back quality at a fixed sparsity. precision selects the kernel precision mode (see RainFusionPrecision).

end_step class-attribute instance-attribute

end_step: int = 0

precision class-attribute instance-attribute

precision: str = RainFusionPrecision.BF16.value

skip_layer_indices class-attribute instance-attribute

skip_layer_indices: set[int] | None = field(
    default=None, repr=False
)

skip_layers class-attribute instance-attribute

skip_layers: str | list[int] | None = None

sparsity class-attribute instance-attribute

sparsity: float = 0.8

start_step class-attribute instance-attribute

start_step: int = 0

CuMemTag

Bases: str, Enum

Tags representing specific CuMem allocations for sleep/wake state tracking.

KV_CACHE class-attribute instance-attribute

KV_CACHE = 'kv_cache'

WEIGHTS class-attribute instance-attribute

WEIGHTS = 'weights'

DiffusionCacheConfig dataclass

Configuration for cache adapters (TeaCache, cache-dit, MagCache, etc.).

This dataclass provides a unified interface for cache configuration parameters. It can be initialized from a dictionary and accessed via attributes.

Common parameters
  • TeaCache: rel_l1_thresh, coefficients (optional)
  • cache-dit: Fn_compute_blocks, Bn_compute_blocks, max_warmup_steps, residual_diff_threshold, enable_taylorseer, taylorseer_order, scm_steps_mask_policy, scm_steps_policy
  • MagCache: mag_threshold, mag_max_skip_steps, mag_retention_ratio, mag_ratios, mag_calibrate
  • SeaCache: sea_threshold, sea_residual_order, sea_max_consecutive_cached, sea_power_exp
  • step_cache: step_cache_dit_enabled, velocity_sim_thresholds, velocity_skip_countdowns, step_cache_dit_min_history
Example

From dict (user-facing API) - partial config uses defaults for missing keys

config = DiffusionCacheConfig.from_dict({"rel_l1_thresh": 0.3})

Access via attribute

print(config.rel_l1_thresh) # 0.3 (from dict) print(config.Fn_compute_blocks) # 8 (default)

Empty dict defers model-specific defaults to the TeaCache backend

default_config = DiffusionCacheConfig.from_dict({}) print(default_config.rel_l1_thresh) # None

Bn_compute_blocks class-attribute instance-attribute

Bn_compute_blocks: int = 0

Fn_compute_blocks class-attribute instance-attribute

Fn_compute_blocks: int = 1

coefficients class-attribute instance-attribute

coefficients: list[float] | None = None

enable_taylorseer class-attribute instance-attribute

enable_taylorseer: bool = False

force_refresh_step_hint class-attribute instance-attribute

force_refresh_step_hint: int | None = None

force_refresh_step_policy class-attribute instance-attribute

force_refresh_step_policy: str = 'once'

mag_calibrate class-attribute instance-attribute

mag_calibrate: bool = False

mag_max_skip_steps class-attribute instance-attribute

mag_max_skip_steps: int = 5

mag_ratios class-attribute instance-attribute

mag_ratios: list[float] | None = None

mag_retention_ratio class-attribute instance-attribute

mag_retention_ratio: float = 0.1

mag_threshold class-attribute instance-attribute

mag_threshold: float = 0.24

max_cached_steps class-attribute instance-attribute

max_cached_steps: int = -1

max_continuous_cached_steps class-attribute instance-attribute

max_continuous_cached_steps: int = 3

max_warmup_steps class-attribute instance-attribute

max_warmup_steps: int = 4

num_inference_steps class-attribute instance-attribute

num_inference_steps: int | None = None

rel_l1_thresh class-attribute instance-attribute

rel_l1_thresh: float | None = None

residual_diff_threshold class-attribute instance-attribute

residual_diff_threshold: float = 0.24

scm_steps_mask_policy class-attribute instance-attribute

scm_steps_mask_policy: str | None = None

scm_steps_policy class-attribute instance-attribute

scm_steps_policy: str = 'dynamic'

sea_max_consecutive_cached class-attribute instance-attribute

sea_max_consecutive_cached: int = 2

sea_power_exp class-attribute instance-attribute

sea_power_exp: float = 3.0

sea_residual_order class-attribute instance-attribute

sea_residual_order: int = 1

sea_threshold class-attribute instance-attribute

sea_threshold: float = 0.25

step_cache_dit_enabled class-attribute instance-attribute

step_cache_dit_enabled: bool = True

step_cache_dit_max_history class-attribute instance-attribute

step_cache_dit_max_history: int = 2

step_cache_dit_min_history class-attribute instance-attribute

step_cache_dit_min_history: int = 2

taylorseer_order class-attribute instance-attribute

taylorseer_order: int = 1

velocity_sim_thresholds class-attribute instance-attribute

velocity_sim_thresholds: list[float] = field(
    default_factory=lambda: [0.95, 0.93]
)

velocity_skip_countdowns class-attribute instance-attribute

velocity_skip_countdowns: list[int] = field(
    default_factory=lambda: [4, 2]
)

from_dict classmethod

from_dict(data: dict[str, Any]) -> DiffusionCacheConfig

Create DiffusionCacheConfig from a dictionary.

Parameters:

Name Type Description Default
data dict[str, Any]

Dictionary containing cache configuration parameters

required

Returns:

Type Description
DiffusionCacheConfig

DiffusionCacheConfig instance with parameters set from dict

DiffusionOutput dataclass

Final output (after pipeline completion)

abort_message class-attribute instance-attribute

abort_message: str | None = None

aborted class-attribute instance-attribute

aborted: bool = False

active_event_ids class-attribute instance-attribute

active_event_ids: list[str] = field(default_factory=list)

async_output_id class-attribute instance-attribute

async_output_id: str | None = None

chunk_index class-attribute instance-attribute

chunk_index: int = 0

completed_event_ids class-attribute instance-attribute

completed_event_ids: list[str] = field(default_factory=list)

error class-attribute instance-attribute

error: str | None = None

error_status_code class-attribute instance-attribute

error_status_code: int | None = None

error_type class-attribute instance-attribute

error_type: str | None = None

finished class-attribute instance-attribute

finished: bool = True

kv_recv_ms class-attribute instance-attribute

kv_recv_ms: float = 0.0

media class-attribute instance-attribute

media: DiffusionMediaOutput | None = None

output class-attribute instance-attribute

output: Tensor | tuple[Any, ...] | dict[str, Any] | None = (
    None
)

peak_memory_mb class-attribute instance-attribute

peak_memory_mb: float = 0.0

post_process_func class-attribute instance-attribute

post_process_func: Callable[..., Any] | None = None

request_started class-attribute instance-attribute

request_started: bool = False

stage_durations class-attribute instance-attribute

stage_durations: dict[str, float] = field(
    default_factory=dict
)

started_event_ids class-attribute instance-attribute

started_event_ids: list[str] = field(default_factory=list)

to_cpu class-attribute instance-attribute

to_cpu: bool = False

total_chunks class-attribute instance-attribute

total_chunks: int = 1

trajectory_decoded class-attribute instance-attribute

trajectory_decoded: list[Image] | None = None

trajectory_latents class-attribute instance-attribute

trajectory_latents: Tensor | dict[str, Any] | None = None

trajectory_log_probs class-attribute instance-attribute

trajectory_log_probs: Tensor | dict[str, Any] | None = None

trajectory_timesteps class-attribute instance-attribute

trajectory_timesteps: Tensor | dict[str, Any] | None = None

from_exception classmethod

from_exception(exc: BaseException) -> DiffusionOutput

DiffusionParallelConfig dataclass

Configuration for diffusion model distributed execution.

allgather_degree class-attribute instance-attribute

allgather_degree: int = 1

Number of GPUs used for AllGather-KV sequence parallelism (causal=False only).

cfg_parallel_size class-attribute instance-attribute

cfg_parallel_size: int = 1

Number of ranks used to execute guidance passes in parallel.

data_parallel_size class-attribute instance-attribute

data_parallel_size: int | None = None

Number of data parallel groups. Inferred from WORLD when omitted.

enable_expert_parallel class-attribute instance-attribute

enable_expert_parallel: bool = False

Enable expert parallelism for MoE layers (TP is still used for non-MoE layers).

hsdp_replicate_size class-attribute instance-attribute

hsdp_replicate_size: int = 1

Number of replica groups for HSDP. Each replica holds a full sharded copy.

hsdp_shard_size class-attribute instance-attribute

hsdp_shard_size: int = -1

Number of GPUs to shard weights across within each replica group. -1 means auto-calculate.

mask_sp_padding class-attribute instance-attribute

mask_sp_padding: bool = False

If True, generate a boolean attention mask for zero-padded SP tokens when sequence length is not divisible by the SP world size. The mask routes attention through the varlen path (unpad→kernel→repad), which is correct but carries additional overhead. When False (default), padding tokens are left unmasked; since _shard_with_auto_pad always pads with zeros, their contribution to attention output is negligible.

pipeline_parallel_size class-attribute instance-attribute

pipeline_parallel_size: int = 1

Number of pipeline parallel stages.

ring_degree class-attribute instance-attribute

ring_degree: int = 1

Number of GPUs used for ring sequence parallelism.

sequence_parallel_size class-attribute instance-attribute

sequence_parallel_size: int | None = None

Number of sequence parallel groups. sequence_parallel_size = ulysses_degree * ring_degree, or allgather_degree when AllGather-KV is enabled.

tensor_parallel_size class-attribute instance-attribute

tensor_parallel_size: int = 1

Number of tensor parallel groups.

text_encoder_tp_size class-attribute instance-attribute

text_encoder_tp_size: int = 1

Number of ranks used to tensor-parallel shard the diffusion text encoder.

Ranks are the first text_encoder_tp_size DiT ranks. Defaults to 1, which keeps the encoder fully resident on the DiT main rank (historical behavior). Values > 1 shard the Qwen3-VL encoder across the encoder TP ranks and run the encode with distributed collectives over the encoder process group.

ulysses_a2a_permute class-attribute instance-attribute

ulysses_a2a_permute: bool = False

Use fused permute-free all-to-all for eligible strict Ulysses exchanges.

ulysses_degree class-attribute instance-attribute

ulysses_degree: int = 1

Number of GPUs used for ulysses sequence parallelism.

ulysses_mode class-attribute instance-attribute

ulysses_mode: str = 'strict'

Ulysses sequence-parallel mode.

  • "strict": Require divisibility constraints (fastest, default).
  • "advanced_uaa": Enable UAA ("Ulysses Anything Attention") to support uneven sequence lengths and non-divisible head counts.

Note: - Ring attention does not support attention_mask, so models that rely on mask-based auto-padding are still incompatible with Ring. - When used in hybrid Ulysses+Ring, Ring requires consistent per-rank sequence shapes across the ring group.

use_hsdp class-attribute instance-attribute

use_hsdp: bool = False

Enable Hybrid Sharded Data Parallel (HSDP) for model weight sharding.

vae_parallel_mode class-attribute instance-attribute

vae_parallel_mode: str = 'tile'

VAE parallel decode strategy.

  • "tile": Patch/tile parallel decode (default). Each rank decodes a subset of spatial tiles and the results are stitched on rank 0.
  • "spatial_shard_height": Spatially-sharded decode that splits decoder feature maps along height and exchanges halo rows around spatial convolutions.
  • "spatial_shard_width": Same as "spatial_shard_height" but sharded along width.

The "spatial_shard_*" modes are decode-only and currently require vae_patch_parallel_size to match the DiT group size; otherwise the VAE falls back to tile-parallel decode at runtime.

vae_patch_parallel_size class-attribute instance-attribute

vae_patch_parallel_size: int = 1

Number of ranks used for VAE patch/tile parallelism (decode/encode).

from_dict classmethod

from_dict(data: dict[str, Any]) -> DiffusionParallelConfig

Create DiffusionParallelConfig from a dictionary.

Parameters:

Name Type Description Default
data dict[str, Any]

Dictionary containing parallel configuration parameters

required

Returns:

Type Description
DiffusionParallelConfig

DiffusionParallelConfig instance with parameters set from dict

from_stage_overrides classmethod

from_stage_overrides(
    kwargs: Mapping[str, Any],
) -> DiffusionParallelConfig

Resolve nested or flat stage inputs through the config's own defaults.

resolve_data_parallel_size

resolve_data_parallel_size(world_size: int) -> int

Resolve or validate diffusion DP against the actual WORLD size.

DiffusionRequestAbortedError

Bases: RuntimeError

Raised when a diffusion request ends via user-visible abort.

OmniACK dataclass

Handshake payload from Workers to Orchestrator.

error_msg class-attribute instance-attribute

error_msg: str | None = None

freed_bytes class-attribute instance-attribute

freed_bytes: int = 0

metadata class-attribute instance-attribute

metadata: dict[str, Any] = field(default_factory=dict)

Additional telemetry such as: - max_contiguous_block: for fragmentation analysis. - cuda_graph_recalled: boolean if graphs were successfully destroyed/rebuilt. - latency_ms: time taken for the D2H/H2D transfer.

rank class-attribute instance-attribute

rank: int | None = None

stage_id class-attribute instance-attribute

stage_id: int | None = None

status instance-attribute

status: str

task_id instance-attribute

task_id: str

OmniDiffusionConfig dataclass

VSA_sparsity class-attribute instance-attribute

VSA_sparsity: float = 0.0

additional_config class-attribute instance-attribute

additional_config: dict[str, Any] = field(
    default_factory=dict
)

boundary_ratio class-attribute instance-attribute

boundary_ratio: float | None = None

cache_backend class-attribute instance-attribute

cache_backend: str | None = 'none'

cache_config class-attribute instance-attribute

cache_config: DiffusionCacheConfig | dict[str, Any] = field(
    default_factory=dict
)

cache_strategy class-attribute instance-attribute

cache_strategy: str = 'none'

cfg_kv_collect_func class-attribute instance-attribute

cfg_kv_collect_func: Any | None = None

custom_pipeline_args class-attribute instance-attribute

custom_pipeline_args: dict[str, Any] | None = None

diffusers_call_kwargs class-attribute instance-attribute

diffusers_call_kwargs: dict[str, Any] = field(
    default_factory=dict
)

diffusers_load_kwargs class-attribute instance-attribute

diffusers_load_kwargs: dict[str, Any] = field(
    default_factory=dict
)

diffusers_pipeline_cls class-attribute instance-attribute

diffusers_pipeline_cls: type[DiffusionPipeline] | None = (
    None
)

diffusion_attention_config class-attribute instance-attribute

diffusion_attention_config: AttentionConfig = field(
    default_factory=lambda: AttentionConfig()
)

diffusion_compile_dynamic class-attribute instance-attribute

diffusion_compile_dynamic: bool = True

diffusion_compile_granularity class-attribute instance-attribute

diffusion_compile_granularity: str = 'regional'

diffusion_kv_cache_dtype class-attribute instance-attribute

diffusion_kv_cache_dtype: str | None = None

diffusion_kv_cache_skip_layer_indices class-attribute instance-attribute

diffusion_kv_cache_skip_layer_indices: set[int] | None = (
    None
)

diffusion_kv_cache_skip_layers class-attribute instance-attribute

diffusion_kv_cache_skip_layers: str | None = None

diffusion_kv_cache_skip_step_indices class-attribute instance-attribute

diffusion_kv_cache_skip_step_indices: set[int] | None = None

diffusion_kv_cache_skip_steps class-attribute instance-attribute

diffusion_kv_cache_skip_steps: str | None = None

diffusion_kv_max_rows_per_request class-attribute instance-attribute

diffusion_kv_max_rows_per_request: int | None = None

diffusion_kv_mode class-attribute instance-attribute

diffusion_load_format class-attribute instance-attribute

diffusion_load_format: str = 'default'

diffusion_model_runner_cls class-attribute instance-attribute

diffusion_model_runner_cls: str | None = None

diffusion_offload_config class-attribute instance-attribute

diffusion_offload_config: dict[str, Any] | None = None

disable_autocast class-attribute instance-attribute

disable_autocast: bool = False

dist_timeout class-attribute instance-attribute

dist_timeout: int | None = None

distributed_executor_backend class-attribute instance-attribute

distributed_executor_backend: str | None = None

dlo_host_registration_limit_gib class-attribute instance-attribute

dlo_host_registration_limit_gib: float = 0.0

dlo_resident_layers class-attribute instance-attribute

dlo_resident_layers: int = 0

dlo_use_allgather class-attribute instance-attribute

dlo_use_allgather: bool = True

dtype class-attribute instance-attribute

dtype: dtype = torch.bfloat16

enable_broadcast_weight_load class-attribute instance-attribute

enable_broadcast_weight_load: bool = False

enable_cache_dit_summary class-attribute instance-attribute

enable_cache_dit_summary: bool = False

enable_cpu_offload class-attribute instance-attribute

enable_cpu_offload: bool = False

enable_diffusion_pipeline_profiler class-attribute instance-attribute

enable_diffusion_pipeline_profiler: bool = False

enable_distributed_layerwise_offload class-attribute instance-attribute

enable_distributed_layerwise_offload: bool = False

enable_layerwise_offload class-attribute instance-attribute

enable_layerwise_offload: bool = False

enable_multithread_weight_load class-attribute instance-attribute

enable_multithread_weight_load: bool = True

enable_prefix_caching class-attribute instance-attribute

enable_prefix_caching: bool = False

enable_prompt_embed_cache class-attribute instance-attribute

enable_prompt_embed_cache: bool = False

enable_session_state_manager class-attribute instance-attribute

enable_session_state_manager: bool = False

enable_sleep_mode class-attribute instance-attribute

enable_sleep_mode: bool = False

enable_stage_verification class-attribute instance-attribute

enable_stage_verification: bool = True

enforce_eager class-attribute instance-attribute

enforce_eager: bool = False

engine_backend class-attribute instance-attribute

engine_backend: str | type = 'default'

extras class-attribute instance-attribute

extras: dict[str, Any] = Field(default_factory=dict)

fa_deterministic class-attribute instance-attribute

fa_deterministic: bool = False

flow_shift class-attribute instance-attribute

flow_shift: float | None = None

force_cutlass_fp8 class-attribute instance-attribute

force_cutlass_fp8: bool = False

gpu_memory_utilization class-attribute instance-attribute

gpu_memory_utilization: float = 0.9

host class-attribute instance-attribute

host: str | None = None

host_weight_runtime_mode class-attribute instance-attribute

host_weight_runtime_mode: str = 'disabled'

host_weight_runtime_root class-attribute instance-attribute

host_weight_runtime_root: str | None = None

is_moe property

is_moe: bool

is_single_file property

is_single_file: bool

kv_cache_memory_bytes class-attribute instance-attribute

kv_cache_memory_bytes: int | None = None

kv_transfer_config class-attribute instance-attribute

kv_transfer_config: KVTransferConfig | None = None

log_level class-attribute instance-attribute

log_level: str = 'info'

lora_backend class-attribute instance-attribute

lora_backend: LoRABackend = LoRABackend.PEFT

lora_path class-attribute instance-attribute

lora_path: str | list[str] | None = None

lora_scale class-attribute instance-attribute

lora_scale: float | list[float] = 1.0

mask_strategy_file_path class-attribute instance-attribute

mask_strategy_file_path: str | None = None

master_port class-attribute instance-attribute

master_port: int | None = None

max_cpu_loras class-attribute instance-attribute

max_cpu_loras: int | None = None

max_model_len class-attribute instance-attribute

max_model_len: int | None = None

max_multimodal_image_inputs class-attribute instance-attribute

max_multimodal_image_inputs: int | None = None

max_num_batched_tokens class-attribute instance-attribute

max_num_batched_tokens: int | None = None

max_num_seqs class-attribute instance-attribute

max_num_seqs: int = 1

moba_config_path class-attribute instance-attribute

moba_config_path: str | None = None

model class-attribute instance-attribute

model: str | None = None

model_class_name class-attribute instance-attribute

model_class_name: str | None = None

model_config class-attribute instance-attribute

model_config: dict[str, Any] = field(default_factory=dict)

model_loaded class-attribute instance-attribute

model_loaded: dict[str, bool] = field(
    default_factory=lambda: {
        "transformer": True,
        "vae": True,
        "text_encoder": True,
        "vae_encoder": True,
    }
)

model_paths class-attribute instance-attribute

model_paths: dict[str, str] = field(default_factory=dict)

moe_backend class-attribute instance-attribute

moe_backend: str = 'auto'

nccl_port class-attribute instance-attribute

nccl_port: int | None = None

num_gpus class-attribute instance-attribute

num_gpus: int | None = None

num_weight_load_threads class-attribute instance-attribute

num_weight_load_threads: int = 4

omni_kv_config class-attribute instance-attribute

omni_kv_config: dict[str, Any] = field(default_factory=dict)

output_type class-attribute instance-attribute

output_type: str = 'pil'

override_transformer_cls_name class-attribute instance-attribute

override_transformer_cls_name: str | None = None

parallel_config class-attribute instance-attribute

parallel_config: DiffusionParallelConfig = field(
    default_factory=DiffusionParallelConfig
)

pin_cpu_memory class-attribute instance-attribute

pin_cpu_memory: bool = True

port class-attribute instance-attribute

port: int | None = None

profiler_config class-attribute instance-attribute

profiler_config: ProfilerConfig | dict[str, Any] | None = (
    None
)

prompt_embed_cache_size class-attribute instance-attribute

prompt_embed_cache_size: int = 32

prompt_file_path class-attribute instance-attribute

prompt_file_path: str | None = None

quantization_config class-attribute instance-attribute

quantization_config: (
    str | QuantizationConfig | dict[str, Any] | None
) = None

quantization_config_is_auto_detected class-attribute instance-attribute

quantization_config_is_auto_detected: bool = False

request_batch_max_wait_ms class-attribute instance-attribute

request_batch_max_wait_ms: float = 0.0

revision class-attribute instance-attribute

revision: str | None = None

scheduler_port class-attribute instance-attribute

scheduler_port: int = 5555

skip_time_steps class-attribute instance-attribute

skip_time_steps: int = 15

stage_id class-attribute instance-attribute

stage_id: int = 0

stage_input_payload_keys class-attribute instance-attribute

stage_input_payload_keys: tuple[str, ...] = ()

stage_output_payload_keys class-attribute instance-attribute

stage_output_payload_keys: tuple[str, ...] = ()

step_execution class-attribute instance-attribute

step_execution: bool = False

streaming_output class-attribute instance-attribute

streaming_output: bool = False

supports_mixed_reference_inputs class-attribute instance-attribute

supports_mixed_reference_inputs: bool = False

supports_multimodal_inputs class-attribute instance-attribute

supports_multimodal_inputs: bool = False

task_type class-attribute instance-attribute

task_type: str | None = None

tf_model_config class-attribute instance-attribute

tf_model_config: TransformerConfig = field(
    default_factory=TransformerConfig
)

trust_remote_code class-attribute instance-attribute

trust_remote_code: bool = False

vae_fast_path class-attribute instance-attribute

vae_fast_path: str = 'lossless'

vae_use_slicing class-attribute instance-attribute

vae_use_slicing: bool = False

vae_use_tiling class-attribute instance-attribute

vae_use_tiling: bool = False

video_output_transport class-attribute instance-attribute

video_output_transport: VideoOutputTransportConfig = field(
    default_factory=VideoOutputTransportConfig
)

worker_extension_cls class-attribute instance-attribute

worker_extension_cls: str | None = None

enrich_config

enrich_config() -> None

Load model metadata from HuggingFace and populate config fields.

Diffusers-style models expose a pipeline index with _class_name. Non-diffusers models (e.g. Bagel, NextStep) only have config.json, so we fall back to reading that and mapping model_type manually.

from_kwargs classmethod

from_kwargs(**kwargs: Any) -> OmniDiffusionConfig

normalize_init_kwargs classmethod

normalize_init_kwargs(
    raw_kwargs: Mapping[str, Any],
) -> dict[str, Any]

set_tf_model_config

set_tf_model_config(tf_config: TransformerConfig) -> None

Assign tf_model_config and propagate quantization if detected.

In the normal startup flow OmniDiffusionConfig is created before the transformer config.json is loaded from disk, so __post_init__ sees an empty TransformerConfig. Callers that load the config later should use this method instead of bare assignment so that an embedded quant_config is propagated to self.quantization_config automatically.

Parameters:

Name Type Description Default
tf_config TransformerConfig

Transformer configuration, typically built via TransformerConfig.from_dict.

required

settle_port

settle_port(
    port: int, port_inc: int = 42, max_attempts: int = 100
) -> int

Find an available port with retry logic.

Parameters:

Name Type Description Default
port int

Initial port to check

required
port_inc int

Port increment for each attempt

42
max_attempts int

Maximum number of attempts to find an available port

100

Returns:

Type Description
int

An available port number

Raises:

Type Description
RuntimeError

If no available port is found after max_attempts

update_multimodal_support

update_multimodal_support() -> None

OmniSleepTask dataclass

Structured sleep instruction.

level class-attribute instance-attribute

level: int = 2

metadata class-attribute instance-attribute

metadata: dict[str, Any] = field(default_factory=dict)

task_id instance-attribute

task_id: str

OmniWakeTask dataclass

Structured wake-up instruction.

tags class-attribute instance-attribute

tags: list[str] | None = None

task_id instance-attribute

task_id: str

RainFusionPrecision

Bases: str, Enum

Execution precision for block-sparse RainFusion (rf_v3) attention.

bf16: no quantization, pure BF16 sparse attention (official baseline). fp8: BSA FP8 path - Hadamard rotation then full FP8 block quantization of Q/K/V before the BSA kernel. mix: EagleQBSA mixed precision - Q/K per-block INT8 + V per-channel FP8.

BF16 class-attribute instance-attribute

BF16 = 'bf16'

FP8 class-attribute instance-attribute

FP8 = 'fp8'

MIX class-attribute instance-attribute

MIX = 'mix'

SkipSoftmaxSpec dataclass

User-facing skip-softmax controls for the TRTLLM_ATTN backend.

target_sparsity uses the checkpoint's calibrated curve (a·exp(b·s)); threshold is the calibration-free absolute skip threshold. They are mutually exclusive.

disabled_until_timestep class-attribute instance-attribute

disabled_until_timestep: float = 0.0

enabled property

enabled: bool

target_sparsity class-attribute instance-attribute

target_sparsity: float | None = None

threshold class-attribute instance-attribute

threshold: float | None = None

TransformerConfig dataclass

Container for raw transformer configuration dictionaries.

params class-attribute instance-attribute

params: dict[str, Any] = field(default_factory=dict)

quant_config class-attribute instance-attribute

quant_config: QuantizationConfig | None = None

quant_method class-attribute instance-attribute

quant_method: str | None = None

from_dict classmethod

from_dict(data: dict[str, Any]) -> TransformerConfig

get

get(key: str, default: Any | None = None) -> Any

to_dict

to_dict() -> dict[str, Any]

VideoOutputTransportConfig dataclass

enable_device_postprocess class-attribute instance-attribute

enable_device_postprocess: bool = False

build_attention_config

build_attention_config(
    attention_config: AttentionConfig
    | Mapping[str, Any]
    | None = None,
) -> AttentionConfig

Normalize diffusion attention config — the single authoritative entry point.

Called exactly once in OmniDiffusionConfig.__post_init__. Handles type-conversion and env-var fallback (DIFFUSION_ATTENTION_BACKEND).

is_diffusion_request_started_output

is_diffusion_request_started_output(output: Any) -> bool

normalize_omni_diffusion_kwargs

normalize_omni_diffusion_kwargs(
    raw_kwargs: Mapping[str, Any],
    *,
    apply_defaults: bool = True,
) -> dict[str, Any]

Normalize diffusion kwargs, deferring defaults until sources are merged.

parse_attention_config

parse_attention_config(
    attention_config: AttentionConfig
    | Mapping[str, Any]
    | None = None,
    *,
    attention_backend: str | None = None,
    fastvideo_vsa_topk: int | None = None,
) -> AttentionConfig

Pure type-conversion: coerce attention_config to an AttentionConfig.

Optionally merges an attention_backend shorthand into the config's default field. This does not read environment variables — use :func:build_attention_config for the full normalisation that should happen exactly once in OmniDiffusionConfig.__post_init__.

parse_kv_cache_skip_selector

parse_kv_cache_skip_selector(
    selector: str
    | list[int]
    | tuple[int, ...]
    | set[int]
    | None,
) -> set[int] | None

Parse a non-negative index selector such as "0-9,20,25-30".

resolve_model_class_name

resolve_model_class_name(
    model: str | None,
    diffusion_load_format: str = "default",
    revision: str | None = None,
) -> str | None

Resolve the diffusion pipeline class name from the model config.

Read-only counterpart of OmniDiffusionConfig.enrich_config, safe to call client-side. Returns None if the pipeline can't be determined.

uses_diffusers_adapter

uses_diffusers_adapter(od_config: object) -> bool

Return whether execution uses the Diffusers adapter backend.

A custom pipeline takes precedence over diffusion_load_format in the worker, so adapter-specific behavior must only apply when no custom pipeline override is configured.

validate_dlo_host_registration_options

validate_dlo_host_registration_options(
    *,
    limit_gib: object,
    enable_dlo: bool,
    use_allgather: bool,
    hwr_mode: object,
) -> float

Validate the optional transport budget without probing CUDA or HWR.

validate_host_weight_runtime_options

validate_host_weight_runtime_options(
    *, mode: object, root: object
) -> None

Validate HWR policy without touching the configured storage domain.

Filesystem locality and store construction belong to the eligible loader path. Keeping this check purely structural is what lets disabled and AllGather DLO configurations retain zero HWR interaction.

validate_omni_diffusion_kwargs

validate_omni_diffusion_kwargs(
    kwargs: Mapping[str, Any],
    allowed_fields: set[str] | frozenset[str],
    *,
    stage_id: int | str | None = None,
) -> None

Reject every field without an owner.