/ Модель

Характеристики

Лицензия
MIT
Библиотека
pytorch
Опубликована
13 окт 2026

topaz-gregg-shorthand-61m

Описание изображенийИзображение → текст3 профессии
60скачиваний за 30 дней0лайковвеса обновлены15 окт 2026

Описание модели

Составлено на русском по карточке модели и метаданным Hugging Face

Компактная CTC-модель распознаёт изображения стенографии Gregg Anniversary и выдаёт запись штрихов в формате Grascii.

Topaz-61M — модель распознавания Gregg Anniversary Shorthand, разработанная авторами проекта Topaz. Это компактная версия модели Topaz-117M: она использует архитектуру CTC и преобразует изображения стенографических записей в Grascii — ASCII-представление штрихов, а не непосредственно в английский текст. В комплект входят веса распознавателя и отдельная модель поиска строк; словарь предлагает возможные английские соответствия для распознанных очертаний.

Модель предназначена для транскрибирования горизонтальных строк и страниц, написанных стенографией Gregg Anniversary (1929). На тестовых печатных таблицах из учебника Gregg Shorthand Functional Method Part Two точность распознавания штрихов составила 84,2%; персональные рукописные заметки могут распознаваться хуже. Для получения связного английского текста авторы предлагают передавать промежуточное представление и словарные подсказки языковой модели. Модель распространяется по лицензии MIT.

Сценарии применения

  • распознавание стенографических записей Gregg Anniversary на изображениях
  • транскрибирование горизонтальных строк Gregg с печатных учебных таблиц
  • подготовка Grascii и словарных подсказок для восстановления английского текста

Ограничения

Обучение и оценка проводились на печатных таблицах, поэтому персональные рукописные записи распознаются хуже. Поддерживается только Gregg Anniversary 1929 года; словарные соответствия неоднозначны и являются кандидатами, а поиск строк может ошибаться на изогнутых или повёрнутых страницах.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

topaz-gregg-shorthand-61m

Topaz-61M is a CTC (Connectionist Temporal Classification)-based model for transcribing Gregg Anniversary Shorthand. This is the smaller version. See Topaz-117M for the larger model.

To achieve this, Topaz-61M does not predict English text directly. Instead, it predicts Grascii, which is a representation of Gregg shorthand strokes in ASCII format. This reduces the burden on the model tremendously by limiting its task to the reading of strokes instead of requiring it to perform the complicated language modeling necessary to convert phonetic stroke representations into English tokens. To facilitate the conversion of the output Grascii into an English representation, we provide an intermediate representation consisting of each word in Grascii combined with suggestions from the Grascii to English dictionary, as well as a prompt for instruction-tuned LLMs instructing it to recover the original plain-text from this intermediate representation. We have found that frontier language models produce fairly good results with this setup, as they are quite intelligent and are able to guess a lot from context even in the face of transcription errors.

Evaluation

On the exercises detailed in "Gregg Shorthand Functional Method Part Two" by Louis A. Leslie, the model achieves 84.2% stroke accuracy.

Demonstrations

demo1

  • Transcription (Topaz-61M): I-L G T-U TH M-A-T
  • Intermediate (using Grascii dictionary): I-L (while/I will/why will/isle/aisle) G (good/go) T-U (to/two/too/it you/at you) TH (the/their/there) M-A-T (matter/might/mat/my it/my at)
  • Prediction (gpt-6-luna, thinking enabled): I'll go to the mat.

demo2

  • Transcription (Topaz-61M): T TH R T L-N G L
  • Intermediate (using Grascii dictionary): T (it/at) TH (the/their/there) R (are/our/hour) T (it/at) L-N (will not/will in/well in) G (good/go) L (will/well)
  • Prediction (Gemini 3.8 flash, medium thinking): At the hour, it will not go well.

The text below this line is AI-generated.

Evaluation details

Error rates are edit distances over stroke tokens (stroke error) or over whole outlines (outline error), divided by the reference length, scored per paragraph. The Functional Method Part Two plates were never trained on; their even paragraphs form a validation half and their odd paragraphs a test half.

