Spaces:
Running
on
Zero
Running
on
Zero
Upload mod.py
Browse files
mod.py
CHANGED
@@ -111,7 +111,7 @@ def get_trigger_word(lorajson: list[dict]):
|
|
111 |
trigger += ", " + d["trigger"]
|
112 |
return trigger
|
113 |
|
114 |
-
|
115 |
# https://github.com/huggingface/diffusers/issues/4919
|
116 |
def fuse_loras(pipe, lorajson: list[dict]):
|
117 |
if not lorajson or not isinstance(lorajson, list): return
|
@@ -134,7 +134,7 @@ def fuse_loras(pipe, lorajson: list[dict]):
|
|
134 |
w_list.append(d["scale"])
|
135 |
if not a_list: return
|
136 |
pipe.set_adapters(a_list, adapter_weights=w_list)
|
137 |
-
|
138 |
#pipe.unload_lora_weights()
|
139 |
|
140 |
|
|
|
111 |
trigger += ", " + d["trigger"]
|
112 |
return trigger
|
113 |
|
114 |
+
# https://huggingface.co/docs/diffusers/v0.23.1/en/api/loaders#diffusers.loaders.LoraLoaderMixin.fuse_lora
|
115 |
# https://github.com/huggingface/diffusers/issues/4919
|
116 |
def fuse_loras(pipe, lorajson: list[dict]):
|
117 |
if not lorajson or not isinstance(lorajson, list): return
|
|
|
134 |
w_list.append(d["scale"])
|
135 |
if not a_list: return
|
136 |
pipe.set_adapters(a_list, adapter_weights=w_list)
|
137 |
+
pipe.fuse_lora(adapter_names=a_list, lora_scale=1.0)
|
138 |
#pipe.unload_lora_weights()
|
139 |
|
140 |
|