Skip to content

Commit 5a9a941

Browse files
[modular] Add LTX Video modular pipeline (#13378)
* Add modular pipeline support for LTX Video * Fix guidance_scale passthrough to guider * Add LTX modular pipeline tests * Add LTX image-to-video modular pipeline * Fix i2v VAE dtype mismatch * Add cache_context to denoiser for CFG parity * Address review feedback * Generate auto docstrings for LTX assembled blocks * Fix ruff lint and format issues * use InputParam/OutputParam templates and ruff check * address all review * Lift LTXVaeEncoderStep out of I2V core denoise into its own auto block * unused declarations * Fix check_copies: sync retrieve_timesteps and drop unsupported Copied from tags * Address review: remove unused code, add LTXAutoBlocks, refactor I2V latents flow * removed LTXBlocks,LTXImage2VideoBlocks * Update test to use LTXAutoBlocks * workflow map and auto docstring * Add LTXVideoPachifier, workflow map --------- Co-authored-by: YiYi Xu <yixu310@gmail.com>
1 parent 87beae7 commit 5a9a941

13 files changed

Lines changed: 1996 additions & 0 deletions

src/diffusers/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,8 @@
455455
"HeliosPyramidDistilledAutoBlocks",
456456
"HeliosPyramidDistilledModularPipeline",
457457
"HeliosPyramidModularPipeline",
458+
"LTXAutoBlocks",
459+
"LTXModularPipeline",
458460
"QwenImageAutoBlocks",
459461
"QwenImageEditAutoBlocks",
460462
"QwenImageEditModularPipeline",
@@ -1234,6 +1236,8 @@
12341236
HeliosPyramidDistilledAutoBlocks,
12351237
HeliosPyramidDistilledModularPipeline,
12361238
HeliosPyramidModularPipeline,
1239+
LTXAutoBlocks,
1240+
LTXModularPipeline,
12371241
QwenImageAutoBlocks,
12381242
QwenImageEditAutoBlocks,
12391243
QwenImageEditModularPipeline,

src/diffusers/modular_pipelines/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@
8888
"QwenImageLayeredModularPipeline",
8989
"QwenImageLayeredAutoBlocks",
9090
]
91+
_import_structure["ltx"] = [
92+
"LTXAutoBlocks",
93+
"LTXModularPipeline",
94+
]
9195
_import_structure["z_image"] = [
9296
"ZImageAutoBlocks",
9397
"ZImageModularPipeline",
@@ -119,6 +123,7 @@
119123
HeliosPyramidDistilledModularPipeline,
120124
HeliosPyramidModularPipeline,
121125
)
126+
from .ltx import LTXAutoBlocks, LTXModularPipeline
122127
from .modular_pipeline import (
123128
AutoPipelineBlocks,
124129
BlockState,
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
from typing import TYPE_CHECKING
2+
3+
from ...utils import (
4+
DIFFUSERS_SLOW_IMPORT,
5+
OptionalDependencyNotAvailable,
6+
_LazyModule,
7+
get_objects_from_module,
8+
is_torch_available,
9+
is_transformers_available,
10+
)
11+
12+
13+
_dummy_objects = {}
14+
_import_structure = {}
15+
16+
try:
17+
if not (is_transformers_available() and is_torch_available()):
18+
raise OptionalDependencyNotAvailable()
19+
except OptionalDependencyNotAvailable:
20+
from ...utils import dummy_torch_and_transformers_objects # noqa F403
21+
22+
_dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
23+
else:
24+
_import_structure["modular_blocks_ltx"] = ["LTXAutoBlocks", "LTXBlocks", "LTXImage2VideoBlocks"]
25+
_import_structure["modular_pipeline"] = ["LTXModularPipeline"]
26+
27+
if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
28+
try:
29+
if not (is_transformers_available() and is_torch_available()):
30+
raise OptionalDependencyNotAvailable()
31+
except OptionalDependencyNotAvailable:
32+
from ...utils.dummy_torch_and_transformers_objects import * # noqa F403
33+
else:
34+
from .modular_blocks_ltx import LTXAutoBlocks, LTXBlocks, LTXImage2VideoBlocks
35+
from .modular_pipeline import LTXModularPipeline
36+
else:
37+
import sys
38+
39+
sys.modules[__name__] = _LazyModule(
40+
__name__,
41+
globals()["__file__"],
42+
_import_structure,
43+
module_spec=__spec__,
44+
)
45+
46+
for name, value in _dummy_objects.items():
47+
setattr(sys.modules[__name__], name, value)

0 commit comments

Comments
 (0)