Spaces:
Running
on
A100
Running
on
A100
Commit
•
3e0af01
1
Parent(s):
6f329ae
Update app.py
Browse files
app.py
CHANGED
@@ -36,8 +36,8 @@ pipe = StableDiffusionXLPipeline.from_pretrained(
|
|
36 |
"stabilityai/stable-diffusion-xl-base-1.0",
|
37 |
vae=vae,
|
38 |
torch_dtype=torch.float16,
|
39 |
-
).to(
|
40 |
-
original_pipe = copy.deepcopy(pipe)
|
41 |
pipe.to(device)
|
42 |
|
43 |
last_lora = ""
|
@@ -136,10 +136,11 @@ def run_lora(prompt, negative, lora_scale, selected_state):
|
|
136 |
cross_attention_kwargs = None
|
137 |
if last_lora != repo_name:
|
138 |
if last_merged:
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
|
|
143 |
else:
|
144 |
pipe.unload_lora_weights()
|
145 |
is_compatible = sdxl_loras[selected_state.index]["is_compatible"]
|
@@ -161,7 +162,6 @@ def run_lora(prompt, negative, lora_scale, selected_state):
|
|
161 |
cross_attention_kwargs=cross_attention_kwargs,
|
162 |
).images[0]
|
163 |
last_lora = repo_name
|
164 |
-
gc.collect()
|
165 |
return image, gr.update(visible=True)
|
166 |
|
167 |
|
|
|
36 |
"stabilityai/stable-diffusion-xl-base-1.0",
|
37 |
vae=vae,
|
38 |
torch_dtype=torch.float16,
|
39 |
+
).to(device)
|
40 |
+
#original_pipe = copy.deepcopy(pipe)
|
41 |
pipe.to(device)
|
42 |
|
43 |
last_lora = ""
|
|
|
136 |
cross_attention_kwargs = None
|
137 |
if last_lora != repo_name:
|
138 |
if last_merged:
|
139 |
+
pipe = StableDiffusionXLPipeline.from_pretrained(
|
140 |
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
141 |
+
vae=vae,
|
142 |
+
torch_dtype=torch.float16,
|
143 |
+
).to(device)
|
144 |
else:
|
145 |
pipe.unload_lora_weights()
|
146 |
is_compatible = sdxl_loras[selected_state.index]["is_compatible"]
|
|
|
162 |
cross_attention_kwargs=cross_attention_kwargs,
|
163 |
).images[0]
|
164 |
last_lora = repo_name
|
|
|
165 |
return image, gr.update(visible=True)
|
166 |
|
167 |
|