hysts HF staff commited on
Commit
cbc964f
1 Parent(s): fef86c6
Files changed (1) hide show
  1. model.py +2 -1
model.py CHANGED
@@ -90,7 +90,8 @@ class Model:
90
  def load_controlnet_weight(self, task_name: str) -> None:
91
  if task_name == self.task_name:
92
  return
93
- del self.pipe.controlnet
 
94
  torch.cuda.empty_cache()
95
  gc.collect()
96
  model_id = CONTROLNET_MODEL_IDS[task_name]
 
90
  def load_controlnet_weight(self, task_name: str) -> None:
91
  if task_name == self.task_name:
92
  return
93
+ if hasattr(self.pipe, 'controlnet'):
94
+ del self.pipe.controlnet
95
  torch.cuda.empty_cache()
96
  gc.collect()
97
  model_id = CONTROLNET_MODEL_IDS[task_name]