__init__.py 3.99 KB
Newer Older
Patrick von Platen's avatar
Patrick von Platen committed
1
# Copyright 2023 The HuggingFace Team. All rights reserved.
2
3
4
5
6
7
8
9
10
11
12
13
14
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

15
16
from typing import TYPE_CHECKING

Suraj Patil's avatar
Suraj Patil committed
17
18
19
20
21
22
from ..utils import (
    DIFFUSERS_SLOW_IMPORT,
    _LazyModule,
    is_flax_available,
    is_torch_available,
)
23
24


Dhruv Nair's avatar
Dhruv Nair committed
25
26
_import_structure = {}

27
if is_torch_available():
Dhruv Nair's avatar
Dhruv Nair committed
28
29
30
    _import_structure["adapter"] = ["MultiAdapter", "T2IAdapter"]
    _import_structure["autoencoder_asym_kl"] = ["AsymmetricAutoencoderKL"]
    _import_structure["autoencoder_kl"] = ["AutoencoderKL"]
Suraj Patil's avatar
Suraj Patil committed
31
    _import_structure["autoencoder_kl_temporal_decoder"] = ["AutoencoderKLTemporalDecoder"]
Dhruv Nair's avatar
Dhruv Nair committed
32
    _import_structure["autoencoder_tiny"] = ["AutoencoderTiny"]
Will Berman's avatar
Will Berman committed
33
    _import_structure["consistency_decoder_vae"] = ["ConsistencyDecoderVAE"]
Dhruv Nair's avatar
Dhruv Nair committed
34
35
36
37
38
39
40
41
42
43
44
    _import_structure["controlnet"] = ["ControlNetModel"]
    _import_structure["dual_transformer_2d"] = ["DualTransformer2DModel"]
    _import_structure["modeling_utils"] = ["ModelMixin"]
    _import_structure["prior_transformer"] = ["PriorTransformer"]
    _import_structure["t5_film_transformer"] = ["T5FilmDecoder"]
    _import_structure["transformer_2d"] = ["Transformer2DModel"]
    _import_structure["transformer_temporal"] = ["TransformerTemporalModel"]
    _import_structure["unet_1d"] = ["UNet1DModel"]
    _import_structure["unet_2d"] = ["UNet2DModel"]
    _import_structure["unet_2d_condition"] = ["UNet2DConditionModel"]
    _import_structure["unet_3d_condition"] = ["UNet3DConditionModel"]
45
    _import_structure["unet_kandinsky3"] = ["Kandinsky3UNet"]
Dhruv Nair's avatar
Dhruv Nair committed
46
    _import_structure["unet_motion_model"] = ["MotionAdapter", "UNetMotionModel"]
Suraj Patil's avatar
Suraj Patil committed
47
    _import_structure["unet_spatio_temporal_condition"] = ["UNetSpatioTemporalConditionModel"]
Dhruv Nair's avatar
Dhruv Nair committed
48
    _import_structure["vq_model"] = ["VQModel"]
49
50

if is_flax_available():
Dhruv Nair's avatar
Dhruv Nair committed
51
52
53
54
55
    _import_structure["controlnet_flax"] = ["FlaxControlNetModel"]
    _import_structure["unet_2d_condition_flax"] = ["FlaxUNet2DConditionModel"]
    _import_structure["vae_flax"] = ["FlaxAutoencoderKL"]


56
if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
57
58
59
60
    if is_torch_available():
        from .adapter import MultiAdapter, T2IAdapter
        from .autoencoder_asym_kl import AsymmetricAutoencoderKL
        from .autoencoder_kl import AutoencoderKL
Suraj Patil's avatar
Suraj Patil committed
61
        from .autoencoder_kl_temporal_decoder import AutoencoderKLTemporalDecoder
62
        from .autoencoder_tiny import AutoencoderTiny
Will Berman's avatar
Will Berman committed
63
        from .consistency_decoder_vae import ConsistencyDecoderVAE
64
65
66
67
68
69
70
71
72
73
74
        from .controlnet import ControlNetModel
        from .dual_transformer_2d import DualTransformer2DModel
        from .modeling_utils import ModelMixin
        from .prior_transformer import PriorTransformer
        from .t5_film_transformer import T5FilmDecoder
        from .transformer_2d import Transformer2DModel
        from .transformer_temporal import TransformerTemporalModel
        from .unet_1d import UNet1DModel
        from .unet_2d import UNet2DModel
        from .unet_2d_condition import UNet2DConditionModel
        from .unet_3d_condition import UNet3DConditionModel
75
        from .unet_kandinsky3 import Kandinsky3UNet
Dhruv Nair's avatar
Dhruv Nair committed
76
        from .unet_motion_model import MotionAdapter, UNetMotionModel
Suraj Patil's avatar
Suraj Patil committed
77
        from .unet_spatio_temporal_condition import UNetSpatioTemporalConditionModel
78
79
80
81
82
83
84
85
86
        from .vq_model import VQModel

    if is_flax_available():
        from .controlnet_flax import FlaxControlNetModel
        from .unet_2d_condition_flax import FlaxUNet2DConditionModel
        from .vae_flax import FlaxAutoencoderKL

else:
    import sys
Dhruv Nair's avatar
Dhruv Nair committed
87

88
    sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)