File size: 2,007 Bytes
060f099
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
license: apache-2.0
language:
- grc
library_name: transformers
tags:
- ancient-greek
- classical-philology
- character-level
- masked-diffusion
- macronization
pipeline_tag: token-classification
---

# 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 an edited text, *scriptio continua*, and a lacuna of unknown length without changing
anything but its input.

Anonymous release accompanying a paper under review.

Vowel length alone: long versus short at every ambiguous bare α, ι or υ. Trained on a silver
corpus of ~130,000 verse lines built by exact constraint propagation -- a solver accepts a line
only when exactly one metrical grammar scans it, and fixes a *dichronon* only when every
accepting parse agrees -- plus converted syllable-weight markup, all checked against the
evaluation benchmark to prevent leakage.

## Usage

```python
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))   # ἄ^νδρα^ μοι ἔννεπε, μοῦσα^, ...
```