Update model.py
Browse files
model.py
CHANGED
@@ -12,6 +12,7 @@ from diffusers import (
|
|
12 |
StableDiffusionControlNetPipeline,
|
13 |
UniPCMultistepScheduler
|
14 |
)
|
|
|
15 |
from cv_utils import resize_image
|
16 |
from preprocessor import Preprocessor
|
17 |
from settings import MAX_IMAGE_RESOLUTION, MAX_NUM_IMAGES
|
@@ -57,7 +58,7 @@ class Model:
|
|
57 |
model_id = CONTROLNET_MODEL_IDS[task_name]
|
58 |
controlnet = ControlNetModel.from_pretrained(model_id, torch_dtype=torch.float16)
|
59 |
pipe = StableDiffusionControlNetPipeline.from_pretrained(
|
60 |
-
base_model_id, safety_checker=
|
61 |
)
|
62 |
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
63 |
if self.device.type == "cuda":
|
|
|
12 |
StableDiffusionControlNetPipeline,
|
13 |
UniPCMultistepScheduler
|
14 |
)
|
15 |
+
from diffusers.pipelines.stable_diffusion import StableDiffusionSafetyChecker
|
16 |
from cv_utils import resize_image
|
17 |
from preprocessor import Preprocessor
|
18 |
from settings import MAX_IMAGE_RESOLUTION, MAX_NUM_IMAGES
|
|
|
58 |
model_id = CONTROLNET_MODEL_IDS[task_name]
|
59 |
controlnet = ControlNetModel.from_pretrained(model_id, torch_dtype=torch.float16)
|
60 |
pipe = StableDiffusionControlNetPipeline.from_pretrained(
|
61 |
+
base_model_id, safety_checker=StableDiffusionSafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker"), controlnet=controlnet, torch_dtype=torch.float16
|
62 |
)
|
63 |
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
64 |
if self.device.type == "cuda":
|