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


anton-l's avatar
anton-l committed
11
__version__ = "0.4.0.dev0"
Patrick von Platen's avatar
Patrick von Platen committed
12

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


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
41
else:
42
    from .utils.dummy_pt_objects import *  # noqa F403
Patrick von Platen's avatar
Patrick von Platen committed
43

44
45
46
47
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
48

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

59
if is_torch_available() and is_transformers_available() and is_onnx_available():
60
61
    from .pipelines import StableDiffusionOnnxPipeline
else:
62
    from .utils.dummy_torch_and_transformers_and_onnx_objects import *  # noqa F403