Skip to content

vllm_omni.config.config_factory

Config factories for vllm-omni, e.g., StageConfigFactory.

logger module-attribute

logger = init_logger(__name__)

StageConfigFactory

Factory that loads pipeline YAML and merges CLI overrides.

Production startup source selection is owned by :func:vllm_omni.config.resolver.resolve_omni_config. Factory methods are lower-level construction primitives for that resolver, config internals, and focused tests; entrypoints and engines must not call them directly.

Handles both single-stage and multi-stage models.

Pipelines are declared in vllm_omni/config/pipeline_registry.py and where keys in OMNI_PIPELINES map to either a PipelineConfig, or a callable which accepts a Transformers config as an arg & resolves to a PipelineConfig.

NOTE: Models with generic HF model_type collisions (e.g. MiMo Audio reports qwen2) should declare hf_architectures=(...) on their PipelineConfig so the factory can disambiguate via hf_config.architectures.

create_default_diffusion classmethod

create_default_diffusion(
    kwargs: dict[str, Any],
) -> list[dict[str, Any]]

Build the temporary runtime ABI for a generic diffusion stage.

The terminal diffusion config owns engine defaults and normalization; this compatibility builder only adds Omni stage topology, request defaults, and device placement.

create_from_model classmethod

create_from_model(
    model: str,
    *,
    trust_remote_code: bool | None,
    cli_overrides: dict[str, Any],
    deploy_config_path: str | None,
    strategy_specs: Mapping[Any, Any] | None = None,
) -> VllmOmniConfig | None

Build the structured Omni config for a model/deploy pair.

create_legacy_stage_configs_from_model classmethod

create_legacy_stage_configs_from_model(
    model: str,
    *,
    trust_remote_code: bool | None,
    cli_overrides: dict[str, Any],
    deploy_config_path: str | None,
    strategy_specs: Mapping[Any, Any] | None = None,
) -> tuple[list[StageConfig] | None, str | None]

Build the migration-only runtime ABI from the shared resolution.

The engine still consumes the legacy StageConfig/OmegaConf shape. This method is the resolver's temporary compatibility bridge, not an alternative production source-selection entrypoint and not a stable public contract. RFC #4021 will remove it as runtime consumers move to VllmOmniConfig.

create_typed_default_diffusion classmethod

create_typed_default_diffusion(
    model: str, kwargs: dict[str, Any]
) -> VllmOmniConfig

Build generic diffusion directly into the structured runtime config.

get_hf_config cached classmethod

get_hf_config(
    model: str, trust_remote_code: bool
) -> PretrainedConfig | None

Fetch the HF config (if it exists) from the model directory.

Parameters:

Name Type Description Default
model str

Model name or path.

required
trust_remote_code bool

Whether to trust remote code for HF config loading.

required

Returns:

Type Description
PretrainedConfig | None

the model's config or None.

get_pipeline_config classmethod

get_pipeline_config(
    model: str,
    trust_remote_code: bool,
    deploy_config_path: str | None = None,
    user_deploy_config: DeployConfig | None = None,
) -> PipelineConfig | None

Resolve the PipelineConfig for a model path/name.

get_pipeline_endpoint_restrictions classmethod

get_pipeline_endpoint_restrictions(
    model: str,
    trust_remote_code: bool,
    deploy_config_path: str | None,
) -> tuple[EndpointRestriction, ...]

Given a model string, determine the corresponding endpoint restrictions.

Parameters:

Name Type Description Default
model str

Model name or path.

required
trust_remote_code bool

Whether to trust remote code for HF config loading.

required
deploy_config_path str | None

Optional path to the deploy config for the pipeline.

required

Returns:

Type Description
tuple[EndpointRestriction, ...]

A tuple of model specific endpoint restrictions.

try_infer_model_type cached classmethod

try_infer_model_type(
    model: str, trust_remote_code: bool
) -> str | None

Auto-detect model_type from model directory and apply any model specific patches to get the correct model_type str. If we are unable to infer it from the model directory, we fall back to the PipelineConfig.

Parameters:

Name Type Description Default
model str

Model name or path.

required
trust_remote_code bool

Whether to trust remote code for HF config loading.

required

Returns:

Type Description
str | None

model_type as a string; may be None on failure.

with_trust_remote_code_override

with_trust_remote_code_override(
    overrides: Mapping[str, Any],
    trust_remote_code: bool | None,
) -> dict[str, Any]

Merge the tri-state trust_remote_code into an override mapping.

Single home for the precedence rule (explicit caller value > deploy yaml per-stage value > vLLM default False): a non-None value becomes an explicit override; None means "not specified" and leaves the deploy yaml's per-stage setting in effect. The serve --trust-remote-code flag is store_true — its absent-False must be mapped to None at the CLI boundary before reaching here, since it cannot express an explicit False.