Spaces:
Running

ExplodingCB2 commited on
Commit
2b83005
·
verified ·
1 Parent(s): d06f5dd

Use per-6h calibrated rain probabilities, enable 80% fan by default, and tighten honest UI copy

Browse files
Files changed (4) hide show
  1. about.html +12 -13
  2. app.js +9 -9
  3. engine.js +2 -0
  4. indra.wasm +2 -2
about.html CHANGED
@@ -20,36 +20,35 @@
20
  <main>
21
  <section class="prose">
22
  <h1>About Indra</h1>
23
- <p><a href="https://huggingface.co/Sculptor-AI/Indra">Indra</a> by <a href="https://huggingface.co/Sculptor-AI">Sculptor AI</a> is a <b>standalone, offline 5-day probabilistic weather model</b> with <b>1.69 million parameters</b> packed into a <b>1.03 MB INT4</b> binary running directly in your browser via a 45 KB freestanding WebAssembly module (compiled from the exact zero-allocation C99 microcontroller runtime).</p>
24
- <p><b>Zero guidance.</b> Unlike NWP post-processors, Indra never reads the National Weather Service, National Blend of Models, GFS, or NAM forecasts. Your browser fetches only the station's past 91 days of measurements and computes a 32-member 5-day weather ensemble right on your device. The NWS curve on the main page is fetched strictly for side-by-side comparison.</p>
25
 
26
  <h2>What it reads</h2>
27
  <ul>
28
- <li><b>Only this station's past 91 days of observations</b> at three timescales: 24 hours at 1h resolution, 20 days at 6h resolution, and 70 days at 24h resolution (temperature, dew point, pressure, plus optional wind, precipitation, and cloud cover). It also works on bare <code>BME280</code> barometric nodes (T, P, RH only).</li>
29
- <li><b>Baked pre-2021 global climate prior (32.4 KB):</b> A quantized 1990–2019 ERA5 seasonal map embedded directly inside the 1.03 MB weights blob — zero leakage from test years.</li>
30
- <li><b>On-device 52-byte Bayesian RLS self-adaptation:</b> As each station reports completed UTC days, Indra solves a closed-form 3×3 Bayesian update in 52 bytes (zero backprop) to learn that station's local microclimate offset and seasonal amplitude relative to the coarse global map.</li>
31
  </ul>
32
 
33
- <h2>How it works</h2>
34
  <ul>
35
- <li><b>Architecture:</b> Attention-free multi-scale 1D ConvNeXt encoder → 16-state discrete synoptic regime bottleneck → Residual Optimal-Transport Conditional Flow Matching (OT-CFM) head with Low-Rank AdaLN-Zero, distilled from 8 NFE to <b>2 Euler steps</b>.</li>
36
- <li><b>Training:</b> Pretrained on 4,000 global ERA5 land stations (1990–2020) via distillation from a privileged spatial-mesh teacher observing 12 neighboring stations (200–1,800 km), then fine-tuned on 2,518 global NOAA GHCNh stations (2010–2023) with sensor dropout and randomized RLS adaptation history.</li>
37
- <li><b>MCU Footprint:</b> 1.033 MB INT4 / 1.782 MB INT8, 54.9 KB peak SRAM arena, zero heap allocations (<code>malloc</code>-free), verified to &lt;0.00002 °C parity vs. Python.</li>
38
  </ul>
39
 
40
- <h2>Verified Benchmarks</h2>
41
- <p>Untouched 2025 NOAA GHCNh holdout (444 never-seen stations, bare <code>BME280</code>-only sensors, 5-day mean CRPSS vs. 14-year station climatology):</p>
42
  <table class="tbl">
43
  <thead><tr><th>Model (Unseen Zero-Shot, BME280-Only)</th><th>Mean D1–D5 CRPSS</th><th>D1 Rain AUC</th></tr></thead>
44
  <tbody>
45
- <tr><td class="best">Indra (Unified, Adapted)</td><td class="best">+0.1264</td><td class="best">0.799</td></tr>
46
  <tr><td>HistGradientBoosting (60 GBDT trees)</td><td>+0.1240</td><td>0.762</td></tr>
47
  <tr><td>Ridge Regression</td><td>+0.0683</td><td>0.731</td></tr>
48
  <tr><td>Damped Persistence</td><td>+0.0507</td><td>—</td></tr>
49
  <tr><td>Persistence</td><td>−0.5619</td><td>—</td></tr>
50
  </tbody>
51
  </table>
