mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-10 12:21:57 +08:00
Change lightning module params to dict when loading (#1639)
* change module params to dict * tiny change * reverse
This commit is contained in:
@@ -1550,8 +1550,9 @@ class LightningModule(ABC, GradInformation, ModelIO, ModelHooks):
|
||||
)
|
||||
|
||||
# load the state_dict on the model automatically
|
||||
model_args = [hparams] if hparams else []
|
||||
model = cls(*model_args, *args, **kwargs)
|
||||
if hparams:
|
||||
kwargs.update(hparams=hparams)
|
||||
model = cls(*args, **kwargs)
|
||||
model.load_state_dict(checkpoint['state_dict'])
|
||||
|
||||
# give model a chance to load something
|
||||
|
||||
Reference in New Issue
Block a user