Open 34127chi opened 4 years ago
这个不能用transformers
的albert加载吧,即便是用BertTokenizer
代替,也会报下面的错误
RuntimeError: Error(s) in loading state_dict for AlbertForClozeExtra:
size mismatch for bert.embeddings.position_embeddings.weight: copying a param with shape torch.Size([512, 2048]) from checkpoint, the shape in current model is torch.Size([512, 128]).
size mismatch for bert.embeddings.token_type_embeddings.weight: copying a param with shape torch.Size([2, 2048]) from checkpoint, the shape in current model is torch.Size([2, 128]).
size mismatch for bert.embeddings.LayerNorm.weight: copying a param with shape torch.Size([2048]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for bert.embeddings.LayerNorm.bias: copying a param with shape torch.Size([2048]) from checkpoint, the shape in current model is torch.Size([128]).
这个不能用
transformers
的albert加载吧,即便是用BertTokenizer
代替,也会报下面的错误RuntimeError: Error(s) in loading state_dict for AlbertForClozeExtra: size mismatch for bert.embeddings.position_embeddings.weight: copying a param with shape torch.Size([512, 2048]) from checkpoint, the shape in current model is torch.Size([512, 128]). size mismatch for bert.embeddings.token_type_embeddings.weight: copying a param with shape torch.Size([2, 2048]) from checkpoint, the shape in current model is torch.Size([2, 128]). size mismatch for bert.embeddings.LayerNorm.weight: copying a param with shape torch.Size([2048]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for bert.embeddings.LayerNorm.bias: copying a param with shape torch.Size([2048]) from checkpoint, the shape in current model is torch.Size([128]).
transfomers库里面的albert是默认支持spm_model_file的 是sentencepiece库生成的
在预训练模型中没有看到spm_model_file 能否提供下这个文件?谢谢🙏 因为我在实验的时候会用到transformers这个库 它的字典文件现在默认是支持这个spm_model_file