Weifeng-Chen / control-a-video

Official Implementation of "Control-A-Video: Controllable Text-to-Video Generation with Diffusion Models"
GNU General Public License v3.0
359 stars 26 forks source link

Enable versioning for each consecutive save #22

Closed G-force78 closed 1 year ago

G-force78 commented 1 year ago

As a complete novice I've been using chatGPT to write some code in a trial and error fashion in an attempt to be able to run inference on multiple prompts consecutively but have not had success yet. I assume something needs to be changed in inference.py to create new versions of demo each time

this is as far as I got

import os
import imageio

filename = 'demo.mp4'
counter = 1

while os.path.exists(filename):
    new_filename = f'demo_{counter}.mp4'
    counter += 1
    filename = new_filename

imageio.mimsave(filename, out, fps=8)

My god it actually worked..

!python3 /content/control-a-video/inference.py --prompt "a bear practicing kungfu, with a background of mountains" --input_video /content/kf.mp4  --control_mode depth --num_sample_frames 10 --inference_step 10 --guidance_scale 10 --init_noise_thres 0.75

!python3 /content/control-a-video/inference.py --prompt "a cyborg cat dancing" --input_video /content/kf.mp4  --control_mode depth --num_sample_frames 10 --inference_step 10 --guidance_scale 10 --init_noise_thres 0.75

!python3 /content/control-a-video/inference.py --prompt "a clown throwing a ball" --input_video /content/kf.mp4  --control_mode depth --num_sample_frames 10 --inference_step 10 --guidance_scale 10 --init_noise_thres 0.75