I have a text dataset that there are scores for all of its sentences. I want to do a sentence regression task. I have word embedding vectors for each of words in the sentences. Now I want to use Pytorch for defining an embedding layer. I now that I should use of these line of code:
import torch as nn
embed=nn.Embedding(num_embeds,embed_dim)
#pretrained weight is a numpy matrix of shape(num_embeds,embed_dim)
embed.weight.data.copy_(torch.from_numpy(pretrained_weight))

But I don’t know what is the order of rows in pretrained_weight. Is it the same order the sequent words appear in the sequent sentences? Does it contain duplicate words?