John6666 commited on
Commit
6f5ad59
1 Parent(s): 17b74d8

Upload 4 files

Browse files
convert_url_to_diffusers_sdxl_gr.py CHANGED
@@ -195,7 +195,7 @@ tags:
195
 
196
 
197
  def fuse_loras(pipe, lora_dict={}, temp_dir=".", civitai_key=""):
198
- if not lora_dict or not isinstance(lora_dict, dict) or not lora_dict.keys(): return
199
  a_list = []
200
  w_list = []
201
  for k, v in lora_dict.items():
@@ -207,7 +207,8 @@ def fuse_loras(pipe, lora_dict={}, temp_dir=".", civitai_key=""):
207
  a_name = Path(new_lora_file).stem
208
  pipe.load_lora_weights(new_lora_file, weight_name = w_name, adapter_name = a_name)
209
  a_list.append(a_name)
210
- w_list.append(v)
 
211
  pipe.set_adapters(a_list, adapter_weights=w_list)
212
  pipe.fuse_lora(adapter_names=a_list, lora_scale=1.0)
213
  pipe.unload_lora_weights()
 
195
 
196
 
197
  def fuse_loras(pipe, lora_dict={}, temp_dir=".", civitai_key=""):
198
+ if not lora_dict or not isinstance(lora_dict, dict): return
199
  a_list = []
200
  w_list = []
201
  for k, v in lora_dict.items():
 
207
  a_name = Path(new_lora_file).stem
208
  pipe.load_lora_weights(new_lora_file, weight_name = w_name, adapter_name = a_name)
209
  a_list.append(a_name)
210
+ w_list.append(v)
211
+ if not a_list: return
212
  pipe.set_adapters(a_list, adapter_weights=w_list)
213
  pipe.fuse_lora(adapter_names=a_list, lora_scale=1.0)
214
  pipe.unload_lora_weights()