@@ -251,6 +251,24 @@ def main():
251
251
else :
252
252
model_args , data_args , training_args = parser .parse_args_into_dataclasses ()
253
253
254
+ # Setup logging
255
+ logging .basicConfig (
256
+ format = "%(asctime)s - %(levelname)s - %(name)s - %(message)s" ,
257
+ datefmt = "%m/%d/%Y %H:%M:%S" ,
258
+ handlers = [logging .StreamHandler (sys .stdout )],
259
+ )
260
+ logger .setLevel (logging .INFO if training_args .should_log else logging .WARN )
261
+
262
+ # Log on each process the small summary:
263
+ logger .warning (
264
+ f"Process rank: { training_args .local_rank } , device: { training_args .device } , n_gpu: { training_args .n_gpu } "
265
+ + f"distributed training: { bool (training_args .local_rank != - 1 )} , 16-bits training: { training_args .fp16 } "
266
+ )
267
+ # Set the verbosity to info of the Transformers logger (on main process only):
268
+ if training_args .should_log :
269
+ transformers .utils .logging .set_verbosity_info ()
270
+ logger .info (f"Training/evaluation parameters { training_args } " )
271
+
254
272
if data_args .source_prefix is None and model_args .model_name_or_path in [
255
273
"t5-small" ,
256
274
"t5-base" ,
@@ -278,24 +296,6 @@ def main():
278
296
"the `--output_dir` or add `--overwrite_output_dir` to train from scratch."
279
297
)
280
298
281
- # Setup logging
282
- logging .basicConfig (
283
- format = "%(asctime)s - %(levelname)s - %(name)s - %(message)s" ,
284
- datefmt = "%m/%d/%Y %H:%M:%S" ,
285
- handlers = [logging .StreamHandler (sys .stdout )],
286
- )
287
- logger .setLevel (logging .INFO if training_args .should_log else logging .WARN )
288
-
289
- # Log on each process the small summary:
290
- logger .warning (
291
- f"Process rank: { training_args .local_rank } , device: { training_args .device } , n_gpu: { training_args .n_gpu } "
292
- + f"distributed training: { bool (training_args .local_rank != - 1 )} , 16-bits training: { training_args .fp16 } "
293
- )
294
- # Set the verbosity to info of the Transformers logger (on main process only):
295
- if training_args .should_log :
296
- transformers .utils .logging .set_verbosity_info ()
297
- logger .info (f"Training/evaluation parameters { training_args } " )
298
-
299
299
# Set seed before initializing model.
300
300
set_seed (training_args .seed )
301
301
0 commit comments