MCPcopy Create free account
hub / github.com/Lightricks/ComfyUI-LTXVideo / LTXVTiledVAEDecode

Class LTXVTiledVAEDecode

tiled_vae_decode.py:11–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9 name="LTXVTiledVAEDecode",
10)
11class LTXVTiledVAEDecode:
12
13 @classmethod
14 def INPUT_TYPES(s):
15 return {
16 "required": {
17 "vae": ("VAE",),
18 "latents": ("LATENT",),
19 "horizontal_tiles": ("INT", {"default": 1, "min": 1, "max": 6}),
20 "vertical_tiles": ("INT", {"default": 1, "min": 1, "max": 6}),
21 "overlap": ("INT", {"default": 1, "min": 1, "max": 8}),
22 "last_frame_fix": ("BOOLEAN", {"default": False}),
23 },
24 "optional": {
25 "working_device": (["cpu", "auto"], {"default": "auto"}),
26 "working_dtype": (["float16", "float32", "auto"], {"default": "auto"}),
27 },
28 }
29
30 RETURN_TYPES = ("IMAGE",)
31 RETURN_NAMES = ("image",)
32
33 FUNCTION = "decode"
34
35 CATEGORY = "latent"
36
37 def decode(
38 self,
39 vae,
40 latents,
41 horizontal_tiles,
42 vertical_tiles,
43 overlap,
44 last_frame_fix,
45 working_device="auto",
46 working_dtype="auto",
47 ):
48 # Get the latent samples
49 samples = latents["samples"]
50
51 if last_frame_fix:
52 # Repeat the last frame along dimension 2 (frames)
53 # samples: [batch, channels, frames, height, width]
54 last_frame = samples[
55 :, :, -1:, :, :
56 ] # shape: [batch, channels, 1, height, width]
57 samples = torch.cat([samples, last_frame], dim=2)
58
59 batch, channels, frames, height, width = samples.shape
60 time_scale_factor, width_scale_factor, height_scale_factor = (
61 vae.downscale_index_formula
62 )
63 image_frames = 1 + (frames - 1) * time_scale_factor
64
65 # Calculate output image dimensions
66 output_height = height * height_scale_factor
67 output_width = width * width_scale_factor
68

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected