当前位置:   article > 正文

Python: BERT Error - Some weights of the model checkpoint at were not used when initializing BertMod_you should probably train this model on a down-str

you should probably train this model on a down-stream task to be able to use

在调用transformers预训练模型库时出现以下信息:

Some weights of the model checkpoint at bert-base-multilingual-cased were not used when initializing BertForTokenClassification_: ['cls.predictions.transform.LayerNorm.weight', 'cls.predictions.transform.dense.weight', 'cls.predictions.transform.dense.bias', 'cls.predictions.bias', 'cls.seq_relationship.bias', 'cls.predictions.decoder.weight', 'cls.predictions.transform.LayerNorm.bias', 'cls.seq_relationship.weight']
- This IS expected if you are initializing BertForTokenClassification_ from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
- This IS NOT expected if you are initializing BertForTokenClassification_ from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
Some weights of BertForTokenClassification_ were not initialized from the model checkpoint at bert-base-multilingual-cased and are newly initialized: ['classifier.weight', 'classifier.bias']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.

解决方法:

这不是一个错误,但这个警告意味着在你的训练过程中,你没有使用pooler来计算损失。因此,如果是这种情况,则无需担心。

可以通过以下方式设置不显示此警告

  1. from transformers import logging
  2. logging.set_verbosity_warning()

或者在在训练后加载模型,则不会看到此错误消息

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/662420
推荐阅读
相关标签
  

闽ICP备14008679号