-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[DO NOT SQUASH] Support nn-Meter in Retiarii framework #3938
Conversation
* 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>
@@ -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): |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
nni/retiarii/converter/graph_gen.py
Outdated
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): |
There was a problem hiding this comment.
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'): |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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). |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
No description provided.