Commit ec8717d5 authored by Julien Chaumond's avatar Julien Chaumond
Browse files

[config] Ensure that id2label always takes precedence over num_labels

parent 751a1e08
......@@ -89,7 +89,7 @@ class PretrainedConfig(object):
self.id2label = kwargs.pop("id2label", None)
self.label2id = kwargs.pop("label2id", None)
if self.id2label is not None:
del kwargs["num_labels"]
kwargs.pop("num_labels", None)
self.id2label = dict((int(key), value) for key, value in self.id2label.items())
# Keys are always strings in JSON so convert ids to int here.
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment