load_from_checkpoint(): hparam_overrides only works with hparams_file
🐛 Bug
Using the hparam_overrides argument for load_from_checkpoint() without the hparams_file argument gives an UnboundLocalError.
To Reproduce
Code sample
Do:
MyLightningModule.load_from_checkpoint(ckpt_path, hparam_overrides={'param': 0})
and the result will be UnboundLocalError: local variable 'hparams' referenced before assignment, but the following works:
MyLightningModule.load_from_checkpoint(ckpt_path, hparams_file=hp_path, hparam_overrides={'param': 0})
Expected behavior
Overriding should be possible even if the hparams are loaded from the checkpoint file rather than the separate hparams file.
Environment

PyTorch Version (e.g., 1.0): 1.5.0
OS (e.g., Linux): Ubuntu 16.04 and 18.04
How you installed PyTorch (conda, pip, source): pip
Python version: 3.8.2
CUDA/cuDNN version: 10.1.243/7.6.5.32
GPU models and configuration: GTX1070

Additional context
This is a super simple fix---I thought about just submitting a PR directly but figured I should check that this behaviour is indeed erroneous first.