Update forge_svd.py

This commit is contained in:
lllyasviel
2024-01-25 23:55:52 -08:00
parent 8e71497b52
commit f4edf7c19a

View File

@@ -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