def compute_metrics(p: EvalPrediction):
    preds = (p.predictions[0] if isinstance(p.predictions, tuple) else p.predictions)
    preds = (np.squeeze(preds) if is_regression else np.argmax(preds, axis=1))
    if (data_args.task_name is not None):
        result = metric.compute(predictions=preds, references=p.label_ids)
        if (len(result) > 1):
            result['combined_score'] = np.mean(list(result.values())).item()
        return result
    elif is_regression:
        return {'mse': ((preds - p.label_ids) ** 2).mean().item()}
    else:
        return {'accuracy': (preds == p.label_ids).astype(np.float32).mean().item()}
def compute_metrics(p: EvalPrediction):
    preds = (p.predictions[0] if isinstance(p.predictions, tuple) else p.predictions)
    preds = (np.squeeze(preds) if is_regression else np.argmax(preds, axis=1))
    if (data_args.task_name is not None):
        result = metric.compute(predictions=preds, references=p.label_ids)
        if (len(result) > 1):
            result['combined_score'] = np.mean(list(result.values())).item()
        return result
    elif is_regression:
        return {'mse': ((preds - p.label_ids) ** 2).mean().item()}
    else:
        return {'accuracy': (preds == p.label_ids).astype(np.float32).mean().item()}