lightseq icon indicating copy to clipboard operation
lightseq copied to clipboard

运行example中的ls_bert.py,报lsi.Bert报错

Open yechong316 opened this issue 2 years ago • 2 comments

问题报错 initializing bert tokenizer... creating huggingface model... Some weights of the model checkpoint at bert-base-uncased were not used when initializing BertForSequenceClassification: ['cls.predictions.bias', 'cls.predictions.transform.LayerNorm.bias', 'cls.seq_relationship.bias', 'cls.predictions.transform.dense.bias', 'cls.seq_relationship.weight', 'cls.predictions.transform.LayerNorm.weight', 'cls.predictions.transform.dense.weight', 'cls.predictions.decoder.weight']

  • This IS expected if you are initializing BertForSequenceClassification 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 BertForSequenceClassification from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model). Some weights of BertForSequenceClassification were not initialized from the model checkpoint at bert-base-uncased and are newly initialized: ['classifier.bias', 'classifier.weight'] You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference. creating lightseq model... Traceback (most recent call last): File "D:\leetcode算法\ls_bert.py", line 112, in main() File "D:\leetcode算法\ls_bert.py", line 82, in main ls_model = LightseqBertClassification("lightseq_bert_base_uncased.hdf5", hf_model) File "D:\leetcode算法\ls_bert.py", line 56, in init self.ls_bert = lsi.Bert(ls_weight_path, 128) AttributeError: module 'lightseq.inference' has no attribute 'Bert'

Process finished with exit code 1

问题复现: 直接运行example中的ls_bert.py报错 从 clone下来的文件夹和在另外独立的文件夹都有这个错误

yechong316 avatar Aug 07 '22 13:08 yechong316

The inference module only works on Linux.

zjersey avatar Aug 10 '22 09:08 zjersey

https://github.com/bytedance/lightseq/issues/148

使用pip install lightseq

hurun avatar Sep 10 '22 06:09 hurun