deforum-art / sd-webui-deforum

Deforum extension for AUTOMATIC1111's Stable Diffusion webui
https://deforum.github.io
Other
2.68k stars 388 forks source link

Experimental render core with keyframe redistribution logic for Parseq. #978

Open Tok opened 1 month ago

Tok commented 1 month ago

Contains a new rendering package with a refactored version of render.py module that may be used as an alternative to the existing render core in some conditions. It was mostly created with Parseq in mind and provides a new function to align keyframes in a way that allows for fast generation at high cadence.

The conditions of whether the new core is used are defined in render.py at the beginning of the 'render_animation' method (this would be a good place to start reviewing the code). If the new core is used, everything is delegated to /rendering/experimental_core.py. One of the conditions is that a new 'keyframe redistribution mode' is activated in a new dropdown on the Parseq UI tab. If the new distribution mode is set to "off" (default setting), then the experimental render core is not called and everything else in render.py proceeds as usual.

The aim of creating the new core was mostly to reduce complexity by separating it into smaller parts and to bring it to a state where I would be able to replace the two nested main loops (frames and tween frames) and their indexes by another main loop that is doing the same thing, but by processing a collection of frame-objects that can have a variable number of (inbe)tween-frames that aren't actually diffused. This makes it possible to realign the frames-to-actually-diffuse with the keyframes provided by the Parseq manifest. The new code related to keyframe redistribution can be found in /rendering/data/frame/key_frame_distribution.py

For a more detailed description and some progsplaining about refactoring and stuff, you may also check this slightly outdated README that I left on an older branch: https://github.com/Tok/sd-webui-deforum/tree/feature/integration

Other things

If you have any questions, please ask away. I may also be around on discord sometimes.

I agree that my work will be granted copyright to Deforum LLC and be licensed under the terms of the GNU Affero General Public License version 3.