flair
A very simple framework for state-of-the-art NLP
What it is and what it does
Flair is a PyTorch-based NLP framework that wraps state-of-the-art transformer and contextual models to make common NLP tasks accessible through a simple API. It ships with pre-trained models for named entity recognition, sentiment analysis, part-of-speech tagging, and biomedical text analysis across multiple languages, and allows you to load, apply, and combine embeddings without writing low-level PyTorch code.
The framework is built for both practitioners who want to apply existing models to text and researchers who want to train custom models. It depends on torch, transformers, huggingface-hub, and a large ecosystem of supporting libraries (scikit-learn, matplotlib, lxml, and others) to handle data loading, visualization, and model evaluation. The aging maintenance status (last release 555 days ago) means you should verify compatibility with your target PyTorch and transformer versions before committing to production use.
Use it for:
- Extract named entities (persons, locations, organizations) from English, German, Dutch, Spanish, or other language text using pre-trained models.
- Classify sentiment in text as positive or negative without training a custom model.
- Generate word and document embeddings for downstream machine learning tasks using Flair embeddings or transformer models.
- Train a custom sequence labeling model (NER, PoS tagging) on your own annotated dataset using the PyTorch framework.
- Analyze biomedical or clinical text using specialized models and datasets designed for domain-specific NLP.
- Combine multiple embeddings (word, document, transformer) and experiment with new architectures for sequence labeling.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Flair is a PyTorch-based NLP framework that applies pre-trained models for named entity recognition, sentiment analysis, part-of-speech tagging, and other sequence labeling tasks, plus text embedding and model training capabilities.
Yes, if you need a high-level NLP framework with pre-trained models and your Python and PyTorch versions align with the package's requirements. The low install friction, permissive license, and strong community adoption (14382 stars) make it a solid choice for NER, sentiment analysis, and embeddings. However, verify that the aging maintenance status (555 days since last release) does not conflict with your dependency update cycles, and test compatibility with your target PyTorch and transformer versions before production deployment.
Install
flair on PyPI
pip
pip install flairuv
uv add flairpoetry
poetry add flairInstalling flair
Before you install
Low install friction with a pure-Python wheel. The package has 25 runtime dependencies including torch, transformers, and huggingface-hub, which are substantial but standard for modern NLP work. Maintenance status is aging—last release was 555 days ago—though the repository remains active with recent commits and 14382 stars.
License in practice
MIT license is permissive and imposes no restrictions on commercial or private use, modification, or redistribution.
Quickstart
pip install flair
from flair.data import Sentence
from flair.nn import Classifier
sentence = Sentence('I love Berlin .')
tagger = Classifier.load('ner')
tagger.predict(sentence)
print(sentence)
Requires Python 3.9+. Installing torch and transformers dependencies may take time and disk space; GPU support is optional but recommended for production use.
Verify before relying
- Whether the 555-day gap since last release indicates active maintenance or reduced development velocity.
- Performance characteristics and memory requirements for large-scale inference or training.
- Compatibility with the latest transformer model releases and huggingface-hub API changes.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 25 — boto3, conllu, deprecated, ftfy, gdown, huggingface-hub, langdetect, lxml, matplotlib, more-itertools, mpld3, pptree, python-dateutil, pytorch-revgrad, regex, scikit-learn, segtok, sqlitedict, tabulate, torch, tqdm, transformer-smaller-training-vocab, transformers, wikipedia-api, bioc |
| Maintenance | aging — 555 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 234,314/month — #9,024 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: flair-0.15.1-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
sentence-transformersComputes embeddings and reranking scores for…
permissive · top 1,000 on PyPI
seqevalseqeval evaluates the performance of sequence…
permissive · top 15,000 on PyPI
spark-nlpSpark NLP provides distributed natural language…
permissive · top 5,000 on PyPI
vaderSentimentVADER performs lexicon and rule-based sentiment…
permissive · top 5,000 on PyPI
pytdcPyTDC provides unified access to multimodal…
permissive · top 15,000 on PyPI
glinerGLiNER is a lightweight framework for named…
permissive · top 15,000 on PyPI
torchtexttorchtext provides text datasets, preprocessing…
permissive · top 15,000 on PyPI
spacyspaCy is an industrial-strength NLP library…
permissive · top 1,000 on PyPI
setfitSetFit fine-tunes Sentence Transformers for…
permissive · top 15,000 on PyPI
textblobTextBlob provides a simple API for common…
permissive · top 5,000 on PyPI