Don't compute metrics in LM examples on TPU (#16029)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user