52
- <p class="note">On untouched 2022 global land ERA5 (30 dates × 4,000 stations), single-node offline Indra achieves Day 1 CRPS 0.95 °C (CRPSS +0.722, calibrated SSR 1.02) vs. deterministic ECMWF IFS HRES (1.07 °C, +0.683), while global 3D NWP/AI models naturally lead Days 2–5 by assimilating planetary upper-air grids.</p>
53
  </section>
54
  </main>
55
  </body>
 
20
  <main>
21
  <section class="prose">
22
  <h1>About Indra</h1>
23
+ <p><a href="https://huggingface.co/Sculptor-AI/Indra">Indra</a> by <a href="https://huggingface.co/Sculptor-AI">Sculptor AI</a> is a tiny, standalone 5-day probabilistic weather model (<b>1.69M parameters</b>, <b>1.03 MB INT4</b>) built for offline microcontrollers and running here in your browser via a 47 KB freestanding WebAssembly build of the zero-allocation C99 runtime.</p>
24
+ <p><b>Zero guidance.</b> Indra never reads NWS, National Blend, GFS, or NAM forecasts. Your browser fetches only the airport's past 91 days of measurements and computes a 32-member 5-day ensemble locally. The NWS line on the forecast page is shown strictly as a comparison reference.</p>
25
 
26
  <h2>What it reads</h2>
27
  <ul>
28
+ <li><b>Only this station's past 91 days of observations</b> across three timescales (24h @ 1h, 20d @ 6h, 70d @ 24h): temperature, dew point, pressure, plus optional wind, precipitation, and cloud cover. It also runs on bare <code>BME280</code> barometric nodes (T, P, RH only).</li>
29
+ <li><b>Embedded pre-2021 global climate map (32.4 KB):</b> A quantized 1990–2019 ERA5 seasonal grid packed inside the 1.03 MB weights blob.</li>
30
+ <li><b>52-byte seasonal offset (causal RLS):</b> A closed-form 3-parameter seasonal bias update that nudges the coarse global grid toward the local station as days accumulate (improving unseen-station 5-day mean CRPSS from +0.120 to +0.126).</li>
31
  </ul>
32
 
33
+ <h2>Honest limits</h2>
34
  <ul>
35
+ <li><b>Days 1–2 vs. Days 3–5:</b> On unseen 2025 NOAA stations, Indra clearly beats simple baselines (persistence, ridge) on Days 1–2 and produces well-calibrated uncertainty ranges (SSR ~ 0.99). Overall it roughly ties a 60-tree gradient-boosted baseline (ahead on Days 1–2 temp and Day 1–5 rain AUC; slightly behind on Days 4–5 temp), and has essentially no temperature skill over 14-year station climatology after Day 3.</li>
36
+ <li><b>Global NWP is much stronger:</b> Operational models like NWS, ECMWF IFS, and Pangu-Weather assimilate global satellites, radar, and upper-air grids, so they have lower point error and higher skill than any single offline station at every lead.</li>
37
+ <li><b>Code &amp; reproducibility:</b> Full model, training, evaluation, and C99 runtime source code are published in <a href="https://huggingface.co/Sculptor-AI/Indra">Sculptor-AI/Indra</a>.</li>
38
  </ul>
39
 
40
+ <h2>Verified Benchmarks (Untouched 2025 NOAA GHCNh)</h2>
41
+ <p>444 never-seen holdout stations, bare <code>BME280</code>-only sensors, 5-day mean CRPSS vs. 14-year station climatology:</p>
42
  <table class="tbl">
43
  <thead><tr><th>Model (Unseen Zero-Shot, BME280-Only)</th><th>Mean D1–D5 CRPSS</th><th>D1 Rain AUC</th></tr></thead>
44
  <tbody>
45
+ <tr><td class="best">Indra (1.69M, 1.03 MB INT4 / FP32)</td><td class="best">+0.1264</td><td class="best">0.799</td></tr>
46
  <tr><td>HistGradientBoosting (60 GBDT trees)</td><td>+0.1240</td><td>0.762</td></tr>
47
  <tr><td>Ridge Regression</td><td>+0.0683</td><td>0.731</td></tr>
48
  <tr><td>Damped Persistence</td><td>+0.0507</td><td>—</td></tr>
49
  <tr><td>Persistence</td><td>−0.5619</td><td>—</td></tr>
50
  </tbody>
51
  </table>
 
52
  </section>
53
  </main>
54
  </body>
app.js CHANGED
@@ -4,7 +4,7 @@ const HOME = "IND";
4
  const S = { data: null, unit: "F", ranges: true, at: HOME, city: null, tz: "America/Indiana/Indianapolis", want: 0 };
