Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐞Modify the import structure of models that don't rely on core requirements. #2408

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/anomalib/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from importlib import import_module

from jsonargparse import Namespace
from lightning_utilities.core.imports import module_available
from omegaconf import DictConfig, OmegaConf

from anomalib.models.components import AnomalyModule
Expand All @@ -30,7 +31,6 @@
Rkde,
Stfpm,
Uflow,
VlmAd,
WinClip,
)
from .video import AiVad
Expand Down Expand Up @@ -58,11 +58,16 @@ class UnknownModelError(ModuleNotFoundError):
"Rkde",
"Stfpm",
"Uflow",
"VlmAd",
"WinClip",
"AiVad",
]

if module_available("anomalib.models.image.vlm_ad"):
from .image import VlmAd

__all__.append("VlmAd")


logger = logging.getLogger(__name__)


Expand Down
9 changes: 7 additions & 2 deletions src/anomalib/models/image/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Copyright (C) 2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from lightning_utilities.core.imports import module_available

from .cfa import Cfa
from .cflow import Cflow
from .csflow import Csflow
Expand All @@ -20,7 +22,6 @@
from .rkde import Rkde
from .stfpm import Stfpm
from .uflow import Uflow
from .vlm_ad import VlmAd
from .winclip import WinClip

__all__ = [
Expand All @@ -41,6 +42,10 @@
"Rkde",
"Stfpm",
"Uflow",
"VlmAd",
"WinClip",
]

if module_available("anomalib.models.image.vlm_ad"):
from .vlm_ad import VlmAd

__all__.append("VlmAd")
Loading