I was training the GPT2LMHeadModel From Scratch with my own dataset. i want to check the accuracy and loss. however when I run trainer. evaluate() it returns the following error. i google for several hours but I couldn’t find a soln.
The Compute Metrix:
def compute_metrics(eval_preds): metric = load_metric("glue", "mrpc") logits, labels = eval_preds predictions = np.argmax(logits, axis=-1) return metric.compute(predictions=predictions, references=labels)
# [TypeError: only size-1 arrays can be converted to Python scalars]