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

Method sample

easy_samplers.py:128–295  ·  view source on GitHub ↗
(
        self,
        model,
        vae,
        width,
        height,
        num_frames,
        guider,
        sampler,
        sigmas,
        noise,
        optional_cond_images=None,
        optional_cond_indices=None,
        strength=0.9,
        crop="disabled",
        crf=35,
        blur=0,
        optional_negative_index_latents=None,
        optional_negative_index=-1,
        optional_negative_index_strength=1.0,
        optional_initialization_latents=None,
        guiding_start_step=0,
        guiding_end_step=1000,
    )

Source from the content-addressed store, hash-verified

126 CATEGORY = "sampling"
127
128 def sample(
129 self,
130 model,
131 vae,
132 width,
133 height,
134 num_frames,
135 guider,
136 sampler,
137 sigmas,
138 noise,
139 optional_cond_images=None,
140 optional_cond_indices=None,
141 strength=0.9,
142 crop="disabled",
143 crf=35,
144 blur=0,
145 optional_negative_index_latents=None,
146 optional_negative_index=-1,
147 optional_negative_index_strength=1.0,
148 optional_initialization_latents=None,
149 guiding_start_step=0,
150 guiding_end_step=1000,
151 ):
152 guider = copy.copy(guider)
153 guider.original_conds = copy.deepcopy(guider.original_conds)
154 positive, negative = _get_raw_conds_from_guider(guider)
155
156 if optional_cond_images is not None:
157 optional_cond_images = (
158 comfy.utils.common_upscale(
159 optional_cond_images.movedim(-1, 1),
160 width,
161 height,
162 "bilinear",
163 crop=crop,
164 )
165 .movedim(1, -1)
166 .clamp(0, 1)
167 )
168 optional_cond_images = comfy_extras.nodes_lt.LTXVPreprocess.execute(
169 optional_cond_images, crf
170 )[0]
171 for i in range(optional_cond_images.shape[0]):
172 optional_cond_images[i] = blur_internal(
173 optional_cond_images[i].unsqueeze(0), blur
174 )
175
176 if optional_cond_indices is not None and optional_cond_images is not None:
177 optional_cond_indices = optional_cond_indices.split(",")
178 optional_cond_indices = [int(i) for i in optional_cond_indices]
179 assert len(optional_cond_indices) == len(
180 optional_cond_images
181 ), "Number of optional cond images must match number of optional cond indices"
182
183 if optional_initialization_latents is None:
184 (latents,) = EmptyLTXVLatentVideo().execute(width, height, num_frames, 1)
185 else:

Callers 2

sampleMethod · 0.45
sampleMethod · 0.45

Calls 7

blur_internalFunction · 0.85
LTXVAddLatentGuideClass · 0.85
executeMethod · 0.45
encodeMethod · 0.45
generateMethod · 0.45
set_condsMethod · 0.45

Tested by

no test coverage detected