Skip to content

Conversation

@leandron
Copy link
Contributor

@leandron leandron commented Sep 7, 2021

Add missing tvm.micro.project_api module file

  • The missing __init__.py makes it impossible to import tvm.micro.project_api, which is indirectly done in tvmc
  • It is more evident when using tlcpack as the module is not included in the package at all

cc @tqchen @areusch @gromero @manupa-arm @Mousius for reviews

@leandron
Copy link
Contributor Author

leandron commented Sep 7, 2021

Having this as a Python module now uncovered some 30-ish linter failures, I'm gonna fix them.

@gromero
Copy link
Contributor

gromero commented Sep 7, 2021

@areusch In general would an user (tvmc) import tvm.micro.project_api or import tvm.micro.project in order to create a new project using the Project API? I'm assuming the later form would be used. @leandron for the tvmc + micro targets work I'm doing https://github.com/gromero/tvm/blob/tvmc_micro_rb4/python/tvm/driver/tvmc/micro.py#L6 (project is already included in __init__.py of micro module) but you probably want it for a different use case?

@leandron
Copy link
Contributor Author

leandron commented Sep 7, 2021

@areusch In general would an user (tvmc) import tvm.micro.project_api or import tvm.micro.project in order to create a new project using the Project API? I'm assuming the later form would be used. @leandron for the tvmc + micro targets work I'm doing https://github.com/gromero/tvm/blob/tvmc_micro_rb4/python/tvm/driver/tvmc/micro.py#L6 (project is already included in __init__.py of micro module) but you probably want it for a different use case?

When using it from a packaged tvm, i.e. tlcpack... this is a very small reproducer, that explains the need for this to be a module:

>>> from tvm.micro import export_model_library_format
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/a/lib/python3.6/site-packages/tvm/micro/__init__.py", line 21, in <module>
    from .project import generate_project, GeneratedProject, TemplateProject
  File "/a/lib/python3.6/site-packages/tvm/micro/project.py", line 27, in <module>
    from .project_api import client
ModuleNotFoundError: No module named 'tvm.micro.project_api'
>>> 

@areusch
Copy link
Contributor

areusch commented Sep 7, 2021

uhhh weird how did that pass regression? very sorry about that! thanks for fixing the lint problems.

@gromero in general i'd expect most users to use tvm.micro.project, not tvm.micro.project_api.

@leandron
Copy link
Contributor Author

leandron commented Sep 7, 2021

uhhh weird how did that pass regression? very sorry about that! thanks for fixing the lint problems.

Probably because it uses a source tree to run the tests.

@leandron leandron requested a review from manupak as a code owner September 7, 2021 21:16
* Add missing tvm.micro.project_api module file. The missing
  __init__.py makes it impossible to import this module with
  `import tvm.micro.project_api`.

* This uncover 30-ish linting errors, which are also fixed here.
@leandron leandron closed this Sep 8, 2021
@leandron leandron deleted the project_api_module_file branch September 8, 2021 11:57
@leandron leandron restored the project_api_module_file branch September 8, 2021 11:57
@leandron leandron deleted the project_api_module_file branch September 8, 2021 11:57
@leandron leandron restored the project_api_module_file branch September 8, 2021 12:23
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.

3 participants