(
self,
vae,
guider,
sampler,
sigmas,
noise,
guiding_latents,
optional_cond_images=None,
optional_cond_indices=None,
num_frames=0,
optional_initialization_latents=None,
optional_negative_index_latents=None,
optional_negative_index=-1,
optional_negative_index_strength=1.0,
cond_image_strength=1.0,
guiding_strength=1.0,
guiding_start_step=0,
guiding_end_step=1000,
)
| 674 | CATEGORY = "sampling" |
| 675 | |
| 676 | def sample( |
| 677 | self, |
| 678 | vae, |
| 679 | guider, |
| 680 | sampler, |
| 681 | sigmas, |
| 682 | noise, |
| 683 | guiding_latents, |
| 684 | optional_cond_images=None, |
| 685 | optional_cond_indices=None, |
| 686 | num_frames=0, |
| 687 | optional_initialization_latents=None, |
| 688 | optional_negative_index_latents=None, |
| 689 | optional_negative_index=-1, |
| 690 | optional_negative_index_strength=1.0, |
| 691 | cond_image_strength=1.0, |
| 692 | guiding_strength=1.0, |
| 693 | guiding_start_step=0, |
| 694 | guiding_end_step=1000, |
| 695 | ): |
| 696 | guider = copy.copy(guider) |
| 697 | guider.original_conds = copy.deepcopy(guider.original_conds) |
| 698 | if optional_cond_images is None: |
| 699 | optional_cond_indices = None |
| 700 | |
| 701 | if optional_cond_indices is not None and optional_cond_images is not None: |
| 702 | optional_cond_indices = optional_cond_indices.split(",") |
| 703 | optional_cond_indices = [int(i) for i in optional_cond_indices] |
| 704 | assert len(optional_cond_indices) == len( |
| 705 | optional_cond_images |
| 706 | ), "Number of optional cond images must match number of optional cond indices" |
| 707 | |
| 708 | positive, negative = _get_raw_conds_from_guider(guider) |
| 709 | |
| 710 | time_scale_factor, width_scale_factor, height_scale_factor = ( |
| 711 | vae.downscale_index_formula |
| 712 | ) |
| 713 | |
| 714 | batch, channels, frames, height, width = guiding_latents["samples"].shape |
| 715 | if num_frames != -1: |
| 716 | frames = (num_frames - 1) // time_scale_factor + 1 |
| 717 | |
| 718 | if optional_initialization_latents is not None: |
| 719 | new_latents = optional_initialization_latents |
| 720 | else: |
| 721 | new_latents = EmptyLTXVLatentVideo.execute( |
| 722 | width=width * width_scale_factor, |
| 723 | height=height * height_scale_factor, |
| 724 | length=(frames - 1) * time_scale_factor + 1, |
| 725 | batch_size=1, |
| 726 | )[0] |
| 727 | |
| 728 | high_sigmas, rest_sigmas = SplitSigmas().get_sigmas(sigmas, guiding_start_step) |
| 729 | middle_sigmas, low_sigmas = SplitSigmas().get_sigmas( |
| 730 | rest_sigmas, guiding_end_step - guiding_start_step |
| 731 | ) |
| 732 | |
| 733 | if len(high_sigmas) > 1: |
nothing calls this directly
no test coverage detected