MCPcopy Create free account
hub / github.com/modelscope/DiffSynth-Studio / upscale_video

Function upscale_video

examples/ExVideo/ExVideo_svd_test.py:78–99  ·  view source on GitHub ↗
(image, video)

Source from the content-addressed store, hash-verified

76
77
78def upscale_video(image, video):
79 # Load models
80 download_models(["stable-video-diffusion-img2vid-xt", "ExVideo-SVD-128f-v1"])
81 model_manager = ModelManager(torch_dtype=torch.float16, device="cuda",
82 file_path_list=[
83 "models/stable_video_diffusion/svd_xt.safetensors",
84 "models/stable_video_diffusion/model.fp16.safetensors",
85 ])
86 pipe = SVDVideoPipeline.from_model_manager(model_manager)
87
88 # Generate a video
89 torch.manual_seed(2)
90 video = pipe(
91 input_image=image.resize((1024, 1024)),
92 input_video=[frame.resize((1024, 1024)) for frame in video], denoising_strength=0.5,
93 num_frames=128, fps=30, height=1024, width=1024,
94 motion_bucket_id=127,
95 num_inference_steps=25,
96 min_cfg_scale=2, max_cfg_scale=2, contrast_enhance_scale=1.2
97 )
98 model_manager.to("cpu")
99 return video
100
101
102# We use Hunyuan DiT to generate the first frame. 10GB VRAM is required.

Callers 1

Calls 4

toMethod · 0.95
download_modelsFunction · 0.90
ModelManagerClass · 0.90
from_model_managerMethod · 0.45

Tested by

no test coverage detected