diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..b4c4b458677943ac137263df0bb1ea808c7a8629 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 NoahH72 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 16eb06471fb11d770343677c615ab2a88151e9ae..cb94134528e532e384246b71e9eb8a182b4d9cf5 100644 --- a/README.md +++ b/README.md @@ -7,165 +7,151 @@ tags: - plasma-physics - tokamak - diii-d - - state-space-model - mamba - - time-series - - real-time --- -# fuse29 — Mamba-2 pedestal predictor for DIII-D +# FUSE-EFIT (in era), ONNX -A 29-input, 6-layer Mamba-2 state-space model that predicts nine pedestal -quantities at ρ_tor = 0.85 from DIII-D actuator settings, at 20 Hz, with a -strictly causal O(1)-per-tick inference path suitable for real-time control. +A 20 Hz, strictly causal model of the DIII-D plasma edge, driven by the heating, fuelling and field +actuators, the measured plasma current, the loop voltage and the EFIT01 boundary shape. Physical units +in, physical units out. Code, documentation and the input contract: https://github.com/NoahH72/FUSE-Pedestal-Predictor-Mamba-ONNX +(`docs/EXPORT.md`, `docs/INPUT_CONTRACT.md`, `MODEL_CARD.md`). -Packaged as two ONNX graphs with normalisation baked in: **raw physical units -in, physical units out.** +## Two forms, one calling convention -| | | -|---|---| -| Parameters | 11,254,425 | -| Architecture | Mamba-2 (SSD), 6 layers, d_model 512, d_state 128 | -| Inputs | 29 actuator channels, physical units | -| Outputs | 9 heads, physical units | -| Cadence | 20 Hz (50 ms) | -| Precision | float32 | -| ONNX opset | 17 | -| Step latency | ~2.9 ms/tick, CPU, batch 1 | -| License | MIT | +| form | what it is | networks per tick | ONNX files | step call, 1 thread | step call, 8 threads | +|---|---|---:|---:|---|---| +| `single` | replicate 0 of the in-era finals (seed 100), the frozen delivered network | 1 | 184 MB | 4.87 ms (99th percentile 5.08 ms) | 1.95 ms (99th percentile 2.00 ms) | +| `averaged` | the eight in-era finals (seeds 100-107); the mean of their raw outputs at every tick | 8 | 1468 MB | 56.33 ms (99th percentile 59.45 ms) | 18.25 ms (99th percentile 18.60 ms) | -## Intended use +Timing: Intel(R) Xeon(R) CPU Max 9470C, onnxruntime 1.30.0, CPU, batch 1. The control cycle is 50 ms per tick. The two forms take and return the same tensors +with the same names, shapes and units; only the recurrent state is larger for `averaged` +(19.9 MB per shot against 2.5 MB). +A host switches form by choosing a folder. -Predicting pedestal density, temperature, rotation, heights and locations from -the actuator request, inside FUSE or an equivalent DIII-D control or analysis -pipeline. The step graph is designed for the 50 ms control cycle; the sequence -graph is for offline scoring and replay. - -**Not** intended for other machines, other radial locations, or as a -safety-critical interlock. It has no uncertainty estimate and no -out-of-distribution detector. - -## Quickstart +## Files -```bash -pip install numpy onnxruntime +``` +era/single/fuse_efit_single_step.onnx one 50 ms tick per call, state in and out +era/single/fuse_efit_single_sequence.onnx one window of 256 ticks +era/averaged/fuse_efit_averaged_step.onnx +era/averaged/fuse_efit_averaged_sequence.onnx +era/