Rename model.py to model.py enabled safety checker
Browse files
model.py → model.py enabled safety checker
RENAMED
@@ -11,6 +11,7 @@ from diffusers import (
|
|
11 |
DiffusionPipeline,
|
12 |
StableDiffusionControlNetPipeline,
|
13 |
UniPCMultistepScheduler,
|
|
|
14 |
)
|
15 |
|
16 |
from cv_utils import resize_image
|
@@ -60,6 +61,7 @@ class Model:
|
|
60 |
pipe = StableDiffusionControlNetPipeline.from_pretrained(
|
61 |
base_model_id, safety_checker=None, controlnet=controlnet, torch_dtype=torch.float16
|
62 |
)
|
|
|
63 |
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
64 |
if self.device.type == "cuda":
|
65 |
pipe.enable_xformers_memory_efficient_attention()
|
|
|
11 |
DiffusionPipeline,
|
12 |
StableDiffusionControlNetPipeline,
|
13 |
UniPCMultistepScheduler,
|
14 |
+
StableDiffusionSafetyChecker
|
15 |
)
|
16 |
|
17 |
from cv_utils import resize_image
|
|
|
61 |
pipe = StableDiffusionControlNetPipeline.from_pretrained(
|
62 |
base_model_id, safety_checker=None, controlnet=controlnet, torch_dtype=torch.float16
|
63 |
)
|
64 |
+
pipe.safety_checker = StableDiffusionSafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker")
|
65 |
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
66 |
if self.device.type == "cuda":
|
67 |
pipe.enable_xformers_memory_efficient_attention()
|