-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot load any Pre-Trained Model #15
Comments
I believe this is a duplicate of #12. Essentially, it is a problem with the update from 3.0.2 to 3.1.0 of huggingface/transformers. The problem is being discussed at huggingface/transformers#6882. While they work on a fix, you can install the previous version of huggingface/transformers by running The steps to load a pretrained model are in the documentation. Please see https://transformersum.readthedocs.io/en/latest/general/getting-started.html#programmatically. Simply import the |
Thanks....! |
I created an extractive summarizer using the "extractive" module and the parser(almost all default values).
from extractive import ExtractiveSummarizer
summarizer = ExtractiveSummarizer
args = build_parser()
model = summarizer(hparams=args)
checkpoint = torch.load( "epoch=3.ckpt", map_location=lambda storage, loc: storage )
model.load_state_dict(checkpoint["state_dict"])
When I try to load a state dict in a model, it raises an error, "RuntimeError: Error(s) in loading state_dict for ExtractiveSummarizer:
Missing key(s) in state_dict: "word_embedding_model.embeddings.position_ids"."
Sometimes with the missing keys error, it produces
IncompatibleKeys
andshape mismatch
error.Note: The model checkpoint file is of the same model name provided in the parser.
for build_parser, I just extracted all the arguments from the
main.py
file and placed it in a function.It would be nice if you can document the necessary steps to load a pretrained model in the official documentation. As of now, I can't find any.
Thanks!
The text was updated successfully, but these errors were encountered: