invert condition for checking log_with

This commit is contained in:
Kohya S
2023-04-22 18:05:19 +09:00
parent ed15f6808b
commit 66edc5af7b

View File

@@ -2748,7 +2748,9 @@ def prepare_accelerator(args: argparse.Namespace):
log_prefix = "" if args.log_prefix is None else args.log_prefix
logging_dir = args.logging_dir + "/" + log_prefix + time.strftime("%Y%m%d%H%M%S", time.localtime())
if args.log_with is not None:
if args.log_with is None:
log_with = None
else:
log_with = args.log_with
if log_with in ["tensorboard", "all"]:
if logging_dir is None:
@@ -2761,8 +2763,6 @@ def prepare_accelerator(args: argparse.Namespace):
if logging_dir is not None:
os.makedirs(logging_dir, exist_ok=True)
os.environ["WANDB_DIR"] = logging_dir
else:
log_with = None
accelerator = Accelerator(
gradient_accumulation_steps=args.gradient_accumulation_steps,