Spaces:
Running
on
A10G
Running
on
A10G
JingyeChen
commited on
Commit
•
93f708e
1
Parent(s):
933272d
update
Browse files
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 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
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
|