Skip to content

Adds Img2Img2 Variant for HunyuanDiT. #9041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
18 changes: 11 additions & 7 deletions src/diffusers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
except OptionalDependencyNotAvailable:
from .utils import dummy_pt_objects # noqa F403

_import_structure["utils.dummy_pt_objects"] = [name for name in dir(dummy_pt_objects) if not name.startswith("_")]
_import_structure["utils.dummy_pt_objects"] = [name for name in dir(dummy_pt_objects) if not name.startswith("_")
]

else:
_import_structure["models"].extend(
Expand Down Expand Up @@ -204,8 +205,7 @@
except OptionalDependencyNotAvailable:
from .utils import dummy_torch_and_torchsde_objects # noqa F403

_import_structure["utils.dummy_torch_and_torchsde_objects"] = [
name for name in dir(dummy_torch_and_torchsde_objects) if not name.startswith("_")
_import_structure["utils.dummy_torch_and_torchsde_objects"] = [name for name in dir(dummy_torch_and_torchsde_objects) if not name.startswith("_")
]

else:
Expand All @@ -217,8 +217,7 @@
except OptionalDependencyNotAvailable:
from .utils import dummy_torch_and_transformers_objects # noqa F403

_import_structure["utils.dummy_torch_and_transformers_objects"] = [
name for name in dir(dummy_torch_and_transformers_objects) if not name.startswith("_")
_import_structure["utils.dummy_torch_and_transformers_objects"] = [name for name in dir(dummy_torch_and_transformers_objects) if not name.startswith("_")
]

else:
Expand All @@ -245,6 +244,7 @@
"CycleDiffusionPipeline",
"HunyuanDiTControlNetPipeline",
"HunyuanDiTPipeline",
"HunyuanDiTImg2ImgPipeline",
"I2VGenXLPipeline",
"IFImg2ImgPipeline",
"IFImg2ImgSuperResolutionPipeline",
Expand Down Expand Up @@ -362,7 +362,8 @@
)

try:
if not (is_torch_available() and is_transformers_available() and is_k_diffusion_available()):
if not (is_torch_available() and is_transformers_available() and is_k_diffusion_available()
):
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
from .utils import dummy_torch_and_transformers_and_k_diffusion_objects # noqa F403
Expand All @@ -372,7 +373,9 @@
]

else:
_import_structure["pipelines"].extend(["StableDiffusionKDiffusionPipeline", "StableDiffusionXLKDiffusionPipeline"])
_import_structure["pipelines"].extend(
["StableDiffusionKDiffusionPipeline", "StableDiffusionXLKDiffusionPipeline"]
)

try:
if not (is_torch_available() and is_transformers_available() and is_onnx_available()):
Expand Down Expand Up @@ -656,6 +659,7 @@
CLIPImageProjection,
CycleDiffusionPipeline,
HunyuanDiTControlNetPipeline,
HunyuanDiTImg2ImgPipeline,
HunyuanDiTPipeline,
I2VGenXLPipeline,
IFImg2ImgPipeline,
Expand Down
14 changes: 9 additions & 5 deletions src/diffusers/pipelines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"VersatileDiffusionTextToImagePipeline",
]
)
_import_structure["amused"] = ["AmusedImg2ImgPipeline", "AmusedInpaintPipeline", "AmusedPipeline"]
_import_structure["amused"] = ["AmusedImg2ImgPipeline","AmusedInpaintPipeline","AmusedPipeline"]
_import_structure["animatediff"] = [
"AnimateDiffPipeline",
"AnimateDiffSDXLPipeline",
Expand Down Expand Up @@ -173,7 +173,7 @@
"IFPipeline",
"IFSuperResolutionPipeline",
]
_import_structure["hunyuandit"] = ["HunyuanDiTPipeline"]
_import_structure["hunyuandit"] = ["HunyuanDiTPipeline","HunyuanDiTImg2ImgPipeline"]
_import_structure["kandinsky"] = [
"KandinskyCombinedPipeline",
"KandinskyImg2ImgCombinedPipeline",
Expand Down Expand Up @@ -327,14 +327,18 @@
)

try:
if not (is_torch_available() and is_transformers_available() and is_k_diffusion_available()):
if not (
is_torch_available() and is_transformers_available() and is_k_diffusion_available()
):
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
from ..utils import (
dummy_torch_and_transformers_and_k_diffusion_objects,
)

_dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_and_k_diffusion_objects))
_dummy_objects.update(
get_objects_from_module(dummy_torch_and_transformers_and_k_diffusion_objects)
)
else:
_import_structure["stable_diffusion_k_diffusion"] = [
"StableDiffusionKDiffusionPipeline",
Expand Down Expand Up @@ -463,7 +467,7 @@
VersatileDiffusionTextToImagePipeline,
VQDiffusionPipeline,
)
from .hunyuandit import HunyuanDiTPipeline
from .hunyuandit import HunyuanDiTImg2ImgPipeline, HunyuanDiTPipeline
from .i2vgen_xl import I2VGenXLPipeline
from .kandinsky import (
KandinskyCombinedPipeline,
Expand Down
2 changes: 2 additions & 0 deletions src/diffusers/pipelines/hunyuandit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
_dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
else:
_import_structure["pipeline_hunyuandit"] = ["HunyuanDiTPipeline"]
_import_structure["pipeline_hunyuandit_img2img"] = ["HunyuanDiTImg2ImgPipeline"]

if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
try:
Expand All @@ -33,6 +34,7 @@
from ...utils.dummy_torch_and_transformers_objects import *
else:
from .pipeline_hunyuandit import HunyuanDiTPipeline
from .pipeline_hunyuandit_img2img import HunyuanDiTImg2ImgPipeline

else:
import sys
Expand Down
Loading