def METHOD_NAME(self, texts):
    with torch.no_grad():
        text = " ".join(texts)
        eval_loss = []
        input_ids = torch.tensor(
            self.ppl_tokenizer.encode(text, add_special_tokens=True)
        ).unsqueeze(0)
        # Strided perplexity calculation from huggingface.co/transformers/perplexity.html
        for i in range(0, input_ids.size(1), self.stride):
            begin_loc = max(i + self.stride - self.max_length, 0)
            end_loc = min(i + self.stride, input_ids.size(1))
            trg_len = end_loc - i
            input_ids_t = input_ids[:, begin_loc:end_loc].to(
                textattack.shared.utils.device
            )
            target_ids = input_ids_t.clone()
            target_ids[:, :-trg_len] = -100
            outputs = self.ppl_model(input_ids_t, labels=target_ids)
            log_likelihood = outputs[0] * trg_len
            eval_loss.append(log_likelihood)
    return torch.exp(torch.stack(eval_loss).sum() / end_loc).item()