import evaluate
rouge = evaluate.load("rouge")

Then create a function that passes your predictions and labels to [~evaluate.EvaluationModule.compute] to calculate the ROUGE metric:

import numpy as np
def compute_metrics(eval_pred):
     predictions, labels = eval_pred
     decoded_preds = tokenizer.batch_decode(predictions, skip_special_tokens=True)
     labels = np.where(labels != -100, labels, tokenizer.pad_token_id)
     decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=True)