如何从自定义的bertformaskedlm加载bertmodel,而无需随机初始化权重?

发布于 2025-02-04 03:08:12 字数 489 浏览 2 评论 0原文

我已经培训了几天的bertformaskedlm模型,并且我save_pretaining() it。

我想从bertmodel与嵌入的编码器向量进行比较 这个新训练的bertformaskedlm

但是,只需使用bertmodel.from_pretrataining(“ path/to/new_bertformaskedlm_model”)> 警告我说:“您可能应该训练此模型....”。

看来bert.pooler.dense.Wewightbert.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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文