From 98268b2e76189d65f7068625cf382ebe03b98480 Mon Sep 17 00:00:00 2001 From: Maziyar Panahi Date: Tue, 4 Apr 2023 15:28:57 +0200 Subject: [PATCH] Add id2label and label2id to model's config in run_xnil (#22558) Add id2label and label2id to config in run_xnil --- examples/pytorch/text-classification/run_xnli.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/pytorch/text-classification/run_xnli.py b/examples/pytorch/text-classification/run_xnli.py index d26f59d0e3..871fa3013c 100755 --- a/examples/pytorch/text-classification/run_xnli.py +++ b/examples/pytorch/text-classification/run_xnli.py @@ -273,6 +273,8 @@ def main(): config = AutoConfig.from_pretrained( model_args.config_name if model_args.config_name else model_args.model_name_or_path, num_labels=num_labels, + id2label={str(i): label for i, label in enumerate(label_list)}, + label2id={label: i for i, label in enumerate(label_list)}, finetuning_task="xnli", cache_dir=model_args.cache_dir, revision=model_args.model_revision,