def METHOD_NAME(self, captions):
    """ Convert caption text to token data.
    Args:
      captions: a batch of texts.
    Returns: token's data as tensor.
    """
    inputs = self.tokenizer(
        captions,
        max_length=self.tokenizer.model_max_length,
        padding='max_length',
        truncation=True,
        return_tensors='pt')
    return inputs.input_ids