nlpmodels/models/gpt.py
def forward(self, data: GPTBatch) -> torch.Tensor:
        """
        The main function call for the gpt model.

        Args:
            data (GPTBatch): A class containing the src, src_mask data for this batch.
        Returns:
            tensor of [batch_size,block_size,vocab_size] of final predictions.
        """
        # pass through decoder blocks
        decode = self._decode(data)
        # calculate y_hat. Don't apply softmax before passing to cross entropy.
        y_hat = self._final_linear(decode)

        return y_hat

        The main function call for the gpt model.

        Args:
            data (GPTBatch): A class containing the src, src_mask data for this batch.
        Returns:
            tensor of [batch_size,block_size,vocab_size] of final predictions.
        
The main function call for the gpt model.
The main function call for the gpt model .
def forward(self, data: GPTBatch) -> torch.Tensor:
        decode = self._decode(data)
        y_hat = self._final_linear(decode)
        return y_hat
def forward ( self , data : GPTBatch ) -> torch . Tensor : decode = self . _decode ( data ) y_hat = self . _final_linear ( decode ) return y_hat
The main function call for the gpt model.
The main function call for the gpt model .
"""
        The main function call for the gpt model.

        Args:
            data (GPTBatch): A class containing the src, src_mask data for this batch.
        Returns:
            tensor of [batch_size,block_size,vocab_size] of final predictions.
        """ # pass through decoder blocks # calculate y_hat. Don't apply softmax before passing to cross entropy.
tensor of [batch_size,block_size,vocab_size] of final predictions.
tensor of [ batch_size block_size vocab_size ] of final predictions .
self
data
GPTBatch
A class containing the src, src_mask data for this batch.
A class containing the src src_mask data for this batch .