Spaces:
Sleeping
Sleeping
Upload convert_url_to_diffusers_sd_gr.py
Browse files
convert_url_to_diffusers_sd_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
|
|
@@ -289,7 +289,7 @@ def convert_url_to_diffusers_sd(url, civitai_key="", hf_token="", is_upload_sf=F
|
|
| 289 |
elif new_vae_file:
|
| 290 |
pipe.vae = AutoencoderKL.from_single_file(new_vae_file)
|
| 291 |
|
| 292 |
-
fuse_loras(pipe, lora_dict, temp_dir, civitai_key)
|
| 293 |
|
| 294 |
sconf = get_scheduler_config(scheduler)
|
| 295 |
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
|
|
|
|
| 289 |
elif new_vae_file:
|
| 290 |
pipe.vae = AutoencoderKL.from_single_file(new_vae_file)
|
| 291 |
|
| 292 |
+
fuse_loras(pipe, lora_dict, temp_dir, civitai_key, hf_token)
|
| 293 |
|
| 294 |
sconf = get_scheduler_config(scheduler)
|
| 295 |
pipe.scheduler = sconf[0].from_config(pipe.scheduler.config, **sconf[1])
|