--- license: mit library_name: onnx pipeline_tag: tabular-regression datasets: - sankalpsthakur/forge-pump-digital-twin-synthetic tags: - industrial - pump - digital-twin - edge-ai - onnx - onnxruntime - pytorch - tensorflow - tflite - litert - anomaly-detection --- # Forge Pump Surrogate — Multi-runtime A **1,478-parameter**, clean-room pump surrogate exported from one PyTorch MLP to four deployable formats: | Runtime | Artifact | |---|---| | ONNX Runtime / ONNX Runtime Web | `onnx/model.onnx` | | PyTorch | `pytorch/model.ts`, `pytorch/model_state.pt` | | TensorFlow | `tensorflow/model.keras` | | LiteRT / TensorFlow Lite | `tensorflow/model.tflite` | The architecture is a `6 → 32 → 32 → 6` ReLU MLP with input/output normalization embedded in the exported graph. It was trained only on [`forge-pump-digital-twin-synthetic`](https://huggingface.co/datasets/sankalpsthakur/forge-pump-digital-twin-synthetic). ## Inputs and outputs Input order: ```text speed_fraction, static_head_m, system_k, voltage_fraction, ambient_temp_c, inlet_pressure_bar ``` Output order: ```text flow_m3h, total_head_m, input_power_kw, winding_temp_c, npsh_margin_m, efficiency_fraction ``` ## Test-set metrics These scores measure approximation of a deterministic synthetic generator—not field accuracy. | Target | MAE | RMSE | R² | |---|---:|---:|---:| | Flow (m³/h) | 0.08441 | 0.11749 | 0.99903 | | Total head (m) | 0.59088 | 0.83321 | 0.99914 | | Input power (kW) | 0.03165 | 0.05005 | 0.99814 | | Winding temperature (°C) | 0.26721 | 0.40810 | 0.99917 | | NPSH margin (m) | 0.07605 | 0.10571 | 0.99977 | | Efficiency fraction | 0.00361 | 0.00701 | 0.99751 | ## Cross-runtime gate Thirty-two frozen test vectors passed an absolute tolerance of `1e-3`: | Comparison against PyTorch | Maximum absolute difference | |---|---:| | ONNX Runtime | 1.5259e-5 | | TensorFlow | 1.5259e-5 | | LiteRT/TFLite | 1.5259e-5 | Exact receipts are in `conformance_receipt.json`, `test_vectors.json`, and `metrics.json`. ## ONNX CPU example ```python import numpy as np import onnxruntime as ort session = ort.InferenceSession("onnx/model.onnx", providers=["CPUExecutionProvider"]) x = np.array([[0.80, 35.0, 0.25, 1.0, 25.0, 1.2]], dtype=np.float32) y = session.run(None, {"features": x})[0] print(y) ``` `edge/inference_onnx.py` adds named inputs/outputs. `edge/tag_map.yml` shows generic, read-only examples for OPC UA, Modbus input registers, and Siemens S7 symbolic tags. Siemens is a trademark of Siemens AG; this project is independent and is not endorsed by Siemens. ## Measured runtime scope One CPU-only container measurement produced ONNX batch-1 median `0.0061 ms` and p95 `0.0067 ms`; PyTorch batch-1 median was `0.0335 ms`. These are smoke-test receipts, **not device latency SLOs**. See `latency_receipt.json` for the environment and repetitions. CUDA was not available in the validation environment, so this release makes no CUDA performance or kernel claim. ## Safety boundary This repository is read-only advisory software. It contains no network client and no PLC, OPC UA, S7, or Modbus write call. It must not bypass or replace PLC/SIS/ESD logic, permissives, interlocks, hardwired protection, or operator authority. The example thresholds are demonstration values, not equipment setpoints. ## Provenance All data and equations were created clean-room for this public release. No customer telemetry, vendor curves, CAD, BOM, nameplate, plant identifier, private model weight, or proprietary source is included. ## Rebuild and verify The generator, training/export script, runtime adapters, manifests, hashes, history, and tests are included. The published build was verified with PyTorch 2.13.0, ONNX Runtime 1.28.0, TensorFlow 2.21.0, and a CPU-only execution provider. Interactive browser demo: [`forge-pump-edge-twin-lab`](https://huggingface.co/spaces/sankalpsthakur/forge-pump-edge-twin-lab)