Views
No views yet
| Model | Best input frames count | Best output frames count | Resolution | Huggingface Link |
|---|---|---|---|---|
| TI2V-5B | 24-32-40 | 49-61-81 | 704x1280 | Link |
1git clone https://github.com/TheDenk/wan2.2-video-continuation
2cd wan2.2-video-continuation 1python -m venv venv
2source venv/bin/activate1pip install git+https://github.com/huggingface/diffusers.git
2pip install -r requirements.txt1python -m inference.gradio_web_demo \
2 --base_model_path Wan-AI/Wan2.2-TI2V-5B-Diffusers \
3 --lora_path TheDenk/wan2.2-video-continuation1python -m inference.cli_demo \
2 --video_path "resources/ship.mp4" \
3 --num_input_frames 24 \
4 --num_output_frames 81 \
5 --prompt "Watercolor style, the wet suminagashi inks slowly spread into the shape of an island on the paper, with the edges continuously blending into delicate textural variations. A tiny paper boat floats in the direction of the water flow towards the still-wet areas, creating subtle ripples around it. Centered composition with soft natural light pouring in from the side, revealing subtle color gradations and a sense of movement." \
6 --base_model_path Wan-AI/Wan2.2-TI2V-5B-Diffusers \
7 --lora_path TheDenk/wan2.2-video-continuation1python -m inference.cli_demo \
2 --video_path "resources/ship.mp4" \
3 --num_input_frames 24 \
4 --num_output_frames 81 \
5 --prompt "Watercolor style, the wet suminagashi inks slowly spread into the shape of an island on the paper, with the edges continuously blending into delicate textural variations. A tiny paper boat floats in the direction of the water flow towards the still-wet areas, creating subtle ripples around it. Centered composition with soft natural light pouring in from the side, revealing subtle color gradations and a sense of movement." \
6 --base_model_path Wan-AI/Wan2.2-TI2V-5B-Diffusers \
7 --lora_path TheDenk/wan2.2-video-continuation \
8 --num_inference_steps 50 \
9 --guidance_scale 5.0 \
10 --video_height 480 \
11 --video_width 832 \
12 --negative_prompt "bad quality, low quality" \
13 --seed 42 \
14 --out_fps 24 \
15 --output_path "result.mp4" \
16 --teacache_treshold 0.51import os
2os.environ['CUDA_VISIBLE_DEVICES'] = "0"
3os.environ["TOKENIZERS_PARALLELISM"] = "false"
4
5import torch
6from diffusers.utils import load_video, export_to_video
7from diffusers import AutoencoderKLWan, UniPCMultistepScheduler
8
9from wan_continuous_transformer import WanTransformer3DModel
10from wan_continuous_pipeline import WanContinuousVideoPipeline
11
12base_model_path = "Wan-AI/Wan2.2-TI2V-5B-Diffusers"
13lora_path = "TheDenk/wan2.2-video-continuation"
14vae = AutoencoderKLWan.from_pretrained(base_model_path, subfolder="vae", torch_dtype=torch.float32)
15transformer = WanTransformer3DModel.from_pretrained(base_model_path, subfolder="transformer", torch_dtype=torch.bfloat16)
16
17pipe = WanContinuousVideoPipeline.from_pretrained(
18 pretrained_model_name_or_path=base_model_path,
19 transformer=transformer,
20 vae=vae,
21 torch_dtype=torch.bfloat16
22)
23pipe.enable_model_cpu_offload()
24
25pipe.transformer.load_lora_adapter(
26 lora_path,
27 weight_name="pytorch_lora_weights.safetensors",
28 adapter_name="video_continuation",
29 prefix=None,
30)
31pipe.set_adapters("video_continuation", adapter_weights=1.0)
32
33img_h = 480 # 704 512 480
34img_w = 832 # 1280 832 768
35
36num_input_frames = 24 # 16 24 32
37num_output_frames = 81 # 81 49
38
39video_path = 'ship.mp4'
40previous_video = load_video(video_path)[-num_input_frames:]
41
42prompt = "Watercolor style, the wet suminagashi inks slowly spread into the shape of an island on the paper, with the edges continuously blending into delicate textural variations. A tiny paper boat floats in the direction of the water flow towards the still-wet areas, creating subtle ripples around it. Centered composition with soft natural light pouring in from the side, revealing subtle color gradations and a sense of movement."
43negative_prompt = "bad quality, low quality"
44
45output = pipe(
46 previous_video=previous_video,
47 prompt=prompt,
48 negative_prompt=negative_prompt,
49 height=img_h,
50 width=img_w,
51 num_frames=num_output_frames,
52 guidance_scale=5,
53 generator=torch.Generator(device="cuda").manual_seed(42),
54 output_type="pil",
55
56 teacache_treshold=0.4,
57).frames[0]
58
59export_to_video(output, "output.mp4", fps=16)@misc{TheDenk,
title={Wan2.2 Video Continuation},
author={Karachev Denis},
url={https://github.com/TheDenk/wan2.2-video-continuation},
publisher={Github},
year={2025}
}