transformer_lens.tools.model_registry.discover_architectures module

Discover all architectures on HuggingFace and classify them.

This is a lightweight discovery tool that scans a sample of HuggingFace models to discover all unique architecture classes and categorize them as supported or unsupported by TransformerLens. For comprehensive scanning, use hf_scraper.py.

Usage:

python -m transformer_lens.tools.model_registry.discover_architectures

class transformer_lens.tools.model_registry.discover_architectures.ArchitectureEntry

Bases: TypedDict

Type for architecture entry dictionaries.

architecture_id: str
example_models: list[str]
total_models: int
transformer_lens.tools.model_registry.discover_architectures.discover_architectures(num_models: int = 5000, output_dir: Path | None = None) tuple[dict, dict]

Discover all architectures by scanning HuggingFace models.

Parameters:
  • num_models – Number of top models to scan

  • output_dir – Directory to write output files

Returns:

Tuple of (supported_count, unsupported_counts)

transformer_lens.tools.model_registry.discover_architectures.main()