Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yechong316 opened this issue Aug 7, 2022 · 2 comments
Open

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

yechong316 opened this issue Aug 7, 2022 · 2 comments

Comments

@yechong316
Copy link

问题报错
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下来的文件夹和在另外独立的文件夹都有这个错误

@zjersey
Copy link
Collaborator

zjersey commented Aug 10, 2022

The inference module only works on Linux.

@hurun
Copy link

hurun commented Sep 10, 2022

#148

使用pip install lightseq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants