i think there is a package version issue of either transformers or evaluate. Not sure though.
anyway try the above. Also why there is only single label name in your code? I didn’t get that
I’ll try those things, thanks. Just strange because I’ve used the code pretty much as it is with another multiple choice dataset recently and it worked fine.
The label name “cop” corresponds to the dataset column containing an integer from 0-3 representing the correct multiple choice answer.
I am also getting this error- “TypeError: only size-1 arrays can be converted to Python scalars”. Basically I am fine-tunning the facebook/bart-base model, with samsum Dataset, in Amazon sagemaker.
# Load metric
metric_name = "f1"
metric = load_metric(metric_name)
# Define metrics
def compute_metrics(eval_pred):
predictions, labels = eval_pred
predictions = np.argmax(predictions, axis=1)
# 'micro', 'macro', etc. are for multi-label classification. If you are running a binary classification, leave it as default or specify "binary" for average
return metric.compute(predictions=predictions, references=labels, average="binary")