added seed

This commit is contained in:
cerspense
2024-02-25 06:11:14 -08:00
parent 59b4024de7
commit 1b854d490b
+9 -3
View File
@@ -50,6 +50,7 @@ class Modelscopet2v:
"negative_prompt": ("STRING", {"default": None}),
"num_inference_steps": ("INT", {"default": 40}),
"guidance_scale": ("FLOAT", {"default": 7.5}),
"seed": ("INT", {"default": None}),
"height": ("INT", {"default": 320}),
"width": ("INT", {"default": 576}),
"num_frames": ("INT", {"default": 24}),
@@ -60,13 +61,18 @@ class Modelscopet2v:
FUNCTION = "generate_video_frames"
CATEGORY = "cspnodes"
def generate_video_frames(self, prompt, num_inference_steps, height, width, num_frames, guidance_scale, negative_prompt):
def generate_video_frames(self, prompt, num_inference_steps, height, width, num_frames, guidance_scale, negative_prompt, seed):
# Set up the generator for deterministic results if seed is provided
generator = torch.Generator()
if seed is not None:
generator.manual_seed(seed)
pipe = DiffusionPipeline.from_pretrained("cerspense/zeroscope_v2_576w", torch_dtype=torch.float16)
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe.enable_model_cpu_offload()
# Added guidance_scale and negative_prompt to the pipe call
video_frames = pipe(prompt, num_inference_steps=num_inference_steps, height=height, width=width, num_frames=num_frames, guidance_scale=guidance_scale, negative_prompt=negative_prompt).frames
# Added generator to the pipe call
video_frames = pipe(prompt, num_inference_steps=num_inference_steps, height=height, width=width, num_frames=num_frames, guidance_scale=guidance_scale, negative_prompt=negative_prompt, generator=generator).frames
# Print the shape of the video frames to debug
print(f"Shape of the video frames: {video_frames.shape}")