Breaking Changes
Reorganized package structure 12
There are now two packages: `flair.models` and `flair.trainers` for the models and model trainers respectively.
Models package
`flair.models` contains 3 model classes: `SequenceTagger`, `TextClassifier` and `LanguageModel`.
Trainers package
`flair.trainers` contains 3 model trainer classes: `SequenceTaggerTrainer`, `TextClassifierTrainer` and `LanguageModelTrainer`.
Direct import from package
You call these classes directly from the packages, for instance the SequenceTagger is now instantiated as:
python
from flair.models import SequenceTagger
tagger = SequenceTagger.load('ner')
Reorganized embeddings 12
Clear distinction between token-level and document-level embeddings by adding two classes, namely `TokenEmbeddings` and `DocumentEmbeddings` from which respective embeddings need to inherit.
New Features
LanguageModelTrainer 24 17
Added `LanguageModelTrainer` class to train your own LM embeddings.
Document Classification 10
Added experimental `TextClassifier` model for document-level text classification. Also added corresponding model trainer class, i.e. `TextClassifierTrainer`.
Batch prediction 7
Added batching into prediction method for faster sequence tagging
CPU-friendly pre-trained models 29
Added pre-trained models with smaller LM embeddings for faster CPU-inference speed
You can load them by adding '-fast' to the model name. Only for English at present.
python
from flair.models import SequenceTagger
tagger = SequenceTagger.load('ner-fast')
Learning Rate Scheduling 19
Added learning rate schedulers to all trainer classes for improved learning rate annealing functionality and control.
Auto-spawn on GPUs 19
All model classes now automatically spawn on GPUs if available. The separate `.cuda()` call is no longer necessary.
Bug Fixes
Retagging error 23
Fixed error that occurred when using multiple pre-trained taggers on the same sentence.
Empty sentence error 33
Fixed error that caused data fetchers to sometimes create empty sentences.
Other
Unit Tests 15
Added a large set of automated unit tests for better stability.
Documentation 15
Expanded documentation and tutorials. Also expanded descriptions of APIs.
Code Simplifications in sequence tagger 19
A number of code simplifications all around, hopefully making the code easier to understand.