Hi Chris,
I follow your instruction but I got a problem… I didn’t find any solution. I hope that you can help me.
So basically the code for me is like this :

w2v_model = gensim.models.Word2Vec.load(’./model/word2vec.model’)
w2v_weights = w2v_model.wv.vectors

so the weight is shape (81505,100 )
so I put my model like this :

class LSTM(nn.Module):
“”“docstring for LSTM”""
def init(self):
super(LSTM, self).init()
self.word_embeddings = nn.Embedding(81505, 100)
self.lstm = nn.LSTM(500, 300,2,bidirectional = True)
self.dropout = nn.Dropout(0.5)
self.dense = nn.Linear(200, 5)
self.act = nn.ReLU()
def forward(self,x):
text_emb = self.word_embeddings(x)
lstm_out, lstm_hidden = self.lstm(text_emb)
lstm_out = lstm_out[:,-1,:]
lstm_out = self.act(lstm_out)
drop_out = self.dropout(lstm_out)
output = self.dense(drop_out)
return output

But then after begin the training I got this error :

return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)

IndexError: index out of range in self

Sorry if my question is too obvious. I’m really new with NLP.