import numpy as np import torch from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler from diffusers.utils import export_to_video from datetime import datetime pipe = DiffusionPipeline.from_pretrained(r"J:\Projects\Video-Projects\text-to-video-ms-1.7b", torch_dtype=torch.float16, variant="fp16") pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config) pipe.enable_model_cpu_offload() timestamp_str = datetime.now().strftime("%Y-%m-%d-%H%M%S") output_video_path=f"J:/Projects/Video-Projects/text-to-video-ms-1.7b/output_videos/{timestamp_str}.mp4" prompt = "Spiderman is surfing" video_frames = pipe(prompt, num_inference_steps=25).frames video_frames_np = [np.array(frame) for frame in video_frames] video_frames_np = np.concatenate(video_frames_np, axis=0) video_path = export_to_video(video_frames_np,output_video_path)