Turning off the model safety checker
By default, the Diffusers pipeline will check the output result with a safety checker model to ensure the generated result does not include any NSFW, violent, or unsafe content. In certain cases, the safety checker may trigger false alarms and produce empty images (completely black images). There are several GitHub issue discussions about the safety checker [11]. In the test stage, we can temporarily turn off the safety checker.
To turn off the safety checker when loading the model using the model ID, run the following code:
import torch from diffusers import StableDiffusionPipeline pipe = StableDiffusionPipeline.from_pretrained( "runwayml/stable-diffusion-v1-5", torch_dtype = torch.float16, safety_checker = None # or load_safety_checker = False )
Note that the parameter to turn off the safety checker is different when we are loading...