shgao commited on
Commit
d91164d
Β·
1 Parent(s): 68298fd
Files changed (1) hide show
  1. sam2edit.py +2 -0
sam2edit.py CHANGED
@@ -137,9 +137,11 @@ def create_demo():
137
  print("To Use:", config_dict[condition_model], "Current:", default_controlnet_path)
138
  if default_controlnet_path!=config_dict[condition_model]:
139
  print("Change condition model to:", config_dict[condition_model])
 
140
  global pipe
141
  pipe = obtain_generation_model(config_dict[condition_model])
142
  default_controlnet_path = config_dict[condition_model]
 
143
 
144
  with torch.no_grad():
145
  if use_blip and (enable_auto_prompt or len(prompt) == 0):
 
137
  print("To Use:", config_dict[condition_model], "Current:", default_controlnet_path)
138
  if default_controlnet_path!=config_dict[condition_model]:
139
  print("Change condition model to:", config_dict[condition_model])
140
+ del pipe
141
  global pipe
142
  pipe = obtain_generation_model(config_dict[condition_model])
143
  default_controlnet_path = config_dict[condition_model]
144
+ torch.cuda.empty_cache()
145
 
146
  with torch.no_grad():
147
  if use_blip and (enable_auto_prompt or len(prompt) == 0):