The scores below use the corrected evaluation set introduced with the step-52,000 update (each plate line scored against its own paragraph's text). The original, uncorrected set was lost with an old training machine and could not be re-scored, so it is no longer shown. The two earlier releases are given for comparison; the step-48,100 scores were measured on the first copy of the corrected set, which was rebuilt later with the same lines.

Data (corrected set)Stroke errorOutline errorStep 52,000 strokeStep 52,000 outlineStep 48,100 strokeStep 48,100 outline
Functional Method Part Two, validation half9.4%23.7%10.8%27.2%12.0%29.0%
Functional Method Part Two, test half15.8%31.3%18.1%36.2%19.4%38.6%

(Released checkpoint: training step 92,000. Stroke error is much stricter than a word error rate: one missed circle vowel is an error even when the word is still obvious.)

Usage

pip install -r requirements.txt
python -m topaz page.png                       # -> page.txt, one line of outlines + suggestions per shorthand line
python -m topaz --lines line.png               # the image is a single line
python -m topaz --with-prompt -o out/ *.jpg    # LLM prompt followed by the transcript
python -m topaz --grascii page.png             # Grascii only

From Python:

from topaz import Topaz

topaz = Topaz.from_pretrained(".")            # this directory, or a Hugging Face repo id
t = topaz.transcribe("page.png")              # lines=True for a single line image
print(t.grascii)                              # I-L G T-U TH M-A-T
print(t.intermediate())                       # I-L (while/I will/...) G (good/go) ...
print(t.llm_prompt())                         # paste into an instruction-tuned LLM

Inputs are photos or scans of a page (any size; the line finder rescales it) or a single line. Lines are read one at a time, so a line's reading never depends on what else is on the page. A GPU is used when available; on a CPU a line takes about half a second.

Files

FileContents
model.safetensors, config.jsonRecognizer weights (fp32) and the architectures of both networks
segmenter.safetensorsLine finder weights
vocab.jsonThe 73 CTC tokens (index 0 is the blank)
dictionary.jsonAbout 31,000 outlines, each with its English candidates and scores
prompt.txtThe LLM prompt used by --with-prompt / llm_prompt()
topaz/Inference code: line finder, line straightening, recognizer, greedy CTC decoding, dictionary lookup

Dictionary lookup

Each recognized outline is looked up in dictionary.json, built from the 1930 Anniversary dictionary, the Anniversary brief forms, the 1924 phrase book and the Qwertigraphy word lists, ranked by word frequency. In order: exact matches; phrases written as two joined outlines (I-K → I can); failing that, the words of the closest outlines (stroke edit distance ≤ 2); three-part phrases as a last resort. A capital mark (=) capitalizes the suggestions.

Limitations

  • The real training data and the evaluation are typeset textbook plates. Personal handwritten notes are harder (irregular proportions, personal abbreviations) and will have higher error rates.
  • Only Anniversary (1929) Gregg is supported; other editions (Pre-Anniversary, Simplified, Diamond Jubilee, Centennial) use different outlines.
  • The dictionary suggestions are candidates, not a transcription: shorthand is ambiguous by design (T-U is to/two/too), and outlines that are not in the dictionary get the words of similar outlines.
  • The line finder expects horizontal lines of writing; heavily curved or rotated pages and drawings mixed with text may be split into lines incorrectly.

Architecture

The model is structured into two sequential stages: a segmenter that isolates and straightens lines of shorthand from source images, and a recognizer that maps these rectified lines to CTC stroke probabilities.

Segmenter

  • Network: A lightweight U-Net with a checkpoint footprint of approximately 6 MB.

  • Encoder and Decoder: The encoder features five levels with channel dimensions of 16, 32, 64, 128, and 192. The decoder utilizes bilinear upsampling combined with skip connections.

  • Outputs (at half resolution):

    • Baseline: A thin band tracing along each line's baseline.
    • Body: The primary writing zone situated above the baseline, where height directly defines the line spacing ($L$).
  • Post-Processing:

    • The predicted maps are traced into polylines, ordered into reading sequence column-by-column, and split cleanly at vertical rules.
    • Each line is rectified by resampling along its traced baseline, effectively straightening any tilted, drifting, or wavy handwriting.

Recognizer

  • Core Design: A CTC-only architecture comprising 61.2 million parameters.

  • Input Format: Grayscale line images scaled to 128 pixels in height (with ink represented as high values) and variable widths (up to 1,600 pixels during training and 2,400 pixels during inference).

  • CNN Backbone (16.0M parameters):

    • Features a 3x3 stride-2 stem followed by ResNet-style blocks with channel progressions of 64 $\to$ 128 $\to$ 256 $\to$ 512 $\to$ 512.
    • Downsamples height by a factor of 32 and width by 4, resulting in 4 rows and 512 channels per column.
  • Projection: Each column ($4 \times 512 = 2,048$ features) passes through a linear layer down to a dimension of 512, paired with sinusoidal position encodings to yield one output frame per 4 pixels of line width.

  • Transformer Encoder: Consists of 14 pre-norm layers, $d_{model} = 512$, 8 attention heads, a feed-forward network dimension of 2,048 with ReLU activation, a dropout rate of 0.1, and padding masks for handling variable widths.

  • Classification Head: Utilizes LayerNorm followed by a linear projection to 73 tokens, decoded using greedy CTC (where blank = token 0).

  • Intermediate CTC: An identical normalization and head applied after encoder layer 7 strictly as a training regularizer.

Training

  • Loss Function: A weighted multi-task loss defined as $0.7 \times \text{CTC} + 0.3 \times \text{intermediate CTC}$.

  • Optimizer & Regularization: AdamW with a weight decay of 0.01, gradient clipping at 1.0, fp16 mixed precision, and a batch size of 64.

  • Learning Rate Schedule: Cosine schedule starting from $3 \times 10^{-4}$ with 2,000 warm-up steps, running up to 80,000 steps.

  • Data Mix: Each training batch consists of 60% synthetic lines (generated on-the-fly via a 20,000-line replay buffer) and 40% augmented real book lines.

  • Training History:

    1. Steps 0–16k: An 8-layer encoder paired with a 6-layer attention decoder, trained jointly using CTC and cross-entropy.
    2. Step 16k: Losslessly converted to CTC-only by inserting 6 identity encoder layers (expanding the encoder from 8 to 14 layers).
    3. Step 20k+: Real data introduced, with its proportion scaled incrementally ($8% \to 20% \to 30% \to 40%$), keeping each increase only if real test performance improved.
    4. Step 43k: CNN capacity expanded from 61.2M to 76.6M parameters with 4 extra ResBlocks (one at 1/8 resolution, two at 1/16, one at 1/32), added as exact identity blocks (zero-initialized final batch normalization) with a 2.2x learning rate multiplier. The real-data share rose to 40% at the same time.
    5. Step 44k: The new blocks' final batch-norm scales were raised from ~0.001 to 0.05 so they receive a useful training signal (this changed no outputs measurably).
    6. Step 48k: The extra blocks were removed again, back to 61.2M parameters. The optimizer had been shrinking them (to ~4% of an established block's scale) and the real test error had not improved, so the extra CNN capacity was not what the model lacked. Removing them changed no frame's best token on a probe batch; training continued briefly to settle the remaining weights. The first release was the step-48,100 checkpoint.
    7. Steps 48.1k to 52k: Training resumed from the first release with its optimizer state, the learning rate continuing down the same cosine curve. From step 49,000 the real lines came from the re-aligned books below: the same garbled paragraph numbers had also cost the training books some lines, and re-aligning them with the corrected paragraph detection returned about 300. This was the second release.
    8. Steps 52k to 92k: Training continued on a rented RTX 3090 from the step-52,000 weights with a fresh optimizer (learning rate 1.5e-4, 1,000 warm-up steps, cosine decay to step 100,000). All books were downloaded, OCR'd and aligned again (with the 117M model), and more books were added as they were found, each at a checkpoint: Gregg Shorthand by the Direct Method (step 71,000); eight Anniversary literature editions whose key is the Project Gutenberg text of the same work, plus Creeds of Great Business Men with its reviewed key (75,000); a fix for line-end hyphenation in the keys ("satis- fied"), with the affected lines re-extracted or dropped (76,000); Progressive Exercises and two Mary Raymond Shipman Andrews stories serialized in the Gregg Writer (78,000); and the reading exercises of the 1929 Manual, keyed by the 1930 Key to the Manual (80,000). The real lines more than doubled, from about 13,200 to 28,400. The step-92,000 checkpoint, the best on both halves of the evaluation, is the one released.

Synthetic Data Pipeline

  • Outlines:

    • 17,766 engraved outlines sourced from the 1930 Anniversary dictionary, skeletonized into centerline graphs, and redrawn dynamically with randomized pen profiles.
    • A procedural renderer built from primitive strokes following Gregg joining rules via the grascii library. Dimensions are calibrated against engraved strokes, circle vowels adhere strictly to manual rules, and smooth joins utilize tangent-blending.
  • Handwriting Simulation:

    • Simulates realistic pen-motion dynamics (spring-damped pen lag that rounds corners and introduces overshoots).
    • Applies elastic distortion alongside variations in slant, size, and spacing.
  • Text Generation:

    • Pulls running text from public-domain literature and Wikipedia, converting word-by-word through the lexicon with proper phrasing, punctuation, and capitalization.
    • Interleaves frequency-sampled random outlines to prevent the model from relying heavily on sentence context.
  • Page Composition:

    • Renders across 7 paper types (white, cream, notebook, steno, legal, graph, aged) and 5 ink variations (black, blue, blue-black, pencil, faded).
    • Incorporates ruled lines, margins, and surrounding printed text, placing shorthand into available free space.
    • Cuts lines using the identical rectification pipeline applied during inference.
  • Labeling Rule: Labels strictly describe the visible graphical strokes rather than the underlying intended words.

Real Data Pipeline

Scanned historical textbooks with typed key texts aligned line-by-line using a bootstrap CTC model:

  1. Pages processed via Tesseract OCR to extract initial keys.
  2. Manual review and correction of OCR errors in the keys (~500 manual fixes).
  3. Alignment of key words directly to plate lines.
  4. Filtering out lines where the transcription disagreed with the reference label.

The literature editions have no printed key; their text is the Project Gutenberg edition of the same work, found page by page in the full text. Lines from these books and from the later textbooks pass stricter filters (no digits or all-caps words that only the key has, no crops holding several rows of writing).

Textbook SourceClean Lines
Gregg Shorthand Manual, Functional Method vol. 12,792
Transcription Drills932
Fundamental Drills (1932)3,126
Gregg Dictation & Transcription (1937)3,267
Gregg Speed Studies (1929)1,635
Graded Readings in Gregg Shorthand (1930)1,483
Gregg Shorthand by the Direct Method (1933)3,829
Gregg Shorthand Manual (1929), reading exercises435
Progressive Exercises in Gregg Shorthand (1929)446
Creeds of Great Business Men891
Mary Raymond Shipman Andrews stories2,405
Letters from a Self-Made Merchant to His Son1,525
Alice's Adventures in Wonderland1,243
The Legend of Sleepy Hollow1,018
A Christmas Carol996
The Man Without a Country891
The Great Stone Face627
Rip Van Winkle547
O. Henry stories321
Total$\approx$28,400 lines, $\approx$247k words

Real lines undergo heavy augmentation during training, including stretching, shearing, rotation, curved baseline warping via smooth remaps, stroke thickening/thinning, blurring, contrast adjustment, and background noise injection.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · pytorch

Нельзя запустить

Архитектура ? неизвестна transformers в образе рантайма.

Ревизия весов
77f32b5

0 моделей