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:
- Pytorch Loading model error: RuntimeError: Error(s) in loading state_dict for Model: Missing key(s) in state_dict
- [Solved] RuntimeError: Error(s) in loading state_dict for Net:
- [Solved] PyTorch Load Model Error: Missing key(s) RuntimeError: Error(s) in loading state_dict for
- [Solved] Pytorch Error: RuntimeError: Error(s) in loading state_dict for Network: size mismatch
- pytorch RuntimeError: Error(s) in loading state_ Dict for dataparall… Import model error solution
- [Solved] RuntimeError: Error(s) in loading state dict for YOLOX:
- [Solved] Error(s) in loading state_dict for GeneratorResNet
- pytorch model.load_state_dict Error [How to Solve]
- [Solved] bushi RuntimeError: version_ <= kMaxSupportedFileFormatVersion INTERNAL ASSERT FAILED at /pytorch/caffe2/s
- [Solved] Yolov5 Deep Learning Error: RuntimeError: DataLoader worker (pid(s) 2516, 1768) exited unexpectedly
- linux ubuntu pip search Fault: <Fault -32500: “RuntimeError: PyPI‘s XMLRPC API is currently disab
- [Pytorch Error Solution] Pytorch distributed RuntimeError: Address already in use
- [Solved] DDP/DistributedDataParallel Error: RuntimeError: Address already in use
- [Solved] Python 3.6 Error: ‘dict’ object has no attribute ‘has_key’
- [Solved] RuntimeError: cublas runtime error : resource allocation failed at
- RuntimeError: Address already in use [How to Solve]
- [Solved] RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place
- [Solved] RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation
- [Solved] PyTorch Caught RuntimeError in DataLoader worker process 0和invalid argument 0: Sizes of tensors mus
- [Solved] TUM associate.py Scripte Error: AttributeError: ‘dict_keys‘ object has no attribute ‘remove‘