Skip to content

Commit

Permalink
Fix pre-commit issues
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianboguszewski committed Dec 15, 2023
1 parent 27d4b6c commit 042a352
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Changed

- Changed default inference device to AUTO in https://github.com/openvinotoolkit/anomalib/pull/1534

### Deprecated

- Support only Python 3.10 and greater in https://github.com/openvinotoolkit/anomalib/pull/1299
Expand Down
2 changes: 1 addition & 1 deletion src/anomalib/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def train(self) -> Callable[..., _EVALUATE_OUTPUT]:
return self.engine.train

@property
def export(self) -> Callable[..., None]:
def export(self) -> Callable[..., Path | None]:
"""Export the model using engine's export method."""
return self.engine.export

Expand Down
7 changes: 4 additions & 3 deletions src/anomalib/deploy/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def export_to_torch(
Albumentations.
task (TaskType | None): Task type should be provided if transforms is of type dict or A.Compose object.
Defaults to ``None``.
Returns:
Path: Path to the exported pytorch model.
Expand Down Expand Up @@ -245,9 +246,9 @@ def export_to_openvino(
model = convert_model(model_path, **ov_args)
serialize(model, ov_model_path)
return ov_model_path
else:
logger.exception("Could not find OpenVINO methods. Please check OpenVINO installation.")
raise ModuleNotFoundError

logger.exception("Could not find OpenVINO methods. Please check OpenVINO installation.")
raise ModuleNotFoundError


def get_metadata(
Expand Down
11 changes: 6 additions & 5 deletions src/anomalib/engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def export(
input_size: tuple[int, int] | None = None,
ov_args: dict[str, Any] | None = None,
ckpt_path: str | None = None,
) -> Path:
) -> Path | None:
"""Export the model in the specified format.
Args:
Expand Down Expand Up @@ -517,7 +517,7 @@ def export(

if export_mode == ExportMode.TORCH:
return export_to_torch(model=model, export_path=export_path, transform=transform, task=self.task)
elif export_mode == ExportMode.ONNX:
if export_mode == ExportMode.ONNX:
assert input_size is not None, "input_size must be provided for ONNX export mode."
return export_to_onnx(
model=model,
Expand All @@ -526,7 +526,7 @@ def export(
transform=transform,
task=self.task,
)
elif export_mode == ExportMode.OPENVINO:
if export_mode == ExportMode.OPENVINO:
assert input_size is not None, "input_size must be provided for OpenVINO export mode."
return export_to_openvino(
model=model,
Expand All @@ -536,5 +536,6 @@ def export(
task=self.task,
ov_args=ov_args,
)
else:
logging.error(f"Export mode {export_mode} is not supported yet.")

logging.error(f"Export mode {export_mode} is not supported yet.")
return None

0 comments on commit 042a352

Please sign in to comment.