Option 1: docker-diffusers-api
Using GitHub - kiri-art/docker-diffusers-api: Diffusers / Stable Diffusion in docker with a REST API, supporting various models, pipelines & schedulers., simply include the following in your request:
{
callInputs: {
safety_checker: False
}
}
For help, use the dedicated forum docker-diffusers-api - Banana Forums (Unofficial).
Option 2: Roll your Own
This can vary depending upon the repo you’re using but basically, for diffusers based repos:
Define a dummy safety checker:
class DummySafetyChecker:
@staticmethod
def __call__(images, clip_input):
return images, False
instantiate it:
dummy_safety_checker = DummySafetyChecker()
and then before calling images = pipeline(....)
, sub out the safety checker as needed, e.g.
safety_checker = call_inputs.get("safety_checker", True)
pipeline.safety_checker = (
model.safety_checker if safety_checker else dummy_safety_checker
)
Now you can choose whether to use the safety checker on each request.