Home ChatGPT How to Disable NSFW Filter in Stable Diffusion

How to Disable NSFW Filter in Stable Diffusion

The power of AI image generation has taken the world by storm, and Stable Diffusion has proven to be one of the best tools in the market. It’s free, flexible, and allows users to bring their wildest ideas into visual reality. However, with its in-built NSFW filters, some of your creations might not see the light of day. So, how do you disable NSFW filter Stable Diffusion? This guide will walk you through the process.

Understanding Stable Diffusion

Before we delve into the process of how to disable NSFW filter Stable Diffusion, let’s understand what Stable Diffusion is. It’s an AI image generator that ranks alongside well-renowned tools such as DALL-E and MidJourney. It allows you to generate a wide range of images based on the prompts you provide.

NSFW Filters in Stable Diffusion

Stable Diffusion, when accessed through platforms like Hugging Face or DreamStudio web app, comes with built-in NSFW filters. These filters prevent the generation of content that may be deemed inappropriate or explicit. But what if you want to explore beyond these restrictions? This guide will show you how to disable NSFW filter Stable Diffusion.

Requirements to Disable NSFW Filter

Before you begin, ensure you have a GPU with at least 6GB of VRAM. This will allow you to run Stable Diffusion locally on your PC and disable its NSFW filter. If you don’t have such a GPU, don’t fret. We will also cover how to disable NSFW filter Stable Diffusion using Google Colab Pro or Plus.

Steps to Disable NSFW Filter Locally

Here are the steps to disable NSFW filter Stable Diffusion locally on your PC:

Setting Up Your Environment

  1. Download and install the latest Anaconda Distribution from here.
  2. Download and install the latest Git from here.

Downloading and Preparing Required Files

  1. Visit this link and select the Files and versions tab. Download the sd-v1-4.ckpt file. You may need to create a Huggingface account to download it.
  2. Download the unfiltered script from this GitHub repository. Click on Code (green button) and select Download ZIP.

Implementing the Filter-Free Script

  1. Unzip the downloaded file and navigate to stable-diffusion-unfiltered-main/models/ldm. Create a folder called “stable-diffusion-v1”. Rename the sd-v1-4.ckpt file to “model.ckpt”, and move it into the folder you’ve created.

Generating NSFW Images

  1. Open the Anaconda cmd prompt and navigate to the “stable-diffusion-unfiltered-main” folder.
  2. Run the following commands:
    • conda env create -f environment.yaml
    • conda activate ldm
    • python scripts/txt2img.py --prompt "Your desired image" --H 512 --W 512 --seed 27 --n_iter 2 --ddim_steps 50

Replace “Your desired image” with your image prompt. You can adjust the height and width of the image by altering the values next to H and W.

Generating NSFW Images Using Google Colab

If you don’t have a powerful GPU, you can still disable NSFW filter Stable Diffusion using Google Colab Pro or Plus. Here’s how:

  1. Visit this Google Colab Notebook.
  2. Click on the magnifying glass icon on the left pane.
  3. Copy-paste !git clone https://github.com/CompVis/stable-diffusion.git into the Find textbox.
  4. Copy-paste !git clone https://github.com/chemistzombie/stable-diffusion-unfiltered.git into the Replace with textbox.
  5. Click on Replace all and then select Ok to confirm.

You can now run each block of code to generate images.

Conclusion

Disabling the NSFW filter in Stable Diffusion opens up new avenues of creativity. However, remember to use this freedom responsibly and create images that respect the guidelines and norms of the platforms where you intend to share them. Happy creating!

Avatar of Aditya Singh
I'm a tech writer with over seven years of experience. I love to help people understand tech through my articles. I write about technology, mobiles, PCs, how-tos & guides, news and gadget reviews. I always stay updated with the latest in tech to give you the best info.
Exit mobile version