divamgupta / stable-diffusion-tensorflow

Stable Diffusion in TensorFlow / Keras
Other
1.57k stars 227 forks source link

Negative prompts #48

Closed Juvuzux closed 1 year ago

Juvuzux commented 1 year ago

As implemented, is it currently possible to use negative prompts?

sweetpalma commented 1 year ago

I could second this question. Is there any way to use negative prompts?

jorgemcgomes commented 1 year ago

The negative prompt is simply the prompt that is used for the "unconditional" generation in Classifier-Free Guidance. In this implementation it is hardcoded to be an empty string (or rather, a sequence full of padding tokens, https://github.com/divamgupta/stable-diffusion-tensorflow/blob/master/stable_diffusion_tf/constants.py), which is how it was originally meant to be by the model developers.

It doesn't seem to be that hard to change the implementation to support any arbitrary prompt to be used for the unconditional guidance.

divamgupta commented 1 year ago

If anyone could send a PR with a Coab example, that would be great.