Greedy Sampling

Here we sample the most likely token from the distribution of logits.

Here's an experiment that uses these sampling techniques.

14import torch
15
16from labml_nn.sampling import Sampler
19class GreedySampler(Sampler):

Sample the most likely token from the distribution of logits

20    def __call__(self, logits: torch.Tensor):
24        return logits.argmax(dim=-1)