Skip to content

Commit 7e0311d

Browse files
committed
add import
1 parent 3287f4b commit 7e0311d

File tree

4 files changed

+67
-0
lines changed

4 files changed

+67
-0
lines changed

src/diffusers/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@
454454
"HunyuanDiTControlNetPipeline",
455455
"HunyuanDiTPAGPipeline",
456456
"HunyuanDiTPipeline",
457+
"HunyuanImagePipeline",
457458
"HunyuanSkyreelsImageToVideoPipeline",
458459
"HunyuanVideoFramepackPipeline",
459460
"HunyuanVideoImageToVideoPipeline",
@@ -1108,6 +1109,7 @@
11081109
HunyuanDiTControlNetPipeline,
11091110
HunyuanDiTPAGPipeline,
11101111
HunyuanDiTPipeline,
1112+
HunyuanImagePipeline,
11111113
HunyuanSkyreelsImageToVideoPipeline,
11121114
HunyuanVideoFramepackPipeline,
11131115
HunyuanVideoImageToVideoPipeline,

src/diffusers/pipelines/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@
240240
"HunyuanVideoImageToVideoPipeline",
241241
"HunyuanVideoFramepackPipeline",
242242
]
243+
_import_structure["hunyuan_image"] = ["HunyuanImagePipeline"]
243244
_import_structure["kandinsky"] = [
244245
"KandinskyCombinedPipeline",
245246
"KandinskyImg2ImgCombinedPipeline",
@@ -636,6 +637,7 @@
636637
ReduxImageEncoder,
637638
)
638639
from .hidream_image import HiDreamImagePipeline
640+
from .hunyuan_image import HunyuanImagePipeline
639641
from .hunyuan_video import (
640642
HunyuanSkyreelsImageToVideoPipeline,
641643
HunyuanVideoFramepackPipeline,
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
17+
try:
18+
if not (is_transformers_available() and is_torch_available()):
19+
raise OptionalDependencyNotAvailable()
20+
except OptionalDependencyNotAvailable:
21+
from ...utils import dummy_torch_and_transformers_objects # noqa F403
22+
23+
_dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
24+
else:
25+
_import_structure["pipeline_hunyuan_image"] = ["HunyuanImagePipeline"]
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+
32+
except OptionalDependencyNotAvailable:
33+
from ...utils.dummy_torch_and_transformers_objects import *
34+
else:
35+
from .pipeline_hunyuan_image import HunyuanImagePipeline
36+
37+
else:
38+
import sys
39+
40+
sys.modules[__name__] = _LazyModule(
41+
__name__,
42+
globals()["__file__"],
43+
_import_structure,
44+
module_spec=__spec__,
45+
)
46+
47+
for name, value in _dummy_objects.items():
48+
setattr(sys.modules[__name__], name, value)

src/diffusers/utils/dummy_torch_and_transformers_objects.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,21 @@ def from_pretrained(cls, *args, **kwargs):
977977
requires_backends(cls, ["torch", "transformers"])
978978

979979

980+
class HunyuanImagePipeline(metaclass=DummyObject):
981+
_backends = ["torch", "transformers"]
982+
983+
def __init__(self, *args, **kwargs):
984+
requires_backends(self, ["torch", "transformers"])
985+
986+
@classmethod
987+
def from_config(cls, *args, **kwargs):
988+
requires_backends(cls, ["torch", "transformers"])
989+
990+
@classmethod
991+
def from_pretrained(cls, *args, **kwargs):
992+
requires_backends(cls, ["torch", "transformers"])
993+
994+
980995
class HunyuanSkyreelsImageToVideoPipeline(metaclass=DummyObject):
981996
_backends = ["torch", "transformers"]
982997

0 commit comments

Comments
 (0)