transformer_lens.model_bridge.sources.transformers.helpers module

HF-loader-specific helpers: model-class selection, modality processor loading, checkpoint revision resolution, registry discovery.

transformer_lens.model_bridge.sources.transformers.helpers.check_model_support(model_id: str) dict

Detailed support info for a model: is_supported, architecture_id, verified, suggestion.

transformer_lens.model_bridge.sources.transformers.helpers.get_hf_model_class_for_architecture(architecture: str)

Pick the correct HuggingFace AutoModel* class for the architecture.

transformer_lens.model_bridge.sources.transformers.helpers.list_supported_models(architecture: str | None = None, verified_only: bool = False) list[str]

List all models supported by TransformerLens.

Parameters:
  • architecture – Filter by architecture ID (e.g., “GPT2LMHeadModel”).

  • verified_only – If True, only return verified-to-work models.

Returns:

List of model IDs.

transformer_lens.model_bridge.sources.transformers.helpers.load_modality_processor(bridge: Any, cfg: Any, model_name: str, trust_remote_code: bool, token: str | None) None

Attach the modality preprocessor to bridge.processor per the cfg’s modality flags.

Best-effort: each loader failure is swallowed so a missing/broken processor never blocks the boot itself.