From 5db34032f679ca205b2bb975ca5c861ee90218c7 Mon Sep 17 00:00:00 2001 From: ChengZi Date: Thu, 5 Jan 2023 10:19:22 +0800 Subject: [PATCH] add making saving dir --- train_isc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/train_isc.py b/train_isc.py index 1f7dd39..9820eb7 100644 --- a/train_isc.py +++ b/train_isc.py @@ -151,6 +151,8 @@ def main_worker(gpu, ngpus_per_node, model, training_args): train_one_epoch(train_loader, model, loss_fn, optimizer, scaler, epoch, rank) if not distributed or (distributed and rank == 0): + if not os.path.exists(training_args.output_dir): + os.mkdir(training_args.output_dir) torch.save({ 'epoch': epoch + 1, 'state_dict': model.state_dict(),