Skip to content

vllm.model_executor.models.registry

Whenever you add an architecture to this page, please also update tests/models/registry.py with example HuggingFace models for it.

_LazyRegisteredModel dataclass

Bases: _BaseRegisteredModel

Represents a model that has not been imported in the main process.

_save_modelinfo_to_cache(mi, module_hash)

Save dictionary json file to cache.

_ModelRegistry dataclass

Methods:

fill_model_info_cache()

Inspect every lazily registered model that is missing from the model info cache, in one subprocess, and cache the results.

A cache miss in inspect_model_cls starts a subprocess for that model alone, which takes about as long as inspecting all of them at once. Best effort: a model that fails to inspect here is left to inspect_model_cls.

is_hc_sp_supported_model(architectures, model_config)

Check support for HC SP without changing MoE parallelism.

register_model(model_arch, model_cls)

Register an external model to be used in vLLM.

model_cls can be either:

  • A torch.nn.Module class directly referencing the model.
  • A string in the format <module>:<class> which can be used to lazily import the model. This is useful to avoid initializing CUDA when importing the model and thus the related error RuntimeError: Cannot re-initialize CUDA in forked subprocess.

_RegisteredModel dataclass

Bases: _BaseRegisteredModel

Represents a model that has already been imported in the main process.