Spaces:
Sleeping
Sleeping
Upload 4 files
Browse files
convert_url_to_diffusers_sdxl.py
CHANGED
@@ -194,7 +194,7 @@ tags:
|
|
194 |
|
195 |
|
196 |
def fuse_loras(pipe, civitai_key="", lora_dict={}, temp_dir="."):
|
197 |
-
if not lora_dict or not isinstance(lora_dict, dict)
|
198 |
a_list = []
|
199 |
w_list = []
|
200 |
for k, v in lora_dict.items():
|
@@ -284,7 +284,8 @@ if __name__ == "__main__":
|
|
284 |
assert args.url is not None, "Must provide a URL!"
|
285 |
|
286 |
lora_dict = {args.lora1: args.lora1s, args.lora2: args.lora2s, args.lora3: args.lora3s, args.lora4: args.lora4s, args.lora5: args.lora5s}
|
287 |
-
|
|
|
288 |
|
289 |
if args.loras and Path(args.loras).exists():
|
290 |
for p in Path(args.loras).glob('**/*.safetensors'):
|
|
|
194 |
|
195 |
|
196 |
def fuse_loras(pipe, civitai_key="", lora_dict={}, temp_dir="."):
|
197 |
+
if not lora_dict or not isinstance(lora_dict, dict): return
|
198 |
a_list = []
|
199 |
w_list = []
|
200 |
for k, v in lora_dict.items():
|
|
|
284 |
assert args.url is not None, "Must provide a URL!"
|
285 |
|
286 |
lora_dict = {args.lora1: args.lora1s, args.lora2: args.lora2s, args.lora3: args.lora3s, args.lora4: args.lora4s, args.lora5: args.lora5s}
|
287 |
+
for k, v in lora_dict.items():
|
288 |
+
if k == None or k == "": del lora_dict[k]
|
289 |
|
290 |
if args.loras and Path(args.loras).exists():
|
291 |
for p in Path(args.loras).glob('**/*.safetensors'):
|
convert_url_to_diffusers_sdxl_gr.py
CHANGED
@@ -311,7 +311,8 @@ def convert_url_to_diffusers_repo(dl_url, hf_user, hf_repo, hf_token, civitai_ke
|
|
311 |
if hf_token and not os.environ.get("HF_TOKEN"): os.environ['HF_TOKEN'] = hf_token
|
312 |
if not civitai_key and os.environ.get("CIVITAI_API_KEY"): civitai_key = os.environ.get("CIVITAI_API_KEY")
|
313 |
lora_dict = {lora1: lora1s, lora2: lora2s, lora3: lora3s, lora4: lora4s, lora5: lora5s}
|
314 |
-
|
|
|
315 |
new_path = convert_url_to_diffusers_sdxl(dl_url, civitai_key, is_upload_sf, half, vae, scheduler, lora_dict)
|
316 |
if not new_path: return ""
|
317 |
new_repo_id = f"{hf_user}/{Path(new_path).stem}"
|
@@ -357,7 +358,8 @@ if __name__ == "__main__":
|
|
357 |
assert args.url is not None, "Must provide a URL!"
|
358 |
|
359 |
lora_dict = {args.lora1: args.lora1s, args.lora2: args.lora2s, args.lora3: args.lora3s, args.lora4: args.lora4s, args.lora5: args.lora5s}
|
360 |
-
|
|
|
361 |
|
362 |
if args.loras and Path(args.loras).exists():
|
363 |
for p in Path(args.loras).glob('**/*.safetensors'):
|
|
|
311 |
if hf_token and not os.environ.get("HF_TOKEN"): os.environ['HF_TOKEN'] = hf_token
|
312 |
if not civitai_key and os.environ.get("CIVITAI_API_KEY"): civitai_key = os.environ.get("CIVITAI_API_KEY")
|
313 |
lora_dict = {lora1: lora1s, lora2: lora2s, lora3: lora3s, lora4: lora4s, lora5: lora5s}
|
314 |
+
for k, v in lora_dict.items():
|
315 |
+
if k == None or k == "": del lora_dict[k]
|
316 |
new_path = convert_url_to_diffusers_sdxl(dl_url, civitai_key, is_upload_sf, half, vae, scheduler, lora_dict)
|
317 |
if not new_path: return ""
|
318 |
new_repo_id = f"{hf_user}/{Path(new_path).stem}"
|
|
|
358 |
assert args.url is not None, "Must provide a URL!"
|
359 |
|
360 |
lora_dict = {args.lora1: args.lora1s, args.lora2: args.lora2s, args.lora3: args.lora3s, args.lora4: args.lora4s, args.lora5: args.lora5s}
|
361 |
+
for k, v in lora_dict.items():
|
362 |
+
if k == None or k == "": del lora_dict[k]
|
363 |
|
364 |
if args.loras and Path(args.loras).exists():
|
365 |
for p in Path(args.loras).glob('**/*.safetensors'):
|
local/convert_url_to_diffusers_sdxl.py
CHANGED
@@ -194,7 +194,7 @@ tags:
|
|
194 |
|
195 |
|
196 |
def fuse_loras(pipe, civitai_key="", lora_dict={}, temp_dir="."):
|
197 |
-
if not lora_dict or not isinstance(lora_dict, dict)
|
198 |
a_list = []
|
199 |
w_list = []
|
200 |
for k, v in lora_dict.items():
|
@@ -284,7 +284,8 @@ if __name__ == "__main__":
|
|
284 |
assert args.url is not None, "Must provide a URL!"
|
285 |
|
286 |
lora_dict = {args.lora1: args.lora1s, args.lora2: args.lora2s, args.lora3: args.lora3s, args.lora4: args.lora4s, args.lora5: args.lora5s}
|
287 |
-
|
|
|
288 |
|
289 |
if args.loras and Path(args.loras).exists():
|
290 |
for p in Path(args.loras).glob('**/*.safetensors'):
|
|
|
194 |
|
195 |
|
196 |
def fuse_loras(pipe, civitai_key="", lora_dict={}, temp_dir="."):
|
197 |
+
if not lora_dict or not isinstance(lora_dict, dict): return
|
198 |
a_list = []
|
199 |
w_list = []
|
200 |
for k, v in lora_dict.items():
|
|
|
284 |
assert args.url is not None, "Must provide a URL!"
|
285 |
|
286 |
lora_dict = {args.lora1: args.lora1s, args.lora2: args.lora2s, args.lora3: args.lora3s, args.lora4: args.lora4s, args.lora5: args.lora5s}
|
287 |
+
for k, v in lora_dict.items():
|
288 |
+
if k == None or k == "": del lora_dict[k]
|
289 |
|
290 |
if args.loras and Path(args.loras).exists():
|
291 |
for p in Path(args.loras).glob('**/*.safetensors'):
|