Skip to content

registry

Central registry for FastVideo pipelines and model configuration discovery.

This module mirrors the organization of sglang's registry while keeping FastVideo's legacy behavior and mappings intact.

Classes

fastvideo.registry.ConfigInfo dataclass

ConfigInfo(sampling_param_cls: type[SamplingParam] | None, pipeline_config_cls: type[PipelineConfig])

Encapsulates sampling + pipeline config classes for a model family.

Functions

fastvideo.registry.register_configs

register_configs(sampling_param_cls: type[SamplingParam] | None, pipeline_config_cls: type[PipelineConfig], hf_model_paths: list[str] | None = None, model_detectors: list[Callable[[str], bool]] | None = None) -> None

Register config classes for a model family.

Source code in fastvideo/registry.py
def register_configs(
    sampling_param_cls: type[SamplingParam] | None,
    pipeline_config_cls: type[PipelineConfig],
    hf_model_paths: list[str] | None = None,
    model_detectors: list[Callable[[str], bool]] | None = None,
) -> None:
    """Register config classes for a model family."""
    model_id = str(len(_CONFIG_REGISTRY))

    _CONFIG_REGISTRY[model_id] = ConfigInfo(
        sampling_param_cls=sampling_param_cls,
        pipeline_config_cls=pipeline_config_cls,
    )

    if hf_model_paths:
        for path in hf_model_paths:
            if path in _MODEL_HF_PATH_TO_NAME:
                logger.warning(
                    "Model path '%s' is already mapped to '%s' and will be overwritten by '%s'.",
                    path, _MODEL_HF_PATH_TO_NAME[path], model_id)
            _MODEL_HF_PATH_TO_NAME[path] = model_id

    if model_detectors:
        for detector in model_detectors:
            _MODEL_NAME_DETECTORS.append((model_id, detector))