token-classification: use is_world_process_zero instead of deprecated is_world_master() (#8828)

This commit is contained in:
Stefan Schweter
2020-11-30 15:21:56 +01:00
committed by GitHub
parent 40ecaf0c2b
commit 19fa01ce2a
2 changed files with 4 additions and 4 deletions

View File

@@ -369,7 +369,7 @@ def main():
]
output_test_results_file = os.path.join(training_args.output_dir, "test_results.txt")
if trainer.is_world_master():
if trainer.is_world_process_zero():
with open(output_test_results_file, "w") as writer:
for key, value in metrics.items():
logger.info(f" {key} = {value}")
@@ -377,7 +377,7 @@ def main():
# Save predictions
output_test_predictions_file = os.path.join(training_args.output_dir, "test_predictions.txt")
if trainer.is_world_master():
if trainer.is_world_process_zero():
with open(output_test_predictions_file, "w") as writer:
for prediction in true_predictions:
writer.write(" ".join(prediction) + "\n")