Spaces:
Runtime error
Runtime error
Commit
•
7f6d5a2
1
Parent(s):
7ee4bc6
Update app.py
Browse files
app.py
CHANGED
@@ -149,16 +149,16 @@ def run_lora(prompt, negative, lora_scale, selected_state, progress=gr.Progress(
|
|
149 |
loaded_state_dict = sdxl_loras[selected_state.index]["state_dict"]
|
150 |
cross_attention_kwargs = None
|
151 |
if last_lora != repo_name:
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
# pipe.unfuse_lora()
|
161 |
is_compatible = sdxl_loras[selected_state.index]["is_compatible"]
|
|
|
162 |
if is_compatible:
|
163 |
pipe.load_lora_weights(loaded_state_dict)
|
164 |
pipe.fuse_lora(lora_scale)
|
|
|
149 |
loaded_state_dict = sdxl_loras[selected_state.index]["state_dict"]
|
150 |
cross_attention_kwargs = None
|
151 |
if last_lora != repo_name:
|
152 |
+
if last_merged:
|
153 |
+
del pipe
|
154 |
+
gc.collect()
|
155 |
+
pipe = copy.deepcopy(original_pipe)
|
156 |
+
pipe.to(device)
|
157 |
+
elif(last_fused):
|
158 |
+
pipe.unfuse_lora()
|
159 |
+
pipe.unload_lora_weights()
|
|
|
160 |
is_compatible = sdxl_loras[selected_state.index]["is_compatible"]
|
161 |
+
|
162 |
if is_compatible:
|
163 |
pipe.load_lora_weights(loaded_state_dict)
|
164 |
pipe.fuse_lora(lora_scale)
|