I am trying to use pre-trained word embedding in Pytorch, Wv.p. I have a word2vec pre-trained dataset of 114044 words and my dataset contains 426 unique words.
To use that embedding I load the pickle file and copy the embeddings by:
self.word_embedding.weight.data.copy_(torch.from_numpy(Wv))
but I get an error when running as:
RuntimeError: inconsistent tensor size, expected tensor [426 x 50] and src [114044 x 50] to have the same number of elements, but got 21300 and 5702200 elements respectively at /Users/soumith/code/builder/wheel/pytorch-src/torch/lib/TH/generic/THTensorCopy.c:121
What wrong am I doing? The number of words can obviously be equivalent to pre-trained dataset.