I have trained a network,
saving code is next:
model_to_save = model.module if hasattr(model, 'module') else model # Only save the model it-self
output_model_file = args.output_dir / "pytorch_model.bin"
torch.save(model_to_save.state_dict(), str(output_model_file))
Then I try to load it and receive error:
>>> model.load_state_dict(torch.load('./finetuned_lm/pytorch_model.bin'))
IncompatibleKeys(missing_keys=[], unexpected_keys=[])
These keys are empty, but still there is an error.
What can be a reason to this?