transformer_lens.model_bridge.get_params_util module¶
Utility function for getting model parameters in TransformerLens format.
- transformer_lens.model_bridge.get_params_util.get_bridge_params(bridge) Dict[str, Tensor]¶
Model parameters in SVDInterpreter format.
Reads the bridge components’ TL-layout weight properties (
W_Q,W_in, …), which already account for layout conversion and weight processing. For absent optional weights, returns zero tensors of appropriate shape instead of raising exceptions. Real components whose weights cannot be represented in the dense TL layout are omitted. Skips attn keys for non-attention layers, and omitspos_embed.W_posfor rotary models (which have no learned position table), matching HookedTransformer’s parameter set. LayerNorm params (blocks.{i}.ln1.wetc.) are included when the modules still carry them (i.e. before folding) so consumers can detect fold state.- Returns:
Dictionary of parameter tensors with TransformerLens naming convention
- Return type:
dict
- Raises:
ValueError – If configuration is inconsistent (e.g., cfg.n_layers != len(blocks))