Skip to content

Commit

Permalink
Correct tests and revert patch for model utils
Browse files Browse the repository at this point in the history
Signed-off-by: smajumdar <titu1994@gmail.com>
  • Loading branch information
titu1994 committed Jun 11, 2021
1 parent 9283119 commit ae79518
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions nemo/utils/model_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,6 @@ def _convert_config(cfg: OmegaConf):
if 'cls' in cfg and '_target_' not in cfg:
cfg._target_ = cfg.pop('cls')

# Get rid of target -> _target_.
if 'target' in cfg and '_target_' not in cfg:
cfg._target_ = cfg.pop('target')

# Get rid of params.
if 'params' in cfg:
params = cfg.pop('params')
Expand Down
4 changes: 2 additions & 2 deletions tests/core/test_optimizers_schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def test_optim_config_parse_arg_by_name(self):
@pytest.mark.unit
def test_optim_config_parse_arg_by_target(self):
basic_optim_config = {
'target': 'nemo.core.config.NovogradParams',
'_target_': 'nemo.core.config.NovogradParams',
'params': {'weight_decay': 0.001, 'betas': [0.8, 0.5]},
}
basic_optim_config = omegaconf.OmegaConf.create(basic_optim_config)
Expand Down Expand Up @@ -256,7 +256,7 @@ def test_sched_config_parse_from_cls(self):
opt = opt_cls(model.parameters(), lr=self.INITIAL_LR)

basic_sched_config = {
'target': 'nemo.core.config.CosineAnnealingParams',
'_target_': 'nemo.core.config.CosineAnnealingParams',
'params': {'min_lr': 0.1},
'max_steps': self.MAX_STEPS,
}
Expand Down

0 comments on commit ae79518

Please sign in to comment.