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
19597998
Unverified
Commit
19597998
authored
Mar 10, 2022
by
Sylvain Gugger
Committed by
GitHub
Mar 10, 2022
Browse files
Don't compute metrics in LM examples on TPU (#16029)
parent
10591399
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
examples/pytorch/language-modeling/run_clm.py
examples/pytorch/language-modeling/run_clm.py
+5
-2
examples/pytorch/language-modeling/run_mlm.py
examples/pytorch/language-modeling/run_mlm.py
+5
-2
No files found.
examples/pytorch/language-modeling/run_clm.py
View file @
19597998
...
...
@@ -43,6 +43,7 @@ from transformers import (
Trainer
,
TrainingArguments
,
default_data_collator
,
is_torch_tpu_available
,
set_seed
,
)
from
transformers.testing_utils
import
CaptureLogger
...
...
@@ -479,8 +480,10 @@ def main():
tokenizer
=
tokenizer
,
# Data collator will default to DataCollatorWithPadding, so we change it.
data_collator
=
default_data_collator
,
compute_metrics
=
compute_metrics
if
training_args
.
do_eval
else
None
,
preprocess_logits_for_metrics
=
preprocess_logits_for_metrics
if
training_args
.
do_eval
else
None
,
compute_metrics
=
compute_metrics
if
training_args
.
do_eval
and
not
is_torch_tpu_available
()
else
None
,
preprocess_logits_for_metrics
=
preprocess_logits_for_metrics
if
training_args
.
do_eval
and
not
is_torch_tpu_available
()
else
None
,
)
# Training
...
...
examples/pytorch/language-modeling/run_mlm.py
View file @
19597998
...
...
@@ -43,6 +43,7 @@ from transformers import (
HfArgumentParser
,
Trainer
,
TrainingArguments
,
is_torch_tpu_available
,
set_seed
,
)
from
transformers.trainer_utils
import
get_last_checkpoint
...
...
@@ -513,8 +514,10 @@ def main():
eval_dataset
=
eval_dataset
if
training_args
.
do_eval
else
None
,
tokenizer
=
tokenizer
,
data_collator
=
data_collator
,
compute_metrics
=
compute_metrics
if
training_args
.
do_eval
else
None
,
preprocess_logits_for_metrics
=
preprocess_logits_for_metrics
if
training_args
.
do_eval
else
None
,
compute_metrics
=
compute_metrics
if
training_args
.
do_eval
and
not
is_torch_tpu_available
()
else
None
,
preprocess_logits_for_metrics
=
preprocess_logits_for_metrics
if
training_args
.
do_eval
and
not
is_torch_tpu_available
()
else
None
,
)
# Training
...
...
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