-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Replace layer choice with selected module after applied fixed architecture #2420
Conversation
""" | ||
if module is None: | ||
module = self.model | ||
for name, mutable in module.named_children(): |
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 not use the util function to traverse here?
Seems because setting module by full name is not trival.
global_name = (prefix + "." if prefix else "") + name | ||
if isinstance(mutable, LayerChoice): | ||
chosen = self._fixed_arc[mutable.key] | ||
if sum(chosen) == 1 and max(chosen) == 1 and not mutable.return_mask: |
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.
what is the meaning of not mutable.return_mask
?
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.
If true, layer choice will return the choice vector. If we replace the layer choice module with the selected module, choice vector will be no longer available, and users’ code will crash.
please update doc at proper place. |
docs/en_US/NAS/NasGuide.md
Outdated
@@ -176,7 +176,7 @@ For example, | |||
} | |||
``` | |||
|
|||
After applying, the model is then fixed and ready for final training. The model works as a single model, although it might contain more parameters than expected. This comes with pros and cons. The good side is, you can directly load the checkpoint dumped from supernet during the search phase and start retraining from there. However, this is also a model with redundant parameters and this may cause problems when trying to count the number of parameters in the model. For deeper reasons and possible workarounds, see [Trainers](./NasReference.md). | |||
After applying, the model is then fixed and ready for final training. The model works as a single model, and unused parameters and modules will be pruned. |
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.
"will be" -> "are"
This should solve the problem #2401 is trying to solve.