transformer_lens.model_bridge.supported_architectures.wav2vec2 module

Wav2Vec2 architecture adapter.

Wav2Vec2Model’s module tree is identical to HubertModel’s (zero symmetric difference over named_modules), so the HuBERT adapter applies wholesale; only the ForCTC nesting attribute differs (wav2vec2. vs hubert.).

class transformer_lens.model_bridge.supported_architectures.wav2vec2.Wav2Vec2ArchitectureAdapter(cfg: Any)

Bases: HubertArchitectureAdapter

Adapter for Wav2Vec2Model (bare encoder) and Wav2Vec2ForCTC.

prepare_model(hf_model: Any) None

Detect nesting under ‘wav2vec2.’ and add the CTC head when present.

The registered “Wav2Vec2ForPreTraining” architecture string exists so checkpoints that DECLARE that class (facebook/wav2vec2-base/-large) boot their encoder via AutoModel -> Wav2Vec2Model. Wrapping the pretraining class itself is refused: its forward returns a Wav2Vec2ForPreTrainingOutput (projected quantizer states, no last_hidden_state), which no bridge output contract fits, and the quantizer head has no interpretability surface.