Spaces:
Sleeping
Sleeping
Upload convert_url_to_diffusers_sdxl_gr.py
Browse files
convert_url_to_diffusers_sdxl_gr.py
CHANGED
@@ -222,13 +222,13 @@ tags:
|
|
222 |
f.write(md)
|
223 |
|
224 |
|
225 |
-
def fuse_loras(pipe, lora_dict={}, temp_dir=".", civitai_key=""):
|
226 |
if not lora_dict or not isinstance(lora_dict, dict): return
|
227 |
a_list = []
|
228 |
w_list = []
|
229 |
for k, v in lora_dict.items():
|
230 |
if not k: continue
|
231 |
-
new_lora_file = get_download_file(temp_dir, k, civitai_key)
|
232 |
if not new_lora_file or not Path(new_lora_file).exists():
|
233 |
print(f"LoRA not found: {k}")
|
234 |
continue
|
@@ -279,7 +279,7 @@ def convert_url_to_diffusers_sdxl(url, civitai_key="", hf_token="", is_upload_sf
|
|
279 |
elif new_vae_file:
|
280 |
pipe.vae = AutoencoderKL.from_single_file(new_vae_file)
|
281 |
|
282 |
-
fuse_loras(pipe, lora_dict, temp_dir, civitai_key)
|
283 |
|
284 |
sconf = get_scheduler_config(scheduler)
|
285 |
pipe.scheduler = sconf[0].from_config(pipe.scheduler.config, **sconf[1])
|
|
|
222 |
f.write(md)
|
223 |
|
224 |
|
225 |
+
def fuse_loras(pipe, lora_dict={}, temp_dir=".", civitai_key="", hf_token=""):
|
226 |
if not lora_dict or not isinstance(lora_dict, dict): return
|
227 |
a_list = []
|
228 |
w_list = []
|
229 |
for k, v in lora_dict.items():
|
230 |
if not k: continue
|
231 |
+
new_lora_file = get_download_file(temp_dir, k, civitai_key, hf_token)
|
232 |
if not new_lora_file or not Path(new_lora_file).exists():
|
233 |
print(f"LoRA not found: {k}")
|
234 |
continue
|
|
|
279 |
elif new_vae_file:
|
280 |
pipe.vae = AutoencoderKL.from_single_file(new_vae_file)
|
281 |
|
282 |
+
fuse_loras(pipe, lora_dict, temp_dir, civitai_key, hf_token)
|
283 |
|
284 |
sconf = get_scheduler_config(scheduler)
|
285 |
pipe.scheduler = sconf[0].from_config(pipe.scheduler.config, **sconf[1])
|