Downloads · 30 days
0
latincy/la_flair_latincy
la_flair_latincy is a machine learning model from latincy. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for flair. The card lists the license as cc-by-nc-sa-4.0.
A Flair model suite for Latin trained on harmonized Universal Dependencies treebanks from LatinCy. Provides POS tagging, lemmatization, and named entity recognition using Flair's stacked embedding architecture (contex…
Downloads · 30 days
0
Access
Public
Updated Mar 23, 2026
Repo size
2.2 GB
Likes
0
Public
Click a slice to open those files.
.pt1.4 GB · 100%
From the Hugging Face model README
A Flair model suite for Latin trained on harmonized Universal Dependencies treebanks from LatinCy. Provides POS tagging, lemmatization, and named entity recognition using Flair's stacked embedding architecture (contextual string embeddings + word vectors + BiLSTM-CRF).
from flair.data import Sentence
from flair.models import SequenceTagger
from huggingface_hub import hf_hub_download
# Download POS tagger (cached after first download)
model_path = hf_hub_download("latincy/la_flair_latincy", "models/pos/best-model.pt")
tagger = SequenceTagger.load(model_path)
# Tag a sentence
sentence = Sentence("Gallia est omnis divisa in partes tres.")
tagger.predict(sentence)
for token in sentence:
print(f"{token.text:12s} {token.get_label('upos').value}")
Output:
Gallia PROPN
est AUX
omnis DET
divisa VERB
in ADP
partes NOUN
tres NUM
. PUNCT
from flair.data import Sentence
from flair.models import SequenceTagger
model_path = hf_hub_download("latincy/la_flair_latincy", "models/ner/best-model.pt")
ner = SequenceTagger.load(model_path)
sentence = Sentence("Caesar in Galliam cum legionibus contendit.")
ner.predict(sentence)
for entity in sentence.get_spans("ner"):
print(f"{entity.text:20s} {entity.get_label('ner').value}")
Output:
Caesar PERSON
Galliam LOC
from flair.data import Sentence
from flair.models import SequenceTagger
model_path = hf_hub_download("latincy/la_flair_latincy", "models/lemmatizer/best-model.pt")
lemmatizer = SequenceTagger.load(model_path)
sentence = Sentence("Arma virumque cano Troiae qui primus ab oris.")
lemmatizer.predict(sentence)
for token in sentence:
print(f"{token.text:12s} {token.get_label('lemma').value}")
Output:
Arma arma
virumque vir
cano cano
Troiae Troia
qui qui
primus primus
ab ab
oris ora
. .
| Property | Value |
|---|---|
| Author | Patrick J. Burns / LatinCy |
| Model type | Flair stacked embeddings + BiLSTM-CRF |
| Language | Latin |
| License | CC BY-NC-SA 4.0 |
| Total size | ~1.35 GB (5 model files) |
| Framework | Flair (Akbik et al.) |
| Component | Model File | Size | Architecture |
|---|---|---|---|
| POS Tagger | models/pos/best-model.pt | 429 MB | BiLSTM-CRF with stacked embeddings |
| NER Tagger | models/ner/best-model.pt | 429 MB | BiLSTM-CRF with stacked embeddings |
| Lemmatizer | models/lemmatizer/best-model.pt | 347 MB | Seq2seq encoder-decoder |
| CharLM (fwd) | models/lm-forward/best-lm.pt | 73 MB | Character-level LSTM language model |
| CharLM (bwd) | models/lm-backward/best-lm.pt | 73 MB | Character-level LSTM language model |
All sequence labeling models use the same stacked embedding architecture:
The stacked embeddings (4396-dim total) are fed into a BiLSTM-CRF for POS/NER, or a seq2seq encoder-decoder for lemmatization.
Trained on harmonized data from 6 Universal Dependencies Latin treebanks, prepared by the LatinCy treebank pipeline. Treebanks are harmonized to consistent annotation standards before combining.
| Treebank | Full Name | Domain |
|---|---|---|
| ITTB | Index Thomisticus Treebank | Scholastic Latin (Thomas Aquinas) |
| LLCT | Late Latin Charter Treebank | Medieval legal charters |
| PROIEL | PROIEL Treebank | Vulgate Bible, historical texts |
| Perseus | Perseus Latin Treebank | Classical Latin (Caesar, Cicero, etc.) |
| UDante | UDante Treebank | Dante Alighieri (De vulgari eloquentia, etc.) |
| CIRCSE | CIRCSE Latin Treebank | LASLA-derived classical texts |
Combined (v0.2): 130,692 train / 12,136 dev / 13,713 test sentences (~2.97M tokens, including LASLA classical Latin data).
Trained on LatinCy NER annotations from 4 sources: 13,493 train / 3,195 dev sentences. Entity types: PERSON (79%), LOC (14%), NORP (7%).
Trained on 1.6 GB of curated Latin text (13.7M sentences from 9 sources) for 10 epochs. Forward and backward CharLMs provide contextualized character-level features to the POS tagger, NER tagger, and lemmatizer.
POS tagger: BiLSTM-CRF with 256-unit hidden layer, stacked Flair + CBOW embeddings, SGD with learning rate 0.1, 150 epochs. Best model at epoch 100.
NER tagger: Same architecture as POS, trained on NER-annotated data, 150 epochs. Best model at epoch 62.
Lemmatizer: Flair seq2seq encoder-decoder with stacked embeddings, GRU decoder, 512-dim hidden, trained with SGD learning rate 0.1, batch size 1024, early stopping with patience 5.
| Component | Metric | v0.1 Test | v0.2 Test | v0.3 Test |
|---|---|---|---|---|
| POS Tagger | F1-micro | 96.65 | 96.89 | 98.02 |
| NER | F1-micro (dev) | — | 90.48 | 92.22 |
| Lemmatizer | F1-micro | 96.55 | 97.46 | 97.41 |
| CharLM (fwd) | Perplexity | — | 3.11 | — |
| CharLM (bwd) | Perplexity | — | 3.12 | — |
POS and Lemma scores are on held-out test sets. NER scores are on dev only (no NER test set exists yet). v0.3 uses Latin BERT transformer embeddings (fine-tuned); v0.2 uses stacked Flair CharLM + CBOW-300 embeddings.
All models trained on the same harmonized treebank data. Scores on held-out test sets unless noted. NER scores are on dev (no test set exists).
| Metric | LatinCy<br>Flair 0.3 | LatinCy<br>Stanza 0.3 | LatinCy<br>UDPipe 0.2 | LatinCy<br>spaCy trf 3.9 |
|---|---|---|---|---|
| UPOS | 98.02 | 97.65 | 93.28 | 97.34 |
| UFeats | -- | 93.93 | 82.48 | 93.95 |
| Lemma | 97.41 | 97.87 | 93.05 | 94.63 |
| UAS | -- | 86.95 | 76.11 | 86.91 |
| LAS | -- | 83.23 | 71.29 | 82.04 |
| NER F1 | 92.22 | 90.22 | -- | 91.14 |
Flair v0.3 with Latin BERT transformer embeddings leads on UPOS and NER. Stanza leads on lemma and dependency parsing. spaCy trf is competitive across all metrics.
@misc{burns2026latincyflair,
author = {Burns, Patrick J.},
title = {{LatinCy Flair (la\_flair\_latincy)}},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/latincy/la_flair_latincy},
}
This work was supported in part through the NYU IT High Performance Computing resources, services, and staff expertise.