[checkpoint logic] Fix bug which doesn't account for NoneType for `model.hparams` (#1817)
The intention of the code is to output a warning message when `hparams` is null or not set. Instead the code now fatals when `model.hparams = None`. Prevent that.
This commit is contained in:
parent
12138ced7c
commit
0e71705a0a
|
@ -342,7 +342,7 @@ class TrainerIOMixin(ABC):
|
|||
if self.use_amp and self.use_native_amp:
|
||||
checkpoint['native_amp_scaling_state'] = self.scaler.state_dict()
|
||||
|
||||
if hasattr(model, "hparams"):
|
||||
if hasattr(model, "hparams") and model.hparams is not None:
|
||||
parsing.clean_namespace(model.hparams)
|
||||
checkpoint['hparams_type'] = model.hparams.__class__.__name__
|
||||
if checkpoint['hparams_type'] == 'dict':
|
||||
|
|
Loading…
Reference in New Issue