From 0f2f030b04e01cfc360afc90f58bbd779e3e4b8e Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sat, 24 Feb 2024 09:54:57 -0500 Subject: [PATCH] add vgen --- CHANGELOG.md | 4 ++++ TODO.md | 1 - scripts/image2video.py | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae64e9b3c..bd9d0e346 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Update for 2024-02-24 +- **Image2Video** + - new module for creating videos from images + - simply enable from *img2img -> scripts -> image2video* + - based on [VGen](https://huggingface.co/ali-vilab/i2vgen-xl) - **Improvements** - default theme updates - additional built-in theme *black-gray* diff --git a/TODO.md b/TODO.md index 651e25315..03af7e25b 100644 --- a/TODO.md +++ b/TODO.md @@ -10,7 +10,6 @@ Main ToDo list can be found at [GitHub projects](https://github.com/users/vladma - init latents: variations, tiling, img2img - x-adapter: - diffusers public callbacks -- image2video: pia and vgen pipelines - video2video - async lowvram: - remove builtin: controlnet diff --git a/scripts/image2video.py b/scripts/image2video.py index 71da691e5..91b265a39 100644 --- a/scripts/image2video.py +++ b/scripts/image2video.py @@ -6,7 +6,7 @@ from modules import scripts, processing, shared, images, sd_models, devices MODELS = [ { 'name': 'None', 'info': '' }, - { 'name': 'PIA', 'url': 'openmmlab/PIA-condition-adapter', 'info': 'Open MMLab Personalized Image Animator' }, + # { 'name': 'PIA', 'url': 'openmmlab/PIA-condition-adapter', 'info': 'Open MMLab Personalized Image Animator' }, { 'name': 'VGen', 'url': 'ali-vilab/i2vgen-xl', 'info': 'Alibaba VGen' }, ] @@ -75,12 +75,12 @@ class Script(scripts.Script): shared.log.debug(f'Image2Video: model={model_name} frames={num_frames}, video={video_type} duration={duration} loop={gif_loop} pad={mp4_pad} interpolate={mp4_interpolate}') p.ops.append('image2video') p.do_not_save_grid = True + orig_pipeline = shared.sd_model if model_name == 'PIA': if shared.sd_model_type != 'sd': shared.log.error('Image2Video PIA: base model must be SD15') return - orig_pipeline = shared.sd_model shared.log.info(f'Image2Video PIA load: model={repo_id}') motion_adapter = diffusers.MotionAdapter.from_pretrained(repo_id) motion_adapter.to(devices.device, devices.dtype) @@ -101,7 +101,6 @@ class Script(scripts.Script): shared.log.debug(f'Image2Video PIA: args={p.task_args}') processed = processing.process_images(p) shared.sd_model.motion_adapter = None - shared.sd_model = orig_pipeline if model_name == 'VGen': if not isinstance(shared.sd_model, diffusers.I2VGenXLPipeline): @@ -121,6 +120,7 @@ class Script(scripts.Script): shared.log.debug(f'Image2Video VGen: args={p.task_args}') processed = processing.process_images(p) + shared.sd_model = orig_pipeline if video_type != 'None' and processed is not None: images.save_video(p, filename=None, images=processed.images, video_type=video_type, duration=duration, loop=gif_loop, pad=mp4_pad, interpolate=mp4_interpolate) return processed