Transformers, Pytorch, Machine Learning, Deep Dives, Data Science.
nn.Linear(self.model_dim, self.vocab_size) @staticmethod def generate_square_subsequent_mask(size: int): """Generate a triangular (size, size) mask. From PyTorch docs.""" mask = (1 - torch.triu(torch.ones(size, size), diagonal=1)).bool() mask = mask.float().masked_fill(mask == 0,