Skip to content
Pinter Computing

Knowledge Base for IT Professionals, Teachers, and Astronauts

Pinter Computing

Knowledge Base for IT Professionals, Teachers, and Astronauts

  • Home
  • Programming
  • DevOps
  • Project Management
  • Software and Hardware
  • Miscellaneous
  • Egyebek
  • About
  • Experience
  • Education
  • Contact
  • Home
  • Programming
  • DevOps
  • Project Management
  • Software and Hardware
  • Miscellaneous
  • Egyebek
  • About
  • Experience
  • Education
  • Contact
Close

Search

Home/Knowledge Base/How to turn off the NSFW filter in Stable Diffusion
Knowledge Base

How to turn off the NSFW filter in Stable Diffusion

By Laszlo Pinter
August 27, 2023 1 Min Read
4

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 txt2img.py file should appear in the scripts directory. If it is not there, clone the repository again from https://github.com/CompVis/stable-diffusion.git

  • Open the scripts/txt2img.py 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 = ...
Author

Laszlo Pinter

Follow Me
Other Articles
Previous

ImportError: cannot import name ‘CLIPTextModelWithProjection’ from ‘transformers’

Next

Prevent scrolling in Lucid Charts embedded viewer

4 Comments
  1. Gotra says:
    December 5, 2023 at 8:38 am

    Total unbrauchbar weil keine txt2img.py gibt!

    Reply
    1. Laszlo Pinter says:
      December 10, 2023 at 10:33 pm

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

      Reply
  2. TheDude says:
    December 17, 2023 at 6:16 am

    txt2img.py is not in the file list on my installation.
    C:\Users\username\stable-diffusion-webui\scripts
    Any other place to make this change?

    Reply
    1. Laszlo Pinter says:
      December 19, 2023 at 7:33 pm

      Hi Dude,

      When you clone the Stable Diffusion GitHub repository, the txt2img.py file should appear in the scripts directory. If it is not there, clone the repository again from https://github.com/CompVis/stable-diffusion.git
      Please see the GitHub screen shot in the updated post above.
      I hope this helps.

      Reply

Leave a Reply Cancel reply

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

Search

Last Changes

  • DevOps Engineering part 1. (Mac) - Make your Macintosh easier to use June 25, 2026
  • Japan travel tips June 22, 2026
  • How to stop the rain and snow in Cities: Skylines II June 20, 2026
  • Cities: Skylines II Developer Mode June 20, 2026
  • 'CSII_MANAGEDPATH' has incorrect path(s) when building Cities: Skylines II mod June 20, 2026

Tags

.NET .NETcore 3Dprinting ASP.NET Core AutodeskInventor AWS C# Chef cloud DevOps Docker EntityFramework Games Git Go iOS iPad iPhone iPod Java Kubernetes Linux MacOSX MSSQL MVC Node.js Packer PowerShell Python RDS RightScale Ruby security Splunk TeamCity Terraform TestKitchen Tomcat Ubuntu Vagrant VirtualBox VisualStudio Windows WordPress Xcode

Recent Comments

  • Zengei László on MyHeritage családfa exportálása és küldése emailben
  • Raúl Castillo on DynDns update error
  • MICHAEL on Windows Media Player 12 cannot find the album information
  • Nargis on Configure Epson ET-3850 scanning on Windows 11
  • Venczelné Zemen Erika on Delta S2302 termosztát programozása

–

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Copyright 2026 — Pinter Computing. All rights reserved.