Skip to content

Commit b3889ea

Browse files
Add modular pipeline for HunyuanVideo 1.5 (#13389)
* Add modular pipeline support for HunyuanVideo 1.5 * Fix I2V latent/cond spatial dimension mismatch * Fix guidance_scale default to 7.5 matching ClassifierFreeGuidance * Fix tokenizer type: use Qwen2TokenizerFast to match model * Fix system message string formatting to match standard pipeline * Rewrite HunyuanVideo 1.5 modular: use standard pipeline methods directly * Remove I2V exports (T2V only for now) * Fix encoder: use static methods directly instead of encode_prompt * Inline all standard pipeline methods, remove runtime dependency * Add HunyuanVideo 1.5 image-to-video modular blocks * Fix missing FrozenDict import in before_denoise.py * auto-generated docstrings via #auto_docstring * Fix ruff lint and format issues * use InputParam/OutputParam templates and fix ruff * Address LTX review feedback here like add AutoBlocks, refactor I2V latents, lift encoders * Add workflow map, workflow tests, auto docstrings, export only AutoBlocks * Address Claude CI review * Address claude CI review 2 --------- Co-authored-by: YiYi Xu <yixu310@gmail.com>
1 parent e0c1ec4 commit b3889ea

13 files changed

Lines changed: 2036 additions & 0 deletions

File tree

src/diffusers/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,8 @@
458458
"HeliosPyramidDistilledAutoBlocks",
459459
"HeliosPyramidDistilledModularPipeline",
460460
"HeliosPyramidModularPipeline",
461+
"HunyuanVideo15AutoBlocks",
462+
"HunyuanVideo15ModularPipeline",
461463
"LTXAutoBlocks",
462464
"LTXModularPipeline",
463465
"QwenImageAutoBlocks",
@@ -1244,6 +1246,8 @@
12441246
HeliosPyramidDistilledAutoBlocks,
12451247
HeliosPyramidDistilledModularPipeline,
12461248
HeliosPyramidModularPipeline,
1249+
HunyuanVideo15AutoBlocks,
1250+
HunyuanVideo15ModularPipeline,
12471251
LTXAutoBlocks,
12481252
LTXModularPipeline,
12491253
QwenImageAutoBlocks,

src/diffusers/modular_pipelines/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@
8888
"QwenImageLayeredModularPipeline",
8989
"QwenImageLayeredAutoBlocks",
9090
]
91+
_import_structure["hunyuan_video1_5"] = [
92+
"HunyuanVideo15AutoBlocks",
93+
"HunyuanVideo15ModularPipeline",
94+
]
9195
_import_structure["ltx"] = [
9296
"LTXAutoBlocks",
9397
"LTXModularPipeline",
@@ -123,6 +127,10 @@
123127
HeliosPyramidDistilledModularPipeline,
124128
HeliosPyramidModularPipeline,
125129
)
130+
from .hunyuan_video1_5 import (
131+
HunyuanVideo15AutoBlocks,
132+
HunyuanVideo15ModularPipeline,
133+
)
126134
from .ltx import LTXAutoBlocks, LTXModularPipeline
127135
from .modular_pipeline import (
128136
AutoPipelineBlocks,
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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_hunyuan_video1_5"] = [
25+
"HunyuanVideo15AutoBlocks",
26+
]
27+
_import_structure["modular_pipeline"] = ["HunyuanVideo15ModularPipeline"]
28+
29+
if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
30+
try:
31+
if not (is_transformers_available() and is_torch_available()):
32+
raise OptionalDependencyNotAvailable()
33+
except OptionalDependencyNotAvailable:
34+
from ...utils.dummy_torch_and_transformers_objects import * # noqa F403
35+
else:
36+
from .modular_blocks_hunyuan_video1_5 import HunyuanVideo15AutoBlocks
37+
from .modular_pipeline import HunyuanVideo15ModularPipeline
38+
else:
39+
import sys
40+
41+
sys.modules[__name__] = _LazyModule(
42+
__name__,
43+
globals()["__file__"],
44+
_import_structure,
45+
module_spec=__spec__,
46+
)
47+
48+
for name, value in _dummy_objects.items():
49+
setattr(sys.modules[__name__], name, value)

0 commit comments

Comments
 (0)