text icon indicating copy to clipboard operation
text copied to clipboard

Save and loading vocabaluray

Open laleye opened this issue 2 years ago • 1 comments

❓ Questions and Help

Description

I trained a classification model and used torchtext to create vocabulary from a pre-trained model. My problem is that when saving the model, I didn't save the vocabulary TXT object. Now I can't get the model to infer because it can't find the vocabulary. Is there a way to create post training vocabulary or I have to retrain the model. Thanks

laleye avatar Dec 13 '22 10:12 laleye

Hi @laleye - you should be able to use build_vocab_from_iterator to rebuild and save the text object given that the way in which you build the vocabulary in the first place was in the same order. There is no need to re-train the model.

joecummings avatar Dec 13 '22 21:12 joecummings