How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("token-classification", model="Ericu950/Stoicheia-macronizer", trust_remote_code=True)
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("Ericu950/Stoicheia-macronizer", trust_remote_code=True, device_map="auto")
Quick Links

Stoicheia -- macronization

Stoicheia is a 405M-parameter character-level masked-diffusion encoder for Ancient Greek (d_model 1024, depth 32, banded attention: three of every four blocks attend within a 256-character window, the fourth globally). Its input is factored into five aligned planes -- letters, word/sentence boundaries, diacritics, capitalization, punctuation -- each of which can be masked independently to an explicit unknown state at inference. That is what lets one model read both an edited text and scriptio continua without changing anything but its input.

Released with Eric Cullhed and Albin Thörn Cleland, Stoicheia: Character-Level Masked Diffusion for Ancient Greek Textual Restoration, Parsing, and Metrical Scansion (EACL 2027). Code: github.com/ericu9500/stoicheia.

Vowel length alone: long versus short at every ambiguous bare α, ι or υ. Fine-tuned on silver labels: 177K verse lines, converted from Hypotactic's syllable-weight markup or mined by a constraint solver that fixes a dichronon only where every admissible metrical parse agrees, and 1.6M lines of Opera Graeca Adnotata prose macronized by the rule-based system of Thörn Cleland and Cullhed, sampled 150K per epoch. Every source was screened against the Norma benchmark to prevent leakage.

Which run this is. Seed 0 of the macron-only recipe (configs/meter/mac_v2.json in the code repository): twelve epochs, keeping the epoch with the best balanced accuracy on Norma's validation positions (epoch 4: 88.86 balanced accuracy, 93.03 accuracy, 2,498 positions). On Norma's 1,916 test positions it reaches 94.26 accuracy (91.73 balanced accuracy).

Backbone. Fine-tuned from an earlier pretraining run of the same 405M architecture, whose data mixture was annealed towards the pristine tier (configuration in training_metadata.json under pretrain_cfg); that backbone is not among the released checkpoints. Three seeds fine-tuned from Stoicheia-doc_clean with the same recipe reach 94.83, 93.79 and 91.49 on the same test positions (mean 93.37), the figure reported in the paper.

Usage

import torch
from transformers import AutoModel
from huggingface_hub import hf_hub_download

REPO = "Ericu950/Stoicheia-macronizer"
model = AutoModel.from_pretrained(REPO, trust_remote_code=True).eval()

hf_hub_download(repo_id=REPO, filename="processing_char_bert_meter.py", local_dir=".")
from processing_char_bert_meter import CharBertMeterProcessor

proc = CharBertMeterProcessor()
batch = proc("ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ")
with torch.no_grad():
    out = model(**{k: v for k, v in batch.items() if not k.startswith("_")})
print(proc.decode_macronization(out, batch))   # ἄ^νδρα^ μοι ἔννεπε, μοῦσα^, ...
Downloads last month
48
Safetensors
Model size
0.4B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Space using Ericu950/Stoicheia-macronizer 1

Collection including Ericu950/Stoicheia-macronizer