Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
ec8717d5
Commit
ec8717d5
authored
Jun 01, 2020
by
Julien Chaumond
Browse files
[config] Ensure that id2label always takes precedence over num_labels
parent
751a1e08
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/configuration_utils.py
src/transformers/configuration_utils.py
+1
-1
No files found.
src/transformers/configuration_utils.py
View file @
ec8717d5
...
@@ -89,7 +89,7 @@ class PretrainedConfig(object):
...
@@ -89,7 +89,7 @@ class PretrainedConfig(object):
self
.
id2label
=
kwargs
.
pop
(
"id2label"
,
None
)
self
.
id2label
=
kwargs
.
pop
(
"id2label"
,
None
)
self
.
label2id
=
kwargs
.
pop
(
"label2id"
,
None
)
self
.
label2id
=
kwargs
.
pop
(
"label2id"
,
None
)
if
self
.
id2label
is
not
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
())
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.
# Keys are always strings in JSON so convert ids to int here.
else
:
else
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment