Open happypanda5 opened 5 years ago
@aconneau please help
Could you try to "git pull" once again and see if you still obtain this error?
@aconneau
Same error.
"""InferSent attempt 4 (redo Facebook).ipynb
I get an error with this
IncompatibleKeys(missing_keys=[], unexpected_keys=[]) """
import os
!git clone https://github.com/facebookresearch/InferSent --quiet
os.mkdir('GloVe') !curl -Lo GloVe/glove.840B.300d.zip http://nlp.stanford.edu/data/glove.840B.300d.zip !unzip GloVe/glove.840B.300d.zip -d GloVe/
os.mkdir('fastText') !curl -Lo fastText/crawl-300d-2M.vec.zip https://dl.fbaipublicfiles.com/fasttext/vectors-english/crawl-300d-2M.vec.zip !unzip fastText/crawl-300d-2M.vec.zip -d fastText/
os.mkdir('encoder') !curl -Lo encoder/infersent1.pkl https://dl.fbaipublicfiles.com/infersent/infersent1.pkl !curl -Lo encoder/infersent2.pkl https://dl.fbaipublicfiles.com/infersent/infersent2.pkl
import nltk nltk.download('punkt')
import torch
from InferSent.models import InferSent V = 2 MODEL_PATH = 'encoder/infersent%s.pkl' % V params_model = {'bsize': 64, 'word_emb_dim': 300, 'enc_lstm_dim': 2048, 'pool_type': 'max', 'dpout_model': 0.0, 'version': V} infersent = InferSent(params_model) infersent.load_state_dict(torch.load(MODEL_PATH))
os.chdir('/content/InferSent')
I am not able to reproduce your error. What you sent in the above message is the code of the ipython notebook but not the full error message.
I am getting the following error:
RuntimeError: Error(s) in loading state_dict for NLINet: Missing key(s) in state_dict: "encoder.enc_lstm.weight_ih_l0", "encoder.enc_lstm.weight_hh_l0", "encoder.enc_lstm.bias_ih_l0", "encoder.enc_lstm.bias_hh_l0", "encoder.enc_lstm.weight_ih_l0_reverse", "encoder.enc_lstm.weight_hh_l0_reverse", "encoder.enc_lstm.bias_ih_l0_reverse", "encoder.enc_lstm.bias_hh_l0_reverse", "classifier.1.weight", "classifier.1.bias", "classifier.4.weight", "classifier.4.bias", "classifier.7.weight", "classifier.7.bias". Unexpected key(s) in state_dict: "enc_lstm.weight_ih_l0", "enc_lstm.weight_hh_l0", "enc_lstm.bias_ih_l0", "enc_lstm.bias_hh_l0", "enc_lstm.weight_ih_l0_reverse", "enc_lstm.weight_hh_l0_reverse", "enc_lstm.bias_ih_l0_reverse", "enc_lstm.bias_hh_l0_reverse".
I am trying to run the demo file available with InferSent on Google Colab but while doing so, in particular, the line
model.load_state_dict(torch.load(MODEL_PATH))
, I get the following errorI run the same demo file without change. Can you help me regarding this error?