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

[TVMC] run: Don't use static path to find model.tar #9712

Merged
merged 2 commits into from
Dec 13, 2021

Conversation

gromero
Copy link
Contributor

@gromero gromero commented Dec 10, 2021

Currently tvmc run can't run Arduino models because model.tar is never found:

$ tvmc run --device micro /tmp/arduino_sine --project-option arduino_board=due --print-top 6 --fill-mode zeros
Error: File /tmp/arduino_sine/model.tar does not exist.

This happens because Arduino doesn't store model.tar in <project_dir>/model.tar like Zephyr.

If this change is applied the MLF path used is taken as returned by the Project API, so tvmc run now works for both Zephyr and Arduino and any future platforms:

$ tvmc run --device micro /tmp/arduino_sine --project-option arduino_board=due --print-top 6 --fill-mode zeros
[[0.        ]
 [0.03384194]]

Currently 'tvmc run' when '--device micro' is specified looks for the
model in the project directory at <project_dir>/model.tar. That works
for Zephyr but fails on Arduino because model.tar is actually located at
<project_dir>/src/model/model.tar. As a consequence 'tvmc run' when used
to run a model on Arduino exists because model.tar is never found.

This commit fixes it by using the MLF path returned by the Project API
instead of using a static path.

This commit also adds a project_dir attribute to TVMCPackage that can be
set when a MLF archive is loaded/imported so the project dir can be
conveniently found (similarly to package_path attribute).

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
Add test for TVMCPackage when importing a MLF archive and setting a
project directory too. Setting a project dir is only supported when a
MLF model is imported, so it must fail on Classic format.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
@gromero
Copy link
Contributor Author

gromero commented Dec 10, 2021

cc for reviews @jwfromm (since it touches TVMCPackage), @guberti (because Arduino) and @areusch @leandron @mehrdadh

Copy link
Contributor

@leandron leandron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for this fix @gromero!

@leandron leandron merged commit 6efade6 into apache:main Dec 13, 2021
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 7, 2022
* [TVMC] run: Don't use static path to find model.tar

Currently 'tvmc run' when '--device micro' is specified looks for the
model in the project directory at <project_dir>/model.tar. That works
for Zephyr but fails on Arduino because model.tar is actually located at
<project_dir>/src/model/model.tar. As a consequence 'tvmc run' when used
to run a model on Arduino exists because model.tar is never found.

This commit fixes it by using the MLF path returned by the Project API
instead of using a static path.

This commit also adds a project_dir attribute to TVMCPackage that can be
set when a MLF archive is loaded/imported so the project dir can be
conveniently found (similarly to package_path attribute).

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>

* [TVMC] test: Add test for importing a MLF with project_dir

Add test for TVMCPackage when importing a MLF archive and setting a
project directory too. Setting a project dir is only supported when a
MLF model is imported, so it must fail on Classic format.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
yangulei pushed a commit to yangulei/tvm that referenced this pull request Jan 11, 2022
* [TVMC] run: Don't use static path to find model.tar

Currently 'tvmc run' when '--device micro' is specified looks for the
model in the project directory at <project_dir>/model.tar. That works
for Zephyr but fails on Arduino because model.tar is actually located at
<project_dir>/src/model/model.tar. As a consequence 'tvmc run' when used
to run a model on Arduino exists because model.tar is never found.

This commit fixes it by using the MLF path returned by the Project API
instead of using a static path.

This commit also adds a project_dir attribute to TVMCPackage that can be
set when a MLF archive is loaded/imported so the project dir can be
conveniently found (similarly to package_path attribute).

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>

* [TVMC] test: Add test for importing a MLF with project_dir

Add test for TVMCPackage when importing a MLF archive and setting a
project directory too. Setting a project dir is only supported when a
MLF model is imported, so it must fail on Classic format.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
yangulei pushed a commit to yangulei/tvm that referenced this pull request Jan 12, 2022
* [TVMC] run: Don't use static path to find model.tar

Currently 'tvmc run' when '--device micro' is specified looks for the
model in the project directory at <project_dir>/model.tar. That works
for Zephyr but fails on Arduino because model.tar is actually located at
<project_dir>/src/model/model.tar. As a consequence 'tvmc run' when used
to run a model on Arduino exists because model.tar is never found.

This commit fixes it by using the MLF path returned by the Project API
instead of using a static path.

This commit also adds a project_dir attribute to TVMCPackage that can be
set when a MLF archive is loaded/imported so the project dir can be
conveniently found (similarly to package_path attribute).

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>

* [TVMC] test: Add test for importing a MLF with project_dir

Add test for TVMCPackage when importing a MLF archive and setting a
project directory too. Setting a project dir is only supported when a
MLF model is imported, so it must fail on Classic format.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* [TVMC] run: Don't use static path to find model.tar

Currently 'tvmc run' when '--device micro' is specified looks for the
model in the project directory at <project_dir>/model.tar. That works
for Zephyr but fails on Arduino because model.tar is actually located at
<project_dir>/src/model/model.tar. As a consequence 'tvmc run' when used
to run a model on Arduino exists because model.tar is never found.

This commit fixes it by using the MLF path returned by the Project API
instead of using a static path.

This commit also adds a project_dir attribute to TVMCPackage that can be
set when a MLF archive is loaded/imported so the project dir can be
conveniently found (similarly to package_path attribute).

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>

* [TVMC] test: Add test for importing a MLF with project_dir

Add test for TVMCPackage when importing a MLF archive and setting a
project directory too. Setting a project dir is only supported when a
MLF model is imported, so it must fail on Classic format.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
qsqqsqqsq-intellif pushed a commit to qsqqsqqsq-intellif/tvm that referenced this pull request Apr 29, 2022
* [TVMC] run: Don't use static path to find model.tar

Currently 'tvmc run' when '--device micro' is specified looks for the
model in the project directory at <project_dir>/model.tar. That works
for Zephyr but fails on Arduino because model.tar is actually located at
<project_dir>/src/model/model.tar. As a consequence 'tvmc run' when used
to run a model on Arduino exists because model.tar is never found.

This commit fixes it by using the MLF path returned by the Project API
instead of using a static path.

This commit also adds a project_dir attribute to TVMCPackage that can be
set when a MLF archive is loaded/imported so the project dir can be
conveniently found (similarly to package_path attribute).

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>

* [TVMC] test: Add test for importing a MLF with project_dir

Add test for TVMCPackage when importing a MLF archive and setting a
project directory too. Setting a project dir is only supported when a
MLF model is imported, so it must fail on Classic format.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants