RuntimeError: Error(s) in loading state_dict for BertForTokenClassification
problem:
RuntimeError: Error(s) in loading state_dict for BertForTokenClassification:size mismatch for bert.embeddings.word_embeddings.weight: copying a param with shape torch.Size([21128, 768]) from checkpoint, the shape in current model is torch.Size([119547, 768]).
RuntimeError: Error(s) in loading state_dict for BertForTokenClassification:size mismatch for bert.embeddings.word_embeddings.weight: copying a param with shape torch.Size([21128, 768]) from checkpoint, the shape in current model is torch.Size([119547, 768]).
Solution:
The parameters of torch are not consistent with the mod
My original code was
The parameters of torch are not consistent with the mod
My original code was
model = AutoModelForTokenClassification.from_pretrained("bert-base-multilingual-cased", num_labels=len(label_names))
Just reinstall pytorch
conda install pytorch==1.7.1
Read More:
- [Solved] Pytorch-transformers Error: AttributeError: ‘str‘ object has no attribute ‘shape‘
- pytorch RuntimeError: Error(s) in loading state_ Dict for dataparall… Import model error solution
- Pytorch Loading model error: RuntimeError: Error(s) in loading state_dict for Model: Missing key(s) in state_dict
- [Solved] AttributeError: ‘_IncompatibleKeys‘ object has no attribute ‘parameters‘
- pytorch model.load_state_dict Error [How to Solve]
- [Solved] RuntimeError: cublas runtime error : resource allocation failed at
- urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
- [Solved] torchsummary Error: RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.F
- [Solved] RuntimeError: Error(s) in loading state_dict for Net:
- Here is the difference and connection of Torch. View (), Transpose (), and Permute ()
- [Solved] Error(s) in loading state_dict for GeneratorResNet
- [Solved] AttributeError: ‘_IncompatibleKeys’ object has no attribute
- [Solved] Pyg load dataset Error: attributeerror [pytorch geometry]
- [Solved] bushi RuntimeError: version_ <= kMaxSupportedFileFormatVersion INTERNAL ASSERT FAILED at /pytorch/caffe2/s
- Python RuntimeError: Expected 4-dimensional input for 4-dimensional weight [32, 1, 5, 5]
- [Solved] Python Error: An attempt has been made to start a new process before the current process has finished …
- OSError: [WinError 1455] The page file is too small to complete the operation. Error loading…
- [Solved] HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/saved_model
- [Solved] RuntimeError: expected scalar type Long but found Float
- Python: RNN principle realized by numpy