How to Use Stable Diffusion without NSFW Filter: The Ultimate Guide

You are currently viewing How to Use Stable Diffusion without NSFW Filter: The Ultimate Guide
Stable Diffusion without NSFW Filter

If you’re trying to generate explicit images using adult prompts, what you get is merely a black screen with an error message saying unsafe content, all thanks to the Stable Diffusion safety filter, or NSFW filter.

Is there a way to use Stable Diffusion AI without an NSFW filter? You may ask. The truth is, while most Stable Diffusion models are censored by default, the answer is still positive, there are viable workarounds. 

You’ll learn from the step-by-step tutorials on how to remove NSFW filters or safety filters in Stable Diffusion.

Meanwhile, you can also discover a wealth of uncensored Stable Diffusion alternatives that are competent for generating high-quality NSFW images in simple steps. Also, check the best Stable Diffusion websites if interested.

👉Learn from our guide on how to install Stable Diffusion, if you haven’t already.

Table of Contents

Method 1. Manually Remove NSFW Filter in Stable Diffusion

For specific versions of Stable Diffusion, you can manually remove NSFW filters, this is the safest way to use Stable Diffusion NSFW, without involving any third-party tools or services. 

In the following, we’ll introduce the methods for the two more popular versions of Stable Diffusion.

For Hugging Face Version

Step 1. Open the Windows Search box and search for: lib\python3.8\site-packages\diffusers\pipelines\stable-diffusion

Step 2. From there, find the location of the source code file pipeline_stable_diffusion.py, and open it with Notepad.

Step 3. Find the following lines of codes.

# run safety checker #safety_cheker_input = self.feature_extractor(self.numpy_to_pil(image), return_tensors="pt").to(self.device) # image, has_nsfw_concept = self.safety_checker(images=image, clip_input=safety_cheker_input.pixel_values)

Step 4. For the return line of code, modify it to the following:

return {"sample": image, "nsfw_content_detected": False}

For CompVis version

Step 1. Open the “scripts” folder and make a copy of the txt2img.py file

Step 2. Open the txt2img.py file in Notepd, and find the 309 line of code: 

x_checked_image, has_nsfw_concept = check_safety(x_samples_ddim)

Step 3. Replace this line of code with the same indenting:

x_checked_image = x_samples_ddim

✅Also Read: The 12 Best Character.ai Alternatives Without NSFW Filter

Method 2. Use NOP’s Stable Diffusion Colab

Google Colab is a project by Google that allows you to write and run python code through the browser, in the cloud, meaning you can also run Stable Diffusion, which is based on Python code.

That is a good way to avoid the complex Stable Diffusion local installation, and it doesn’t require you to have a decent GPU.

You can either set up Stable Diffusion on your own or use the ones by other people. In the following tutorial, we’ll be using NOP’s Stable Diffusion Colab, which is a constantly maintained NSFW-disabled Stable Diffusion model and is trusted by the community.

Step 1. Go to NOP’s Stable Diffusion Google Colab, log into your Google account, and save it to your Google Drive.

Step 2. Connect Google Colab to your Google Drive and allow permissions. And install NOP Stable Diffusion repo.

Step 3. Download an NSFW model from Civitai or Hugging Face, and upload it to your Google Drive.

Step 4. Go to the Files panel to access your model (.ckpt file) stored in Google Drive from Colab. Copy its Google Drive path and paste it to the Path_to_MODEL box.

Step 5. Copy and paste the token into the token box from the Model Download/Load section.

Step 6. Hit the play button beside the Start Stable-Diffusion, copy and paste the generated URL into the web browser, and press Enter on the keyboard.

Step 7. That’s it! Now you have the Stable Diffusion NSFW version in your web browser, start creating!

Method 3. Use Uncensored Stable Diffusion Models

Many popular Stable Diffusion models and checkpoints have safety filters disabled by default, allowing you to generate NSFW images without trouble.

So if you are running Stable Diffusion locally, another practical method is by downloading and using an uncensored Stable Diffusion model. And to find Stable Diffusion models, the best place is a website called Civitai.com.

