Add prepare_sampling wrapper to allow modifying noise_shape #7500
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.
Most likely starting 4 months ago with the memory management changes, memory usage expectation for context window-related sampling (such as with AnimateDiff-Evolved) is vastly overestimated. There doesn't seem to be anything 'wrong' with that code - ComfyUI is simply trying to account for things in memory estimation it wasn't before.
In practice, this at best decreases performance by >25% due to models being forced to be loaded partially with high total latent counts, and at worst causes new edge cases that may cause crashes on select workflows.
This PR adds a wrapper around the prepare_sampling function to allow custom nodes to provide a better estimate for noise_shape without the need for any monkey patching.
Related PR that will be merged into AnimateDiff-Evolved once this is merged: Kosinkadink/ComfyUI-AnimateDiff-Evolved#549