I used the compute_metrics (measure accuracy, f1, precision and accuracy) provided by the tutorial and I am doing a classification task with 5 task.

Could you tell us which tutorial? From the error message, it seems your metric value is a NumPy array, so sharing your compute_metric function would also help.