transformer_lens.components.rms_norm_pre#

Hooked Transformer RMS Norm Pre Component.

This module contains all the component RMSNormPre.

class transformer_lens.components.rms_norm_pre.RMSNormPre(cfg: Union[Dict, HookedTransformerConfig])#

Bases: Module

__init__(cfg: Union[Dict, HookedTransformerConfig])#

RMSNormPre - LayerNormPre without the centering and bias (RMS = Root Mean Square)

forward(x: Float[Tensor, 'batch pos length']) Float[Tensor, 'batch pos length']#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.