MCPcopy
hub / github.com/Lightricks/ComfyUI-LTXVideo / execute

Method execute

easy_samplers.py:941–1051  ·  view source on GitHub ↗
(
        cls,
        noise,
        guider,
        sampler,
        sigmas,
        latent_image,
        video_normalization_factors,
        audio_normalization_factors,
    )

Source from the content-addressed store, hash-verified

939
940 @classmethod
941 def execute(
942 cls,
943 noise,
944 guider,
945 sampler,
946 sigmas,
947 latent_image,
948 video_normalization_factors,
949 audio_normalization_factors,
950 ) -> io.NodeOutput:
951
952 if (
953 guider.model_patcher.model.diffusion_model.__class__.__name__
954 != "LTXAVModel"
955 ):
956 raise ValueError()
957
958 ltxav: LTXAVModel = guider.model_patcher.model.diffusion_model
959
960 video_normalization_factors = video_normalization_factors.split(",")
961 audio_normalization_factors = audio_normalization_factors.split(",")
962 video_normalization_factors = [
963 float(factor) for factor in video_normalization_factors
964 ]
965 audio_normalization_factors = [
966 float(factor) for factor in audio_normalization_factors
967 ]
968
969 # Extend normalization factors to match the length of sigmas
970 sigmas_len = len(sigmas) - 1
971 if len(video_normalization_factors) < sigmas_len:
972 if len(video_normalization_factors) > 0:
973 video_normalization_factors.extend(
974 [video_normalization_factors[-1]]
975 * (sigmas_len - len(video_normalization_factors))
976 )
977 if len(audio_normalization_factors) < sigmas_len:
978 if len(audio_normalization_factors) > 0:
979 audio_normalization_factors.extend(
980 [audio_normalization_factors[-1]]
981 * (sigmas_len - len(audio_normalization_factors))
982 )
983
984 # Calculate indices where both normalization factors are not 1.0
985 sampling_split_indices = [
986 i + 1
987 for i, (v, a) in enumerate(
988 zip(video_normalization_factors, audio_normalization_factors)
989 )
990 if v != 1.0 or a != 1.0
991 ]
992 print("Sampling split indices: %s" % sampling_split_indices, flush=True)
993
994 # Split sigmas according to sampling_split_indices
995 def split_by_indices(arr, indices):
996 """
997 Splits arr into chunks according to indices (split points).
998 Indices are treated as starting a new chunk at each index in the list.

Callers 3

sampleMethod · 0.45
sampleMethod · 0.45
sampleMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected