From f4edf7c19a85b5b5698034807683b49d7bf7abb3 Mon Sep 17 00:00:00 2001 From: lllyasviel Date: Thu, 25 Jan 2024 23:55:52 -0800 Subject: [PATCH] Update forge_svd.py --- extensions-builtin/sd_forge_svd/scripts/forge_svd.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions-builtin/sd_forge_svd/scripts/forge_svd.py b/extensions-builtin/sd_forge_svd/scripts/forge_svd.py index 4b3f6403..a77f8c49 100644 --- a/extensions-builtin/sd_forge_svd/scripts/forge_svd.py +++ b/extensions-builtin/sd_forge_svd/scripts/forge_svd.py @@ -2,7 +2,7 @@ import gradio as gr import os import pathlib -from modules import scripts, script_callbacks +from modules import script_callbacks from modules.paths import models_path from modules.ui_common import ToolButton, refresh_symbol from modules import shared @@ -11,6 +11,7 @@ from modules_forge.forge_util import numpy_to_pytorch, pytorch_to_numpy from ldm_patched.modules.sd import load_checkpoint_guess_config from ldm_patched.contrib.external_video_model import VideoLinearCFGGuidance, SVD_img2vid_Conditioning from ldm_patched.contrib.external import KSampler, VAEDecode +from ldm_patched.modules import model_management # from modules_forge.gradio_compile import gradio_compile @@ -45,6 +46,8 @@ def predict(filename, width, height, video_frames, motion_bucket_id, fps, augmen model = opVideoLinearCFGGuidance.patch(model_raw, guidance_min_cfg)[0] init_image = numpy_to_pytorch(input_image) positive, negative, latent_image = opSVD_img2vid_Conditioning.encode(clip_vision, init_image, vae, width, height, video_frames, motion_bucket_id, fps, augmentation_level) + model_management.unload_all_models() + model_management.soft_empty_cache() output_latent = opKSampler.sample(model, sampling_seed, sampling_steps, sampling_cfg, sampling_sampler_name, sampling_scheduler, positive, negative, latent_image, sampling_denoise) output_pixels = opVAEDecode.decode(vae, output_latent)[0] return