JingyeChen commited on
Commit
93f708e
1 Parent(s): 933272d
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -10,6 +10,7 @@ from tqdm import tqdm
10
  from PIL import Image
11
  from PIL import Image, ImageDraw, ImageFont
12
  import random
 
13
 
14
  import string
15
  alphabet = string.digits + string.ascii_lowercase + string.ascii_uppercase + string.punctuation + ' ' # len(aphabet) = 95
@@ -90,13 +91,13 @@ unet = UNet2DConditionModel.from_pretrained(
90
  text_encoder.resize_token_embeddings(len(tokenizer))
91
 
92
 
93
- # #### load lcm components
94
- # model_id = "lambdalabs/sd-pokemon-diffusers"
95
- # lcm_lora_id = "latent-consistency/lcm-lora-sdv1-5"
96
- # pipe = DiffusionPipeline.from_pretrained(model_id, unet=unet, tokenizer=tokenizer, text_encoder=text_encoder, torch_dtype=torch.float16)
97
- # pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
98
- # pipe.load_lora_weights(lcm_lora_id)
99
- # pipe.to(device="cuda")
100
 
101
 
102
  #### for interactive
 
10
  from PIL import Image
11
  from PIL import Image, ImageDraw, ImageFont
12
  import random
13
+ import copy
14
 
15
  import string
16
  alphabet = string.digits + string.ascii_lowercase + string.ascii_uppercase + string.punctuation + ' ' # len(aphabet) = 95
 
91
  text_encoder.resize_token_embeddings(len(tokenizer))
92
 
93
 
94
+ #### load lcm components
95
+ model_id = "lambdalabs/sd-pokemon-diffusers"
96
+ lcm_lora_id = "latent-consistency/lcm-lora-sdv1-5"
97
+ pipe = DiffusionPipeline.from_pretrained(model_id, unet=copy.deepcopy(unet), tokenizer=tokenizer, text_encoder=copy.deepcopy(text_encoder), torch_dtype=torch.float16)
98
+ pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
99
+ pipe.load_lora_weights(lcm_lora_id)
100
+ pipe.to(device="cuda")
101
 
102
 
103
  #### for interactive