# Flair NLP: tagging with Classifier.load, a transformers pin below 5.0.0, and a license field GitHub cannot read

> flairNLP/flair is a Python and PyTorch library from Humboldt University of Berlin for named entity recognition, sentiment analysis, part-of-speech tagging and text embeddings. This article covers how its API works, what pip install flair pulls in, and where the dependency pins and license metadata need a second look.

**flairNLP/flair** — A very simple framework for state-of-the-art Natural Language Processing (NLP)

- Repository: https://github.com/flairNLP/flair
- Website: https://flairnlp.github.io/flair/
- Stars: 14,397 · Forks: 2,095
- Language: Python
- License: NOASSERTION
- Published: 2026-10-20 · Updated: 2026-11-03 · Language: en
- Canonical page: https://hysenlabs.com/projects/flairnlp-flair

## Two lines turn a Sentence into tagged output

Flair's main interface is a pair of classes. You build a Sentence from a string, load a model with Classifier.load, and call predict. The tagger name selects the task, so swapping 'ner' for 'sentiment' changes the whole job while the rest of the code stays identical.

```python
from flair.data import Sentence
from flair.nn import Classifier

# make a sentence
sentence = Sentence('I love Berlin .')

# load the NER tagger
tagger = Classifier.load('ner')

# run NER over sentence
tagger.predict(sentence)

# print the sentence with all annotations
print(sentence)
```

For the NER model the output is a Sentence line with Berlin tagged as LOC. For the sentiment model the same sentence prints as POSITIVE with a score of 0.9983, and the Sentence[4] count includes the space-separated period token.

Predictions are written onto the Sentence object itself. That is convenient for pipelines, because annotations travel with the text, but it means you read results from the object and not from a return value.

## Where the NER benchmark table beats the best published score, and where it does not

The project publishes a table of its latest NER models against the best published results. On English CoNLL-03 with four classes, Flair scores 94.09 against 94.3 from Yamada et al. (2020). On English Ontonotes with 18 classes it scores 90.93 against 91.3 from Yu et al. (2020). So on both English sets the best published number is slightly higher.

The other three rows go the other way. German CoNLL-03 shows 92.31 against 90.3, Dutch CoNLL-03 shows 95.25 against 93.7, and Spanish CoNLL-03 shows 90.54 against 90.3. Each row links to a demo on the Hugging Face hub, with models such as ner-english-large, ner-german-large, ner-dutch-large and ner-spanish-large.

These are the project's own reported figures on standard corpora, not results on your text. Domain shift hurts every tagger, so run the model on a sample of your own documents before trusting a headline number. Many Flair sequence tagging models are hosted on the Hugging Face hub, where you can read how each was trained and try it online.

## pip install flair brings torch, transformers below 5.0.0 and a long tail

Installation is a single command, ideally inside a virtual environment:

```
pip install flair
```

Flair requires Python 3.9 or newer, and setup.py sets python_requires to >=3.9. The dependencies come from requirements.txt, and a few matter for compatibility. torch must be at least 1.13.1. transformers with the sentencepiece extra must be at least 4.25.0 and below 5.0.0. conllu is held to 4.x, and bioc is held below 3.0.0 while requiring at least 2.0.0.

The transformers cap is the one that bites. If another package in your environment needs transformers 5, pip will report a conflict instead of letting Flair coexist, so a separate virtual environment per project is the safe route.

The list also pulls in scikit-learn, matplotlib, boto3, gdown, huggingface-hub, langdetect, lxml, segtok, sqlitedict, tabulate, tqdm, wikipedia-api and transformer-smaller-training-vocab. An optional extra named word-embeddings adds gensim 4.2.0 or newer and bpemb 0.3.5 or newer for classic word vectors.

## The tutorial book was written for an older Flair and some examples no longer work

Official learning material sits on the documentation site at flairnlp.github.io, split into four tutorials: basic tagging, training models, embeddings and biomedical text. The biomedical track has its own landing page for biomedical NER and datasets, with a HunFlair2 page for the newer models.

