From f0acf7b6d8053d57cc8c40fd16f2561cf5b95800 Mon Sep 17 00:00:00 2001 From: jheitmann Date: Mon, 22 Jan 2024 12:31:31 +0100 Subject: [PATCH] Fix id2label assignment in run_classification.py (#28590) --- examples/pytorch/text-classification/run_classification.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/pytorch/text-classification/run_classification.py b/examples/pytorch/text-classification/run_classification.py index 3e580f9b16..a080df108e 100755 --- a/examples/pytorch/text-classification/run_classification.py +++ b/examples/pytorch/text-classification/run_classification.py @@ -545,7 +545,7 @@ def main(): "run. You can ignore this if you are doing finetuning." ) model.config.label2id = label_to_id - model.config.id2label = {id: label for label, id in config.label2id.items()} + model.config.id2label = {id: label for label, id in label_to_id.items()} elif not is_regression: # classification, but not training logger.info("using label infos in the model config") logger.info("label2id: {}".format(model.config.label2id))