Skip to content

Commit c033276

Browse files
Support passing setup_kwargs to DynamicModule.convert() (#577)
## What does this PR do? **Type of change:** Implementation improvement <!-- Use one of the following: Bug fix, new feature, new example, new tests, documentation. --> For Minitron, currently we define hparams in DynamicModule._setup() and then overwrite it with hparams from other layers so they share the same reference (e.g. hidden_size hparam from embedding should be used throughout the model). Instead, allowing kwargs in _setup and passing them from DMRegistry.convert() will make the code more intuitive and less error-prone ## Testing - No functionality change, only implementation improvement - We have thorough CICD tests already that are passing after this change ## Before your PR is "*Ready for review*" <!-- If you haven't finished some of the above items you can still open `Draft` PR. --> - **Make sure you read and follow [Contributor guidelines](https://github.com/NVIDIA/TensorRT-Model-Optimizer/blob/main/CONTRIBUTING.md)** and your commits are signed. - **Is this change backward compatible?**: Yes <!--- If No, explain why. --> - **Did you write any new necessary tests?**: No - **Did you add or update any necessary documentation?**: No - **Did you update [Changelog](https://github.com/NVIDIA/TensorRT-Model-Optimizer/blob/main/CHANGELOG.rst)?**: No <!--- Only for new features, API changes, critical bug fixes or bw breaking changes. --> --------- Signed-off-by: Keval Morabia <[email protected]>
1 parent e35db17 commit c033276

File tree

5 files changed

+128
-171
lines changed

5 files changed

+128
-171
lines changed

modelopt/torch/nas/hparams/concat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def active(self) -> int:
121121
active += hp.active
122122
return active
123123

124-
@active.setter # type: ignore[override]
124+
@active.setter
125125
def active(self, val: int | None):
126126
"""Set the active value with a sanity check for choices and dynamic hparams."""
127127
val = self.original if val is None else val

0 commit comments

Comments
 (0)