John6666 commited on
Commit
2f8eea6
1 Parent(s): 164a8bf

Just in case to prevent resource leakage.

Browse files

Depending on the version and configuration of `PEFT`, it could be impossible to unload the pipe if you lose track of the `pipe instance`. Or rather, I learned about it because it was.

Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -352,6 +352,8 @@ def run_lora(prompt, image_input, image_strength, cfg_scale, steps, selected_ind
352
  low_cpu_mem_usage=False,
353
  adapter_name=lora_name
354
  )
 
 
355
  print("Loaded LoRAs:", lora_names)
356
  print("Adapter weights:", lora_weights)
357
  if image_input is not None:
 
352
  low_cpu_mem_usage=False,
353
  adapter_name=lora_name
354
  )
355
+ if image_input is not None: pipe_i2i = pipe_to_use
356
+ else: pipe = pipe_to_use
357
  print("Loaded LoRAs:", lora_names)
358
  print("Adapter weights:", lora_weights)
359
  if image_input is not None: