neilctwu / YouyakuMan

Extractive summarizer using BertSum as summarization model
53 stars 15 forks source link

data loading error #9

Open Ishihara-Masabumi opened 3 years ago

Ishihara-Masabumi commented 3 years ago

I have a problem. When I tried to summarize using example command. There occurred an error as follows:

$ python3 youyakuman.py -txt_file testjp.txt -lang ja -n 3 --super_long Language not supported, will activate Translation. Language not supported, will activate Translation. <Translator: Input article is wrote in [JA] language> Traceback (most recent call last): File "youyakuman.py", line 45, in <module> model = ModelLoader(lf.toolkit.cp, lf.toolkit.opt, lf.toolkit.bert_model) File "/home/****/YouyakuMan/src/ModelLoader.py", line 12, in __init__ self.load_cp(cp_statedict) File "/home/****/YouyakuMan/src/models/model_builder.py", line 70, in load_cp self.load_state_dict(pt, strict=True) File "/home/****/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1224, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for ModelLoader: Missing key(s) in state_dict: "bert.model.embeddings.position_ids".

Please let me know hot to fix it.

Best Regards,

kaedefuto commented 3 years ago

Try changing the transformers version. transformers==2.9.0