Skip to content

Commit 200d5e0

Browse files
Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py
Co-authored-by: Patrick von Platen <[email protected]>
1 parent 6939fd4 commit 200d5e0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,10 @@ def run_safety_checker(self, image, device, dtype):
427427
if self.safety_checker :
428428
has_nsfw_concept = False
429429
else:
430-
feature_extractor_input = self.image_processor.postprocess(image, output_type="pil")
430+
if torch.is_tensor(image):
431+
feature_extractor_input = self.image_processor.postprocess(image, output_type="pil")
432+
else:
433+
feature_extractor_input = self.numpy_to_pil(image)
431434
safety_checker_input = self.feature_extractor(feature_extractor_input, return_tensors="pt").to(device)
432435
image, has_nsfw_concept = self.safety_checker(
433436
images=image, clip_input=safety_checker_input.pixel_values.to(dtype)

0 commit comments

Comments
 (0)