Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

[DO NOT SQUASH] Support nn-Meter in Retiarii framework #3938

Merged
merged 5 commits into from
Jul 27, 2021
Merged

Conversation

ultmaster
Copy link
Contributor

No description provided.

@ultmaster ultmaster changed the title [DO NOT SQUASH] Support nn-meter in Retiarii framework [DO NOT SQUASH] Support nn-Meter in Retiarii framework Jul 14, 2021
kaleid-liner and others added 2 commits July 15, 2021 16:01
* Fix mutable default

* LayerChoice:forward now will default run the first candidate to support trace (#3910)

* New GraphConverter to parse shape info required by nn-meter (#3910)

* Support model filter in Random strategy

* Support latency aware search in SPOS multi-trial example

* Fix for review (#3910)

* Add doc for hardware-aware NAS

* Fix lint python & Add nn_meter to sphinx mock

* Add comments

* Move LatencyFilter to examples

* Move example inputs into configs

* Support nested layer choice

Co-authored-by: Jianyu Wei <v-wjiany@microsoft.com>
Co-authored-by: kalineid <nnob@mail.ustc.edu.cn>
Co-authored-by: Yuge Zhang <scottyugochang@gmail.com>
Co-authored-by: Yuge Zhang <Yuge.Zhang@microsoft.com>
@ultmaster ultmaster marked this pull request as ready for review July 20, 2021 06:24
@@ -654,8 +644,214 @@ def convert_module(self, script_module, module, module_name, ir_model):

return ir_graph, {}

def convert_module(self, script_module, module, module_name, ir_model):
Copy link
Contributor

Choose a reason for hiding this comment

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

why we need both convert_module and _convert_module?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

_convert_module is exposed to subclass to overwrite internal logic.

If forward path of candidates depends on input data, then wrong path will be traced.
This will result in incomplete shape info.
"""
def convert_module(self, script_module, module, module_name, ir_model, example_inputs):
Copy link
Contributor

Choose a reason for hiding this comment

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

example_inputs -> dummy_input?

self._trace_module(module, module_name, ir_model, example_inputs)
return ir_graph, attrs

def _initialize_parameters(self, ir_model: 'Model'):
Copy link
Contributor

Choose a reason for hiding this comment

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

is this a common use case of type hints?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so. It's used "everywhere" in Retiarii.


Basically, this demo will select the model whose latency satisfy constraints to train.

To run this demo, first install nn-Meter from source code (currently we haven't released this package, so development installation is required).
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we give a link to nn-Meter here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure. My suggestion is that you can do that later when you actually have nn-Meter open sourced.

@ultmaster ultmaster merged commit 08fe292 into master Jul 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants