nateraw / stable-diffusion-videos

Create 🔥 videos with Stable Diffusion by exploring the latent space and morphing between text prompts
Apache License 2.0
4.44k stars 422 forks source link

adding check for nsfw, if so, don't save the image or upsample #24

Closed kennethgoodman closed 2 years ago

kennethgoodman commented 2 years ago

In the case of NSFW output, I don't think we want to save the image or increase the frame index, it makes the video weird. Should this parameterized? Should we potentially retry with a slight change? Maybe even more complex, if before/after are NOT NSFW, then just move slightly in latent space?

nateraw commented 2 years ago

In the case of NSFW output, I don't think we want to save the image or increase the frame index, it makes the video weird.

Yes this is incredibly frustrating. I've found the safety checker to be a bit too liberal (blocking things like abstract art, other things that aren't nsfw at all, etc).

For this reason, I have added a NoCheck class in the package, which I use every time I do a run. For obvious reasons I haven't been advertising this one, but it is the best solution imo as long as you aren't acting nefariously.

from stable_diffusion_videos import pipeline, walk, NoCheck

pipeline.safety_checker = NoCheck().cuda()

walk(...)

Maybe even more complex, if before/after are NOT NSFW, then just move slightly in latent space?

I think I would prefer a solution like this instead of just skipping. If combined with #19 effectively it could be really nice. Would take some experimentation to see if something like this would actually reduce likelihood of the nsfw outputs showing up, or if at certain parts coming from certain images just lead to nsfw...not sure.


As for this PR, thanks for the contribution :) - I'm going to think about this one a bit more before making a decision to merge or close this.

nateraw commented 2 years ago

I added some thoughts to #19 that could lead to the more complex solution you mentioned. no clue what the user-facing API should be for a workflow like that though.

nateraw commented 2 years ago

Could just be a bool option..."exclude_nsfw_outputs" or something. set to False by default. If you add that, I'll merge this. Or if solution above works for you, lets close this

vyshnavigutta369 commented 2 years ago

adding init image and init mage strength is causing NSFW images to appear? Can u please add the init image functionality too in the Stablediffusionwalk pipeline?

nateraw commented 2 years ago

@kennethgoodman is it OK to close this one? I think using the NoCheck class is still best solution here for now.

kennethgoodman commented 2 years ago

Yes