Hi,
I have a problem with loading a saved model with torch.load. When debugging, it showed that it has problems here: (in /py3env/lib/python3.5/site-packages/torch/nn/modules/module.py, lines 666-671) I am using the BiDAF model from ([https://github.com/galsang/BiDAF-pytorch 1]):
for key, input_param in state_dict.items():
                if key.startswith(prefix):
                    input_name = key[len(prefix):]
                    input_name = input_name.split('.', 1)[0]  # get the name of param/buffer/child
                    if input_name not in self._modules and input_name not in local_state:
                        unexpected_keys.append(key)
...

Last good iteration: key[len(prefix):] = ‘word_emb.weight’ --> input_name = word_emb
Bad iteration:  key[len(prefix):] = u’highway_linear0.0.linear.weight’   --> input_name = u’highway_linear0
and the next checking is bad: u’highway_linear0 not in self._modules returns True
(I checked, “highway_linear0’” not in self._modules returns False)
The output of the program is:
…
File “/home/py3env/lib/python3.5/site-packages/torch/nn/modules/module.py”, line 669, in _load_from_state_dict
input_name = input_name.split(’.’, 1)[0]  # get the name of param/buffer/child
File “/home/py3env/lib/python3.5/site-packages/ww/wrappers/strings.py”, line 359, in split
chunks = multisplit(self, *separators, **kwargs)  # type: Iterable[str]
File “/home/py3env/lib/python3.5/site-packages/ww/tools/strings.py”, line 152, in multisplit
“”".format(sep, i, type(sep)))
TypeError:
‘1’, the separator at index ‘1’, is of type ‘<class ‘int’>’.
multisplit() only accepts unicode strings.
So I guess the u’…’ convention caused the problem.
I’m using Python 3.5.2, PyTorch 0.4.1
Could you help me to solve this problem? Thank you very much in advance.