From 028d4b7c8be2c2fc1146fcc1e9bd253c1a7ea346 Mon Sep 17 00:00:00 2001 From: fireindark707 <30530581+fireindark707@users.noreply.github.com> Date: Wed, 1 Jun 2022 23:15:53 +0800 Subject: [PATCH] Deal with the error when task is regression (#16330) --- 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 bfd73b8f2b..ba23ac1409 100644 --- a/examples/pytorch/text-classification/run_glue_no_trainer.py +++ b/examples/pytorch/text-classification/run_glue_no_trainer.py @@ -343,7 +343,7 @@ def main(): f"model labels: {list(sorted(label_name_to_id.keys()))}, dataset labels: {list(sorted(label_list))}." "\nIgnoring the model labels as a result.", ) - elif args.task_name is None: + elif args.task_name is None and not is_regression: label_to_id = {v: i for i, v in enumerate(label_list)} if label_to_id is not None: