Skip to content

Commit 6b42ef8

Browse files
committed
OpenCV dummy objects
1 parent d1387ec commit 6b42ef8

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

src/diffusers/__init__.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@
352352
"CogView3PlusPipeline",
353353
"CogView4ControlPipeline",
354354
"CogView4Pipeline",
355-
"ConsisIDPipeline",
356355
"CycleDiffusionPipeline",
357356
"EasyAnimateControlPipeline",
358357
"EasyAnimateInpaintPipeline",
@@ -518,6 +517,25 @@
518517
]
519518
)
520519

520+
521+
try:
522+
if not (is_torch_available() and is_transformers_available()):
523+
raise OptionalDependencyNotAvailable()
524+
except OptionalDependencyNotAvailable:
525+
from .utils import dummy_torch_and_transformers_and_opencv_objects # noqa F403
526+
527+
_import_structure["utils.dummy_torch_and_transformers_and_opencv_objects"] = [
528+
name for name in dir(dummy_torch_and_transformers_and_opencv_objects) if not name.startswith("_")
529+
]
530+
531+
else:
532+
_import_structure["pipelines"].extend(
533+
[
534+
"ConsisIDPipeline",
535+
]
536+
)
537+
538+
521539
try:
522540
if not (is_torch_available() and is_transformers_available() and is_k_diffusion_available()):
523541
raise OptionalDependencyNotAvailable()

src/diffusers/pipelines/consisid/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,30 @@
88
is_torch_available,
99
is_transformers_available,
1010
)
11+
from ...utils.import_utils import is_opencv_available
1112

1213

1314
_dummy_objects = {}
1415
_import_structure = {}
1516

1617

1718
try:
18-
if not (is_transformers_available() and is_torch_available()):
19+
if not (is_transformers_available() and is_torch_available() and is_opencv_available()):
1920
raise OptionalDependencyNotAvailable()
2021
except OptionalDependencyNotAvailable:
21-
from ...utils import dummy_torch_and_transformers_objects # noqa F403
22+
from ...utils import dummy_torch_and_transformers_and_opencv_objects # noqa F403
2223

23-
_dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
24+
_dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_and_opencv_objects))
2425
else:
2526
_import_structure["pipeline_consisid"] = ["ConsisIDPipeline"]
2627

2728
if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
2829
try:
29-
if not (is_transformers_available() and is_torch_available()):
30+
if not (is_transformers_available() and is_torch_available() and is_opencv_available()):
3031
raise OptionalDependencyNotAvailable()
3132

3233
except OptionalDependencyNotAvailable:
33-
from ...utils.dummy_torch_and_transformers_objects import *
34+
from ...utils.dummy_torch_and_transformers_and_opencv_objects import *
3435
else:
3536
from .pipeline_consisid import ConsisIDPipeline
3637

src/diffusers/utils/dummy_torch_and_transformers_and_opencv_objects.py

Whitespace-only changes.

0 commit comments

Comments
 (0)