flairNLP / flair

A very simple framework for state-of-the-art Natural Language Processing (NLP)
https://flairnlp.github.io/flair/
Other
13.7k stars 2.08k forks source link

[Question]: tarsclassifier prediction is very slow for more then 100 classes #3479

Open sainiudit opened 2 days ago

sainiudit commented 2 days ago

Question

I am using tarsclassifier and fine tuned it for 100+ classes, prediction is taking forever to run any work around for this

alanakbik commented 2 days ago

Hello @sainiudit, unfortunately TARS is slow in scenarios with many classes. The reason is that TARS makes an independent forward pass through the model for each class. So if you have 100 classes, each sentence requires 100 forward passes through the model in order to predict.

We worked together with a team at Bayer to scale TARS up to 80,000 classes. This is not integrated into Flair, but there is code and a paper available: