Views
No views yet
1$ pip install git+https://github.com/huggingface/diffusers.git
2$ pip install transformers accelerate torch1import torch
2from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
3from diffusers.utils import export_to_video
4
5pipe = DiffusionPipeline.from_pretrained("cerspense/zeroscope_v2_576w", torch_dtype=torch.float16)
6pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
7pipe.enable_model_cpu_offload()
8pipe.enable_vae_slicing()
9pipe.unet.enable_forward_chunking(chunk_size=1, dim=1) # disable if enough memory as this slows down significantly
10
11prompt = "Darth Vader is surfing on waves"
12video_frames = pipe(prompt, num_inference_steps=40, height=320, width=576, num_frames=36).frames
13video_path = export_to_video(video_frames)1pipe = DiffusionPipeline.from_pretrained("cerspense/zeroscope_v2_XL", torch_dtype=torch.float16)
2pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
3pipe.enable_model_cpu_offload()
4pipe.enable_vae_slicing()
5
6video = [Image.fromarray(frame).resize((1024, 576)) for frame in video_frames]
7
8video_frames = pipe(prompt, video=video, strength=0.6).frames
9video_path = export_to_video(video_frames, output_video_path="/home/patrick/videos/video_1024_darth_vader_36.mp4")