modelzoo.transformers.pytorch.gpt2.model.Gpt2Model#
- class modelzoo.transformers.pytorch.gpt2.model.Gpt2Model[source]#
Bases:
torch.nn.Module
GPT-2 models
Methods
build_model
The forward pass on the input data.
- __call__(*args: Any, **kwargs: Any) Any #
Call self as a function.
- static __new__(cls, *args: Any, **kwargs: Any) Any #
- forward(data, reduce_batch=True, output_logits=False)[source]#
The forward pass on the input data. This method returns the loss tensor if output_logits is False. If output_logits is True, the model call will also return the output logits tensor in addition to the loss as a (loss, lm_logits) tuple.
This may be useful for performing post processing on the model’s output logits.