don't save model without training

This commit is contained in:
Chi-Liang Liu
2019-07-30 18:37:37 +08:00
committed by Julien Chaumond
parent 189ff9b664
commit 40acf6b52a

View File

@@ -481,7 +481,7 @@ def main():
# Save the trained model and the tokenizer # Save the trained model and the tokenizer
if args.local_rank == -1 or torch.distributed.get_rank() == 0: if args.do_train and args.local_rank == -1 or torch.distributed.get_rank() == 0:
# Create output directory if needed # Create output directory if needed
if not os.path.exists(args.output_dir) and args.local_rank in [-1, 0]: if not os.path.exists(args.output_dir) and args.local_rank in [-1, 0]:
os.makedirs(args.output_dir) os.makedirs(args.output_dir)