diff --git a/model_zoo/research/nlp/textrcnn/requirements.txt b/model_zoo/research/nlp/textrcnn/requirements.txt new file mode 100644 index 00000000000..1efa59af564 --- /dev/null +++ b/model_zoo/research/nlp/textrcnn/requirements.txt @@ -0,0 +1 @@ +gensim==4.0.1 diff --git a/model_zoo/research/nlp/textrcnn/src/dataset.py b/model_zoo/research/nlp/textrcnn/src/dataset.py index 57921736367..15850eb216e 100644 --- a/model_zoo/research/nlp/textrcnn/src/dataset.py +++ b/model_zoo/research/nlp/textrcnn/src/dataset.py @@ -84,13 +84,13 @@ def collect_weight(glove_path, vocab, word_to_idx, embed_size): idx_to_word = {i + 1: word for i, word in enumerate(vocab)} idx_to_word[0] = '' - for i in range(len(wvmodel.index2word)): + for i in range(len(wvmodel.index_to_key)): try: - index = word_to_idx[wvmodel.index2word[i]] + index = word_to_idx[wvmodel.index_to_key[i]] except KeyError: continue weight_np[index, :] = wvmodel.get_vector( - idx_to_word[word_to_idx[wvmodel.index2word[i]]]) + idx_to_word[word_to_idx[wvmodel.index_to_key[i]]]) return weight_np