| 914 | |
| 915 | @comfy_node(description="LTXV Normalizing Sampler") |
| 916 | class LTXVNormalizingSampler(io.ComfyNode): |
| 917 | @classmethod |
| 918 | def define_schema(cls): |
| 919 | return io.Schema( |
| 920 | node_id="LTXVNormalizingSampler", |
| 921 | category="utility", |
| 922 | inputs=[ |
| 923 | io.Noise.Input("noise"), |
| 924 | io.Guider.Input("guider"), |
| 925 | io.Sampler.Input("sampler"), |
| 926 | io.Sigmas.Input("sigmas"), |
| 927 | io.Latent.Input("latent_image"), |
| 928 | io.String.Input( |
| 929 | "video_normalization_factors", default="1,1,1,1,1,1,1,1" |
| 930 | ), |
| 931 | io.String.Input( |
| 932 | "audio_normalization_factors", default="1,1,0.25,1,1,0.25,1,1" |
| 933 | ), |
| 934 | ], |
| 935 | outputs=[ |
| 936 | io.Latent.Output(display_name="denoised_output"), |
| 937 | ], |
| 938 | ) |
| 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( |
nothing calls this directly
no outgoing calls
no test coverage detected