megatron.model.language_model.Pooler#
- class megatron.model.language_model.Pooler(hidden_size, init_method, args)#
Bases:
MegatronModule
Pool hidden states of a specific token (for example start of the sequence) and add a linear transformation followed by a tanh.
- Parameters:
hidden_size – hidden size
init_method – weight initialization method for the linear layer. bias is set to zero.
- forward(hidden_states, sequence_index=0)#
Define 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.