Commit 6cd559c
authored
feat: support dynamic mode decomposition calibrator (#1053)
* Add a Dynamic Mode Decomposition (Prony) exponential-basis calibrator (`calibrator_type="dmd"`)
* Address review: cache the DMD fit, decouple batch items, guard fp16 overflow
- Cache the horizon-free DMD eigendecomposition per snapshot window
(DMDState._fit / _fit_key, invalidated when a new snapshot arrives). Skip
steps now reuse one SVD/eig instead of recomputing it every step, which is
what restores the intended cache speedup at large fresh intervals.
- Fit DMD independently per batch item (axis 0). Flattening folded the batch
into one state, so a prompt's forecast depended on the other prompts in the
batch; per-item fitting keeps them independent like the Taylor path.
- Move the finite check after the output-dtype cast: a finite float64 forecast
can still overflow to inf in fp16, so the cast result is what gets guarded.
- yapf / docformatter clean (fixes the failing pre-commit CI check).
* Add 'dmd' to the example generate CLI (--dmd / --dmd-history)
Per review: enable the DMD calibrator from `python -m cache_dit.generate`
exactly like --taylorseer. --dmd selects DMDCalibratorConfig (history via
--dmd-history, default 6); --taylorseer is unchanged.
Verified end-to-end:
python -m cache_dit.generate flux --cache --dmd --cpu-offload
generates with the DMD calibrator active (optimization tag ...DMDH6_S12, image saved).1 parent 33eacf7 commit 6cd559c
6 files changed
Lines changed: 489 additions & 2 deletions
File tree
- src/cache_dit
- _utils
- caching
- cache_contexts
- calibrators
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
309 | 310 | | |
310 | 311 | | |
311 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
312 | 325 | | |
313 | 326 | | |
314 | 327 | | |
| |||
2282 | 2295 | | |
2283 | 2296 | | |
2284 | 2297 | | |
2285 | | - | |
2286 | | - | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
2287 | 2301 | | |
2288 | 2302 | | |
2289 | 2303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
Lines changed: 68 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
153 | 154 | | |
154 | 155 | | |
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 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
156 | 221 | | |
157 | 222 | | |
158 | 223 | | |
| |||
183 | 248 | | |
184 | 249 | | |
185 | 250 | | |
| 251 | + | |
186 | 252 | | |
187 | 253 | | |
188 | 254 | | |
| |||
201 | 267 | | |
202 | 268 | | |
203 | 269 | | |
| 270 | + | |
| 271 | + | |
204 | 272 | | |
205 | 273 | | |
0 commit comments