How to turn off the NSFW filter in Stable Diffusion

When the Stable Diffusion AI image generator creates pictures, it sometimes flags ordinary outputs as Not Safe For Work (NSFW). If you use the software at home on your personal computer you may disable the NSFW filter.

When you clone the Stable Diffusion GitHub repository, the file should appear in the scripts directory. If it is not there, clone the repository again from

  • Open the scripts/ file in a text editor
  • Add a new first line to the check_safety function to immediately return the original image and an empty string without checking. Leave the rest of the function as is, as it will not be executed.
def check_safety(x_image):    return x_image, ' '
    safety_checker_input = ...

Join the Conversation


    1. Hi Gotra,
      My “scripts” directory has the file. Please see the screen shot in the updated post. I hope this helps.

  1. is not in the file list on my installation.
    Any other place to make this change?

Leave a comment

Your email address will not be published. Required fields are marked *