amir-zeldes / HebPipe

An NLP pipeline for Hebrew
Other
34 stars 9 forks source link

Compatibility of heb.flair with new transformers models #23

Closed andreys1982 closed 2 years ago

andreys1982 commented 2 years ago

I am getting the following error when loading the SequenceTagger ModuleNotFoundError: No module named 'transformers.modeling_bert'

Discovered similar one described here https://github.com/flairNLP/flair/issues/2109

Found this quote: "It appears that the transfomers module was reorganized on 16 Nov 2020 #8580 (https://github.com/huggingface/transformers/commit/c89bdfbe720bc8f41c7dc6db5473a2cb0955f224#diff-550edeb1fa88e111752fd13ba725609f25858d5729dfe10b9773918bc1e974a1) but the downloaded model pickle files use the previous module organization."

While it is theoretically possible to downgrade transformers, perhaps some of the models (e.g heb.flair) can be updated?

amir-zeldes commented 2 years ago

Thanks for reporting - I agree it would be nice to update all models for the system across the board, but in the meantime please take a look at the requirements.txt - indeed it sounds like you might have a newer version of transformers installed (it looks like the model available online requires 3.5.1).

The easiest solution for getting the tools to run as intended is to use a venv and install using the requirements. Hopefully we will update the models with some of the latest released IAHLT data soon, and then the library versions will change as well, but ultimately this will just happen again when some dependency releases a newer version, so making sure requirements are met is always the best way to go.