Open DineshShrestha opened 5 years ago
Hi, seems your vocabulary size is not matched to the pretrained model. The vocab_size is 9080 for the pretrained model. You can first try executing the ipynb file to check how the vocab_size is obtained.
How can i change the vocab size so that it is similar to pretrained model?
If you directly set vocab_size as that of the pretrained model, you can load it. But the tokenization of corpus may be different so that there may be some problems on the predicted results. Your vocab size (8990) may be because your source of data is different. You can try the flickr8K dataset on Kaggle https://www.kaggle.com/shadabhussain/flickr8k, or here https://github.com/jbrownlee/Datasets/releases.
Thank you for the suggestion. But i have another problem where i got stucked now.
RuntimeError: Error(s) in loading state_dict for CaptionModel_B: size mismatch for rnn.embed.weight: copying a param with shape torch.Size([9080, 50]) from checkpoint, the shape in current model is torch.Size([8990, 50]). size mismatch for rnn.linear.weight: copying a param with shape torch.Size([9080, 160]) from checkpoint, the shape in current model is torch.Size([8990, 160]). size mismatch for rnn.linear.bias: copying a param with shape torch.Size([9080]) from checkpoint, the shape in current model is torch.Size([8990]).