美文网首页
Bert代码跑albert报错

Bert代码跑albert报错

作者: park_one | 来源:发表于2022-08-22 15:45 被阅读0次

    用bert的fine-tune代码跑albert模型,结果报错:

    Shape of variable bert/embeddings/word_embeddings:0 ((21128, 312)) doesn't match with shape of tensor bert/embeddings/word_embeddings ([21128, 128]) from checkpoint reader.

    这是因为bert代码和albert不是兼容的,需要替换成albert的对应代码,方法也很简单,把bert使用的modeling.py替换成albert的modeling.py就可以了

    添加这两个文件(modeling_albert.py就是albert的modeling.py,我这里改了个名字):

    相关文章

      网友评论

          本文标题:Bert代码跑albert报错

          本文链接:https://www.haomeiwen.com/subject/khpigrtx.html