def num_tokens(
            self,
            index: int
    ):
        """
        Return the number of tokens in a sample. This value is used to
        enforce max-tokens during batching.
        """
        return self.sizes[index]

        Return the number of tokens in a sample. This value is used to
        enforce max-tokens during batching.
        
infoxlm/fairseq/fairseq/data/legacy/masked_lm_dataset.py