-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Ability to change the strength of safety_checker #9068
base: main
Are you sure you want to change the base?
Conversation
However, I could not solve the following two problems by myself.
Please let me know if there are other problems. |
Hello, @yiyixuxu |
Hi @suzukimain |
Hi, @yiyixuxu It is intended to be used in classes such as pip install git+https://github.com/suzukimain/diffusers@safety_checker
from diffusers import StableDiffusionPipeline
import torch
pipe = StableDiffusionPipeline.from_pretrained(
"stable-diffusion-v1-5/stable-diffusion-v1-5",
torch_dtype=torch.float16
).to("cuda")
#To see the filter strength.
print(f"Default filter strength: {pipe.filter_level()}") # 0.0
pipe.safety_checker_level("STRONG")
print(f"Filter strength: {pipe.filter_level()}") # 0.5
img=pipe("An image of a squirrel in Picasso style").images[0]
img |
thanks I'm trying to understand whether it would be a common/meaningful use case that people need this feature - |
Currently, the safety checker only allows for enabling or disabling its functionality. |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
IMO to have this option is not bad but I really don't understand why we added the safety checker as part of diffusers, this is better handled outside of diffusers (on the app or library) so they can use whatever they want to filter the outputs, probably this is what all the services are doing right now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with @asomoza not sure why the safety checker was added, I don't believe it's actually part of the license/usage restrictions and the safety checker is so bad nobody has ever really used it which defeats the purpose.
Anyway changes look good other than the comments.
Co-authored-by: hlky <[email protected]>
Co-authored-by: hlky <[email protected]>
Co-authored-by: hlky <[email protected]>
hi @hlky, fixed. Thank you. |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Hello @hlky, Some corrections have been made. |
I apologize for the inconvenience. I have corrected it again. |
@suzukimain could you run some tests to demonstrate the oversensitivity of the safety checker and find what level of adjustment works well? Choose some (safe) prompt(s), find seed(s) that trigger the safety checker, then set filter strength until the image is allowed through. |
What does this PR do?
Fixes #9003
Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.