Skip to content

Commit

Permalink
Fix GLUE MNLI when using max_eval_samples (huggingface#18722)
Browse files Browse the repository at this point in the history
  • Loading branch information
lvwerra authored Sep 21, 2022
1 parent 18643ff commit ef6741f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/pytorch/text-classification/run_glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,11 @@ def compute_metrics(p: EvalPrediction):
eval_datasets = [eval_dataset]
if data_args.task_name == "mnli":
tasks.append("mnli-mm")
eval_datasets.append(raw_datasets["validation_mismatched"])
valid_mm_dataset = raw_datasets["validation_mismatched"]
if data_args.max_eval_samples is not None:
max_eval_samples = min(len(valid_mm_dataset), data_args.max_eval_samples)
valid_mm_dataset = valid_mm_dataset.select(range(max_eval_samples))
eval_datasets.append(valid_mm_dataset)
combined = {}

for eval_dataset, task in zip(eval_datasets, tasks):
Expand Down

0 comments on commit ef6741f

Please sign in to comment.