Skip to content
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

errors when I was using huggingface to load pretrained_weights #42

Open
Siri-2001 opened this issue Nov 15, 2022 · 2 comments
Open

errors when I was using huggingface to load pretrained_weights #42

Siri-2001 opened this issue Nov 15, 2022 · 2 comments

Comments

@Siri-2001
Copy link

Hi!I am using huggingface to the pretrained_weights of layoutlm_large_500k_epoch_1.But huggingface shows me the errors as below:
Traceback (most recent call last):
File "D:\SoulCode\PaddleDetection\DocBank\DocBank_infer.py", line 8, in
model = LayoutLMForTokenClassification.from_pretrained("D:\Download\layoutlm_large_500k_epoch_1")
File "D:\Python39\lib\site-packages\transformers\modeling_utils.py", line 2225, in from_pretrained
model, missing_keys, unexpected_keys, mismatched_keys, error_msgs = cls._load_pretrained_model(
File "D:\Python39\lib\site-packages\transformers\modeling_utils.py", line 2357, in _load_pretrained_model
raise ValueError(
ValueError: The state dictionary of the model you are trying to load is corrupted. Are you sure it was properly saved?

Codes as below:
from transformers import AutoTokenizer,LayoutLMForTokenClassification

import torch

tokenizer = AutoTokenizer.from_pretrained('D:\Download\layoutlm_large_500k_epoch_1')
model = LayoutLMForTokenClassification.from_pretrained("D:\Download\layoutlm_large_500k_epoch_1")

How can I deal with it?Thanks!

@zamling
Copy link

zamling commented Apr 25, 2023

The same problem!
Do you resovle this issules? <3

@Siri-2001
Copy link
Author

Siri-2001 commented Apr 25, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants