From 87dd1a00ef1de8d8ccead5b095265906128d9e36 Mon Sep 17 00:00:00 2001 From: Sylvain Gugger <35901082+sgugger@users.noreply.github.com> Date: Mon, 3 May 2021 11:42:55 -0400 Subject: [PATCH] Fix metric computation in `run_glue_no_trainer` (#11569) --- examples/pytorch/text-classification/run_glue_no_trainer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/pytorch/text-classification/run_glue_no_trainer.py b/examples/pytorch/text-classification/run_glue_no_trainer.py index f2658db9e6..b1c1848aa3 100644 --- a/examples/pytorch/text-classification/run_glue_no_trainer.py +++ b/examples/pytorch/text-classification/run_glue_no_trainer.py @@ -404,7 +404,7 @@ def main(): model.eval() for step, batch in enumerate(eval_dataloader): outputs = model(**batch) - predictions = outputs.logits.argmax(dim=-1) + predictions = outputs.logits.argmax(dim=-1) if not is_regression else outputs.logits.squeeze() metric.add_batch( predictions=accelerator.gather(predictions), references=accelerator.gather(batch["labels"]),