def METHOD_NAME(eval_preds):
    labels = paddle.to_tensor(eval_preds.label_ids, dtype="int64")
    logits = paddle.to_tensor(eval_preds.predictions)
    loss_fct = nn.CrossEntropyLoss()
    eval_loss = loss_fct(logits[:, :-1, :], labels[:, 1:])
    perplexity = math.exp(eval_loss)
    return {"perplexity": perplexity}