guberti commented on code in PR #12495:
URL: https://github.com/apache/tvm/pull/12495#discussion_r966087664
##########
python/tvm/micro/session.py:
##########
@@ -275,25 +279,44 @@ def compile_and_create_micro_session(
project_options: dict
Options for the microTVM API Server contained in template_project_dir.
- """
- temp_dir = utils.tempdir()
- # Keep temp directory for generate project
- temp_dir.set_keep_for_debug(True)
- model_library_format_path = temp_dir / "model.tar.gz"
- with open(model_library_format_path, "wb") as mlf_f:
- mlf_f.write(mod_src_bytes)
+ project_dir: str
+ if use_existing is False: The path to save the generated microTVM
Project.
+ if use_existing is True: The path to a generated microTVM Project for
debugging.
- try:
- template_project =
project.TemplateProject.from_directory(template_project_dir)
- generated_project = template_project.generate_project_from_mlf(
- model_library_format_path,
- str(temp_dir / "generated-project"),
+ use_existing: bool
+ skips the project generation and opens transport to the project at the
project_dir address.
+ """
+
+ if use_existing:
+ project_dir = pathlib.Path(project_dir)
+ assert pathlib.Path(project_dir).is_dir(), f"{project_dir} does not
exist."
Review Comment:
No need to call `pathlib.Path` twice.
```suggestion
assert project_dir.is_dir(), f"{project_dir} does not exist."
```
##########
python/tvm/micro/build.py:
##########
@@ -120,18 +120,35 @@ class AutoTvmModuleLoader:
project_options : dict
project generation option
+
+ project_dir: str
+ if use_existing is False: The path to save the generated microTVM
Project.
+ if use_existing is True: The path to a generated microTVM Project for
debugging.
+
+ use_existing: bool
+ skips the project generation and opens transport to the project at the
project_dir address.
"""
def __init__(
- self, template_project_dir: Union[pathlib.Path, str], project_options:
dict = None
+ self,
+ template_project_dir: Union[pathlib.Path, str],
+ project_options: dict = None,
+ project_dir: Union[pathlib.Path, str] = None,
Review Comment:
Nit: the [Python
docs](https://docs.python.org/3/library/os.html#os.PathLike) suggest using
`os.PathLike` for typechecking, which is the abstract base class for
`pathlib.Path`.
```suggestion
template_project_dir: Union[os.PathLike, str],
project_options: dict = None,
project_dir: Union[os.PathLike, str] = None,
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]