加载自己训练的Roberta,如果使用
tokenizer = AutoTokenizer/BertTokenizerFast.from_pretrained()
model = AutoModel.from_pretrained()
会出提示:
Some weights of the model checkpoint at D:\PTM3\roberta-c were not used when initializing RobertaModel: ['lm_head.bias', 'lm_head.layer_norm.bias', 'lm_head.layer_norm.weight', 'lm_head.dense.bias', 'lm_head.decoder.bias', 'lm_head.dense.weight', 'lm_head.decoder.weight']
- This IS expected if you are initializing RobertaModel 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 RobertaModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
Some weights of RobertaModel were not initialized from the model checkpoint at D:\PTM3\roberta-c and are newly initialized: ['roberta.pooler.dense.weight', 'roberta.pooler.dense.bias']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
但最终训练F1有80+,我想知道如果他不出现这些提示效果会不会更好?我查阅网上资料有人回答说不用管这个提示,但是我如果把model = AutoModel.from_pretrained()按照原来代码那样使用model = BertModel.from_pretrained()的话,上面的提示会变得特别长,提示很多参数都未使用和重新被加载、初始化。
所以我觉得应该有必要解决一下这个问题,不知您是否有建议