8000 256加载模型错误 · Issue #4 · iflytek/MiniRBT · GitHub
[go: up one dir, main page]

Skip to content

256加载模型错误 #4

Open
Open

Description

@CodeXiaoLingYun

from transformers import BertTokenizer, BertModel

tokenizer = BertTokenizer.from_pretrained("MODEL_NAME")
model = BertModel.from_pretrained("MODEL_NAME")

我将模型下载到了本地,MiniRBT-h256-pt文件夹下有三个文件 config.json pytorch_model.bin vocab.txt
我将MODEL_NAME替换成本地模型路径:XXXXX/MiniRBT-h256-pt,
config能够正常加载
但是加载model时候报错
Some weights of the model checkpoint at XXXXX/MiniRBT-h256-pt were not used when initializing BertModel: ['cls.predictions.bias', 'cls.predictions.decoder.bias', 'cls.predictions.transform.dense.bias', 'cls.predictions.decoder.weight', 'cls.predictions.transform.LayerNorm.bias', 'cls.predictions.transform.dense.weight', 'cls.predictions.transform.LayerNorm.weight']

  • This IS expected if you are initializing BertModel 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 BertModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
    Some weights of BertModel were not initialized from the model checkpoint at XXXXXX/MiniRBT-h256-pt and are newly initialized: ['bert.pooler.dense.bias', 'bert.pooler.dense.weight']
    You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.

根据错误提示的是,模型结构和权重不一致,导致的,请问这个问题是我下载文件有错误?还是哪里的错误

Activity

  1. CodeXiaoLingYun commented on Oct 11, 2023

    @CodeXiaoLingYun
    Author

    我查阅了下文档,这个好像是警告,并不是错误?

  2. CodeXiaoLingYun commented on Oct 11, 2023

    @CodeXiaoLingYun
    Author

    我查阅了下文档,这个好像是警告,并不是错误?

  3. futz12 commented on Sep 8, 2024

    @futz12

    我验证了,他这个模型没带pooler的权重了,导致最终pooler_output的数据是随机的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0