Skip to content

Commit

Permalink
reduce memory usage to fit in 12gb colab
Browse files Browse the repository at this point in the history
  • Loading branch information
ratwithacompiler committed Oct 7, 2022
1 parent 71ec208 commit c9f9c45
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions convert_original_stable_diffusion_to_diffusers.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ def convert_ldm_clip_checkpoint(checkpoint):

unet = UNet2DConditionModel(**unet_config)
unet.load_state_dict(converted_unet_checkpoint)
del converted_unet_checkpoint

print("unet loaded dict")

Expand All @@ -686,6 +687,7 @@ def convert_ldm_clip_checkpoint(checkpoint):

vae = AutoencoderKL(**vae_config)
vae.load_state_dict(converted_vae_checkpoint)
del converted_vae_checkpoint

print("vae loaded")

Expand All @@ -694,6 +696,7 @@ def convert_ldm_clip_checkpoint(checkpoint):
if text_model_type == "FrozenCLIPEmbedder":
print("converting clip")
text_model = convert_ldm_clip_checkpoint(checkpoint)
del checkpoint
print("converting clip done")
tokenizer = CLIPTokenizer.from_pretrained("openai/clip-vit-large-patch14")
print("safety checker")
Expand Down

0 comments on commit c9f9c45

Please sign in to comment.