如何从自定义的bertformaskedlm加载bertmodel,而无需随机初始化权重?
我已经培训了几天的bertformaskedlm
模型,并且我save_pretaining()
it。
我想从bertmodel
与嵌入的编码器向量进行比较 这个新训练的bertformaskedlm
。
但是,只需使用bertmodel.from_pretrataining(“ path/to/new_bertformaskedlm_model”)
> 警告我说:“您可能应该训练此模型....”。
看来bert.pooler.dense.Wewight
和bert.pooler.dense.bias
在删除LM头后已将其添加到BertModel中,并随机初始化。我认为这意味着该当前模型的输出将是没有用的。
与BertModel嵌入式(删除LM头后),我需要做什么?
我只想比较向量。
I've trained a BertForMaskedLM
model for a few days, and I've save_pretrained()
it.
I want to compare encoder vectors from a BertModel
, with the embeddings from
this newly trained BertForMaskedLM
.
However, simply using BertModel.from_pretrained("path/to/new_BertForMaskedLM_model")
warns me that "You should probably TRAIN this model....".
It seems that bert.pooler.dense.weight
and bert.pooler.dense.bias
have been added to the BertModel after removing the LM head, and randomly initialized. I assume this means the output of this current model will be useless.
What do I need to do to compare BertForMaskedLM embeddings (after removing the LM head) with BertModel embeddings?
I just want to compare vectors.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论