You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to save a trained model, then re-load the saved state so I can apply the model to new data, I get a size mismatch error for the noise in the dropout layer.
I can reproduce the error in your example of fitting a sine function in the sin_x.ipynb notebook. Start from the end of that notebook and do the following:
This will reproduce the error, which should look like this:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-16-0537a1e1603f> in <module>()
----> 1 model2.load_state_dict(torch.load('bnn_model.pth'))
/opt/anaconda36/lib/python3.6/site-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict)
717 if len(error_msgs) > 0:
718 raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
--> 719 self.__class__.__name__, "\n\t".join(error_msgs)))
720
721 def parameters(self):
RuntimeError: Error(s) in loading state_dict for BSequential:
size mismatch for drop_0.noise: copying a param of torch.Size([]) from checkpoint, where the shape is torch.Size([100, 100, 200]) in current model.
size mismatch for drop_1.noise: copying a param of torch.Size([]) from checkpoint, where the shape is torch.Size([100, 100, 200]) in current model.
Is there an alternative method for re-loading a saved model state?
The text was updated successfully, but these errors were encountered:
When I try to save a trained model, then re-load the saved state so I can apply the model to new data, I get a size mismatch error for the noise in the dropout layer.
I can reproduce the error in your example of fitting a sine function in the sin_x.ipynb notebook. Start from the end of that notebook and do the following:
This will reproduce the error, which should look like this:
Is there an alternative method for re-loading a saved model state?
The text was updated successfully, but these errors were encountered: