facebookresearch / InferSent

InferSent sentence embeddings
Other
2.28k stars 470 forks source link

Incompatibility with SentEval #60

Closed Deltaus closed 6 years ago

Deltaus commented 6 years ago

When using evaluate_model.py in encoder, I got: /usr/local/lib/python2.7/dist-packages/torch/serialization.py:367: SourceChangeWarning: source code of class 'models.BLSTMEncoder' has changed. you can retrieve the original source code by accessing the object's source attribute or set torch.nn.Module.dump_patches = True and use the patch tool to revert the changes. warnings.warn(msg, SourceChangeWarning) /usr/local/lib/python2.7/dist-packages/torch/serialization.py:367: SourceChangeWarning: source code of class 'torch.nn.modules.rnn.LSTM' has changed. you can retrieve the original source code by accessing the object's source attribute or set torch.nn.Module.dump_patches = True and use the patch tool to revert the changes. warnings.warn(msg, SourceChangeWarning) Traceback (most recent call last): File "evaluate_model.py", line 72, in se = senteval.SentEval(params_senteval, batcher, prepare) AttributeError: 'module' object has no attribute 'SentEval'

And if I use infersent.py in SentEval's examples folder, when I use the infersent.allnli.pickle provided, it can run, but if I use the pickle file that I trained with this latest version of InferSent, it reports: Traceback (most recent call last): File "infersent.py", line 57, in params_senteval['infersent'] = torch.load(INFERSENT_PATH) File "/usr/local/lib/python2.7/dist-packages/torch/serialization.py", line 303, in load return _load(f, map_location, pickle_module) File "/usr/local/lib/python2.7/dist-packages/torch/serialization.py", line 469, in _load result = unpickler.load() AttributeError: 'module' object has no attribute 'NLINet'

Thanks!

aconneau commented 6 years ago

Hi, the two issues should have been fixed by 14b7ebb01d9186e9130330deb720367ce67bb9f4 and f49af4f75ca5d1e41aa898152e2c507aa94a2894 . We removed the evaluate_model.py from Infersent, so the infersent.py in SentEval should be used instead (https://github.com/facebookresearch/SentEval/blob/master/examples/infersent.py). Note that we made several modifications in the way the model is loaded, which should make things easier. Best, Alexis

aconneau commented 6 years ago

Please re-open if you still have these issues