MCPcopy Index your code
hub / github.com/Lightricks/ComfyUI-LTXVideo / sample

Method sample

easy_samplers.py:376–624  ·  view source on GitHub ↗
(
        self,
        model,
        vae,
        latents,
        num_new_frames,
        frame_overlap,
        guider,
        sampler,
        sigmas,
        noise,
        strength=0.5,
        guiding_strength=1.0,
        cond_image_strength=1.0,
        optional_guiding_latents=None,
        optional_cond_images=None,
        optional_cond_indices=None,
        optional_reference_latents=None,
        optional_initialization_latents=None,
        adain_factor=0.0,
        optional_negative_index_latents=None,
        optional_negative_index=-1,
        optional_negative_index_strength=1.0,
        guiding_start_step=0,
        guiding_end_step=1000,
        normalize_per_frame=False,
    )

Source from the content-addressed store, hash-verified

374 CATEGORY = "sampling"
375
376 def sample(
377 self,
378 model,
379 vae,
380 latents,
381 num_new_frames,
382 frame_overlap,
383 guider,
384 sampler,
385 sigmas,
386 noise,
387 strength=0.5,
388 guiding_strength=1.0,
389 cond_image_strength=1.0,
390 optional_guiding_latents=None,
391 optional_cond_images=None,
392 optional_cond_indices=None,
393 optional_reference_latents=None,
394 optional_initialization_latents=None,
395 adain_factor=0.0,
396 optional_negative_index_latents=None,
397 optional_negative_index=-1,
398 optional_negative_index_strength=1.0,
399 guiding_start_step=0,
400 guiding_end_step=1000,
401 normalize_per_frame=False,
402 ):
403 guider = copy.copy(guider)
404 guider.original_conds = copy.deepcopy(guider.original_conds)
405
406 if optional_cond_indices is not None and optional_cond_images is not None:
407 optional_cond_indices = optional_cond_indices.split(",")
408 optional_cond_indices = [int(i) for i in optional_cond_indices]
409 assert len(optional_cond_indices) == len(
410 optional_cond_images
411 ), "Number of optional cond images must match number of optional cond indices"
412
413 positive, negative = _get_raw_conds_from_guider(guider)
414
415 samples = latents["samples"]
416 batch, channels, frames, height, width = samples.shape
417 time_scale_factor, width_scale_factor, height_scale_factor = (
418 vae.downscale_index_formula
419 )
420 overlap = frame_overlap // time_scale_factor
421
422 if num_new_frames == -1 and optional_guiding_latents is not None:
423 num_new_frames = (
424 optional_guiding_latents["samples"].shape[2] - overlap
425 ) * time_scale_factor
426
427 (last_overlap_latents,) = LTXVSelectLatents().select_latents(
428 latents, -overlap, -1
429 )
430
431 if optional_initialization_latents is None:
432 new_latents = EmptyLTXVLatentVideo.execute(
433 width=width * width_scale_factor,

Callers

nothing calls this directly

Calls 12

LTXVSelectLatentsClass · 0.85
LTXVAddLatentGuideClass · 0.85
LTXVAdainLatentClass · 0.85
select_latentsMethod · 0.80
batch_normalizeMethod · 0.80
processMethod · 0.80
executeMethod · 0.45
generateMethod · 0.45
set_condsMethod · 0.45
sampleMethod · 0.45

Tested by

no test coverage detected