DocBank icon indicating copy to clipboard operation
DocBank copied to clipboard

errors when I was using huggingface to load pretrained_weights

Open Siri-2001 opened this issue 3 years ago • 2 comments

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!

Siri-2001 avatar Nov 15 '22 08:11 Siri-2001

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

zamling avatar Apr 25 '23 14:04 zamling

It seems that you should use unlim instead of huggingface.Please refer to offical codes.

| | @.*** | | @.*** |

---- Replied Message ---- | From | Enming @.> | | Date | 04/25/2023 22:01 | | To | @.> | | Cc | @.>@.> | | Subject | Re: [doc-analysis/DocBank] errors when I was using huggingface to load pretrained_weights (Issue #42) |

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

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

Siri-2001 avatar Apr 25 '23 14:04 Siri-2001