Closed helpmefindaname closed 4 months ago
Combined with https://github.com/flairNLP/flair/issues/3441 we currently recommend installing flair via:
pip install flair "transformers<4.40.0" "scipy<1.13.0"
until the respective issues are resolved.
They fixed it on their side
Describe the bug
This is due to a regression on the transformers side, see: https://github.com/huggingface/transformers/issues/30643 for details.
Flair uses the
tokenizer.model_max_length
in the TransformerEmbeddings to truncate (ifallow_long_sentences=False
) or split (ifallow_long_sentences=True
) long sentences.To Reproduce
Expected behavior
The code should run through without any issue.
Logs and Stack traces
Screenshots
No response
Additional Context
This bug is on the side of https://github.com/huggingface/transformers/issues/30643 therefore this issue is only for visiblity.
If you run into this problem, you can hotfix it in 2 ways:
transformers<4.40.0
model_max_length
parameter yourself, e.g.emb = TransformerWordEmbeddings("distilbert-base-cased", allow_long_sentences=True, model_max_length=512)
Environment
Versions:
Flair
0.13.1
Pytorch
2.3.0+cpu
Transformers
4.40.0
GPU
False