Outside the repository, the README points to the book Natural Language Processing with Flair and its code repository. The same section warns that the book was written for an older version of Flair and some examples may no longer work. Treat it as background on the ideas and use the current docs for syntax.

Third-party posts are linked too, covering custom NER training, text classification, zero and few-shot learning, a visualisation tool for extracted entities, a Colab walkthrough, NER benchmarking, clinical NLP and a Flask microservice. Their ages vary, so check any import path in them against the 0.15.1 API.

## Tests fail on any warning, and linters run inside pytest

The pyproject.toml shows how strict the project is with itself. Black runs with a line length of 120 and a py39 target. Pytest is configured with addopts of --black --mypy --ruff, so formatting, type checks and lint rules execute as part of the test run rather than in a separate job.

The filterwarnings list starts with "error", which converts every warning into a failure. A long list of ignore entries follows, each annotated with a reason: Distilbert tracing, TorchScript type annotations, a scipy.linalg deprecation raised by gensim, Pillow 10 removals triggered by Hugging Face layoutlmv2, deprecated calls in layoutlmv3, imp module warnings from hyperopt, and pkg_resources notices from Hugging Face.

For a contributor this means a new dependency that emits a deprecation warning will break the suite until someone adds an ignore line. For a user it is evidence of where the dependency tree is noisy: gensim, layout models and Torch export all appear in that list.

## Releases stop at 0.15.1 in February 2025 while commits continue

The repository is not archived. The last push was 2026-10-19. The tagged releases are v0.15.1 on 2025-02-05, v0.15.0 on 2024-12-20 and v0.14.0 on 2024-07-25, and setup.py still declares version 0.15.1. So the code on master has moved past the last tagged release by more than twenty months, and pip install flair gives you the packaged 0.15.1 rather than what is on the default branch.

If a fix you need landed after February 2025, installing from the git repository is the route to it, with the usual risk of an untagged state. Check the issue tracker for the specific bug before relying on a newer commit.

The repository root holds a SECURITY.md, CONTRIBUTING.md and CODE_OF_CONDUCT.md, plus examples/ with multi_gpu and ner folders, a collect_env.py script, a tests/ directory and a resources/ folder with docs.

## License fields disagree: NOASSERTION on GitHub, MIT in setup.py and the badge

GitHub's license detection for this repository returns NOASSERTION, which means it could not map the LICENSE file to a known identifier. Meanwhile setup.py declares license="MIT" and the README badge links to the MIT page on opensource.org. The LICENSE file sits at the repository root.

A compliance review that reads GitHub's metadata alone will flag an unknown license, so read the LICENSE file itself and cite setup.py when you document your dependencies.

The code is licensed separately from the models. Pre-trained models live on the Hugging Face hub, each with its own model card, so check the card for the specific model you deploy. Author metadata names Alan Akbik, and the README credits Humboldt University of Berlin and friends. Pulling models at first use also needs network access to the hub, which matters for air-gapped deployments.

## Conclusion

Choose Flair if you want pre-trained taggers behind a two-line Classifier.load and predict API, or a PyTorch base for training your own sequence taggers and embeddings. Avoid it if your stack already uses transformers 5.x, since requirements.txt caps it below 5.0.0. Before installing, check the license your legal team will read: GitHub reports NOASSERTION while setup.py and the README badge say MIT.

## FAQ

### How do I install Flair?

Run pip install flair in a virtual environment. Flair requires Python 3.9 or newer.

### What tasks does Flair NLP cover?

Flair covers named entity recognition, sentiment analysis, part-of-speech tagging, sense disambiguation and classification, with special support for biomedical text. It also provides word and document embeddings.

### What license does Flair use?

setup.py declares MIT and the README badge links to the MIT license, although GitHub reports the license as NOASSERTION.

## Sources

- [flairNLP/flair on GitHub](https://github.com/flairNLP/flair)
- [Issues](https://github.com/flairNLP/flair/issues)
- [Project website](https://flairnlp.github.io/flair/)
- [README](https://github.com/flairNLP/flair/blob/master/README.md)
- [Releases](https://github.com/flairNLP/flair/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/flairnlp-flair
