Hi. I use a method for constructing embedding matrix based on vacab words indexes:
def load_embeddings(CorpusPretrainedEmbdDict,word2idx,embedding_dim):
    embeddings=np.zeros((len(word2idx),embedding_dim))
    for word,index in word2idx.items():
        vector = np.array(CorpusPretrainedEmbdDict[word], dtype='float32')
        embeddings[index]=vector
        return embeddings

I also construct word2idx to get indexes of all the words in my vocabulary. Then I use load_embeddings for constructing embedding matrix for the words in my vocabulary based on word2idx.
word2idx = {word: idx for idx, word in enumerate(DUC_vocab)}
#create embedding matrix for our vocab (based on word2idx)
my_embeddings=load_embeddings(CorpusPretrainedEmbdDict,word2idx,n_dim)
#Create an embedding layer
embed=nn.Embedding(len(word2idx),n_dim)
#feed our pretrained word vectors to embedding layer
embed.weight.data.copy_(torch.from_numpy(my_embeddings))

Could you please guide me this way is true? Thanks