Had slightly different error:
RuntimeError Traceback (most recent call last)
~/anaconda2/envs/fastai1/lib/python3.6/site-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict)
481 try:
–> 482 own_state[name].copy_(param)
483 except Exception:
RuntimeError: invalid argument 2: sizes do not match at /opt/conda/conda-bld/pytorch_1512387374934/work/torch/lib/THC/generic/THCTensorCopy.c:51
During handling of the above exception, another exception occurred:
RuntimeError Traceback (most recent call last)
in ()
----> 1 learner.load(‘imdb_adam3_c1_cl10_cyc_0’)
~/fastai/courses/dl1/fastai/learner.py in load(self, name)
62 def get_model_path(self, name): return os.path.join(self.models_path,name)+’.h5’
63 def save(self, name): save_model(self.model, self.get_model_path(name))
—> 64 def load(self, name): load_model(self.model, self.get_model_path(name))
65
66 def set_data(self, data): self.data_ = data
~/fastai/courses/dl1/fastai/torch_imports.py in load_model(m, p)
24 def children(m): return m if isinstance(m, (list, tuple)) else list(m.children())
25 def save_model(m, p): torch.save(m.state_dict(), p)
—> 26 def load_model(m, p): m.load_state_dict(torch.load(p, map_location=lambda storage, loc: storage))
27
28 def load_pre(pre, f, fn):
~/anaconda2/envs/fastai1/lib/python3.6/site-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict)
485 'whose dimensions in the model are {} and '
486 ‘whose dimensions in the checkpoint are {}.’
–> 487 .format(name, own_state[name].size(), param.size()))
488 elif strict:
489 raise KeyError(‘unexpected key “{}” in state_dict’
RuntimeError: While copying the parameter named 0.encoder.weight, whose dimensions in the model are torch.Size([34933, 200]) and whose dimensions in the checkpoint are torch.Size([34945, 200]).