mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-09 11:32:07 +08:00
Backward compatibility for checkpoint loading (#1132)
* check if hparams_type exists in checkpoint dictionary for backward compatibility * concisely maintain backward compatibility for hparams type * Bug fix in checkpoint loading (#1132)
This commit is contained in:
@@ -29,6 +29,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
||||
### Fixed
|
||||
|
||||
- Fixed bug related to type cheking of `ReduceLROnPlateau` lr schedulers([#1114](https://github.com/PyTorchLightning/pytorch-lightning/issues/1114))
|
||||
- Fixed a bug to ensure lightning checkpoints to be backward compatible ([#1132](https://github.com/PyTorchLightning/pytorch-lightning/pull/1132))
|
||||
|
||||
## [0.7.1] - 2020-03-07
|
||||
|
||||
|
||||
@@ -1396,7 +1396,7 @@ class LightningModule(ABC, GradInformation, ModelIO, ModelHooks):
|
||||
|
||||
if cls_takes_hparams:
|
||||
if ckpt_hparams is not None:
|
||||
is_namespace = checkpoint.get('hparams_type') == 'namespace'
|
||||
is_namespace = checkpoint.get('hparams_type', 'namespace') == 'namespace'
|
||||
hparams = Namespace(**ckpt_hparams) if is_namespace else ckpt_hparams
|
||||
else:
|
||||
warnings.warn(
|
||||
|
||||
Reference in New Issue
Block a user