diffusers
diffusers copied to clipboard
Add Diffusers supported callbacks
Is your feature request related to a problem? Please describe. We currently support passing in callbacks to pipelines in order to manipulate/customise aspects of the diffusion process. It would be nice to have a set of officially supported callbacks in Diffusers that would allow us to support functionality such as turning off classifier free guidance out of the box.
Describe the solution you'd like. A potential design to support callbacks (this is just a pseudo-code example)
from diffusers import StableDiffusionPipeline
from diffusers.pipelines.callbacks import GuidanceCallback
pipe = StableDiffusionPipeline.from_pretrained("...")
callbacks = [GuidanceCallback()]
pipe.add_callbacks(callbacks)
image = pipe(...).images[0]
Additional context. Transformers does support callbacks: https://huggingface.co/docs/transformers/main/en/main_classes/callback for training, while ours I think would be mostly focused on inference.
let's start with something simple and just start to support some really useful callback functions with the current callback design
cc @asomoza here - can you take a lead on this?
yes, I'll take this
Hi @asomoza, @yiyixuxu Is this issue open for community?
@Bhavay-2001 Not for now, I'm doing it with a specific simple design so we don't change that much of what we have right now.
We're open to suggestions if you consider something important or want to contribute, here's the PR: https://github.com/huggingface/diffusers/pull/7761