Spaces:
Runtime error
Runtime error
Commit
·
1e47ffe
1
Parent(s):
29f021f
Update app.py
Browse files
app.py
CHANGED
@@ -75,7 +75,7 @@ current_model_path = current_model.path
|
|
75 |
if is_colab:
|
76 |
pipe = StableDiffusionPipeline.from_pretrained(
|
77 |
current_model.path,
|
78 |
-
torch_dtype=torch.
|
79 |
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler"),
|
80 |
safety_checker=lambda images, clip_input: (images, False)
|
81 |
)
|
@@ -83,13 +83,13 @@ if is_colab:
|
|
83 |
else:
|
84 |
pipe = StableDiffusionPipeline.from_pretrained(
|
85 |
current_model.path,
|
86 |
-
torch_dtype=torch.
|
87 |
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler")
|
88 |
)
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
|
94 |
device = "GPU 🔥" if torch.cuda.is_available() else "CPU 🥶"
|
95 |
|
@@ -164,14 +164,14 @@ def txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width,
|
|
164 |
if is_colab or current_model == custom_model:
|
165 |
pipe = StableDiffusionPipeline.from_pretrained(
|
166 |
current_model_path,
|
167 |
-
torch_dtype=torch.
|
168 |
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler"),
|
169 |
safety_checker=lambda images, clip_input: (images, False)
|
170 |
)
|
171 |
else:
|
172 |
pipe = StableDiffusionPipeline.from_pretrained(
|
173 |
current_model_path,
|
174 |
-
torch_dtype=torch.
|
175 |
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler")
|
176 |
)
|
177 |
# pipe = pipe.to("cpu")
|
@@ -213,19 +213,19 @@ def img_to_img(model_path, prompt, n_images, neg_prompt, img, strength, guidance
|
|
213 |
if is_colab or current_model == custom_model:
|
214 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
|
215 |
current_model_path,
|
216 |
-
torch_dtype=torch.
|
217 |
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler"),
|
218 |
safety_checker=lambda images, clip_input: (images, False)
|
219 |
)
|
220 |
else:
|
221 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
|
222 |
current_model_path,
|
223 |
-
torch_dtype=torch.
|
224 |
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler")
|
225 |
)
|
226 |
# pipe = pipe.to("cpu")
|
227 |
# pipe = current_model.pipe_i2i
|
228 |
-
|
229 |
if torch.cuda.is_available():
|
230 |
pipe = pipe.to("cuda")
|
231 |
pipe.enable_xformers_memory_efficient_attention()
|
@@ -285,8 +285,8 @@ with gr.Blocks(css="style.css") as demo:
|
|
285 |
</div>
|
286 |
"""
|
287 |
)
|
288 |
-
|
289 |
-
|
290 |
with gr.Column(scale=55):
|
291 |
with gr.Group():
|
292 |
model_name = gr.Dropdown(label="Model", choices=[m.name for m in models], value=current_model.name)
|
|
|
75 |
if is_colab:
|
76 |
pipe = StableDiffusionPipeline.from_pretrained(
|
77 |
current_model.path,
|
78 |
+
torch_dtype=torch.float16,
|
79 |
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler"),
|
80 |
safety_checker=lambda images, clip_input: (images, False)
|
81 |
)
|
|
|
83 |
else:
|
84 |
pipe = StableDiffusionPipeline.from_pretrained(
|
85 |
current_model.path,
|
86 |
+
torch_dtype=torch.float16,
|
87 |
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler")
|
88 |
)
|
89 |
+
|
90 |
+
if torch.cuda.is_available():
|
91 |
+
pipe = pipe.to("cuda")
|
92 |
+
pipe.enable_xformers_memory_efficient_attention()
|
93 |
|
94 |
device = "GPU 🔥" if torch.cuda.is_available() else "CPU 🥶"
|
95 |
|
|
|
164 |
if is_colab or current_model == custom_model:
|
165 |
pipe = StableDiffusionPipeline.from_pretrained(
|
166 |
current_model_path,
|
167 |
+
torch_dtype=torch.float16,
|
168 |
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler"),
|
169 |
safety_checker=lambda images, clip_input: (images, False)
|
170 |
)
|
171 |
else:
|
172 |
pipe = StableDiffusionPipeline.from_pretrained(
|
173 |
current_model_path,
|
174 |
+
torch_dtype=torch.float16,
|
175 |
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler")
|
176 |
)
|
177 |
# pipe = pipe.to("cpu")
|
|
|
213 |
if is_colab or current_model == custom_model:
|
214 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
|
215 |
current_model_path,
|
216 |
+
torch_dtype=torch.float16,
|
217 |
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler"),
|
218 |
safety_checker=lambda images, clip_input: (images, False)
|
219 |
)
|
220 |
else:
|
221 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
|
222 |
current_model_path,
|
223 |
+
torch_dtype=torch.float16,
|
224 |
scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler")
|
225 |
)
|
226 |
# pipe = pipe.to("cpu")
|
227 |
# pipe = current_model.pipe_i2i
|
228 |
+
|
229 |
if torch.cuda.is_available():
|
230 |
pipe = pipe.to("cuda")
|
231 |
pipe.enable_xformers_memory_efficient_attention()
|
|
|
285 |
</div>
|
286 |
"""
|
287 |
)
|
288 |
+
|
289 |
+
with gr.Row():
|
290 |
with gr.Column(scale=55):
|
291 |
with gr.Group():
|
292 |
model_name = gr.Dropdown(label="Model", choices=[m.name for m in models], value=current_model.name)
|