Skip to content

Commit

Permalink
Override model during conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
jkosek committed Jun 21, 2023
1 parent 801e3b5 commit 15cbace
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ limitations under the License.

## 0.5.6
- fix: Load samples as sorted to keep valid order
- fix: Execute conversion when model already exists in path
- Other minor fixes and improvements

[//]: <> (put here on external component update with short summary what change or link to changelog)
Expand Down
3 changes: 0 additions & 3 deletions model_navigator/commands/convert/onnx/onnx2trt.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ def _run(

input_model_path = workspace / parent_path
converted_model_path = workspace / path
if converted_model_path.exists():
LOGGER.info("Model already exists. Skipping conversion.")
return CommandOutput(status=CommandStatus.SKIPPED)

if not input_model_path.exists():
LOGGER.warning(f"Exported ONNX model not found at {input_model_path}. Skipping conversion.")
Expand Down
7 changes: 1 addition & 6 deletions model_navigator/commands/convert/tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ def _run(
exported_model_path = workspace / parent_path
converted_model_path = workspace / path
converted_model_path.parent.mkdir(parents=True, exist_ok=True)
if converted_model_path.exists():
LOGGER.info("Model already exists. Skipping conversion.")
return CommandOutput(status=CommandStatus.SKIPPED)

if not exported_model_path.exists():
LOGGER.warning(f"Exported SavedModel model not found at {exported_model_path}. Skipping conversion")
return CommandOutput(status=CommandStatus.SKIPPED)
Expand Down Expand Up @@ -132,9 +130,6 @@ def _run(
converted_model_path = workspace / path
converted_model_path.parent.mkdir(parents=True, exist_ok=True)

if converted_model_path.exists():
LOGGER.info("Model already exists. Skipping conversion.")
return CommandOutput(status=CommandStatus.SKIPPED)
if not exported_model_path.exists():
LOGGER.warning(f"Exported SavedModel model not found at {exported_model_path}. Skipping conversion")
return CommandOutput(status=CommandStatus.SKIPPED)
Expand Down
10 changes: 2 additions & 8 deletions model_navigator/commands/convert/torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ def _run(
LOGGER.info("TorchScript to ONNX conversion started")
exported_model_path = workspace / parent_path
converted_model_path = workspace / path
if converted_model_path.exists():
LOGGER.info("Model already exists. Skipping export.")
return CommandOutput(status=CommandStatus.SKIPPED)

converted_model_path.parent.mkdir(parents=True, exist_ok=True)

with ExecutionContext(
Expand Down Expand Up @@ -120,7 +116,7 @@ def _run(
) -> CommandOutput:
"""Run Torchscript ot Torch-TensorRT conversion.
For detaild explenation of TensorRT parameters please refer to [documentation]
For detailed explanation of TensorRT parameters please refer to [documentation]
[documentation]: https://pytorch.org/TensorRT/
Args:
Expand Down Expand Up @@ -154,9 +150,7 @@ def _run(
raise RuntimeError("No GPUs available.")
exported_model_path = workspace / parent_path
converted_model_path = workspace / path
if converted_model_path.exists():
LOGGER.info("Model already exists. Skipping conversion.")
return CommandOutput(status=CommandStatus.SKIPPED)

if not exported_model_path.exists():
LOGGER.warning(f"Exported TorchScript model not found at {exported_model_path}. Skipping conversion.")
return CommandOutput(status=CommandStatus.SKIPPED)
Expand Down

0 comments on commit 15cbace

Please sign in to comment.