Skip to content

🔨Update imports causing import warnings #2698

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

Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ One key advantage of Anomalib's post-processor design is that it becomes part of
```python
from anomalib.models import Patchcore
from anomalib.post_processing import PostProcessor
from openvino.runtime import Core
from openvino import Core
import numpy as np

# Training: Post-processor is part of the model
Expand Down
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ core = [
"lightning>=2.2",
"torch>=2",
"torchmetrics>=1.3.2",
# NOTE: open-clip-torch throws the following error on v2.26.1
# torch.onnx.errors.UnsupportedOperatorError: Exporting the operator
# 'aten::_native_multi_head_attention' to ONNX opset version 14 is not supported
"open-clip-torch>=2.23.0,<2.26.1",
"open-clip-torch>=2.32.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think vlm model was broken when we installed >2.32.0. @ashwinvaidya17, can you confirm?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is where the tests fail when we use a newer clip version

FAILED tests/integration/model/test_models.py::TestAPI::test_export[onnx-win_clip] - torch.onnx.errors.UnsupportedOperatorError: Exporting the operator 'aten::_native_multi_head_attention' to ONNX opset version 14 is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub: https://github.com/pytorch/pytorch/issues.
FAILED tests/integration/model/test_models.py::TestAPI::test_export[openvino-win_clip] - torch.onnx.errors.UnsupportedOperatorError: Exporting the operator 'aten::_native_multi_head_attention' to ONNX opset version 14 is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub: https://github.com/pytorch/pytorch/issues.
===== 2 failed, 182 passed, 16 skipped, 972 warnings in 1506.18s (0:25:06) =====

"fvcore",
]
openvino = ["openvino>=2024.0", "nncf>=2.10.0", "onnx>=1.16.0"]
Expand Down
2 changes: 1 addition & 1 deletion src/anomalib/deploy/inferencers/openvino_inferencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
import numpy as np
import torch
from lightning_utilities.core.imports import module_available
from openvino.runtime.utils.data_helpers.wrappers import OVDict
from openvino.utils.data_helpers.wrappers import OVDict
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can see OVDict is only used for annotation. Maybe we could have the import something like this

if TYPE_CHECKING:
    from openvino.utils.data_helpers.wrappers import OVDict

....

def post_process(predictions: "OVDict") -> dict:

from PIL.Image import Image as PILImage

from anomalib.data import NumpyImageBatch
Expand Down
1 change: 1 addition & 0 deletions src/anomalib/models/components/base/export_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def to_onnx(
dynamic_axes=dynamic_axes,
input_names=["input"],
output_names=output_names,
dynamo=True,
)

return onnx_path
Expand Down
Loading