5
  try {
6
  S.unit = localStorage.getItem("kind-unit") || "F";
7
- const savedR = localStorage.getItem("kind-ranges");
8
  S.ranges = savedR == null ? true : savedR === "1";
9
  S.at = localStorage.getItem("indra-at") || HOME;
10
  S.city = localStorage.getItem("indra-city");
@@ -99,7 +99,8 @@ function build() {
99
  tl50: p.tl50,
100
  td,
101
  mslp: p.p50,
102
- rain: dayObj ? dayObj.pop_05 : null,
 
103
  rain50: dayObj ? dayObj.pop_50 : null,
104
  nws: nwsForBucket(time.getTime()),
105
  };
@@ -158,8 +159,8 @@ function rowsSpec() {
158
  { id: "nws", h: 18, label: "NWS (compare)" },
159
  { id: "vs", h: 18, label: "NWS vs Indra" },
160
  { id: "sp1", h: 12, label: "" },
161
- { id: "rchart", h: 86, label: `<span>Rain chance %<br><i class="k" style="background:var(--r-ours)"></i>Indra 24h <i class="k" style="background:var(--r-nws)"></i>NWS</span>` },
162
- { id: "rain", h: 18, label: "Indra 24h %", strong: true },
163
  { id: "rnws", h: 18, label: "NWS %" },
164
  { id: "rmeas", h: 18, label: `Measured, ${uR()}` },
165
  { id: "sp2", h: 12, label: "" },
@@ -298,7 +299,7 @@ function drawStrip() {
298
  const tip = p.past
299
  ? `measured ${r0(U.t(p.t))}°`
300
  : `Indra ${r0(U.t(p.t))}° (80%: ${r0(U.t(p.t10))}–${r0(U.t(p.t90))}°)` + (p.nws?.tF != null ? `, NWS ${r0(U.tF(p.nws.tF))}°` : "");
301
- const rainTip = !p.past && p.rain != null ? `. 24h rain >=0.5mm: ${r0(p.rain)}%` : "";
302
  el("title", {}, r, `${fWhen.format(p.time)}: ${tip}${rainTip}`);
303
  });
304
 
@@ -331,11 +332,10 @@ function drawPlace() {
331
  const airport = `${st.name} (${st.id})`;
332
  $("#where").textContent = S.city ? `${S.city}: ${airport}` : airport;
333
  document.title = `${S.city ? S.city.split(",")[0] : st.name} — Indra (Standalone)`;
334
- const reg = d.regime;
335
- $("#zero-meta").innerHTML = `<b>Zero NWP/NWS guidance</b> · Station sensors only · 52 B Bayesian RLS adapted over <b>${d.adaptDays} days</b> · Regime <b>R${reg.id}</b> (${reg.label}, ${(reg.conf * 100).toFixed(0)}%) · Computed in <b>${d.device_seconds}s</b> on your device (${d.model.sizeMB} MB INT4 WASM).`;
336
  $("#place-note").textContent = d.nws?.error
337
  ? "NWS comparison is temporarily unavailable; showing Indra's standalone 5-day forecast."
338
- : "NWS is fetched strictly for side-by-side comparison and is never passed into Indra.";
339
  }
340
 
341
  function drawInputs() {
@@ -504,7 +504,7 @@ $("#units").addEventListener("click", () => {
504
  $("#strip-labels").addEventListener("change", (e) => {
505
  if (e.target.id !== "ranges") return;
506
  S.ranges = e.target.checked;
507
- try { localStorage.setItem("kind-ranges", S.ranges ? "1" : "0"); } catch (err) { /* ignore */ }
508
  render();
509
  $("#ranges").focus();
510
  });
 
4
  const S = { data: null, unit: "F", ranges: true, at: HOME, city: null, tz: "America/Indiana/Indianapolis", want: 0 };
5
  try {
6
  S.unit = localStorage.getItem("kind-unit") || "F";
7
+ const savedR = localStorage.getItem("indra-ranges-v2");
8
  S.ranges = savedR == null ? true : savedR === "1";
9
  S.at = localStorage.getItem("indra-at") || HOME;
10
  S.city = localStorage.getItem("indra-city");
 
99
  tl50: p.tl50,
100
  td,
101
  mslp: p.p50,
102
+ rain: p.rain6h != null ? p.rain6h : (dayObj ? dayObj.pop_05 : null),
103
+ rain24: dayObj ? dayObj.pop_05 : null,
104
  rain50: dayObj ? dayObj.pop_50 : null,
105
  nws: nwsForBucket(time.getTime()),
106
  };
 
159
  { id: "nws", h: 18, label: "NWS (compare)" },
160
  { id: "vs", h: 18, label: "NWS vs Indra" },
161
  { id: "sp1", h: 12, label: "" },
162
+ { id: "rchart", h: 86, label: `<span>Rain chance (6h) %<br><i class="k" style="background:var(--r-ours)"></i>Indra 6h <i class="k" style="background:var(--r-nws)"></i>NWS</span>` },
163
+ { id: "rain", h: 18, label: "Indra 6h %", strong: true },
164
  { id: "rnws", h: 18, label: "NWS %" },
165
  { id: "rmeas", h: 18, label: `Measured, ${uR()}` },
166
  { id: "sp2", h: 12, label: "" },
 
299
  const tip = p.past
300
  ? `measured ${r0(U.t(p.t))}°`
301
  : `Indra ${r0(U.t(p.t))}° (80%: ${r0(U.t(p.t10))}–${r0(U.t(p.t90))}°)` + (p.nws?.tF != null ? `, NWS ${r0(U.tF(p.nws.tF))}°` : "");
302
+ const rainTip = !p.past && p.rain != null ? `. 6h rain chance: ${r0(p.rain)}% (24h >=0.5mm: ${r0(p.rain24)}%)` : "";
303
  el("title", {}, r, `${fWhen.format(p.time)}: ${tip}${rainTip}`);
304
  });
305
 
 
332
  const airport = `${st.name} (${st.id})`;
333
  $("#where").textContent = S.city ? `${S.city}: ${airport}` : airport;
334
  document.title = `${S.city ? S.city.split(",")[0] : st.name} — Indra (Standalone)`;
335
+ $("#zero-meta").innerHTML = `<b>Zero NWP/NWS guidance</b> · Station sensors only · 91d history + 52 B seasonal offset (<b>${d.adaptDays}d</b>) · Computed in <b>${d.device_seconds}s</b> on your device (${d.model.sizeMB} MB INT4 WASM).`;
 
336
  $("#place-note").textContent = d.nws?.error
337
  ? "NWS comparison is temporarily unavailable; showing Indra's standalone 5-day forecast."
338
+ : "NWS is fetched strictly for side-by-side comparison and is never passed into Indra. Without spatial weather grids, Days 3–5 revert toward local seasonal averages.";
339
  }
340
 
341
  function drawInputs() {
 
504
  $("#strip-labels").addEventListener("change", (e) => {
505
  if (e.target.id !== "ranges") return;
506
  S.ranges = e.target.checked;
507
+ try { localStorage.setItem("indra-ranges-v2", S.ranges ? "1" : "0"); } catch (err) { /* ignore */ }
508
  render();
509
  $("#ranges").focus();
510
  });
engine.js CHANGED
@@ -225,6 +225,7 @@ const Engine = (() => {
225
 
226
  const dailyRaw = new Float32Array(ex.memory.buffer, ex.wasm_out_daily(), 47);
227
  const stepRaw = new Float32Array(ex.memory.buffer, ex.wasm_out_6h(), 180);
 
228
 
229
  const daily = [];
230
  for (let d = 0; d < 5; d++) {
@@ -257,6 +258,7 @@ const Engine = (() => {
257
  tl50: stepRaw[o + 6],
258
  p50: stepRaw[o + 7],
259
  dp_dep: stepRaw[o + 8],
 
260
  dayIdx: Math.floor(k / 4),
261
  });
262
  }
 
225
 
226
  const dailyRaw = new Float32Array(ex.memory.buffer, ex.wasm_out_daily(), 47);
227
  const stepRaw = new Float32Array(ex.memory.buffer, ex.wasm_out_6h(), 180);
228
+ const rain6hRaw = new Float32Array(ex.memory.buffer, ex.wasm_out_rain6h(), 20);
229
 
230
  const daily = [];
231
  for (let d = 0; d < 5; d++) {
 
258
  tl50: stepRaw[o + 6],
259
  p50: stepRaw[o + 7],
260
  dp_dep: stepRaw[o + 8],
261
+ rain6h: rain6hRaw[k] * 100,
262
  dayIdx: Math.floor(k / 4),
263
  });
264
  }
indra.wasm CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d378d37948957d86975e98992465080a8a6433601d5bdc2d97569753dc81d00d
3
- size 45961
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3719128c586f9ff9fbfa36ee03fae1b0ffac51ff3d674b91c60ec7b6802082fa
3
+ size 47352