transformer_lens.model_bridge.supported_architectures.native module¶
Architecture adapter for TL-native models built via boot_native.
Component mapping adapts to cfg: gated MLP → GatedMLPBridge, RMS norm →
RMSNormalizationBridge, rotary drops pos_embed, attn_only drops MLP.
- class transformer_lens.model_bridge.supported_architectures.native.NativeArchitectureAdapter(cfg: Any)¶
Bases:
ArchitectureAdapterAdapter for
NativeModel— TL-native, split-QKV, pre-LN; feature set driven by cfg (gated MLP, RMS norm, rotary, GQA, soft-cap, attn_only).- prepare_model(model: Any) None¶
Reject modules whose attribute names collide with bridge slots.
Bridge’s
__getattr__falls back togetattr(original_model, name)for unknown attrs, so a name match — submodule, buffer, plain tensor, or property — makesadd_moduleraise mid-setup with an opaque message. Failing here points at the real cause. Reserved set is derived fromcomponent_mapping.keys()so adapter variants stay in sync.