huggingface / huggingface/diffusers
Ability to select the strength of the safety_checker
- Ngôn ngữ chính
- Python
- Star
- 34.5k
- Fork
- 7.3k
- Merge trung bình
- 3 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 91
Mô tả
**Is your feature request related to a problem? Please describe.**
Safety_checker can currently only be turned on/off, and we would like to be able to configure it in more detail.
**Describe alternatives you've considered.**
[I made it based on StableDiffusionPipeline.](https://github.com/suzukimain/diffusers/tree/edit_safety_checker)
**Describe the solution you'd like.**
I would like to be able to specify this in any pipeline using a parameter such as `safety_Level`.
```python
pipe = StableDiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5",
safety_Level="MAX"
).to("cuda")
```
**Additional context.**
```python
git clone https://github.com/suzukimain/diffusers.git -b edit_safety_checker ./diffusers
pip install ./diffusers
import torch
from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5",
).to("cuda")
"""
About safety_Level.
`int` or `float` or one of the following
'WEAK',
'MEDIUM',
'NOMAL',
'STRONG',
'MAX'.
"""
#-------------
#To see the filter strength.
pipe.safety_checker.safety_Level() # 0.0 (default)
#--------------
#If you want to change the intensity.
pipe.safety_checker_Level("STRONG", pipe.safety_checker)
pipe.safety_checker.safety_Level() # 0.1
#--------------
# If numbers are used
pipe.safety_checker_Level(3.0, pipe.safety_checker)
pipe.safety_checker.safety_Level() # 3.0
```
It is related to #5623.
Also, I wasn't sure what range of numbers to put in for `adjustment`, so I put -0.2~0.2 for once.
(If possible, I would appreciate it if someone could tell me about the range of `adjustment`.)
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với StableDiffusionPipeline và safety_checker của nó, sau đó so sánh branch edit_safety_checker được liên kết trong issue. Làm rõ các phạm vi có tên và phạm vi số được chấp nhận, bao gồm cả việc điều chỉnh, trước khi đánh giá một tham số pipeline nhất quán; hoàn thành nghĩa là một pipeline có thể cấu hình độ mạnh của bộ lọc vượt ra ngoài hành vi chỉ bật/tắt.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python, pytorch
- Lĩnh vực
- ai, machine-learning, security
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100