Hi,
I am currently using torchtext-0.6.0 for text classification. I have trained my model and now i want to make a small web app out of it. However, I can’t find a way to save the torchtext Field vocabulary using dill or pickle. Whenever i load the pickle/dill file I get the following error.
Code used for saving:
SENT_FIELD = Field(sequential=True, tokenize='spacy')
# loading dataset
SENT_FIELD.build_vocab(train)
SENT_FIELD.vocab.load_vectors('glove.6B.300d')
# saving
import dill
with open("SENT_FIELD_dill.dill","wb")as f:
dill.dump(SENT_FIELD,f)
Code for loading field:
with open("SENT_FIELD_dill.dill","rb")as f:
TEXT=dill.load(f)
Error:
TypeError: an integer is required (got type bytes)
Is their any way I can save the vocabulary for further use?
Thanks in Advance.