Repository navigation
add a helper function insert_step_callback and callback test on modular - #15427
Merged
Merged
Conversation
Adds a step callback block to every denoising loop of a modular pipeline, so it accepts `callback_on_step_end` like a standard pipeline. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
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. Pages changed in this PR: |
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds
insert_step_callback, which makes a modular pipeline acceptcallback_on_step_end:It adds a block to the end of each denoising loop that calls the callback with
(pipeline, step, timestep, callback_kwargs).callback_kwargsholds the loopvalues (e.g.
latents) plusnum_timesteps, and returned values are written back.Motivation: #15017 (
diffusers serve) writes this block by hand to report progress.It stays useful after
pipe.stream()(#14159) for anyone who already has a callback.Notes:
callback_on_step_end_tensor_inputs: the callback gets the whole loop state.pipe._interruptis not supported.Wan Animate 2) and Echo are not supported and raise a
ValueError.Tests:
test_step_callbackandtest_step_callback_early_stopinModularPipelineTesterMixinrun on every modular pipeline. The unsupported onesskip them explicitly.
Docs: the "Modular pipelines" section of the callbacks guide now uses the function.