Skip to content

Commit

Permalink
Merge pull request #246 from damian0815/patch-2
Browse files Browse the repository at this point in the history
prevent OOM with disabled unet when gradient checkpointing is enabled
  • Loading branch information
victorchall authored Jan 16, 2024
2 parents e08d5de + 9fc6ae7 commit 1819871
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ def sigterm_handler(signum, frame):

train_dataloader = build_torch_dataloader(train_batch, batch_size=args.batch_size)

unet.train() if not args.disable_unet_training else unet.eval()
unet.train() if (args.gradient_checkpointing or not args.disable_unet_training) else unet.eval()
text_encoder.train() if not args.disable_textenc_training else text_encoder.eval()

logging.info(f" unet device: {unet.device}, precision: {unet.dtype}, training: {unet.training}")
Expand Down

0 comments on commit 1819871

Please sign in to comment.