Just note that you better go with the Stable-Diffusion-1.5-based ones since Stable Diffusion 2 has been nerfed.

Stable Diffusion NSFW Models

ModelsCivitai Link
Uber Realistic Porn Merge https://civitai.com/models/2661/uber-realistic-porn-merge-urpm
Deliberate https://civitai.com/models/4823/deliberate
Edge Of Realismhttps://civitai.com/models/21813/edge-of-realism
Realistic Vision V2.0https://civitai.com/models/4201/realistic-vision-v20
SXD + berrymix merge https://civitai.com/models/1349/sxd-berrymix-merge
Juggernauthttps://civitai.com/models/46422/juggernaut
Ether Real Mixhttps://civitai.com/models/18207/ether-real-mix
SXZ Lumahttps://civitai.com/models/25831/sxz-luma

Method 4. Use an Unfiltered Stable Diffusion Fork

While the most popular Stable Diffusion versions have NSFW filters on by default, there are other custom-made Stable Diffusion forks that have turned off the filters. Download and install them, and you’ll be able to create NSFW images without seeing black screens.

You only need to be careful to download the best-used ones if you don’t want any potential risks, and we’ve thoroughly tested and recommended the Stable Diffusion Unfiltered by chemistzombie from Github.

Method 5. The Best Stable Diffusion Alternatives without NSFW Filters

To save your time and all the trouble, you can also opt for an uncensored Stable Diffusion alternative without safety filters to generate NSFW images with ease, and many of them have rather high output quality. 

In the following you’ll find some great options, and you’re also highly recommended to discover more from our complete list of the best NSFW AI art generators.

Yodayo

Yodayo is a website that has a text-to-image AI tool with dozens of popular AI models like Anything V5 and AbyssOrangeMix3, all without safety filters. You can create NSFW images in both anime and realistic styles.

Go to Yodayo website

Dezgo

Dezgo is the go to place for generating NSFW images with uncensored Stable Diffusion Models. Dezgo allows you to create with Stable Diffusion 2.1, Stable Diffusion 1.5, Anything V5, etc. without signing up for an account.

Go to Dezgo Website

PixAI.Art

PixAI.Art is a free AI art generator website that is extremely good at generating anime AI art with outstanding details, and it doesn’t have any NSFW filters. You need to sign up for an account or log in with Google, and you get free credits daily.

Go to PixAI.Art website

What is the Stable Diffusion NSFW Filter?

The NSFW filter, also referred to as the safety filter, is a series of codes used to prevent Stable Diffusion from generating explicit images, and it’s said to prevent “misuse” of the program. It looks at text prompts input by the user, determines whether or not it’s sensitive, and generates the according results.

How to Resolve Stable Diffusion Unsafe Content Error

To remove the Stable Diffusion unsafe content error, you have to remove the safety filter. You can do so by manually removing the safety filter in your version of Stable Diffusion by fiddling with the source code. 

Moreover, you can also choose an uncensored Stable Diffusion model or an unfiltered Stable Diffusion fork as alternatives.

Wrapping-up

According to our testing, Stable Diffusion works great when generating nudities, the results are eye-pleasing and the details are impeccable. However, at the current stage, Stable Diffusion isn’t trained enough on pornography scenes, so this type of results won’t be satisfying.

As previously introduced in this article, there are various ways to bypass the NSFW filters in Stable Diffusion, such as manually removing safety filters, using Google Colab, using NSFW Stable Diffusion models, using Stable Diffusion alternatives without NSFW filters, etc.

We aimed to make this guide as complete as possible, but I could miss out on something. If you have anything you have better ideas or anything you think can help improve this guide, please drop a line and let us know. 

Oswald Chen

As a seasoned tech and IT professional, Oswald is also a heavy cord-cutter, video editor, and gamer in his leisure time. His primary goal is to bring correct and unbiased information to the public from thorough research. Oswald was originally known by the public as a Kodi (XBMC) expert, now he keeps learning and innovating, and his interest has branched out to the entire technology field. Follow him on Twitter and Facebook.

Leave a Reply