Multilingual text transformer model fails with ModuleAttributeError
My colleague is testing the new multilingual text transformer model (#6 (comment 531799)) and receiving an error:
I downloaded multilingual model from here https://drive.google.com/file/d/1Gq0gFevGmv9Q97ZsDBU2XU9CDi1bPzkT/view?usp=sharing and placed it in \transformer\io\model\ directory. To test the text_transformer app I used code example given in https://gitlab.inria.fr/comprise/text_transformer/-/tree/master/ with modified params to use the model just downloaded so:
params = {'m':r"E:\Anon_Toolkit\comprise_text_transformer\transformer\io\model\comprise-ner.pt", 'r': 'REDACT'} However, running this results in error while loading the new model:
2021-08-06 09:21:17,360 loading file E:\Anon_Toolkit\comprise_text_transformer\transformer\io\model\comprise-ner.pt
Traceback (most recent call last):
File "transform.py", line 427, in <module>
model = SequenceTagger.load(model)
File "C:\Python368x64\lib\site-packages\flair\nn.py", line 90, in load
model = cls._init_model_with_state_dict(state)
File "C:\Python368x64\lib\site-packages\flair\models\sequence_tagger_model.py", line 296, in _init_model_with_state_dict
model.load_state_dict(state["state_dict"])
File "C:\Python368x64\lib\site-packages\torch\nn\modules\module.py", line 1030, in load_state_dict
load(self)
File "C:\Python368x64\lib\site-packages\torch\nn\modules\module.py", line 1028, in load
load(child, prefix + name + '.')
File "C:\Python368x64\lib\site-packages\torch\nn\modules\module.py", line 1028, in load
load(child, prefix + name + '.')
File "C:\Python368x64\lib\site-packages\torch\nn\modules\module.py", line 1028, in load
load(child, prefix + name + '.')
[Previous line repeated 1 more time]
File "C:\Python368x64\lib\site-packages\torch\nn\modules\module.py", line 1025, in load
state_dict, prefix, local_metadata, True, missing_keys, unexpected_keys, error_msgs)
File "C:\Python368x64\lib\site-packages\torch\nn\modules\module.py", line 953, in _load_from_state_dict
persistent_buffers = {k: v for k, v in self._buffers.items() if k not in self._non_persistent_buffers_set}
File "C:\Python368x64\lib\site-packages\torch\nn\modules\module.py", line 953, in <dictcomp>
persistent_buffers = {k: v for k, v in self._buffers.items() if k not in self._non_persistent_buffers_set}
File "C:\Python368x64\lib\site-packages\torch\nn\modules\module.py", line 772, in __getattr__
type(self).__name__, name))
torch.nn.modules.module.ModuleAttributeError: 'BertEmbeddings' object has no attribute '_non_persistent_buffers_set'
Edited by Dāvis Raģels