Skip to content

Commit

Permalink
Fix raising exception when the model in project dir is not a MLF
Browse files Browse the repository at this point in the history
Fix missing 'raise' when raising a TVMCException when the 'tvmc run'
finds a model in the project dir but its format is not a MLF, e.g. when
the model is compiled without `--output-format mlf` and the resulting
model is kept in the 'classic' archive format.

This also tries to enhance a bit the message when the exception happens.
  • Loading branch information
gromero committed Oct 22, 2021
1 parent 0e21e63 commit 8f6f6f6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/tvm/driver/tvmc/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,8 @@ def drive_run(args):
path = path / "model.tar"
if not path.is_file():
TVMCException(
f"Could not find MLF {path} in the specified project dir {path.dirname()}."
f"Could not find model (model.tar) in the specified project dir {path.dirname()}."
)
else:
print("MLF found, using micro target runner.")

# Check for options unavailable for micro targets.

Expand All @@ -197,6 +195,8 @@ def drive_run(args):
if args.profile:
raise TVMCException("--profile is not supported for micro targets.")

# Get and check options for micro targets.

options = get_options(args.project_option)
check_options(options, args.valid_options)
check_options_choices(options, args.valid_options)
Expand Down Expand Up @@ -463,7 +463,7 @@ def run_module(
micro = False
if device == "micro":
if tvmc_package.type != "mlf":
TVMCException("--device 'micro' specified but no MLF archive found in PATH.")
raise TVMCException(f"Model {tvmc_package.package_path} is not a MLF archive.")

micro = True
project_dir = os.path.dirname(tvmc_package.package_path)
Expand Down

0 comments on commit 8f6f6f6

Please sign in to comment.