megatron.model.multiple_choice.MultipleChoice#
- class megatron.model.multiple_choice.MultipleChoice(num_tokentypes=2, pre_process=True, post_process=True, model_type=None)#
Bases:
MegatronModule
- forward(model_input, attention_mask, tokentype_ids=None)#
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.
- load_state_dict(state_dict, strict=True)#
Customized load.
- set_input_tensor(input_tensor)#
See megatron.model.transformer.set_input_tensor()
- state_dict_for_save_checkpoint(prefix='', keep_vars=False)#
For easy load when model is combined with other heads, add an extra key.