Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions blehconfig.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ betterTaesdPreviews:
# Setting it to "vae" will use whatever dtype ComfyUI is set to use for VAE.
preview_dtype: null

# Uses non-blocking transfers for previews when the device supports it.
# Not recommended as it is extremely likely to corrupt previews, especially if the previewer
# is relatively slow or the latent is large (video models, Chroma Radiance). However,
# it might decrease the performance impact of previewing.
preview_non_blocking: false

# Allows skipping upscale layers in the TAESD model, may increase performance when previewing large images or batches.
# May be set to -1 (conservative) or -2 (aggressive) to automatically calculate how many to skip. See README.md for details.
skip_upscale_layers: 0
Expand Down
93 changes: 68 additions & 25 deletions py/better_previews/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,86 @@

from comfy import latent_formats

from .tae_vid import TAEVid, TAEVidBase, TAEVidLTX2

if TYPE_CHECKING:
from pathlib import Path


class VideoModelInfo(NamedTuple):
name: str
latent_format: latent_formats.LatentFormat
fps: int = 24
fps: int | float = 24
temporal_compression: int = 8
temporal_layers: int = 0
patch_size: int = 1
nested_tensor_index: int = 0
tae_model: str | Path | None = None
tae_class: TAEVidBase | None = TAEVid


VIDEO_FORMATS = {
"mochi": VideoModelInfo(
latent_formats.Mochi,
temporal_compression=6,
tae_model="taem1.pth",
),
"hunyuanvideo": VideoModelInfo(
latent_formats.HunyuanVideo,
temporal_compression=4,
tae_model="taehv.pth",
),
"cosmos1cv8x8x8": VideoModelInfo(latent_formats.Cosmos1CV8x8x8),
"wan21": VideoModelInfo(
latent_formats.Wan21,
fps=16,
temporal_compression=4,
tae_model="taew2_1.pth",
),
"wan22": VideoModelInfo(
latent_formats.Wan22,
fps=24,
temporal_compression=4,
patch_size=2,
tae_model="taew2_2.pth",
),
vmi.name: vmi
for vmi in (
VideoModelInfo(
"mochi",
latent_formats.Mochi,
temporal_compression=6,
tae_model="taem1.pth",
),
VideoModelInfo(
"hunyuanvideo",
latent_formats.HunyuanVideo,
temporal_compression=4,
tae_model="taehv.pth",
),
VideoModelInfo(
"hunyuanvideo15",
latent_formats.HunyuanVideo15,
temporal_compression=4,
patch_size=2,
tae_model="taehv1_5.pth",
),
VideoModelInfo(
"cosmos1cv8x8x8",
latent_formats.Cosmos1CV8x8x8,
),
VideoModelInfo(
"wan21",
latent_formats.Wan21,
fps=16,
temporal_compression=4,
temporal_layers=2,
tae_model="taew2_1.pth",
),
VideoModelInfo(
"wan22",
latent_formats.Wan22,
fps=24,
temporal_compression=4,
temporal_layers=2,
patch_size=2,
tae_model="taew2_2.pth",
),
VideoModelInfo(
"ltxv",
latent_formats.LTXV,
fps=24,
patch_size=4,
temporal_layers=3,
tae_model="taeltx_2.pth",
tae_class=TAEVidLTX2,
),
VideoModelInfo(
"ltxav",
latent_formats.LTXV,
fps=24,
patch_size=4,
temporal_layers=3,
tae_model="taeltx_2.pth",
tae_class=TAEVidLTX2,
),
)
}


Expand Down
Loading