@@ -246,7 +246,10 @@ def compute_metrics(p: EvalPrediction) -> Dict:
246
246
trainer .save_model ()
247
247
# For convenience, we also re-save the tokenizer to the same directory,
248
248
# so that you can share your model easily on huggingface.co/models =)
249
- if trainer .is_world_master ():
249
+
250
+ # error log: Replace "is_world_master" with "is_world_process_zero"
251
+
252
+ if trainer .is_world_process_zero ():
250
253
tokenizer .save_pretrained (training_args .output_dir )
251
254
252
255
# Evaluation
@@ -257,7 +260,9 @@ def compute_metrics(p: EvalPrediction) -> Dict:
257
260
result = trainer .evaluate ()
258
261
259
262
output_eval_file = os .path .join (training_args .output_dir , "eval_results.txt" )
260
- if trainer .is_world_master ():
263
+
264
+ # error log: Replace "is_world_master" with "is_world_process_zero"
265
+ if trainer .is_world_process_zero ():
261
266
with open (output_eval_file , "w" ) as writer :
262
267
logger .info ("***** Eval results *****" )
263
268
for key , value in result .items ():
@@ -284,7 +289,9 @@ def compute_metrics(p: EvalPrediction) -> Dict:
284
289
285
290
# Save predictions
286
291
output_test_results_file = os .path .join (training_args .output_dir , "test_results.txt" )
287
- if trainer .is_world_master ():
292
+
293
+ # error log: Replace "is_world_master" with "is_world_process_zero"
294
+ if trainer .is_world_process_zero ():
288
295
with open (output_test_results_file , "w" ) as writer :
289
296
logger .info ("***** Test results *****" )
290
297
for key , value in metrics .items ():
@@ -293,7 +300,9 @@ def compute_metrics(p: EvalPrediction) -> Dict:
293
300
294
301
295
302
output_test_predictions_file = os .path .join (training_args .output_dir , "test_predictions.txt" )
296
- if trainer .is_world_master ():
303
+
304
+ # error log: Replace "is_world_master" with "is_world_process_zero"
305
+ if trainer .is_world_process_zero ():
297
306
with open (output_test_predictions_file , "w" ) as writer :
298
307
with open (os .path .join (data_args .data_dir , "test.txt" ), "r" ) as f :
299
308
example_id = 0
0 commit comments