Input of compute_metrics in ASR model

What should be the input of the function below?
Is it the model or a pass forward of the model?

def compute_metrics(pred):
    pred_logits = pred.predictions
    pred_ids = np.argmax(pred_logits, axis=-1)

    pred.label_ids[pred.label_ids == -100] = processor.tokenizer.pad_token_id

    pred_str = processor.batch_decode(pred_ids)
    # we do not want to group tokens when computing the metrics
    label_str = processor.batch_decode(pred.label_ids, group_tokens=False)

    wer = wer_metric.compute(predictions=pred_str, references=label_str)

    return {"wer": wer}

Also, I have one question about how the Trainer class works…
I mean, it encloses everything, but does it update the weights of the model automatically or it creates another instance for model?