Question about build_model

when i execute ner_modelformulti = build_model(‘ner_ontonotes_bert’, download=True, install=True),
I got the error “AttributeError: ‘BertForTokenClassification’ object has no attribute ‘module’” with transformers version == 4.13.0 and torch version == 1.13.0.


微信截图_20230712201629

Hi, @Crabbit-F!
Thank you for informing us about this issue. The fix is already in PR, we plan to add it to the master branch soon.

1 Like

Thanks a lots! And,hao can i use now? :grin:

You can either wait for the release of a new version, or you can replace the file path_to_installed_library/deeppavlov/models/torch_bert/torch_transformers_classifier.py from the library with the file from the link.

1 Like

thanks a lot!let me have a try. :+1: :+1: :+1:

I replace the file but it don’t work :smiling_face_with_tear:

I apologize for the delay in responding. Checked the proposed solution again, it really doesn’t work :thinking:. Therefore, now I advise you to either use one GPU (CUDA_VISIBLE_DEVICE=0), or you can change the file again, but this time replace the file path_to_installed_library/deeppavlov/models/torch_bert/torch_transformers_sequence_tagger.py with the file from the link. Hope this will help you now :slight_smile: