| 478 | |
| 479 | class VideoDDIMSampler(BaseDiffusionSampler): |
| 480 | def __init__(self, fixed_frames=None, sdedit=False, cond_inds_sampling=None, apply_cond_aug=None, |
| 481 | apply_cond_aug_chunk_inference = 'zero', |
| 482 | fix_timestep_bug = False, |
| 483 | directly_use_idx_as_timestep = False, # sampling_timestep for guider wrt. t: [25, 24, ...., 0] |
| 484 | **kwargs): |
| 485 | super().__init__(**kwargs) |
| 486 | self.sdedit = sdedit |
| 487 | self.cond_inds = cond_inds_sampling |
| 488 | self.apply_cond_aug = apply_cond_aug |
| 489 | assert self.apply_cond_aug in [None, 'V1', 'V2'], f"Invalid apply_cond_aug: {self.apply_cond_aug}" |
| 490 | self.fix_timestep_bug = fix_timestep_bug |
| 491 | self.directly_use_idx_as_timestep = directly_use_idx_as_timestep |
| 492 | |
| 493 | self.apply_cond_aug_chunk_inference = apply_cond_aug_chunk_inference |
| 494 | assert isinstance(self.apply_cond_aug_chunk_inference, int) or \ |
| 495 | self.apply_cond_aug_chunk_inference in ['v1', 'zero', 'min', 'dynamic'] |
| 496 | # * v1 for randomly sampled gaussian noise |
| 497 | |
| 498 | # * Fixed value |
| 499 | # * - chunk 0 --> timestep: 50 |
| 500 | # * - chunk 1 --> timestep: 150 |
| 501 | # * - chunk x --> timestep: x * 100 + 50 |
| 502 | # * Zero |
| 503 | # * - no effect |
| 504 | # * Min |
| 505 | # * - chunk 0 --> timestep: 0 |
| 506 | # * Dynamic |
| 507 | # * - gradually increase the timestep chunk from 0 -> 7 |
| 508 | # * - then chunk x --> timestep: x * 100 + 50 |
| 509 | |
| 510 | def prepare_sampling_loop(self, x, cond, uc=None, num_steps=None): |
| 511 | alpha_cumprod_sqrt, timesteps = self.discretization( |