transformer_lens.tools.model_registry.exceptions module

Custom exceptions for the model registry API.

This module defines specific exceptions that can be raised by the model registry to provide clear error messages for common failure scenarios.

exception transformer_lens.tools.model_registry.exceptions.ArchitectureNotSupportedError(architecture_id: str, model_count: int | None = None)

Bases: ModelRegistryError

Raised when an architecture is not supported by TransformerLens.

architecture_id

The architecture that is not supported

model_count

Number of models using this architecture (if known)

exception transformer_lens.tools.model_registry.exceptions.DataNotLoadedError(data_type: str, path: str | None = None)

Bases: ModelRegistryError

Raised when registry data has not been loaded or is unavailable.

data_type

Type of data that was not loaded (e.g., “supported_models”)

path

Optional path where data was expected

exception transformer_lens.tools.model_registry.exceptions.DataValidationError(file_path: str, errors: list[str])

Bases: ModelRegistryError

Raised when registry data fails validation.

file_path

Path to the file that failed validation

errors

List of validation error messages

exception transformer_lens.tools.model_registry.exceptions.ModelNotFoundError(model_id: str, suggestion: str | None = None)

Bases: ModelRegistryError

Raised when a requested model ID is not found in the registry.

model_id

The model ID that was not found

suggestion

Optional suggested alternative model

exception transformer_lens.tools.model_registry.exceptions.ModelRegistryError

Bases: Exception

Base exception for all model registry errors.