__init__.py 2.72 KB
Newer Older
1
from .utils import (
2
    is_flax_available,
3
4
5
    is_inflect_available,
    is_onnx_available,
    is_scipy_available,
6
    is_torch_available,
7
8
9
    is_transformers_available,
    is_unidecode_available,
)
Patrick von Platen's avatar
Patrick von Platen committed
10
11


Anton Lozhkov's avatar
Anton Lozhkov committed
12
__version__ = "0.6.0.dev0"
Patrick von Platen's avatar
Patrick von Platen committed
13

Patrick von Platen's avatar
Patrick von Platen committed
14
from .configuration_utils import ConfigMixin
15
from .onnx_utils import OnnxRuntimeModel
Patrick von Platen's avatar
Patrick von Platen committed
16
from .utils import logging
17
18


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
if is_torch_available():
    from .modeling_utils import ModelMixin
    from .models import AutoencoderKL, UNet2DConditionModel, UNet2DModel, VQModel
    from .optimization import (
        get_constant_schedule,
        get_constant_schedule_with_warmup,
        get_cosine_schedule_with_warmup,
        get_cosine_with_hard_restarts_schedule_with_warmup,
        get_linear_schedule_with_warmup,
        get_polynomial_decay_schedule_with_warmup,
        get_scheduler,
    )
    from .pipeline_utils import DiffusionPipeline
    from .pipelines import DDIMPipeline, DDPMPipeline, KarrasVePipeline, LDMPipeline, PNDMPipeline, ScoreSdeVePipeline
    from .schedulers import (
        DDIMScheduler,
        DDPMScheduler,
        KarrasVeScheduler,
        PNDMScheduler,
        SchedulerMixin,
        ScoreSdeVeScheduler,
    )
    from .training_utils import EMAModel
42
else:
43
    from .utils.dummy_pt_objects import *  # noqa F403
Patrick von Platen's avatar
Patrick von Platen committed
44

45
46
47
48
if is_torch_available() and is_scipy_available():
    from .schedulers import LMSDiscreteScheduler
else:
    from .utils.dummy_torch_and_scipy_objects import *  # noqa F403
Patrick von Platen's avatar
Patrick von Platen committed
49

50
if is_torch_available() and is_transformers_available():
51
52
53
54
55
56
    from .pipelines import (
        LDMTextToImagePipeline,
        StableDiffusionImg2ImgPipeline,
        StableDiffusionInpaintPipeline,
        StableDiffusionPipeline,
    )
Patrick von Platen's avatar
Patrick von Platen committed
57
else:
58
    from .utils.dummy_torch_and_transformers_objects import *  # noqa F403
59

60
if is_torch_available() and is_transformers_available() and is_onnx_available():
61
    from .pipelines import OnnxStableDiffusionPipeline, StableDiffusionOnnxPipeline
62
else:
63
    from .utils.dummy_torch_and_transformers_and_onnx_objects import *  # noqa F403
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

if is_flax_available():
    from .modeling_flax_utils import FlaxModelMixin
    from .models.unet_2d_condition_flax import FlaxUNet2DConditionModel
    from .models.vae_flax import FlaxAutoencoderKL
    from .pipeline_flax_utils import FlaxDiffusionPipeline
    from .schedulers import (
        FlaxDDIMScheduler,
        FlaxDDPMScheduler,
        FlaxKarrasVeScheduler,
        FlaxLMSDiscreteScheduler,
        FlaxPNDMScheduler,
        FlaxSchedulerMixin,
        FlaxScoreSdeVeScheduler,
    )
else:
    from .utils.dummy_flax_objects import *  # noqa F403

if is_flax_available() and is_transformers_available():
    from .pipelines import FlaxStableDiffusionPipeline
else:
    from .utils.dummy_flax_and_transformers_objects import *  # noqa F403