I am trying to load an AllenNLP model weights. I could not find any documentation on how to save/load a whole model, so playing with weights only.
from allennlp.nn import util
model_state = torch.load(filename_model, map_location=util.device_mapping(-1))
model.load_state_dict(model_state)
I modified my input corpus a bit and I am guessing because of this I am getting corpus-size mismatch:
RuntimeError: Error(s) in loading state_dict for BasicTextFieldEmbedder:
size mismatch for token_embedder_tokens.weight:
copying a param with shape torch.Size([2117, 16]) from checkpoint,
the shape in current model is torch.Size([2129, 16]).
Seemingly there is no official way to save model with corpus vocabulary. Any hacks around it?