MuQiuJun-AI / bert4pytorch

超轻量级bert的pytorch版本,大量中文注释,容易修改结构,持续更新
408 stars 68 forks source link

KeyError: 'bert.embeddings.LayerNorm.gamma' #9

Open fangzhaoyi1995 opened 2 years ago

fangzhaoyi1995 commented 2 years ago

有人知道这个问题改怎么解决吗 File "F:\software\Anaconda\envs\tensor\lib\site-packages\bert4pytorch\modeling.py", line 71, in load_weights_from_pytorch_checkpoint state_dict[new_key] = state_dict.pop(old_key) KeyError: 'bert.embeddings.LayerNorm.gamma'

Tongjilibo commented 2 years ago

我也遇到了,你解决了吗

Tongjilibo commented 2 years ago

我也遇到了,你解决了吗

解决了,修改了了下variable_mapping里面的映射,把gamma和beta修改为weight和bias