smoothieAI commited on
Commit
a6f5535
·
verified ·
1 Parent(s): ad2c80d

Update pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +6 -7
pipeline.py CHANGED
@@ -518,9 +518,7 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
518
  )
519
 
520
  # Copied from diffusers.pipelines.text_to_video_synthesis.pipeline_text_to_video_synth.TextToVideoSDPipeline.prepare_latents
521
- def prepare_latents(
522
- self, batch_size, num_channels_latents, num_frames, height, width, dtype, device, generator, latents=None, smooth_weight=0.5
523
- ):
524
  shape = (
525
  batch_size,
526
  num_channels_latents,
@@ -543,9 +541,7 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
543
  latents = latents * self.scheduler.init_noise_sigma
544
  return latents
545
 
546
- def prepare_latents_consistent(
547
- self, batch_size, num_channels_latents, num_frames, height, width, dtype, device, generator, latents=None
548
- ):
549
  shape = (
550
  batch_size,
551
  num_channels_latents,
@@ -563,7 +559,6 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
563
  latents = randn_tensor(shape, generator=generator, device=device, dtype=dtype)
564
 
565
  # blend each frame with the surrounding N frames making sure to wrap around at the end
566
- smooth_steps = 3
567
  for i in range(num_frames):
568
  blended_latent = torch.zeros_like(latents[:, :, i])
569
  for s in range(-smooth_steps, smooth_steps + 1):
@@ -817,6 +812,8 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
817
  init_image_strength: Optional[float] = 1.0,
818
  init_noise_correlation: Optional[float] = 0.0,
819
  latent_mode: Optional[str] = "normal",
 
 
820
  ):
821
  r"""
822
  The call function to the pipeline for generation.
@@ -997,6 +994,8 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
997
  device,
998
  generator,
999
  latents,
 
 
1000
  )
1001
 
1002
 
 
518
  )
519
 
520
  # Copied from diffusers.pipelines.text_to_video_synthesis.pipeline_text_to_video_synth.TextToVideoSDPipeline.prepare_latents
521
+ def prepare_latents(self, batch_size, num_channels_latents, num_frames, height, width, dtype, device, generator, latents=None):
 
 
522
  shape = (
523
  batch_size,
524
  num_channels_latents,
 
541
  latents = latents * self.scheduler.init_noise_sigma
542
  return latents
543
 
544
+ def prepare_latents_consistent(self, batch_size, num_channels_latents, num_frames, height, width, dtype, device, generator, latents=None,smooth_weight=0.5,smooth_steps=3):
 
 
545
  shape = (
546
  batch_size,
547
  num_channels_latents,
 
559
  latents = randn_tensor(shape, generator=generator, device=device, dtype=dtype)
560
 
561
  # blend each frame with the surrounding N frames making sure to wrap around at the end
 
562
  for i in range(num_frames):
563
  blended_latent = torch.zeros_like(latents[:, :, i])
564
  for s in range(-smooth_steps, smooth_steps + 1):
 
812
  init_image_strength: Optional[float] = 1.0,
813
  init_noise_correlation: Optional[float] = 0.0,
814
  latent_mode: Optional[str] = "normal",
815
+ smooth_weight: Optional[float] = 0.5,
816
+ smooth_steps: Optional[int] = 3,
817
  ):
818
  r"""
819
  The call function to the pipeline for generation.
 
994
  device,
995
  generator,
996
  latents,
997
+ smooth_weight,
998
+ smooth_steps,
999
  )
1000
 
1001