Spaces:
Runtime error
Runtime error
apolinario
commited on
Commit
·
3d6ce7e
1
Parent(s):
1951044
Performance optimization
Browse files- app.py +6 -6
- requirements.txt +1 -1
app.py
CHANGED
@@ -15,6 +15,7 @@ models_list = api.list_models(author="sd-concepts-library", sort="likes", direct
|
|
15 |
models = []
|
16 |
|
17 |
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=True, revision="fp16", torch_dtype=torch.float16).to("cuda")
|
|
|
18 |
|
19 |
def load_learned_embed_in_clip(learned_embeds_path, text_encoder, tokenizer, token=None):
|
20 |
loaded_learned_embeds = torch.load(learned_embeds_path, map_location="cpu")
|
@@ -146,12 +147,11 @@ def checkbox_block():
|
|
146 |
return checkbox
|
147 |
|
148 |
def infer(text):
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
)
|
155 |
output_images = []
|
156 |
for i, image in enumerate(images_list["sample"]):
|
157 |
output_images.append(image)
|
|
|
15 |
models = []
|
16 |
|
17 |
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=True, revision="fp16", torch_dtype=torch.float16).to("cuda")
|
18 |
+
torch.backends.cudnn.benchmark = True
|
19 |
|
20 |
def load_learned_embed_in_clip(learned_embeds_path, text_encoder, tokenizer, token=None):
|
21 |
loaded_learned_embeds = torch.load(learned_embeds_path, map_location="cpu")
|
|
|
147 |
return checkbox
|
148 |
|
149 |
def infer(text):
|
150 |
+
images_list = pipe(
|
151 |
+
[text]*2,
|
152 |
+
num_inference_steps=50,
|
153 |
+
guidance_scale=7.5
|
154 |
+
)
|
|
|
155 |
output_images = []
|
156 |
for i, image in enumerate(images_list["sample"]):
|
157 |
output_images.append(image)
|
requirements.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
diffusers
|
2 |
transformers
|
3 |
nvidia-ml-py3
|
4 |
ftfy
|
|
|
1 |
+
-e git+https://github.com/Narsil/diffusers.git@6a4d2ef1e514a25ff5b511cafa1f06b039f0909b#egg=diffusers
|
2 |
transformers
|
3 |
nvidia-ml-py3
|
4 |
ftfy
|