Skip to content

Commit

Permalink
concisely maintain backward compatibility for hparams type
Browse files Browse the repository at this point in the history
  • Loading branch information
amoudgl committed Mar 17, 2020
1 parent 13874b3 commit 65c9f84
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions pytorch_lightning/core/lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -1396,9 +1396,7 @@ def _load_model_state(cls, checkpoint: Dict[str, Any]) -> 'LightningModule':

if cls_takes_hparams:
if ckpt_hparams is not None:
is_namespace = False
if 'hparams_type' not in checkpoint or checkpoint.get('hparams_type') == 'namespace':
is_namespace = True
is_namespace = checkpoint.get('hparams_type', 'namespace') == 'namespace'
hparams = Namespace(**ckpt_hparams) if is_namespace else ckpt_hparams
else:
warnings.warn(
Expand Down

0 comments on commit 65c9f84

Please sign in to comment.