yahshibu / nested-ner-tacl2020-transformers

Implementation of Nested Named Entity Recognition using BERT
GNU General Public License v3.0
138 stars 24 forks source link

BUG #1

Closed tongchangD closed 4 years ago

tongchangD commented 4 years ago

AttributeError: module 'torch.optim' has no attribute 'optimizer'

i use torch==1.3.0

yahshibu commented 4 years ago

Thank you for letting me know.

"torch.optim.optimizer" exists in version 1.3.0. https://github.com/pytorch/pytorch/blob/v1.3.0/torch/optim/optimizer.py https://github.com/pytorch/pytorch/blob/v1.3.0/torch/optim/optimizer.pyi

And also, I tried running "train.py" again to check if I would see the same error, but the error didn't happen with version 1.3.0 in my environment.

Could you give me the details, like the whole error message?

yahshibu commented 4 years ago

Or, if you want to fix and run it as soon as possible, it might be good to delete the following lines. https://github.com/yahshibu/nested-ner-2019-bert/blob/34fcdabad5937f42d233681841b02cb49fb680ed/training/utils.py#L6 https://github.com/yahshibu/nested-ner-2019-bert/blob/34fcdabad5937f42d233681841b02cb49fb680ed/training/utils.py#L40

tongchangD commented 4 years ago

thanks for your reply. Now a new problem has arisen. f = open(config.train_data_path, 'rb') FileNotFoundError: [Errno 2] No such file or directory: './data/sample_train.pkl' Can you tell me the format of this PKL file

yahshibu commented 4 years ago

That .pkl file is made by "gen_data_for_xxx.py". In other words, "train.py" must be executed after "gen_data_for_xxx.py".

README.md says the detailed procedure. https://github.com/yahshibu/nested-ner-2019-bert/blob/master/README.md I hope this is clear enough for you to do an experiment.

If you want to quickly check whether the program works, it is good to use the sample data. https://github.com/yahshibu/nested-ner-2019-bert/blob/master/README.md#testing-this-library-with-a-sample-data

When you do an experiment using either of ACE-2004, ACE-2005, or GENIA, you can use "parse_xxx.py" and "gen_data_for_xxx.py" in this repository. But, if you want to apply to another dataset, the corresponding scripts must be newly prepared.

tongchangD commented 4 years ago

thanks very much

yahshibu commented 4 years ago

You're welcome :) I will close this issue. But, if you face a new trouble, feel free to ask.