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
936b5715
Unverified
Commit
936b5715
authored
May 17, 2021
by
Sylvain Gugger
Committed by
GitHub
May 17, 2021
Browse files
Use new evaluation loop in TrainerQA (#11746)
parent
73893fc7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
examples/pytorch/question-answering/trainer_qa.py
examples/pytorch/question-answering/trainer_qa.py
+4
-2
No files found.
examples/pytorch/question-answering/trainer_qa.py
View file @
936b5715
...
@@ -39,8 +39,9 @@ class QuestionAnsweringTrainer(Trainer):
...
@@ -39,8 +39,9 @@ class QuestionAnsweringTrainer(Trainer):
# Temporarily disable metric computation, we will do it in the loop here.
# Temporarily disable metric computation, we will do it in the loop here.
compute_metrics
=
self
.
compute_metrics
compute_metrics
=
self
.
compute_metrics
self
.
compute_metrics
=
None
self
.
compute_metrics
=
None
eval_loop
=
self
.
prediction_loop
if
self
.
args
.
use_legacy_prediction_loop
else
self
.
evaluation_loop
try
:
try
:
output
=
self
.
prediction
_loop
(
output
=
eval
_loop
(
eval_dataloader
,
eval_dataloader
,
description
=
"Evaluation"
,
description
=
"Evaluation"
,
# No point gathering the predictions if there are no metrics, otherwise we defer to
# No point gathering the predictions if there are no metrics, otherwise we defer to
...
@@ -72,8 +73,9 @@ class QuestionAnsweringTrainer(Trainer):
...
@@ -72,8 +73,9 @@ class QuestionAnsweringTrainer(Trainer):
# Temporarily disable metric computation, we will do it in the loop here.
# Temporarily disable metric computation, we will do it in the loop here.
compute_metrics
=
self
.
compute_metrics
compute_metrics
=
self
.
compute_metrics
self
.
compute_metrics
=
None
self
.
compute_metrics
=
None
eval_loop
=
self
.
prediction_loop
if
self
.
args
.
use_legacy_prediction_loop
else
self
.
evaluation_loop
try
:
try
:
output
=
self
.
prediction
_loop
(
output
=
eval
_loop
(
predict_dataloader
,
predict_dataloader
,
description
=
"Prediction"
,
description
=
"Prediction"
,
# No point gathering the predictions if there are no metrics, otherwise we defer to
# No point gathering the predictions if there are no metrics, otherwise we defer to
...
...
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