File size: 5,029 Bytes
6e36888
 
98e273a
 
6e36888
98e273a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6e36888
 
98e273a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6e36888
98e273a
6e36888
98e273a
6e36888
98e273a
 
 
6e36888
98e273a
 
 
 
6e36888
98e273a
6e36888
 
 
 
 
 
 
 
 
98e273a
6e36888
98e273a
6e36888
98e273a
6e36888
 
 
98e273a
6e36888
 
98e273a
6e36888
 
98e273a
6e36888
98e273a
6e36888
98e273a
 
 
 
 
 
 
 
 
6e36888
98e273a
6e36888
98e273a
6e36888
98e273a
6e36888
98e273a
 
 
 
 
 
 
 
 
6e36888
 
98e273a
 
 
 
 
 
 
6e36888
 
98e273a
6e36888
98e273a
6e36888
98e273a
6e36888
98e273a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
---
license: apache-2.0
library_name: pytorch
pipeline_tag: time-series-forecasting
tags:
- time-series
- forecasting
- pytorch
- deployable
- edge-ai
- onnx
- streaming
- raspberry-pi
- transformer
- zero-shot
- iot
- real-time
- tiny-ml
- timesfm-alternative
- huggingface
metrics:
- mase
- smape
- mae
- crps
model-index:
- name: NanoForecast 500k
  results:
  - task:
      type: time-series-forecasting
      name: Time Series Forecasting
    dataset:
      name: ETTh1
      type: ett
      config: h1
    metrics:
    - type: mase
      value: 3.342
      name: MASE
    - type: smape
      value: 25.13
      name: sMAPE (%)
  - task:
      type: time-series-forecasting
      name: Time Series Forecasting
    dataset:
      name: ETTh2
      type: ett
      config: h2
    metrics:
    - type: mase
      value: 3.707
      name: MASE
    - type: smape
      value: 17.65
      name: sMAPE (%)
  - task:
      type: time-series-forecasting
      name: Time Series Forecasting
    dataset:
      name: ETTm1
      type: ett
      config: m1
    metrics:
    - type: mase
      value: 3.578
      name: MASE
    - type: smape
      value: 17.22
      name: sMAPE (%)
  - task:
      type: time-series-forecasting
      name: Time Series Forecasting
    dataset:
      name: Overall
      type: multi-dataset
    metrics:
    - type: mase
      value: 3.453
      name: Overall MASE
    - type: smape
      value: 18.68
      name: Overall sMAPE (%)
---

<h1 align="center">
  🔮 NanoForecast 500k (v0.2)
  <br>
  <sub>Ultra-lightweight time series transformer</sub>
</h1>

<p align="center">
  <b>1.6M params · 256 context · Streaming RNN · ONNX-ready</b>
  <br>
  <i>Runs on CPU, Raspberry Pi, and in the browser</i>
</p>

<p align="center">
  <a href="https://huggingface.co/spaces/eulogik/nanoforecast"><img src="https://img.shields.io/badge/🤗%20Live%20Demo-Spaces-blueviolet"></a>
  <a href="https://github.com/eulogik/NanoForecast"><img src="https://img.shields.io/badge/GitHub-eulogik%2FNanoForecast-181717?logo=github"></a>
  <a href="https://pypi.org/project/nanoforecast/"><img src="https://img.shields.io/pypi/v/nanoforecast"></a>
  <a href="https://eulogik.com"><img src="https://img.shields.io/badge/by-Eulogik-purple"></a>
</p>

<p align="center">
  🚀 <b>New:</b> Try the improved <a href="https://huggingface.co/eulogik/nanoforecast-v03"><b>nanoforecast-v03</b></a> — 21% better MASE, 6.5M params, 512 context!
</p>

---

## 📦 Quick Start

```bash
pip install nanoforecast
```

```python
from nanoforecast import NanoForecast
model = NanoForecast.from_pretrained("eulogik/nanoforecast-500k")
```

## 🏆 Benchmarks

| Dataset | MASE | sMAPE (%) | MAE | CRPS |
|---|---:|---:|---:|---:|
| ETTh1 | 3.342 | 25.13 | 2.402 | 1.800 |
| ETTh2 | 3.707 | 17.65 | 3.212 | 2.518 |
| ETTm1 | 3.578 | 17.22 | 1.174 | 1.003 |
| exchange_rate | 7.306 | 1.63 | 0.010 | 0.009 |
| electricity | 1.536 | 5.65 | 189.748 | 187.256 |
| traffic | 1.246 | 44.80 | 0.006 | 0.005 |
| **Overall** | **3.453** | **18.68** | **32.759** | **32.099** |

> 🔥 For better accuracy, upgrade to [nanoforecast-v03](https://huggingface.co/eulogik/nanoforecast-v03) (MASE 2.73, **21% improvement**).

## 🔄 Streaming Inference (Unique to NanoForecast)

```python
result = model.predict(context, horizon=48, return_state=True)
state = result.pop("state")
for new_val in incoming_data_stream:
    result = model.predict_step(new_val, state, horizon=48)
    print(result["forecast"][0, :5])
```

Perfect for IoT, real-time dashboards, and live financial data.

## 📋 Model Details

| Attribute | Value |
|---|---|
| Profile | `d64-L8` |
| Parameters | 1,606,232 |
| Context | 256 |
| Horizon | 48 |
| Size | 6.4 MB (FP32), ~1.4 MB (ONNX) |
| Architecture | LongConv + DeltaNet RNN + Gated Router + MLP |
| Deploy targets | CPU, ARM, Raspberry Pi, Lambda, iOS, browser |

## 🎯 Try It in 1 Click

[![Open in HF Spaces](https://img.shields.io/badge/🤗%20Open%20in%20Spaces-blueviolet)](https://huggingface.co/spaces/eulogik/nanoforecast)

Upload a CSV → forecast + prediction intervals. No code. No GPU.

## 📚 All Variants

| Model | Params | Context | MASE | Best For |
|---|---|---|---|---|
| [nanoforecast-200k](https://huggingface.co/eulogik/nanoforecast-200k) | 676K | 256 | ~4-11 | Extreme edge / RPi Zero |
| **nanoforecast-500k** (you are here) | **1.6M** | **256** | **3.45** | General purpose |
| [nanoforecast-v03](https://huggingface.co/eulogik/nanoforecast-v03) | **6.5M** | **512** | **2.73** | Max accuracy |

## ⚡ Deploy

```bash
# FastAPI
pip install nanoforecast fastapi uvicorn python-multipart
python3 deploy/fastapi_server.py

# ONNX
pip install "nanoforecast[onnx]"
python3 -m nanoforecast.export.onnx_export --checkpoint <dir> --output nanoforecast.onnx
```

## ❤️ Built by Eulogik

[![Eulogik](https://img.shields.io/badge/by-Eulogik-purple)](https://eulogik.com)

**Eulogik** — deployable AI for the real world.

Star the repo ⭐ on [GitHub](https://github.com/eulogik/NanoForecast)!