def METHOD_NAME(self, texts, context_length=77):
    if isinstance(texts, str):
        texts = [texts]
    sot_token = self.encoder['<|startoftext|>']
    eot_token = self.encoder['<|endoftext|>']
    all_tokens = [[sot_token] + self.encode(text) + [eot_token]
                  for text in texts]
    result = torch.zeros(len(all_tokens), context_length, dtype=torch.int)
    for i, tokens in enumerate(all_tokens):
        if len(tokens) > context_length:
            tokens = tokens[:context_length]
            tokens[-1] = eot_token
        result[i, :len(tokens)] = torch.tensor(tokens)
    return result