Closed AIstudentSH closed 4 years ago
What do you mean by saying "word vector"? Is it word embeddings? You can get the word embeddings from pre-trained models.
Sorry, can you introduce that how I can get word embeddings from a pre-trained model. I didn't fully understand your code.
You can get word embeddings as following:
import torch
path_to_pretrained_model = './model/pretrained_model/vl-bert-base-e2e.model'
checkpoint = torch.load(path_to_pretrained_model, map_location='cpu')
word_embeddings = checkpoint['state_dict']['module.vlbert.word_embeddings.weight']
print(word_embeddings.shape)
You should get output like:
torch.Size([30522, 768])
Hope it helps! @AIstudentSH
BTW, I don't think it is a good idea that you just use the word embeddings. You'd better use the whole pre-trained model to take full advantage of VL-BERT.
Thank you for your work, I would love to reference your VL-Bert in my network. Is there a VQA dataset word vector file saved in txt format?