Instructions to use hakurei/waifu-diffusion with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use hakurei/waifu-diffusion with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("hakurei/waifu-diffusion", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
NSFW content
Hello! Excuse me...I don't know, is it allowed to ask this question, was it already discussed. Anyway, I'll ask it. How to turn NSFW filter off?
Save a copy of the txt2img script if something goes wrong in a separate place.
Then, make these changes and save.
Disabling the Safety Checks:
• Open the "scripts" folder and make a backup copy of txt2img.py
• Open txt2img.py, and find the line (might be line 309) that says:
x_checked_image, has_nsfw_concept = check_safety(x_samples_ddim)
• Replace it with this (make sure to keep the indenting the same as before):
x_checked_image = x_samples_ddim
Optional: Stopping the safety models from even loading to save Vram (thanks NotMyMain007)
• In txt2img.py, find and delete the three separate lines (might be 26, 27, 28) that say:
safety_model_id = "CompVis/stable-diffusion-safety-checker"
safety_feature_extractor = AutoFeatureExtractor.from_pretrained(safety_model_id)
safety_checker = StableDiffusionSafetyChecker.from_pretrained(safety_model_id)
Thank you!
Some more questions. Were you talking about this website? I'm using the website for generating images. I can't find the folders that you mentioned. Is it possible to make it happen on this website too?
But what if there is no such file in the folder? and after a while it still turns out a black image. computer version
Just use google colab or kaggle if you cant access the files.
My kaggle is here ;) : https://www.kaggle.com/code/olfway/waifu-diffusion-version-1-3-with-web-gui
Google colab (easier to access): https://colab.research.google.com/drive/1T8NKPZknFrylmUMAGLsSqUJ9QEgQBs_3
Just set:
#@title 1.3 Model
model_name = "wd-v1-3-float16.ckpt" #@param {type:"string"}
model_link = "https://huggingface.co/hakurei/waifu-diffusion-v1-3/resolve/main/wd-v1-3-float16.ckpt" #@param {type:"string"}
!wget {model_link} -O models/Stable-diffusion/{model_name}
To:
model_name = "wd-1-4-anime_e1.ckpt"
model_link = "https://huggingface.co/hakurei/waifu-diffusion-v1-4/resolve/main/wd-1-4-anime_e1.ckpt"
!wget {model_link} -O models/Stable-diffusion/{model_name}
%cd /content/stable-diffusion-webui
!wget https://huggingface.co/hakurei/waifu-diffusion-v1-4/raw/main/wd-1-4-anime_e1.yaml -O models/Stable-diffusion/wd-1-4-anime_e1.yaml
To update it to wd1.4