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

[1.6.x] Fix export precision #3394

Merged
merged 1 commit into from
Apr 25, 2024
Merged
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
6 changes: 4 additions & 2 deletions src/otx/algorithms/classification/adapters/mmcls/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,10 @@ def _export_model(self, precision: ModelPrecision, export_format: ExportType, du
output_names.append("saliency_map")
export_options["model_builder"] = getattr(self, "model_builder", build_classifier)

if precision == ModelPrecision.FP16:
export_options["deploy_cfg"]["backend_config"]["mo_options"]["flags"].append("--compress_to_fp16")
if self._precision[0] == ModelPrecision.FP16:
export_options["deploy_cfg"]["backend_config"]["mo_options"]["flags"].append("--compress_to_fp16=True")
else:
export_options["deploy_cfg"]["backend_config"]["mo_options"]["flags"].append("--compress_to_fp16=False")

backend_cfg_backup = {}
if export_format == ExportType.ONNX:
Expand Down
4 changes: 3 additions & 1 deletion src/otx/algorithms/detection/adapters/mmdet/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,9 @@ def _export_model(
export_options["model_builder"] = getattr(self, "model_builder", build_detector)

if self._precision[0] == ModelPrecision.FP16:
export_options["deploy_cfg"]["backend_config"]["mo_options"]["flags"].append("--compress_to_fp16")
export_options["deploy_cfg"]["backend_config"]["mo_options"]["flags"].append("--compress_to_fp16=True")
else:
export_options["deploy_cfg"]["backend_config"]["mo_options"]["flags"].append("--compress_to_fp16=False")

backend_cfg_backup = {}
if export_format == ExportType.ONNX:
Expand Down
4 changes: 3 additions & 1 deletion src/otx/algorithms/segmentation/adapters/mmseg/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,9 @@
export_options["model_builder"] = getattr(self, "model_builder", build_segmentor)

if self._precision[0] == ModelPrecision.FP16:
export_options["deploy_cfg"]["backend_config"]["mo_options"]["flags"].append("--compress_to_fp16")
export_options["deploy_cfg"]["backend_config"]["mo_options"]["flags"].append("--compress_to_fp16=True")

Check warning on line 448 in src/otx/algorithms/segmentation/adapters/mmseg/task.py

View check run for this annotation

Codecov / codecov/patch

src/otx/algorithms/segmentation/adapters/mmseg/task.py#L448

Added line #L448 was not covered by tests
else:
export_options["deploy_cfg"]["backend_config"]["mo_options"]["flags"].append("--compress_to_fp16=False")

Check warning on line 450 in src/otx/algorithms/segmentation/adapters/mmseg/task.py

View check run for this annotation

Codecov / codecov/patch

src/otx/algorithms/segmentation/adapters/mmseg/task.py#L450

Added line #L450 was not covered by tests

backend_cfg_backup = {}
if export_format == ExportType.ONNX:
Expand Down
Loading