Skip to content

πŸ§ͺ Add tests #2355

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

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions src/anomalib/engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,10 @@ def export(
--input_size "[256,256]" --compression_type INT8_PTQ --data MVTec
```
"""
if self.task == TaskType.EXPLANATION:
logging.error("Exporting explanation models is not supported.")
return None

export_type = ExportType(export_type)
self._setup_trainer(model)
if ckpt_path:
Expand Down
8 changes: 8 additions & 0 deletions tests/integration/model/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# SPDX-License-Identifier: Apache-2.0

from pathlib import Path
from unittest.mock import MagicMock

import pytest

Expand Down Expand Up @@ -181,6 +182,8 @@ def _get_objects(
task_type = TaskType.DETECTION
elif model_name in {"ganomaly", "dfkde"}:
task_type = TaskType.CLASSIFICATION
elif model_name == "vlm_ad":
task_type = TaskType.EXPLANATION
else:
task_type = TaskType.SEGMENTATION

Expand Down Expand Up @@ -209,6 +212,11 @@ def _get_objects(
)

model = get_model(model_name, **extra_args)

if model_name == "vlm_ad":
model.vlm_backend = MagicMock()
model.vlm_backend.predict.return_value = "YES: Because reasons..."

engine = Engine(
logger=False,
default_root_dir=project_path,
Expand Down
Loading