yownas / shift-attention

In stable diffusion, generate a sequence of images shifting attention in the prompt.
Other
166 stars 17 forks source link

[Feature Request] Support prompt interpolation for batch image processing #20

Open NergiZed opened 5 months ago

NergiZed commented 5 months ago

I suggest that when the shift-attention script is activated alongside any sort of batch image processing, that it interpolates the prompt in-sync with the batch of images processed.

So if shift-attention is set to 16 steps, and there are 16 images, it will interpolate the prompt over those 16 images and output 16 new images. If steps are more than the images in batch, it will interpolate each step until it runs out of images. If images in batch are greater than the steps, it will interpolate each step until it runs out of steps, and then repeats the last step for all subsequent images.

Currently, if batch processing is activated, shift-attention will interpolate all 16 steps on the first image only, then repeatedly interpolate the last shift-attention-step the total number of steps on each subsequent frame.

I ran a test with 13 keyframes in batch and 5 steps of shift attention: First frame, with all 5 steps: https://github.com/yownas/shift-attention/assets/60335527/77e3fdb9-a3db-4706-b899-05c81861731e

A subsequent frame, with the last step repeated 5 times. They all basically look like this. https://github.com/yownas/shift-attention/assets/60335527/8317e01b-46fb-4821-b017-0a5870e0c194

Also, it weirdly creates these increasingly deep folder structure for each subsequent frame. It's super weird. image

Anyhow, I really like this script and I use it often on both Automatic1111 and Forge. It's really useful sometimes, especially with masking, and I think with image batch processing, it could be even more useful. Potentially helping out with simple facial animation on top of ready-made character animation, which is what I want to try to use it for.