nateraw / stable-diffusion-videos

Create 🔥 videos with Stable Diffusion by exploring the latent space and morphing between text prompts
Apache License 2.0
4.4k stars 421 forks source link

Add batch inference #45

Closed nateraw closed 1 year ago

nateraw commented 1 year ago

This PR lets you do batch inference. Previously, we were generating 1 image at a time while making videos. Now, you should be able to generate batch_size number of frames at a time. Suggest to increase this to a value 1 less than what makes you run out of VRAM. For me, that's 4 on a V100 16GB.

nateraw commented 1 year ago

Usage:

import time

from stable_diffusion_videos import walk

video_path = walk(
    prompts=['a cat with a funny hat', 'a dog wearing clown shoes'],
    seeds=[42, 58],
    make_video=True,
    num_steps=60,
    name=time.strftime("%Y%m%d-%H%M%S"),
    batch_size=4
)