Allow tvmc to compile models with AOT executor in MLF#8331
Allow tvmc to compile models with AOT executor in MLF#8331leandron merged 3 commits intoapache:mainfrom
Conversation
gromero
left a comment
There was a problem hiding this comment.
Hi @Mousius . Thanks for adding these AOT bits to tvmc.
Please see my comments inline
I really liked your commit message and I get happy when I see that format instead of the "bullet format", like adding the comment about shlex etc. Thank you. The only thing I missed is that you actually added an important change in TVMCPackage.import_package() which is the ability to distinguish Graph from AOT runtime based on graph, so it would be nice to mention it also in the commit message, I think :)
| if "graph" in metadata["runtimes"]: | ||
| graph = temp.relpath("runtime-config/graph/graph.json") | ||
| else: | ||
| graph = None |
There was a problem hiding this comment.
Nice. I just think a hint about AOT should exist here. How about adding a comment above graph = None, like "AOT runtime"?
There was a problem hiding this comment.
I'll use the code as docs rather than a comment and pop the condition in a variable:
is_graph_runtime = "graph" in metadata["runtimes"]
graph = temp.relpath("runtime-config/graph/graph.json") if is_graph_runtime else None
| @pytest.fixture(scope="session") | ||
| def tflite_compiled_model_mlf(tmpdir_factory): | ||
| @pytest.fixture | ||
| def tflite_tvmc_compiler(tmpdir_factory): |
There was a problem hiding this comment.
How about renaming the tflite_tvmc_compiler fixture to tflite_compile_model, just because I don't think that tvmc in there is informative. But no strong feelings about it. Feel free also to get more input from Leandro before sending a v2.
There was a problem hiding this comment.
Also, this is in the tvmc conftest so context makes more sense 😸 good call!
|
|
||
|
|
||
| def test_tvmc_import_package_mlf(tflite_compiled_model_mlf): | ||
| def test_tvmc_import_package_mlf(tflite_mobilenet_v1_1_quant, tflite_tvmc_compiler): |
There was a problem hiding this comment.
I think we can rename test_tvmc_import_package_mlf to test_tvmc_import_package_mlf_graph.
| @@ -97,3 +104,27 @@ def test_tvmc_import_package_mlf(tflite_compiled_model_mlf): | |||
| assert tvmc_package.graph is not None, ".graph must be set in the MLF archive." | |||
There was a problem hiding this comment.
The error message must be adapted here, adding "[...] if not AOT". Maybe:
`".graph must be set in the MLF archive if not AOT runtime"
There was a problem hiding this comment.
Good call, I'll say "if Graph" to make it clear where the distinction is
The tflite_compiled_model fixture was getting duplicated a few times so I've added a parameterized fixture tflite_tvmc_compiler which combines tmpdir_factory setup with compile_model Nested targets broke a basic string split, so in cases where we use nested targets I replaced the string split with shlex split
Plus other clean ups
|
This is is failing in the latest version of this PR. I'm pasting the error below, to save a trip to Jenkins: Apart from that, LGTM. Happy to review/merge once we get CI working. |
|
Hopefully that should do it, thanks for your feedback @gromero 😸 |
* Allow tvmc to compile models with AOT executor The tflite_compiled_model fixture was getting duplicated a few times so I've added a parameterized fixture tflite_tvmc_compiler which combines tmpdir_factory setup with compile_model Nested targets broke a basic string split, so in cases where we use nested targets I replaced the string split with shlex split * Clarify that graph JSON is required only for graph executor Plus other clean ups * Change parametrize fixture to use string instead of list
* Allow tvmc to compile models with AOT executor The tflite_compiled_model fixture was getting duplicated a few times so I've added a parameterized fixture tflite_tvmc_compiler which combines tmpdir_factory setup with compile_model Nested targets broke a basic string split, so in cases where we use nested targets I replaced the string split with shlex split * Clarify that graph JSON is required only for graph executor Plus other clean ups * Change parametrize fixture to use string instead of list
* Allow tvmc to compile models with AOT executor The tflite_compiled_model fixture was getting duplicated a few times so I've added a parameterized fixture tflite_tvmc_compiler which combines tmpdir_factory setup with compile_model Nested targets broke a basic string split, so in cases where we use nested targets I replaced the string split with shlex split * Clarify that graph JSON is required only for graph executor Plus other clean ups * Change parametrize fixture to use string instead of list
The tflite_compiled_model fixture was getting duplicated a few times so I've added a parameterized fixture tflite_tvmc_compiler which combines tmpdir_factory setup with compile_model
Nested target params broke a basic string split, so in cases where we use nested target params I replaced the string split with shlex split