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
f0acf7b6
Unverified
Commit
f0acf7b6
authored
Jan 22, 2024
by
jheitmann
Committed by
GitHub
Jan 22, 2024
Browse files
Fix id2label assignment in run_classification.py (#28590)
parent
83f9196c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
examples/pytorch/text-classification/run_classification.py
examples/pytorch/text-classification/run_classification.py
+1
-1
No files found.
examples/pytorch/text-classification/run_classification.py
View file @
f0acf7b6
...
@@ -545,7 +545,7 @@ def main():
...
@@ -545,7 +545,7 @@ def main():
"run. You can ignore this if you are doing finetuning."
"run. You can ignore this if you are doing finetuning."
)
)
model
.
config
.
label2id
=
label_to_id
model
.
config
.
label2id
=
label_to_id
model
.
config
.
id2label
=
{
id
:
label
for
label
,
id
in
config
.
label
2
id
.
items
()}
model
.
config
.
id2label
=
{
id
:
label
for
label
,
id
in
label
_to_
id
.
items
()}
elif
not
is_regression
:
# classification, but not training
elif
not
is_regression
:
# classification, but not training
logger
.
info
(
"using label infos in the model config"
)
logger
.
info
(
"using label infos in the model config"
)
logger
.
info
(
"label2id: {}"
.
format
(
model
.
config
.
label2id
))
logger
.
info
(
"label2id: {}"
.
format
(
model
.
config
.
label2id
))
...
...
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