barakmeiri commited on
Commit
deb578d
·
verified ·
1 Parent(s): ef9f8b1

try to clean gpu memory each time the set_pipe is called with existing editor on device

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -63,6 +63,10 @@ with gr.Blocks(css="style.css") as demo:
63
 
64
  if image_editor is not None:
65
  image_editor = image_editor.to('cpu')
 
 
 
 
66
 
67
  if input_image is None or not description_prompt:
68
  return None, "Please set all inputs."
 
63
 
64
  if image_editor is not None:
65
  image_editor = image_editor.to('cpu')
66
+ if device == 'cuda':
67
+ torch.cuda.empty_cache()
68
+ print("#### torch.cuda.memory_summary(device=None, abbreviated=False):")
69
+ print(torch.cuda.memory_summary(device=None, abbreviated=False))
70
 
71
  if input_image is None or not description_prompt:
72
  return None, "Please set all inputs."