lightseq icon indicating copy to clipboard operation
lightseq copied to clipboard

RuntimeError: Unable to read HDF5 file from lightseq_bert_base_uncased.hdf5

Open hurun opened this issue 3 years ago • 1 comments

系统版本:ubuntu 20.04 lightseq: Version: 2.2.1 python: 3.7.12 torch Version: 1.11.0+cu113

代码复现过程 1、运行python test/ls_bert.py 2、无其他操作。

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

  • 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.weight', 'classifier.bias'] You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference. creating lightseq model... Parsing hdf5: lightseq_bert_base_uncased.hdf5 HDF5-DIAG: Error detected in HDF5 (1.12.0) thread 0: #000: H5F.c line 793 in H5Fopen(): unable to open file major: File accessibility minor: Unable to open file #001: H5VLcallback.c line 3500 in H5VL_file_open(): open failed major: Virtual Object Layer minor: Can't open object #002: H5VLcallback.c line 3465 in H5VL__file_open(): open failed major: Virtual Object Layer minor: Can't open object #003: H5VLnative_file.c line 100 in H5VL__native_file_open(): unable to open file major: File accessibility minor: Unable to open file #004: H5Fint.c line 1564 in H5F_open(): unable to open file: name = 'lightseq_bert_base_uncased.hdf5', tent_flags = 0 major: File accessibility minor: Unable to open file #005: H5FD.c line 741 in H5FD_open(): open failed major: Virtual File Layer minor: Unable to initialize object #006: H5FDsec2.c line 346 in H5FD_sec2_open(): unable to open file: name = 'lightseq_bert_base_uncased.hdf5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0 major: File accessibility minor: Unable to open file Traceback (most recent call last): File "ls_bert.py", line 112, in main() File "ls_bert.py", line 82, in main ls_model = LightseqBertClassification("lightseq_bert_base_uncased.hdf5", hf_model) File "ls_bert.py", line 56, in init self.ls_bert = lsi.Bert(ls_weight_path, 128) RuntimeError: Unable to read HDF5 file from lightseq_bert_base_uncased.hdf5

hurun avatar Sep 10 '22 06:09 hurun

You could check the README and export the model first.

Taka152 avatar Sep 13 '22 02:09 Taka152