codedecde / Recognizing-Textual-Entailment

A pyTorch implementation of models used for Recognizing Textual Entailment using the SNLI corpus
MIT License
33 stars 11 forks source link

AttributeError: 'Lang' object has no attribute 'ix2word' #1

Open pouryas7 opened 6 years ago

pouryas7 commented 6 years ago

Hi,

I am trying to run the code on SICK dataset. I don't know what I should put for vocab.pkl.

BTW, I put a similar file in data folder. Now, I am facing with following error:

Traceback (most recent call last):
  File "run_rte.py", line 124, in <module>
    rte_model = RTE(l_en, options)
  File "/home/pourya/Programs/NLP/Recognizing-Textual-Entailment-master/rte_model.py", line 26, in __init__
    self.embedding = nn.Embedding(len(l_en) + 1, self.n_embed).type(dtype)
  File "/home/pourya/Programs/NLP/Recognizing-Textual-Entailment-master/Lang.py", line 66, in __len__
    assert len(self.ix2word) == len(self.word2ix), "Index not built using generate_vocab and add_word"
AttributeError: 'Lang' object has no attribute 'ix2word'

I don't know how to solve this issue

Thanks.

codedecde commented 6 years ago

The model expects a Lang class object. Essentially, it a two way dictionary between words <-> integer ix. You can take a look at the Lang.py file for constructing one. The data format for RTE is

\t \t