multimodalart HF staff commited on
Commit
2da1810
1 Parent(s): 45d03d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -344,16 +344,13 @@ def run_lora(prompt, image_input, image_strength, cfg_scale, steps, selected_ind
344
  lora_path = lora['repo']
345
  weight_name = lora.get("weights")
346
  print(f"Lora Path: {lora_path}")
347
- if image_input is not None:
348
- if weight_name:
349
- pipe_i2i.load_lora_weights(lora_path, weight_name=weight_name, low_cpu_mem_usage=True, adapter_name=lora_name)
350
- else:
351
- pipe_i2i.load_lora_weights(lora_path, low_cpu_mem_usage=True, adapter_name=lora_name)
352
- else:
353
- if weight_name:
354
- pipe.load_lora_weights(lora_path, weight_name=weight_name, low_cpu_mem_usage=True, adapter_name=lora_name)
355
- else:
356
- pipe.load_lora_weights(lora_path, low_cpu_mem_usage=True, adapter_name=lora_name)
357
  print("Loaded LoRAs:", lora_names)
358
  print("Adapter weights:", lora_weights)
359
  if image_input is not None:
 
344
  lora_path = lora['repo']
345
  weight_name = lora.get("weights")
346
  print(f"Lora Path: {lora_path}")
347
+ pipe_to_use = pipe_i2i if image_input is not None else pipe
348
+ pipe_to_use.load_lora_weights(
349
+ lora_path,
350
+ weight_name=weight_name if weight_name else None,
351
+ low_cpu_mem_usage=False,
352
+ adapter_name=lora_name
353
+ )
 
 
 
354
  print("Loaded LoRAs:", lora_names)
355
  print("Adapter weights:", lora_weights)
356
  if image_input is not None: