transformer_lens.model_bridge.supported_architectures.ast module

AST (Audio Spectrogram Transformer) architecture adapter.

Supports ASTForAudioClassification

class transformer_lens.model_bridge.supported_architectures.ast.ASTArchitectureAdapter(cfg: Any)

Bases: ArchitectureAdapter

Architecture adapter for AST (Audio Spectrogram Transformer) audio classifiers.

Input is a [batch, time=1024, n_mels=128] spectrogram; positions 0/1 are the CLS and distillation tokens. HF pools (cls+dist)/2 after ln_final and applies an extra LayerNorm inside the classifier head, see the unembed mapping note.

component_mapping: ComponentMapping | None
prepare_model(hf_model: Any) None

Detect classification head, rebind prefixes, guard unembed, and set n_ctx.

supports_generation: bool = False
uses_split_attention: bool
weight_processing_conversions: Dict[str, ParamProcessingConversion | str] | None