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: ArchitectureAdapter

Adapter 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 to getattr(original_model, name) for unknown attrs, so a name match — submodule, buffer, plain tensor, or property — makes add_module raise mid-setup with an opaque message. Failing here points at the real cause. Reserved set is derived from component_mapping.keys() so adapter variants stay in sync.