r/StableDiffusion • • 20h ago

Question - Help Do I need an uncensored text encoder? (Qwen 2.1)

I’m brand new to this stuff and am trying to figure out if I need an uncensored text encoder to do uncensored images, or if the default text encoder will work.

Also, if I load an uncensored LORA, will that work by itself or do I also need a custom uncensored base model or checkpoint?

9 Upvotes

20 comments sorted by

43

u/Spudnock 20h ago

uncensored text encoders is peak snake oil, unless you're using it to generate prompts.

1

u/Jollyfat_ 19h ago

Awesome, thanks for the advice!

0

u/PrinceHeinrich 20h ago

Listen to this man

2

u/PrinceHeinrich 20h ago

Also: then getting into prompt generation thru text encoders dont even get you what you really want to get, it just gives you a prompt with better fidelity. that time could have been spent prompting and generating more

14

u/Ruvaakdein 20h ago

No, it makes practically no difference as a text encoder whether it is censored or not, since the layers responsible for the censorship never get called into play. The only place you'd actually need an uncensored text model would be in a prompt enhancer.

Here's the guy responsible for uncensoring models saying it: https://www.reddit.com/r/StableDiffusion/s/Ju7gx7LWfF

4

u/elevendr 5h ago

RIP PEW

4

u/purelawan 20h ago

Start with the default encoder. The text encoder only turns your prompt into numbers, it doesn't refuse anything, so swapping it rarely changes what the image model can draw. What limits you is what the base model saw during training: if it never learned a concept, a different encoder won't add it.

A LoRA trained for what you want, loaded on the normal base model, is usually enough. You don't need a separate checkpoint on top of it. If the results look wrong, check the LoRA strength first (try 0.6 to 1.0) and use the trigger words from its page before you change anything else.

5

u/Reasonable_Bear_6258 20h ago

Adding an uncensored text encoder can actually backfire and make your resulting image less accurate to the prompt. Stick to the original.

6

u/VegaKH 19h ago

The general consensus is that you do not, but I'm not so sure that is 100% correct. P-E-W (RIP) came into our sub back around August and said that abliterated models won't work for this. But everyone forgets that he added an important footnote at the end:

(Note: Generation models like Ideogram that can actively refuse prompts are potentially an exception to this rule and might be amenable to abliteration, but only with an approach that significantly differs from how Heretic works today.)

Both Qwen 2.1 and Minimax H3-Image fit this description, as they can both actively refuse prompts. You can tell if the text encoder actively refused your prompt because you will get back the same input image with little to no changes. In testing (done by others,) Qwen refused about 22% of NSFW test prompts.

Also, the approach that Heretic uses today significantly differs from the approach it used when this post was made. On October 1, P-E-W added Arbitrary Rank Ablation (ARA) as an alternative to directional abliteration, and this was pushed as the preferred and default method with the release of Heretic 2.0 on November 1.

So basically, around 80% of the time your NSFW prompt will make it past the standard text encoder without refusal, and any errors are due to censorship in the image model itself. But if you get outright refusals, it may be worth trying an uncensored text encoder.

Note: I can't say for sure how well it will work or which one to use because I haven't tested. Please reply with recommendations if you have them.

2

u/molbal 15h ago

For text encoder: No! It may actually hurt. A model is trained with an original text encoders hidden state as conditioner. Using an uncensored model as text encoder might cause drift and actually even slightly hurt output quality of prompt adherence (but will probably just have no effect)

For a prompt enchancer: when your use a model as a prompt enchancer you use it's text output as an output and not it's hidden state. If it contains whatever your want explicitly, it will help. That will still post through the regular text encoding as an extra step before it. This is what why as a prompt enchancer you can use whatever model even one from a different family or a cloud closed weight one.

Some people like to use a single uncensored model for both, because then they only need to download and load one model for both prompt enchancing and text encoding, and an uncensored can be better for the prompt enchancer and is probably close enough for text encoding.

If you don't need NSFW stuff the exact model that the diffusion model recommends will work best, because that model's conditioning is expected by the diffusion model.

2

u/johnfkngzoidberg 6h ago

As a tokenizer to generate images, an unsensored text encoder does nothing. But a lot of workflows have a prompt enhancer now, which uses the text encoder model as an LLM to enhance your prompt, and for that an uncensored model is absolutely necessary for NSFW.

1

u/Carbon849 19h ago

Is Qwen 2.1 not censored at the model level? Like H3 image, which wasn't trained with truly NSFW material and thus simply cannot produce it, I was under the impression that Qwen 2.1 was the same, meaning that an abliterated TE would, or rather could, do nothing. Am I wrong?

1

u/Mikeairm 5h ago

I had a bf16 standard and a bf16 ultra-uncensored text encoder for Qwen 2.1 and making/editing a nsfw image I could not find any differences so I’ve mostly kept using the uncensored just in case.
Some checkpoints the heretic models can be a bit average though so I usually test a few, my text encoder folder was bigger than my Diffusion Models folder the other day… 😭 over 200GB

1

u/05032-MendicantBias 20h ago

Heretic CLIP for editing models is a must. It really makes a difference.

1

u/Specific_Team9951 20h ago

you need a uncensored prompt enhancer

1

u/Sarashana 19h ago

Not only you don't need it, they are outright harmful.

1

u/No-Zookeepergame4774 18h ago

Basically no to all those, if you want to do images that the base model isn't trained for, one or more LoRA targeting that base model trained for the concept(s) involved in all you usually beed. In general, a different text encoder will not help, and will only weaken prompt adherence, but I've seen at leasst one case where an particular uncensored TE was helpful (off the top of my head I don’t remember which image model this was with, though.)