LPX55 commited on
Commit
19d5b34
·
verified ·
1 Parent(s): 044d861

Update optimized.py

Browse files
Files changed (1) hide show
  1. optimized.py +2 -2
optimized.py CHANGED
@@ -106,7 +106,7 @@ def generate_image(prompt, scale, steps, control_image, controlnet_conditioning_
106
  torch.cuda.empty_cache()
107
  # torch.cuda.ipc_collect()
108
 
109
- del variables
110
  gc.collect()
111
  print(f"VRAM used: {torch.cuda.memory_allocated()/1e9:.2f}GB")
112
  return image
@@ -128,7 +128,7 @@ iface = gr.Interface(
128
  description="Generate images using the FluxControlNetPipeline. Upload a control image and enter a prompt to create an image.",
129
  )
130
  print(f"Memory Usage: {torch.cuda.memory_summary(device=None, abbreviated=False)}")
131
- del variables
132
  gc.collect()
133
  # Launch the app
134
  iface.launch()
 
106
  torch.cuda.empty_cache()
107
  # torch.cuda.ipc_collect()
108
 
109
+
110
  gc.collect()
111
  print(f"VRAM used: {torch.cuda.memory_allocated()/1e9:.2f}GB")
112
  return image
 
128
  description="Generate images using the FluxControlNetPipeline. Upload a control image and enter a prompt to create an image.",
129
  )
130
  print(f"Memory Usage: {torch.cuda.memory_summary(device=None, abbreviated=False)}")
131
+ gc.enable()
132
  gc.collect()
133
  # Launch the app
134
  iface.launch()