Add the steps to use the data as is
Browse files
README.md
CHANGED
|
@@ -13,41 +13,70 @@ The exact MAST data used to pretrain the MASTER masked auto-encoder tokenizer: t
|
|
| 13 |
signal cache, its camera targets, and the TokaMark task 1 windows the model is trained and
|
| 14 |
scored on. Files are byte-identical to the training inputs; nothing was converted for upload.
|
| 15 |
|
| 16 |
-
##
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
| `master/shots/<split>/<shot>.bin` | 11,177 shots, 40 signals at native rate in physical units: a JSON header, then one LZ4 block per 10 ms piece with float32 values and a state byte per value |
|
| 21 |
-
| `master/meta.json` | Schema, j_tor cells the model reads, and the shots of each split (train 8,954, val 1,114, test 1,109) |
|
| 22 |
-
| `master/stats.npz` | Normalization center, scale and count per channel, fitted on observed training values |
|
| 23 |
-
| `master/audit.json` | Spread of each signal after its transform, and how many values each rejection rule removed |
|
| 24 |
-
| `master/cameras/<shot>.bin` | 8,387 shots: per piece and camera (`rba`, `rbb`, `rbc`, `rgb`, `rgc`) the two 5 ms chunk-mean 224 x 224 canvases and frame counts, on the piece grid of `master/shots` |
|
| 25 |
-
| `master/cameras/meta.json` | Canvas geometry and the vocabulary of each camera token field |
|
| 26 |
-
| `tokamark/task_1-{1,2,3}/{train,val,test}.npz` | TokaMark task 1 windows exported by `methods.tokamind.export` |
|
| 27 |
|
| 28 |
-
|
| 29 |
-
finite values, used by the MAE, but excluded from the normalization statistics.
|
| 30 |
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
|
| 34 |
-
split folders (the Hub allows at most 10,000 files per folder; the code reads `master/shots/<shot>.bin`):
|
| 35 |
|
| 36 |
-
```sh
|
| 37 |
-
hf download lmil/tsam_preprocessed --repo-type dataset --local-dir data
|
| 38 |
-
|
| 39 |
-
```
|
| 40 |
|
| 41 |
-
|
|
|
|
| 42 |
|
| 43 |
-
```sh
|
| 44 |
-
|
| 45 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
```python
|
| 48 |
from pathlib import Path
|
|
|
|
| 49 |
from methods.MASTER.dataset import Transform, Windows
|
| 50 |
|
| 51 |
windows = Windows(Path("data/master"), "train", chunks=4, cameras=("rba", "rbb"))
|
| 52 |
-
|
|
|
|
|
|
|
| 53 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
signal cache, its camera targets, and the TokaMark task 1 windows the model is trained and
|
| 14 |
scored on. Files are byte-identical to the training inputs; nothing was converted for upload.
|
| 15 |
|
| 16 |
+
## Use as is
|
| 17 |
|
| 18 |
+
The data was built with, and is read by, commit `c06b314` of the code repository
|
| 19 |
+
[lucas-maes/nuclear](https://github.com/lucas-maes/nuclear) (private: ask the author for access).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
1. Get the code at that commit and install it with [uv](https://docs.astral.sh/uv/):
|
|
|
|
| 22 |
|
| 23 |
+
```sh
|
| 24 |
+
git clone https://github.com/lucas-maes/nuclear && cd nuclear
|
| 25 |
+
git checkout c06b314
|
| 26 |
+
uv sync
|
| 27 |
+
```
|
| 28 |
|
| 29 |
+
2. From the repository root, download into `data/` (148 GB), the location the code reads by default:
|
|
|
|
| 30 |
|
| 31 |
+
```sh
|
| 32 |
+
uv run hf download lmil/tsam_preprocessed --repo-type dataset --local-dir data
|
| 33 |
+
```
|
|
|
|
| 34 |
|
| 35 |
+
3. Move the shots out of their split folders. The Hub allows at most 10,000 files per folder,
|
| 36 |
+
so they are stored as `master/shots/<split>/<shot>.bin`; the code reads `master/shots/<shot>.bin`:
|
| 37 |
|
| 38 |
+
```sh
|
| 39 |
+
for split in train val test; do mv data/master/shots/$split/*.bin data/master/shots/ && rmdir data/master/shots/$split; done
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
4. Train the masked auto-encoder on the three task 1 tasks (it reads `data/master` and `data/tokamark`):
|
| 43 |
+
|
| 44 |
+
```sh
|
| 45 |
+
uv run python -m methods.MASTER.mae task_1-1 task_1-2 task_1-3
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
On Slurm, `methods/MASTER/slurm/mae.sh` takes the same arguments, copies the cache to the
|
| 49 |
+
node's local disk first, and requeues itself before the time limit:
|
| 50 |
+
|
| 51 |
+
```sh
|
| 52 |
+
mkdir -p logs && sbatch methods/MASTER/slurm/mae.sh task_1-1 task_1-2 task_1-3
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
To read the data directly:
|
| 56 |
|
| 57 |
```python
|
| 58 |
from pathlib import Path
|
| 59 |
+
from methods.MASTER.cameras import CameraTransform
|
| 60 |
from methods.MASTER.dataset import Transform, Windows
|
| 61 |
|
| 62 |
windows = Windows(Path("data/master"), "train", chunks=4, cameras=("rba", "rbb"))
|
| 63 |
+
item = windows[0] # item["values"][name]: (chunks, samples, channels), physical units
|
| 64 |
+
normalized, used = Transform(Path("data/master"))(item["values"], item["states"], unrated=True)
|
| 65 |
+
# item["cameras"][name]: frames (chunks, 224, 224), count, padding, tokens, bounds
|
| 66 |
```
|
| 67 |
+
|
| 68 |
+
## Layout
|
| 69 |
+
|
| 70 |
+
| Path | Content |
|
| 71 |
+
| --- | --- |
|
| 72 |
+
| `master/shots/<split>/<shot>.bin` | 11,177 shots, 40 signals at native rate in physical units: a JSON header, then one LZ4 block per 10 ms piece with float32 values and a state byte per value |
|
| 73 |
+
| `master/meta.json` | Schema, j_tor cells the model reads, and the shots of each split (train 8,954, val 1,114, test 1,109) |
|
| 74 |
+
| `master/stats.npz` | Normalization center, scale and count per channel, fitted on observed training values |
|
| 75 |
+
| `master/audit.json` | Spread of each signal after its transform, and how many values each rejection rule removed |
|
| 76 |
+
| `master/cameras/<shot>.bin` | 8,387 shots: per piece and camera (`rba`, `rbb`, `rbc`, `rgb`, `rgc`) the two 5 ms chunk-mean 224 x 224 canvases and frame counts, on the piece grid of `master/shots` |
|
| 77 |
+
| `master/cameras/meta.json` | Canvas geometry and the vocabulary of each camera token field |
|
| 78 |
+
| `tokamark/task_1-{1,2,3}/{train,val,test}.npz` | TokaMark task 1 windows exported by `methods.tokamind.export` |
|
| 79 |
+
|
| 80 |
+
EFIT equilibrium samples that have no rating are kept under their own state, `UNRATED` (7):
|
| 81 |
+
their values are finite and the masked auto-encoder uses them (`unrated=True`, its default),
|
| 82 |
+
but they are excluded from the normalization statistics.
|