Files
paultal 98e88cac04 Add clean Path A proof of concept (#1)
Spoken-English math to Typst with a small (~8M parameter) encoder-decoder Transformer trained from scratch, following the build guide (Path A only).

## What's in it
- `generate.py` / `render.py` / `ast.py`: random expression trees rendered to Typst (deterministic) and English (random phrasings); every Typst string is compile-checked, split by a hash of the Typst string
- `tokenizer.py`: byte-level BPE shared by both sides
- `model.py`: `nn.Transformer` seq2seq with `encode()` / `decode()` for inference
- `train.py`: teacher forcing, AdamW, warmup + cosine, overfit-100 sanity check, checkpoints
- `translate.py`: greedy decoding CLI (`uv run isotope "..."`)
- `evaluate.py`: exact match + compile rate on the synthetic test split and `eval/hand_test.jsonl`
- `run.sh`: whole pipeline; `./run.sh --quick` is a 2-minute smoke run
- `AGENTS.md`: commit and workflow rules for agents

## Checked
- `uv run pytest` (8 tests: Typst compiles, English is unambiguous, tokenizer round-trips, causal mask) and `ruff check` pass
- `./run.sh --quick` and the full `./run.sh` run end to end on an M-series Mac

Reviewed-on: #1
Co-authored-by: Paul Tal <[email protected]>
2026-11-27 00:24:05 +02:00

39 lines
896 B
TOML

[project]
name = "isotope-typst"
version = "0.1.0"
description = "Spoken-English math -> Typst math with a small Transformer trained from scratch"
readme = "README.md"
authors = [
{ name = "Paul Tal", email = "[email protected]" }
]
requires-python = ">=3.12"
dependencies = [
"numpy>=2.5.5",
"tokenizers>=0.23.3",
"torch>=2.15.0",
]
[project.scripts]
isotope-gen = "isotope_typst.generate:main"
isotope-tokenizer = "isotope_typst.tokenizer:main"
isotope-train = "isotope_typst.train:main"
isotope-eval = "isotope_typst.evaluate:main"
isotope = "isotope_typst.translate:main"
[build-system]
requires = ["uv_build>=0.13.9,<0.14.0"]
build-backend = "uv_build"
[dependency-groups]
dev = [
"pytest>=9.2.0",
"ruff>=0.17.6",
]
[tool.ruff]
line-length = 120
[tool.pytest.ini_options]
testpaths = ["tests"]
filterwarnings = ["ignore:enable_nested_tensor"]