kadirnar commited on
Commit
50e9233
1 Parent(s): ea3852a

Update diffusion_webui/diffusion_models/controlnet_inpaint_pipeline.py

Browse files
diffusion_webui/diffusion_models/controlnet_inpaint_pipeline.py CHANGED
@@ -23,7 +23,7 @@ class StableDiffusionControlNetInpaintGenerator(ControlnetPipeline):
23
  super().__init__()
24
 
25
  def load_model(self, stable_model_path, controlnet_model_path, scheduler):
26
- if self.pipe is None:
27
  controlnet = ControlNetModel.from_pretrained(
28
  controlnet_model_path, torch_dtype=torch.float16
29
  )
@@ -35,10 +35,11 @@ class StableDiffusionControlNetInpaintGenerator(ControlnetPipeline):
35
  torch_dtype=torch.float16,
36
  )
37
  )
38
-
39
- self.pipe = get_scheduler(pipe=self.pipe, scheduler=scheduler)
40
- self.pipe.to("cuda")
41
- self.pipe.enable_xformers_memory_efficient_attention()
 
42
 
43
  return self.pipe
44
 
 
23
  super().__init__()
24
 
25
  def load_model(self, stable_model_path, controlnet_model_path, scheduler):
26
+ if self.pipe is None or self.pipe.model_name != stable_model_path or self.pipe.scheduler_name != scheduler:
27
  controlnet = ControlNetModel.from_pretrained(
28
  controlnet_model_path, torch_dtype=torch.float16
29
  )
 
35
  torch_dtype=torch.float16,
36
  )
37
  )
38
+
39
+ self.pipe.model_name = stable_model_path
40
+ self.pipe = get_scheduler(pipe=self.pipe, scheduler=scheduler)
41
+ self.pipe.to("cuda")
42
+ self.pipe.enable_xformers_memory_efficient_attention()
43
 
44
  return self.pipe
45