Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSFW filter #950

Closed
Xerxemi opened this issue Nov 15, 2023 · 18 comments · Fixed by #958
Closed

NSFW filter #950

Xerxemi opened this issue Nov 15, 2023 · 18 comments · Fixed by #958
Labels
enhancement New feature or request
Milestone

Comments

@Xerxemi
Copy link

Xerxemi commented Nov 15, 2023

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I'm currently setting up an event for a school and I'd ideally like to have some extra insurance. An NSFW filter would be useful just in case anything pops up (I don't want to get sued ;).

Describe the idea you'd like
A clear and concise description of what you want to happen.

NSFW filter, equivalent to that in diffusers / other webuis.

@mashb1t
Copy link
Collaborator

mashb1t commented Nov 15, 2023

@Xerxemi please check out my up-to-date fork including an NSFW filter, which is activatable via config.
https://github.com/mashb1t/Fooocus

@tiancool
Copy link

@Xerxemi please check out my up-to-date fork including an NSFW filter, whoch is activatable via config. https://github.com/mashb1t/Fooocus

How did you do it? I didn't see the NSFW filter in your configuration file

@tiancool
Copy link

I hope the author can consider making it a checkbox, in the advanced settings, to enable or disable

@Nebhg
Copy link

Nebhg commented Dec 1, 2023

Is there an opposite for this to ensure the model generates NSFW images?

@mashb1t
Copy link
Collaborator

mashb1t commented Dec 2, 2023

@Nebhg this is a checker, so feel free to negate the condition.
To get more NSFW images i'd propose to use a negative prompt with "sfw" and increase its weight to a suitable amount and/or to use a model fine-tuned for NSFW generation.

@Nebhg
Copy link

Nebhg commented Dec 2, 2023

Thanks for the help! I figured out I can train my own lora and add that model in which seems to be the best solution.

@daniellambert95
Copy link

@Nebhg I'm a bit confused, is it possible to generate NSFW images with Fooocus? Can you please explain how I can do this if it possible?

@mashb1t
Copy link
Collaborator

mashb1t commented Dec 2, 2023

@daniellambert95 in general, you can generate everything in Fooocus and are not limited. What limits you is the capability of the model, e.g. SDXL Base doesn't have an extensive amount of nudity in its training dataset but is capable of it when fine tuning a model via Dreambooth or a LoRA/LyCORIS/Locon/Loha etc.
You can find a comparison here:
image

@daniellambert95
Copy link

@mashb1t thanks for the information. I'm a bit of a noob to all this, could you recommend a place to start learning how to implementing/fine-tuning these models?

@Nebhg
Copy link

Nebhg commented Dec 2, 2023

@mashb1t When training the fine tuned mode is the text embedding vital in the model understanding new words?

@Nebhg
Copy link

Nebhg commented Dec 2, 2023

@Nebhg I'm a bit confused, is it possible to generate NSFW images with Fooocus? Can you please explain how I can do this if it possible?

it is but as mashbit mentioned it wasn't trained on NSFW images so it doesn't produce good quality images

@mashb1t
Copy link
Collaborator

mashb1t commented Dec 2, 2023

@daniellambert95 a potential starting point would be the tutorials section here: https://github.com/bmaltais/kohya_ss#tutorials
Please be advised that fine-tuning models is resource-intensive, so a LoRA is probably a better way for you to start.

@Nebhg for LoRAs it's mandatory to train keywords in order for the adjustments to take full effect. I've never trained a model via Dreambooth but i assume you also have to describe the content you tune, but you can also use CLIP/BLIP auto captioning via kohys_ss.

Hope this helps and all the best!

@mashb1t
Copy link
Collaborator

mashb1t commented Dec 28, 2023

I hope the author can consider making it a checkbox, in the advanced settings, to enable or disable

@tiancool the checkbox has also been added a few days ago in #958, so you can set it in config and UI. It will do censoring if one of both is true.

@Amit30swgoh
Copy link

Is there an opposite for this to ensure the model generates NSFW images?

Not sure how to do it

@mashb1t
Copy link
Collaborator

mashb1t commented Dec 28, 2023

@Nebhg this is a checker, so feel free to negate the condition. To get more NSFW images i'd propose to use a negative prompt with "sfw" and increase its weight to a suitable amount and/or to use a model fine-tuned for NSFW generation.

using a LoRA or a specific NSFW model would be your best option if adding "nsfw" to positive and "sfw" to negative prompt doesn't work for you.

@Amit30swgoh

This comment was marked as off-topic.

@mashb1t mashb1t added the enhancement New feature or request label Dec 30, 2023
@mashb1t mashb1t mentioned this issue Jan 1, 2024
@mashb1t
Copy link
Collaborator

mashb1t commented May 18, 2024

#958 has just been merged to develop

@mashb1t mashb1t closed this as completed May 18, 2024
@mashb1t mashb1t added this to the 2.4.0 milestone May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
@mashb1t @tiancool @Amit30swgoh @Nebhg @daniellambert95 @Xerxemi and others