| 
 | 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 | +_additional_imports = {}  | 
 | 15 | +#_import_structure = {"pipeline_output": ["FluxPipelineOutput", "FluxPriorReduxPipelineOutput"]}  | 
 | 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_bria"] = ["BriaPipeline"]  | 
 | 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 | +    except OptionalDependencyNotAvailable:  | 
 | 32 | +        from ...utils.dummy_torch_and_transformers_objects import *  # noqa F403  | 
 | 33 | +    else:  | 
 | 34 | +        from .pipeline_bria import BriaPipeline  | 
 | 35 | +else:  | 
 | 36 | +    import sys  | 
 | 37 | + | 
 | 38 | +    sys.modules[__name__] = _LazyModule(  | 
 | 39 | +        __name__,  | 
 | 40 | +        globals()["__file__"],  | 
 | 41 | +        _import_structure,  | 
 | 42 | +        module_spec=__spec__,  | 
 | 43 | +    )  | 
 | 44 | + | 
 | 45 | +    for name, value in _dummy_objects.items():  | 
 | 46 | +        setattr(sys.modules[__name__], name, value)  | 
 | 47 | +    for name, value in _additional_imports.items():  | 
 | 48 | +        setattr(sys.modules[__name__], name, value)  | 
0 commit comments