Skip to content

Commit 9c03f29

Browse files
committed
add low_cpu_mem_usage
1 parent 77a5362 commit 9c03f29

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

examples/text_to_image/train_img2img_test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,9 @@ def main():
460460
args.pretrained_model_name_or_path, subfolder="text_encoder", revision=args.revision
461461
)
462462
vae = AutoencoderKL.from_pretrained(args.pretrained_model_name_or_path, subfolder="vae", revision=args.revision)
463+
464+
# https://github.com/huggingface/diffusers/issues/1619
465+
# all ignore_mismatched_sizes and low_cpu_mem_usage and in_channels are needed
463466
unet = UNet2DConditionModel.from_pretrained(
464467
args.pretrained_model_name_or_path, subfolder="unet", in_channels=8, revision=args.non_ema_revision,
465468
ignore_mismatched_sizes=True,low_cpu_mem_usage=False
@@ -473,6 +476,8 @@ def main():
473476

474477
# Create EMA for the unet.
475478
if args.use_ema:
479+
# https://github.com/huggingface/diffusers/issues/1619
480+
# all ignore_mismatched_sizes and low_cpu_mem_usage and in_channels are needed
476481
ema_unet = UNet2DConditionModel.from_pretrained(
477482
args.pretrained_model_name_or_path, subfolder="unet", in_channels=8, revision=args.revision,
478483
ignore_mismatched_sizes=True,low_cpu_mem_usage=False

0 commit comments

Comments
 (0)