Spoken-English math to Typst with a small from-scratch encoder-decoder Transformer, following the build guide: compile-checked synthetic data generator, shared BPE tokenizer, nn.Transformer model, training loop with an overfit sanity check, greedy decoding CLI, and evaluation on synthetic and hand-written test sets. ./run.sh runs the whole pipeline. Co-Authored-By: Claude Opus 5.5 <[email protected]>
23 lines
958 B
Bash
Executable File
23 lines
958 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# The whole Path A pipeline: data -> tokenizer -> overfit check -> train -> evaluate.
|
|
# ./run.sh full run (200k pairs, small model, 8000 steps: ~20 min on an M-series Mac)
|
|
# ./run.sh --quick smoke run in ~2 min (20k pairs, tiny model, 1500 steps)
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
command -v typst >/dev/null || { echo "typst CLI missing: brew install typst"; exit 1; }
|
|
|
|
if [[ "${1:-}" == "--quick" ]]; then
|
|
N=20000; TRAIN=(--config tiny --steps 1500 --eval-every 500)
|
|
else
|
|
N=200000; TRAIN=()
|
|
fi
|
|
|
|
uv sync -q
|
|
echo "== 1/5 generate data"; uv run isotope-gen -n "$N"
|
|
echo "== 2/5 train tokenizer"; uv run isotope-tokenizer
|
|
echo "== 3/5 overfit 100 pairs"; uv run isotope-train --overfit 100
|
|
echo "== 4/5 train"; uv run isotope-train ${TRAIN[@]+"${TRAIN[@]}"}
|
|
echo "== 5/5 evaluate"; uv run isotope-eval
|
|
echo
|
|
echo 'Try it: uv run isotope "the integral from 0 to 1 of x squared dx"'
|