Instructions to use Ericu950/CharDiff-grc-meter with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Ericu950/CharDiff-grc-meter with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="Ericu950/CharDiff-grc-meter", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Ericu950/CharDiff-grc-meter", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
CharDiff-grc-meter (macronization + metrical scansion)
A CharDiff-grc backbone fine-tuned for two joint per-letter classification tasks: macronization
(recovering vowel length on ambiguous bare α/ι/υ, since Ancient Greek orthography never marks it)
and metrical scansion (heavy/light/verse-final syllable weight). Fine-tuned from
Ericu950/CharDiff-grc-doc_clean
with an ELMo-style learned mix over all 32 backbone layers, plus a fine-tune-only capitalization
input channel.
The benchmark used is Albin Thörn Cleland's Norma benchmark (932 hand-annotated lines, 16 authors, Homer to Nonnus, plus 78 lines of Aristophanic lyric, deliberately disjoint from the Hypotactic scansion resource so a Hypotactic-trained model gains no unfair benchmark advantage). Training data was source from Cleland's macronizer, from a ~130,000-line silver training corpus (mined via a rule-based finite-state metrical constraint solver over hexameter/iambic/choliambic/elegiac/trochaic/anapaestic grammars, with exact constraint propagation — a dichronon's length is fixed only when every valid parse of its line agrees), and Hypotactic-
Results (this checkpoint, single model, no ensembling)
| task | split | metric | value |
|---|---|---|---|
| Macronization (long/short, ambiguous α/ι/υ) | Norma test (n=2660, 16 sources) | balanced acc / acc | 0.924 / 0.936 |
| Macronization | Norma dev (n=306, 13 sources) | balanced acc / acc | 0.942 / 0.964 |
| Scansion, gold-syllabified (none/heavy/light/verse-end) | Norma test (n=29,171) | balanced acc / acc | 0.896 / 0.879 |
| Scansion, whole verses by work | held-out work split (n=131,948) | balanced acc / acc | 0.991 / 0.990 |
Usage
import torch
from transformers import AutoModel
model = AutoModel.from_pretrained("Ericu950/CharDiff-grc-meter", trust_remote_code=True)
model.eval()
from processing_char_bert_meter import CharBertMeterProcessor
processor = CharBertMeterProcessor()
# macronization: only ambiguous alpha/iota/upsilon positions get a mark (`_`=long, `^`=short)
text = "βαρυκτυπος ανθρωπος"
batch = processor(text)
with torch.no_grad():
out = model(**{k: v for k, v in batch.items() if not k.startswith("_")})
print(processor.decode_macronization(out, batch))
# metrical scansion: [heavy] / {light} syllable brackets, per letter
print(processor.decode_scansion(out, batch))
Unlike the base pretraining model, capitalization (cap) is a real input here (fine-tune-only
channel, zero-init) — the processor's __call__ includes it in the batch directly rather than
keeping it out-of-band.
Citation
See the CharDiff-grc repository and the associated paper (citation to be added on publication).
- Downloads last month
- -