NEST

Docs

Install, verify data, train, evaluate

Every command on this page runs against the current repository. No placeholder output, no invented flags — if something does not work yet, it says so.

01

Requirements

Python 3.9 or later, and PyTorch 2.0 or later. The rest of the stack comes from requirements.txt: transformers for the BART decoder, mne for EEG preprocessing, plus numpy, scipy, pandas, lightning, h5py, jiwer, and python-Levenshtein for evaluation.

A CPU or an Apple Silicon Mac with MPS is enough for --quick-test and the CTC model. The BART model is trained with --fp16, which requires an NVIDIA GPU with CUDA; NEST v2 BART has not been trained to completion yet because that GPU time has not been available.

02

Install

Clone the repository, create a virtual environment, and install the dependencies.

Terminal
git clone https://github.com/wazder/nest
cd nest
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

There is no PyPI package. pip install nest does not exist, and pip install -e . does not work yet: pyproject.toml has no [project] table, so there is nothing for pip to build. Run scripts directly from a cloned checkout, as shown throughout this page.

03

Data

NEST trains on the ZuCo corpus. Request access at osf.io/q3zws and place the extracted pickles so the layout matches what the loader expects, one pickle file per task:

Expected layout
ZuCo_Dataset/ZuCo/task1-SR/pickle/task1-SR-dataset.pickle
ZuCo_Dataset/ZuCo/task2-NR/pickle/task2-NR-dataset.pickle
ZuCo_Dataset/ZuCo/task3-TSR/pickle/task3-TSR-dataset.pickle

Verify the dataset loads and reports the expected number of sentence-subject pairs:

Terminal
python src/data/zuco_pickle_dataset.py ZuCo_Dataset/ZuCo
04

Quick test

Before a full run, confirm the pipeline works end to end. --quick-test trains for 2 epochs on 50 samples and skips the held-out test evaluation.

Terminal
python scripts/train_nest_v2.py --quick-test --model ctc
05

Train

The training entry point is scripts/train_nest_v2.py. It supports two model types, ctc and bart, selected with --model.

CTC baseline (linear CTC head, runs on CPU, MPS or GPU):

Terminal
python scripts/train_nest_v2.py --model ctc --epochs 200

BART decoder (best quality, needs an NVIDIA GPU for --fp16):

Terminal
python scripts/train_nest_v2.py \
    --model bart \
    --epochs 200 \
    --batch-size 16 \
    --fp16 \
    --d-model 768 \
    --num-layers 6 \
    --tasks task1-SR task2-NR task3-TSR

Flags that exist on train_nest_v2.py, verified against its argument parser:

FlagDefaultMeaning
--modelctcModel type: ctc or bart
--data-dirZuCo_Dataset/ZuCoPath to the ZuCo dataset
--taskstask1-SR task2-NR task3-TSRZuCo tasks to include
--epochs200Number of training epochs
--batch-size16Training batch size
--lr3e-4Learning rate
--d-model512Transformer hidden size, 512 or 768
--num-layers6Number of Transformer encoder layers
--nhead8Number of attention heads
--fp16offMixed precision; requires CUDA
--grad-accum4Gradient accumulation steps
--patience20Early stopping patience, in epochs
--output-dirnoneWhere to write results
--resumenonePath to a checkpoint to resume from
--num-workers0DataLoader worker processes
--fixationGDEEG fixation measure: FFD, TRT or GD
--quick-testoff2 epochs, 50 samples, skip test eval
--no-subject-splitoffRandom 80/10/10 split instead of subject-independent
06

Evaluate

Evaluation is not a separate script. Pass a checkpoint to --resume, point --output-dir at that checkpoint's directory so the final evaluation step reloads it, and set --epochs 0 to skip training:

Terminal
python scripts/train_nest_v2.py \
    --resume results/nest_v2_bart_TIMESTAMP/best_model.pt \
    --output-dir results/nest_v2_bart_TIMESTAMP \
    --epochs 0

Results are written to results.json with a test_wer and a test_cer field: word error rate and character error rate, both computed as Levenshtein edit distance against the reference text. The BART path decodes with model.generate(), free autoregressive decoding with no teacher forcing (greedy in the current implementation). The CTC path decodes greedily. No checkpoint exists yet, so no results.json has been produced by this path.

07

Cloud

Local training needs an NVIDIA GPU for the BART run. notebooks/NEST_CloudTraining.ipynb is a ready-to-run Colab notebook for that case. On an A100, a full 200-epoch BART run is estimated at 8 to 12 hours; that estimate has not been measured end to end because the run has not completed.

08

Repository layout

nest/
src/          preprocessing, models (nest.py, nest_bart.py, nest_v2.py),
              data loaders, training and evaluation modules
scripts/      train_nest_v2.py, train_nest_bart.py, upload_to_huggingface.py
notebooks/    NEST_CloudTraining.ipynb (Colab)
papers/       NEST_manuscript.md (technical report draft)
configs/      YAML model configurations
tests/        80 test functions across 5 files
website/      this site (Cloudflare Pages)
09

Known issues

  • The test suite (80 test functions in 5 files) currently fails to import because of code and test drift. It has not been repaired yet; see Contributing for how to help.
  • pyproject.toml has no [project] table, so packaging metadata is missing and pip install -e . does not work.
  • No trained NEST v2 checkpoint exists. The one completed run trained a small ad hoc LSTM smoke-test model, not NEST v2, and its loss decreased without any word error rate being computed.

Track these and file new ones at github.com/wazder/nest/issues.

10

Evaluation protocol commitment

No word error rate is published on this site until it is measured with free decoding on held-out subjects, alongside a noise-input control. The full commitment and the reasoning behind it are on the research page.

Run into a problem

Open an issue with your command, your environment, and the error. Real bugs get fixed faster than reports get written.