zsfm 0.2.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. zsfm-0.2.6/LICENSE +21 -0
  2. zsfm-0.2.6/PKG-INFO +447 -0
  3. zsfm-0.2.6/README.md +427 -0
  4. zsfm-0.2.6/pyproject.toml +47 -0
  5. zsfm-0.2.6/zsfm-rs/Cargo.lock +3450 -0
  6. zsfm-0.2.6/zsfm-rs/Cargo.toml +69 -0
  7. zsfm-0.2.6/zsfm-rs/crates/models/chronos/Cargo.toml +24 -0
  8. zsfm-0.2.6/zsfm-rs/crates/models/chronos/src/config.rs +63 -0
  9. zsfm-0.2.6/zsfm-rs/crates/models/chronos/src/convert.rs +361 -0
  10. zsfm-0.2.6/zsfm-rs/crates/models/chronos/src/infer/mod.rs +649 -0
  11. zsfm-0.2.6/zsfm-rs/crates/models/chronos/src/infer/rope.rs +71 -0
  12. zsfm-0.2.6/zsfm-rs/crates/models/chronos/src/lib.rs +7 -0
  13. zsfm-0.2.6/zsfm-rs/crates/models/chronos/src/tensor_map.rs +169 -0
  14. zsfm-0.2.6/zsfm-rs/crates/models/flowstate/Cargo.toml +25 -0
  15. zsfm-0.2.6/zsfm-rs/crates/models/flowstate/src/config.rs +51 -0
  16. zsfm-0.2.6/zsfm-rs/crates/models/flowstate/src/convert.rs +281 -0
  17. zsfm-0.2.6/zsfm-rs/crates/models/flowstate/src/infer/mod.rs +700 -0
  18. zsfm-0.2.6/zsfm-rs/crates/models/flowstate/src/lib.rs +7 -0
  19. zsfm-0.2.6/zsfm-rs/crates/models/flowstate/src/tensor_map.rs +101 -0
  20. zsfm-0.2.6/zsfm-rs/crates/models/lag_llama/Cargo.toml +25 -0
  21. zsfm-0.2.6/zsfm-rs/crates/models/lag_llama/src/config.rs +43 -0
  22. zsfm-0.2.6/zsfm-rs/crates/models/lag_llama/src/convert.rs +179 -0
  23. zsfm-0.2.6/zsfm-rs/crates/models/lag_llama/src/infer/mod.rs +683 -0
  24. zsfm-0.2.6/zsfm-rs/crates/models/lag_llama/src/lib.rs +7 -0
  25. zsfm-0.2.6/zsfm-rs/crates/models/lag_llama/src/tensor_map.rs +64 -0
  26. zsfm-0.2.6/zsfm-rs/crates/models/mitra/Cargo.toml +24 -0
  27. zsfm-0.2.6/zsfm-rs/crates/models/mitra/src/config.rs +45 -0
  28. zsfm-0.2.6/zsfm-rs/crates/models/mitra/src/convert.rs +297 -0
  29. zsfm-0.2.6/zsfm-rs/crates/models/mitra/src/infer/mod.rs +483 -0
  30. zsfm-0.2.6/zsfm-rs/crates/models/mitra/src/lib.rs +7 -0
  31. zsfm-0.2.6/zsfm-rs/crates/models/mitra/src/tensor_map.rs +91 -0
  32. zsfm-0.2.6/zsfm-rs/crates/models/moirai/Cargo.toml +25 -0
  33. zsfm-0.2.6/zsfm-rs/crates/models/moirai/src/config.rs +33 -0
  34. zsfm-0.2.6/zsfm-rs/crates/models/moirai/src/convert.rs +243 -0
  35. zsfm-0.2.6/zsfm-rs/crates/models/moirai/src/infer/mod.rs +423 -0
  36. zsfm-0.2.6/zsfm-rs/crates/models/moirai/src/lib.rs +7 -0
  37. zsfm-0.2.6/zsfm-rs/crates/models/moirai/src/tensor_map.rs +77 -0
  38. zsfm-0.2.6/zsfm-rs/crates/models/moirai2/Cargo.toml +25 -0
  39. zsfm-0.2.6/zsfm-rs/crates/models/moirai2/src/config.rs +37 -0
  40. zsfm-0.2.6/zsfm-rs/crates/models/moirai2/src/convert.rs +246 -0
  41. zsfm-0.2.6/zsfm-rs/crates/models/moirai2/src/infer/mod.rs +526 -0
  42. zsfm-0.2.6/zsfm-rs/crates/models/moirai2/src/infer/rope.rs +46 -0
  43. zsfm-0.2.6/zsfm-rs/crates/models/moirai2/src/lib.rs +7 -0
  44. zsfm-0.2.6/zsfm-rs/crates/models/moirai2/src/tensor_map.rs +79 -0
  45. zsfm-0.2.6/zsfm-rs/crates/models/moment/Cargo.toml +24 -0
  46. zsfm-0.2.6/zsfm-rs/crates/models/moment/src/config.rs +38 -0
  47. zsfm-0.2.6/zsfm-rs/crates/models/moment/src/convert.rs +260 -0
  48. zsfm-0.2.6/zsfm-rs/crates/models/moment/src/infer/mod.rs +388 -0
  49. zsfm-0.2.6/zsfm-rs/crates/models/moment/src/lib.rs +7 -0
  50. zsfm-0.2.6/zsfm-rs/crates/models/moment/src/tensor_map.rs +68 -0
  51. zsfm-0.2.6/zsfm-rs/crates/models/sundial/Cargo.toml +24 -0
  52. zsfm-0.2.6/zsfm-rs/crates/models/sundial/src/config.rs +42 -0
  53. zsfm-0.2.6/zsfm-rs/crates/models/sundial/src/convert.rs +267 -0
  54. zsfm-0.2.6/zsfm-rs/crates/models/sundial/src/infer/mod.rs +451 -0
  55. zsfm-0.2.6/zsfm-rs/crates/models/sundial/src/infer/rope.rs +60 -0
  56. zsfm-0.2.6/zsfm-rs/crates/models/sundial/src/lib.rs +7 -0
  57. zsfm-0.2.6/zsfm-rs/crates/models/sundial/src/tensor_map.rs +80 -0
  58. zsfm-0.2.6/zsfm-rs/crates/models/tabdpt/Cargo.toml +24 -0
  59. zsfm-0.2.6/zsfm-rs/crates/models/tabdpt/src/config.rs +50 -0
  60. zsfm-0.2.6/zsfm-rs/crates/models/tabdpt/src/convert.rs +287 -0
  61. zsfm-0.2.6/zsfm-rs/crates/models/tabdpt/src/infer/mod.rs +444 -0
  62. zsfm-0.2.6/zsfm-rs/crates/models/tabdpt/src/lib.rs +7 -0
  63. zsfm-0.2.6/zsfm-rs/crates/models/tabdpt/src/tensor_map.rs +80 -0
  64. zsfm-0.2.6/zsfm-rs/crates/models/tabfm/Cargo.toml +25 -0
  65. zsfm-0.2.6/zsfm-rs/crates/models/tabfm/src/config.rs +53 -0
  66. zsfm-0.2.6/zsfm-rs/crates/models/tabfm/src/convert.rs +330 -0
  67. zsfm-0.2.6/zsfm-rs/crates/models/tabfm/src/ensemble/aggregate.rs +125 -0
  68. zsfm-0.2.6/zsfm-rs/crates/models/tabfm/src/ensemble/calibration.rs +179 -0
  69. zsfm-0.2.6/zsfm-rs/crates/models/tabfm/src/ensemble/cat_encoder.rs +127 -0
  70. zsfm-0.2.6/zsfm-rs/crates/models/tabfm/src/ensemble/config_gen.rs +263 -0
  71. zsfm-0.2.6/zsfm-rs/crates/models/tabfm/src/ensemble/mod.rs +27 -0
  72. zsfm-0.2.6/zsfm-rs/crates/models/tabfm/src/ensemble/nnls.rs +229 -0
  73. zsfm-0.2.6/zsfm-rs/crates/models/tabfm/src/ensemble/oof.rs +147 -0
  74. zsfm-0.2.6/zsfm-rs/crates/models/tabfm/src/ensemble/orchestrate.rs +520 -0
  75. zsfm-0.2.6/zsfm-rs/crates/models/tabfm/src/ensemble/pyrandom.rs +243 -0
  76. zsfm-0.2.6/zsfm-rs/crates/models/tabfm/src/ensemble/scalers.rs +674 -0
  77. zsfm-0.2.6/zsfm-rs/crates/models/tabfm/src/infer/mod.rs +929 -0
  78. zsfm-0.2.6/zsfm-rs/crates/models/tabfm/src/lib.rs +9 -0
  79. zsfm-0.2.6/zsfm-rs/crates/models/tabfm/src/tensor_map.rs +318 -0
  80. zsfm-0.2.6/zsfm-rs/crates/models/tabicl/Cargo.toml +24 -0
  81. zsfm-0.2.6/zsfm-rs/crates/models/tabicl/src/config.rs +44 -0
  82. zsfm-0.2.6/zsfm-rs/crates/models/tabicl/src/infer/mod.rs +582 -0
  83. zsfm-0.2.6/zsfm-rs/crates/models/tabicl/src/lib.rs +5 -0
  84. zsfm-0.2.6/zsfm-rs/crates/models/tabpfn/Cargo.toml +24 -0
  85. zsfm-0.2.6/zsfm-rs/crates/models/tabpfn/src/config.rs +63 -0
  86. zsfm-0.2.6/zsfm-rs/crates/models/tabpfn/src/infer/mod.rs +822 -0
  87. zsfm-0.2.6/zsfm-rs/crates/models/tabpfn/src/lib.rs +5 -0
  88. zsfm-0.2.6/zsfm-rs/crates/models/timesfm/Cargo.toml +24 -0
  89. zsfm-0.2.6/zsfm-rs/crates/models/timesfm/src/config.rs +64 -0
  90. zsfm-0.2.6/zsfm-rs/crates/models/timesfm/src/convert.rs +271 -0
  91. zsfm-0.2.6/zsfm-rs/crates/models/timesfm/src/infer/mod.rs +613 -0
  92. zsfm-0.2.6/zsfm-rs/crates/models/timesfm/src/infer/rope.rs +58 -0
  93. zsfm-0.2.6/zsfm-rs/crates/models/timesfm/src/lib.rs +7 -0
  94. zsfm-0.2.6/zsfm-rs/crates/models/timesfm/src/tensor_map.rs +47 -0
  95. zsfm-0.2.6/zsfm-rs/crates/models/tirex/Cargo.toml +24 -0
  96. zsfm-0.2.6/zsfm-rs/crates/models/tirex/src/config.rs +47 -0
  97. zsfm-0.2.6/zsfm-rs/crates/models/tirex/src/convert.rs +220 -0
  98. zsfm-0.2.6/zsfm-rs/crates/models/tirex/src/infer/mod.rs +706 -0
  99. zsfm-0.2.6/zsfm-rs/crates/models/tirex/src/lib.rs +7 -0
  100. zsfm-0.2.6/zsfm-rs/crates/models/tirex/src/tensor_map.rs +103 -0
  101. zsfm-0.2.6/zsfm-rs/crates/models/toto/Cargo.toml +24 -0
  102. zsfm-0.2.6/zsfm-rs/crates/models/toto/src/config.rs +43 -0
  103. zsfm-0.2.6/zsfm-rs/crates/models/toto/src/convert.rs +417 -0
  104. zsfm-0.2.6/zsfm-rs/crates/models/toto/src/infer/mod.rs +776 -0
  105. zsfm-0.2.6/zsfm-rs/crates/models/toto/src/infer/rope.rs +119 -0
  106. zsfm-0.2.6/zsfm-rs/crates/models/toto/src/lib.rs +7 -0
  107. zsfm-0.2.6/zsfm-rs/crates/models/toto/src/tensor_map.rs +136 -0
  108. zsfm-0.2.6/zsfm-rs/crates/models/ttm/Cargo.toml +24 -0
  109. zsfm-0.2.6/zsfm-rs/crates/models/ttm/src/config.rs +32 -0
  110. zsfm-0.2.6/zsfm-rs/crates/models/ttm/src/convert.rs +309 -0
  111. zsfm-0.2.6/zsfm-rs/crates/models/ttm/src/infer/mod.rs +373 -0
  112. zsfm-0.2.6/zsfm-rs/crates/models/ttm/src/lib.rs +7 -0
  113. zsfm-0.2.6/zsfm-rs/crates/models/ttm/src/tensor_map.rs +112 -0
  114. zsfm-0.2.6/zsfm-rs/crates/zsfm-checkpoint/Cargo.toml +20 -0
  115. zsfm-0.2.6/zsfm-rs/crates/zsfm-checkpoint/src/cast.rs +221 -0
  116. zsfm-0.2.6/zsfm-rs/crates/zsfm-checkpoint/src/hdf5_keras.rs +161 -0
  117. zsfm-0.2.6/zsfm-rs/crates/zsfm-checkpoint/src/lib.rs +9 -0
  118. zsfm-0.2.6/zsfm-rs/crates/zsfm-checkpoint/src/onnx.rs +475 -0
  119. zsfm-0.2.6/zsfm-rs/crates/zsfm-checkpoint/src/read.rs +535 -0
  120. zsfm-0.2.6/zsfm-rs/crates/zsfm-checkpoint/src/recast.rs +57 -0
  121. zsfm-0.2.6/zsfm-rs/crates/zsfm-core/Cargo.toml +12 -0
  122. zsfm-0.2.6/zsfm-rs/crates/zsfm-core/src/cfgval.rs +15 -0
  123. zsfm-0.2.6/zsfm-rs/crates/zsfm-core/src/forecast.rs +25 -0
  124. zsfm-0.2.6/zsfm-rs/crates/zsfm-core/src/input.rs +49 -0
  125. zsfm-0.2.6/zsfm-rs/crates/zsfm-core/src/json.rs +115 -0
  126. zsfm-0.2.6/zsfm-rs/crates/zsfm-core/src/lib.rs +9 -0
  127. zsfm-0.2.6/zsfm-rs/crates/zsfm-gguf/Cargo.toml +11 -0
  128. zsfm-0.2.6/zsfm-rs/crates/zsfm-gguf/src/lib.rs +7 -0
  129. zsfm-0.2.6/zsfm-rs/crates/zsfm-gguf/src/reader.rs +312 -0
  130. zsfm-0.2.6/zsfm-rs/crates/zsfm-gguf/src/types.rs +86 -0
  131. zsfm-0.2.6/zsfm-rs/crates/zsfm-gguf/src/writer.rs +168 -0
  132. zsfm-0.2.6/zsfm-rs/crates/zsfm-hub/Cargo.toml +19 -0
  133. zsfm-0.2.6/zsfm-rs/crates/zsfm-hub/src/discover.rs +244 -0
  134. zsfm-0.2.6/zsfm-rs/crates/zsfm-hub/src/download.rs +271 -0
  135. zsfm-0.2.6/zsfm-rs/crates/zsfm-hub/src/http.rs +25 -0
  136. zsfm-0.2.6/zsfm-rs/crates/zsfm-hub/src/lib.rs +8 -0
  137. zsfm-0.2.6/zsfm-rs/crates/zsfm-hub/src/upload.rs +625 -0
  138. zsfm-0.2.6/zsfm-rs/crates/zsfm-nn/Cargo.toml +14 -0
  139. zsfm-0.2.6/zsfm-rs/crates/zsfm-nn/src/ffn.rs +12 -0
  140. zsfm-0.2.6/zsfm-rs/crates/zsfm-nn/src/gguf.rs +63 -0
  141. zsfm-0.2.6/zsfm-rs/crates/zsfm-nn/src/lib.rs +17 -0
  142. zsfm-0.2.6/zsfm-rs/crates/zsfm-nn/src/linear.rs +68 -0
  143. zsfm-0.2.6/zsfm-rs/crates/zsfm-nn/src/mask.rs +47 -0
  144. zsfm-0.2.6/zsfm-rs/crates/zsfm-nn/src/norm.rs +98 -0
  145. zsfm-0.2.6/zsfm-rs/crates/zsfm-python/Cargo.toml +43 -0
  146. zsfm-0.2.6/zsfm-rs/crates/zsfm-python/src/lib.rs +809 -0
zsfm-0.2.6/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Andrew Mayes
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
zsfm-0.2.6/PKG-INFO ADDED
@@ -0,0 +1,447 @@
1
+ Metadata-Version: 2.4
2
+ Name: zsfm
3
+ Version: 0.2.6
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: 3
6
+ Classifier: License :: OSI Approved :: MIT License
7
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
8
+ Requires-Dist: numpy>=1.20
9
+ Requires-Dist: pytest ; extra == 'dev'
10
+ Requires-Dist: pytest-benchmark ; extra == 'dev'
11
+ Provides-Extra: dev
12
+ License-File: LICENSE
13
+ Summary: Python bindings for zsfm — zero-shot forecasting and tabular foundation models (uv + pyo3 + maturin)
14
+ Keywords: forecasting,time-series,tabular,foundation-model,gguf
15
+ Author-email: Andrew Mayes <andrew@example.com>
16
+ License: MIT
17
+ Requires-Python: >=3.8
18
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
19
+
20
+ # zsfm-rs — Zero-Shot Forecasters & Tabular Foundation Models in Rust
21
+
22
+ > **One `zsfm` binary, 16 foundation models, no Python.** Download real weights from Hugging Face, convert to a single self-contained [GGUF](https://github.com/ggerganov/ggml/blob/master/docs/gguf.md) file, and run zero-shot inference locally via [candle](https://github.com/huggingface/candle).
23
+
24
+ [![CI](https://github.com/amaye15/zsfm-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/amaye15/zsfm-rs/actions/workflows/ci.yml)
25
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
26
+ [![Rust](https://img.shields.io/badge/rust-1.70%2B-orange.svg)](https://www.rust-lang.org)
27
+
28
+ **Repo:** `amaye15/zsfm-rs` (renamed from `zero-shot-forecasters-gguf`) · **Binary:** `zsfm` · **Workspace:** `zsfm-rs/`
29
+
30
+ ---
31
+
32
+ ## What is this?
33
+
34
+ `zsfm-rs` is a Rust workspace that ports **11 zero-shot time-series forecasters** and **5 tabular foundation models** to a unified GGUF + candle stack. Each port is verified **bit-exact** (or within F32 rounding, ~1e-6–1e-7) tensor-for-tensor against the original PyTorch checkpoint before being considered done — no re-training, no approximations, just the original published weights re-encoded.
35
+
36
+ There are two halves — plus a cleanup helper:
37
+
38
+ 1. **Convert** — `zsfm <model> convert` downloads the model's real weights from Hugging Face and writes a single `*.gguf` file.
39
+ 2. **Infer** — `zsfm <model> infer --gguf <file> < request.json` loads that GGUF and returns a forecast / tabular prediction. No PyTorch, no Python runtime.
40
+ 3. **Delete** — `zsfm <model> delete` removes the cached `model-f32.gguf` + `config.json` (and optionally an output GGUF) to free disk (`zsfm chronos delete --output gguf/chronos-f16.gguf`).
41
+
42
+ The same GGUF file works with any GGUF consumer; `infer` just happens to use candle.
43
+
44
+ **Docs:** [User Guide (mdBook)](https://amaye15.github.io/zsfm-rs/guide/) · [API docs (rustdoc)](https://amaye15.github.io/zsfm-rs/api/) · [Benchmark](benchmark.md)
45
+
46
+ ---
47
+
48
+ ## Supported models
49
+
50
+ ### Time-series forecasters (11)
51
+
52
+ All read a numeric `context` (past values) + `horizon` (steps to predict) and return an OpenAI-compatible `{ point, quantiles }` forecast. Toto / Moirai / Moirai-2 also support batch and multivariate input.
53
+
54
+ | Model | HF weights | Original code | Paper | License | Output |
55
+ |-------|------------|---------------|-------|---------|--------|
56
+ | **Toto-2** (Datadog) | [Datadog/Toto-2.0-2.5B](https://huggingface.co/Datadog/Toto-2.0-2.5B) | [DataDog/toto](https://github.com/DataDog/toto) | [Toto 2.0](https://arxiv.org/abs/2605.20119) | Apache-2.0 | quantiles |
57
+ | **Chronos-2** (Amazon) | [amazon/chronos-2](https://huggingface.co/amazon/chronos-2) | [amazon-science/chronos-forecasting](https://github.com/amazon-science/chronos-forecasting) | [Chronos-2](https://arxiv.org/abs/2510.15821) | Apache-2.0 | quantiles |
58
+ | **TimesFM 2.5** (Google) | [google/timesfm-2.5-200m-pytorch](https://huggingface.co/google/timesfm-2.5-200m-pytorch) | [google-research/timesfm](https://github.com/google-research/timesfm) | [TimesFM](https://arxiv.org/abs/2310.10688) | Apache-2.0 | quantiles |
59
+ | **Sundial** (thuml) | [thuml/sundial-base-128m](https://huggingface.co/thuml/sundial-base-128m) | [thuml/Sundial](https://github.com/thuml/Sundial) | [Sundial](https://arxiv.org/abs/2502.00816) | Apache-2.0 | point only |
60
+ | **TTM** (IBM Granite) | [ibm-granite/granite-timeseries-ttm-r2](https://huggingface.co/ibm-granite/granite-timeseries-ttm-r2) | [ibm-granite/granite-tsfm](https://github.com/ibm-granite/granite-tsfm) | [TTM](https://arxiv.org/abs/2401.03955) | Apache-2.0 | point only |
61
+ | **Lag-Llama** | [time-series-foundation-models/Lag-Llama](https://huggingface.co/time-series-foundation-models/Lag-Llama) | [time-series-foundation-models/lag-llama](https://github.com/time-series-foundation-models/lag-llama) | [Lag-Llama](https://arxiv.org/abs/2310.08278) | Apache-2.0 | point only |
62
+ | **MOMENT** (CMU) | [AutonLab/MOMENT-1-large](https://huggingface.co/AutonLab/MOMENT-1-large) | [moment-timeseries-foundation-model/moment](https://github.com/moment-timeseries-foundation-model/moment) | [MOMENT](https://arxiv.org/abs/2402.03885) | MIT | point only |
63
+ | **Moirai 1.0** (Salesforce) | [Salesforce/moirai-1.0-R-large](https://huggingface.co/Salesforce/moirai-1.0-R-large) | [SalesforceAIResearch/uni2ts](https://github.com/SalesforceAIResearch/uni2ts) | [Moirai](https://arxiv.org/abs/2402.02592) | CC-BY-NC-4.0 ⚠️ | point only |
64
+ | **Moirai 2.0** (Salesforce) | [Salesforce/moirai-2.0-R-small](https://huggingface.co/Salesforce/moirai-2.0-R-small) | [SalesforceAIResearch/uni2ts](https://github.com/SalesforceAIResearch/uni2ts) | [Moirai 2.0](https://arxiv.org/abs/2511.11698) | CC-BY-NC-4.0 ⚠️ | point only |
65
+ | **FlowState-R1** (IBM) | [ibm-granite/granite-timeseries-flowstate-r1](https://huggingface.co/ibm-granite/granite-timeseries-flowstate-r1) | [ibm-granite/granite-tsfm](https://github.com/ibm-granite/granite-tsfm/tree/main/tsfm_public/models/flowstate) | [FlowState](https://arxiv.org/abs/2508.05287) | Apache-2.0 | quantiles |
66
+ | **TiRex** (NX-AI) | [NX-AI/TiRex](https://huggingface.co/NX-AI/TiRex) | [NX-AI/tirex](https://github.com/NX-AI/tirex) | [TiRex](https://arxiv.org/abs/2505.23719) | NXAI Community ⚠️ | quantiles |
67
+
68
+ ### Tabular foundation models (5)
69
+
70
+ Zero-shot in-context classification/regression: give a small labeled support set + query rows, get predictions in one forward pass — no fine-tuning.
71
+
72
+ | Model | HF weights | Original code | Paper | License | Class. | Regr. |
73
+ |-------|------------|---------------|-------|---------|--------|-------|
74
+ | **Mitra** (AutoGluon) | [autogluon/mitra-classifier](https://huggingface.co/autogluon/mitra-classifier) / [mitra-regressor](https://huggingface.co/autogluon/mitra-regressor) | [autogluon/autogluon](https://github.com/autogluon/autogluon/tree/master/tabular/src/autogluon/tabular/models/mitra) | [Mitra](https://arxiv.org/abs/2510.21204) | Apache-2.0 | ✅ | ✅ |
75
+ | **TabDPT** (Layer6) | [Layer6/TabDPT](https://huggingface.co/Layer6/TabDPT) | [layer6ai-labs/TabDPT-inference](https://github.com/layer6ai-labs/TabDPT-inference) | [TabDPT](https://huggingface.co/papers/2410.18164) | Apache-2.0 | ✅ | ✅ |
76
+ | **TabICL v2** | [jingang/TabICL](https://huggingface.co/jingang/TabICL) | [soda-inria/tabicl](https://github.com/soda-inria/tabicl) | [TabICL](https://arxiv.org/abs/2502.05564) / [v2](https://arxiv.org/abs/2602.11139) | BSD-3-Clause | ✅ | ❌ |
77
+ | **TabPFN-3** (Prior Labs) | [Prior-Labs/tabpfn_3](https://huggingface.co/Prior-Labs/tabpfn_3) | [PriorLabs/TabPFN](https://github.com/PriorLabs/TabPFN) | [TabPFN-3](https://arxiv.org/abs/2605.13986) | Non-commercial ⚠️ | ✅ | ❌ |
78
+ | **TabFM** (Google) | [google/tabfm-1.0.0-pytorch](https://huggingface.co/google/tabfm-1.0.0-pytorch) | [google-research/tabfm](https://github.com/google-research/tabfm) | [Blog post](https://research.google/blog/introducing-tabfm-a-zero-shot-foundation-model-for-tabular-data/) | Non-commercial ⚠️ | ✅ | ✅ |
79
+
80
+ > ⚠️ **Moirai / TabPFN-3 / TabFM are non-commercial only** (research & internal evaluation). **TiRex** is free commercially unless your org's consolidated annual revenue exceeds €100M and you ship TiRex in a commercial product/service. See [Licensing](#licensing) and [docs-guide/src/licensing.md](docs-guide/src/licensing.md).
81
+
82
+ ---
83
+
84
+ ## Installation
85
+
86
+ ### Option 1: `cargo install` (like `cargo install ripgrep`)
87
+
88
+ From [crates.io](https://crates.io/crates/zsfm) (requires a recent stable Rust toolchain from [rustup.rs](https://rustup.rs)):
89
+
90
+ ```bash
91
+ cargo install zsfm --locked
92
+ zsfm --help
93
+ ```
94
+
95
+ From git (latest `main`):
96
+
97
+ ```bash
98
+ cargo install --git https://github.com/amaye15/zsfm-rs zsfm --locked
99
+ # or pin a tag:
100
+ cargo install --git https://github.com/amaye15/zsfm-rs --tag v0.2.2 zsfm --locked
101
+ ```
102
+
103
+ From a local checkout:
104
+
105
+ ```bash
106
+ git clone https://github.com/amaye15/zsfm-rs.git
107
+ cargo install --path zsfm-rs/crates/zsfm --locked
108
+ # or, build without installing:
109
+ cargo build --release -p zsfm --manifest-path zsfm-rs/Cargo.toml
110
+ ./zsfm-rs/target/release/zsfm --help
111
+ ```
112
+
113
+ > `--locked` uses the `Cargo.lock` tested in CI for reproducible builds. Omit it if you want the latest compatible dependencies.
114
+
115
+ ### Option 2: pre-built binary
116
+
117
+ Binaries for Linux (`x86_64-unknown-linux-gnu`) and macOS Apple Silicon (`aarch64-apple-darwin`) are published on the [Releases](https://github.com/amaye15/zsfm-rs/releases) page:
118
+
119
+ ```bash
120
+ tar xzf zsfm-v0.2.2-aarch64-apple-darwin.tar.gz
121
+ sudo mv zsfm*/*zsfm /usr/local/bin/
122
+ zsfm --help
123
+ ```
124
+
125
+ > macOS Intel (`x86_64-apple-darwin`) is not currently published (GitHub's free Intel runner capacity was cut). Use `cargo install` above instead — the workspace builds fine on Intel Macs.
126
+
127
+ On macOS the release profile automatically links Apple's Accelerate framework for faster BLAS; on Linux/Windows it falls back to candle's portable backend with no extra setup.
128
+
129
+ Verify:
130
+
131
+ ```bash
132
+ zsfm --help # one subcommand per model
133
+ zsfm chronos --help # per-model: convert / infer / upload / inspect-tensors / delete
134
+ zsfm chronos delete --help # per-model cache deletion
135
+ ```
136
+
137
+ ---
138
+
139
+ ## Quick start
140
+
141
+ ### Time-series forecasting (Moirai-2, ~45 MB)
142
+
143
+ ```bash
144
+ # 1. Download + convert to GGUF (cached at models/Salesforce__moirai-2.0-R-small/model-f32.gguf)
145
+ zsfm moirai2 convert
146
+
147
+ # 2. Build a request (Moirai batches series; univariate models take a flat array)
148
+ cat > request.json <<'EOF'
149
+ {
150
+ "context": [[10.0, 10.5, 11.0, 10.8, 11.2, 11.5, 11.3, 11.8, 12.0, 12.2]],
151
+ "horizon": 4
152
+ }
153
+ EOF
154
+
155
+ # 3. Forecast
156
+ zsfm moirai2 infer --gguf gguf/moirai2-f32.gguf < request.json
157
+ ```
158
+
159
+ Response (OpenAI-compatible):
160
+
161
+ ```json
162
+ {
163
+ "id": "forecast-...",
164
+ "object": "forecast",
165
+ "model": "moirai-2",
166
+ "choices": [{ "index": 0, "forecast": { "point": [12.35, 12.51, 12.64, 12.72] } }]
167
+ }
168
+ ```
169
+
170
+ Univariate models use a flat array instead:
171
+
172
+ ```bash
173
+ zsfm chronos convert
174
+ echo '{"context": [1,2,3,4,5,6,7,8], "horizon": 4}' | zsfm chronos infer --gguf gguf/chronos-f16.gguf
175
+ ```
176
+
177
+ ### Tabular prediction (Mitra)
178
+
179
+ ```bash
180
+ zsfm mitra convert --model autogluon/mitra-classifier --task classification
181
+
182
+ cat > request.json <<'EOF'
183
+ {
184
+ "x_support": [[0.1, 1.2], [0.9, -0.3], [-1.1, 0.4], [1.5, 1.1]],
185
+ "y_support": [0, 1, 1, 0],
186
+ "x_query": [[0.2, 0.9], [-0.8, 0.1]],
187
+ "n_classes": 2
188
+ }
189
+ EOF
190
+
191
+ zsfm mitra infer --gguf gguf/mitra-classification-f32.gguf < request.json
192
+ # {"task":"classification","probabilities":[[0.83,0.17],[0.21,0.79]]}
193
+ ```
194
+
195
+ See [Time-series forecasters](docs-guide/src/models/time-series.md) and [Tabular foundation models](docs-guide/src/models/tabular.md) for every model's exact request/response shape, flags, and caveats.
196
+
197
+ ### Python (uv + pyo3)
198
+
199
+ The same models are available from Python (`uv` + `maturin` + `pyo3`):
200
+
201
+ ```bash
202
+ # from a local checkout (editable, recommended for development)
203
+ uv sync && uv run maturin develop # or: pip install -e . (needs maturin)
204
+ uv run python -c "import zsfm; print(zsfm.list_models())"
205
+
206
+ # from git / crates.io (once published)
207
+ uv pip install "zsfm @ git+https://github.com/amaye15/zsfm-rs"
208
+ uv pip install zsfm # crates.io / PyPI
209
+ ```
210
+
211
+ ```python
212
+ import zsfm
213
+ print(zsfm.__version__, zsfm.list_forecasters()[:3])
214
+
215
+ # download + convert (like `zsfm ttm convert`)
216
+ zsfm.convert("ttm", dtype="f32")
217
+
218
+ # load and forecast (like `zsfm ttm infer`)
219
+ model = zsfm.TtmModel("gguf/ttm-f32.gguf", config="models/ibm-granite__granite-timeseries-ttm-r2/config.json")
220
+ print(model.forecast([10.0, 10.5, 11.0, 10.8], horizon=4))
221
+
222
+ # tabular (like `zsfm mitra infer`)
223
+ mitra = zsfm.MitraModel("gguf/mitra-classification-f32.gguf", task="classification")
224
+ print(mitra.predict_classification([[0.1, 1.2]], [0], [[0.2, 0.9]], n_classes=2))
225
+
226
+ # delete cache (like `zsfm ttm delete`)
227
+ zsfm.delete("ttm")
228
+ ```
229
+
230
+ See [Python bindings](docs-guide/src/python.md) for the full API (11 forecasters + 5 tabular, `numpy` arrays, `convert`/`delete` dispatch).
231
+
232
+ ---
233
+
234
+ ## CLI overview
235
+
236
+ Every model is a subcommand: `zsfm <model> <action>`.
237
+
238
+ | Action | What it does |
239
+ |--------|--------------|
240
+ | `convert` | Download from Hugging Face and write a GGUF file |
241
+ | `infer` | Load a GGUF and run inference on JSON from stdin → JSON to stdout |
242
+ | `upload` | Push source + GGUF to a Hugging Face repo you control |
243
+ | `inspect-tensors` | Print every tensor name/shape/dtype in a local checkpoint |
244
+ | `delete` | Remove the cached canonical GGUF + config for this model (and optionally an output GGUF) |
245
+
246
+ ```bash
247
+ zsfm <model> --help
248
+ zsfm <model> convert --help
249
+ zsfm <model> infer --help
250
+ zsfm <model> delete --help
251
+ ```
252
+
253
+ #### Model caching
254
+
255
+ The first `convert` for a model:
256
+
257
+ 1. Downloads raw weights from HF.
258
+ 2. Writes a **canonical F32 GGUF** to `<model-dir>/<owner>__<repo>/model-f32.gguf` (default `model-dir` is `models/`).
259
+ 3. Deletes the raw weight files (they're redundant once the canonical GGUF exists).
260
+
261
+ Later converts for the same model — at any `--dtype` — recast from that cache with no network:
262
+
263
+ ```bash
264
+ zsfm chronos convert --dtype f32 # downloads
265
+ zsfm chronos convert --dtype f16 # <1s, from cache
266
+ zsfm chronos convert --dtype q8 # <1s, from cache (Q8_0 block-quant; tiny tensors stay F32)
267
+ zsfm chronos convert --redownload # force a fresh download
268
+ ```
269
+
270
+ To free disk, remove the cache (and optionally an output file):
271
+
272
+ ```bash
273
+ zsfm chronos delete # removes models/amazon__chronos-2/
274
+ zsfm chronos delete --output gguf/chronos-f16.gguf # also removes the converted file
275
+ zsfm chronos delete --model custom/repo --model-dir /tmp/models # custom locations
276
+ ```
277
+
278
+ Most `convert` commands accept `--dtype f32|f16|q8`. BF16 is available only through the generic converter (candle can't currently load GGUF BF16 back).
279
+
280
+ #### Generic converter
281
+
282
+ TabICL and TabPFN-3 ship checkpoints whose tensor names are used unchanged, so they go through a model-agnostic path (also works for any HF repo):
283
+
284
+ ```bash
285
+ zsfm convert --repo jingang/TabICL --file classifier-v2 --format ckpt -o gguf/tabicl-v2-f32.gguf
286
+ zsfm convert --repo Prior-Labs/tabpfn_3 --file classifier-v3_default --format ckpt -o gguf/tabpfn-v3-f32.gguf
287
+ # re-quantize an existing GGUF:
288
+ zsfm convert existing.gguf -o smaller.gguf --dtype q8
289
+ ```
290
+
291
+ `--file` is a case-insensitive substring to disambiguate repos that publish multiple checkpoints.
292
+
293
+ ---
294
+
295
+ ## Benchmark
296
+
297
+ `zsfm-bench` (`zsfm-rs/crates/zsfm-bench/`) links all 11 forecasters in-process via the shared `zsfm_core::Forecaster` trait — each GGUF is loaded once and independent models run concurrently.
298
+
299
+ ```bash
300
+ # convert the models you want to evaluate first
301
+ zsfm ttm convert && zsfm moirai2 convert
302
+
303
+ # single dataset
304
+ zsfm-bench run --dataset ETTh1 --models ttm,moirai2 --windows 30
305
+
306
+ # full sweep (21 datasets × models × horizons/contexts) → writes ../benchmark.md
307
+ zsfm-bench report
308
+ ```
309
+
310
+ Results are cached in `benchmark/bench_cache.json` (gitignored) so re-runs and interruptions only compute what's missing. The full pre-computed results live in [benchmark.md](benchmark.md):
311
+
312
+ - **21 datasets** across Energy, Climate, Astronomy, Health, Finance, Transport, Hydrology — from ETTh/m (Transformer benchmark) through Monash and Informer collections to Jena/Saugeen.
313
+ - **30 rolling windows** at `context=512, horizon=96` for the main table, plus horizon sweeps (`96/192/336/720`) and context sweeps (`96/256/512/1024`).
314
+ - **11 ensemble strategies** evaluated over all non-trivial model subsets (mean, median, inverse-MAE weighted, trimmed mean, softmax-weighted, geometric mean, online adaptive, Hedge, EMA-smoothed, greedy selection, per-horizon and uncertainty-weighted).
315
+ - **Metrics:** MAE, RMSE, MASE (scale-free vs. naïve 1-step baseline), and per-window inference latency.
316
+
317
+ Highlights from `benchmark.md:140-167` (best ensemble vs. best solo, `context=512, horizon=96, 30 windows`): ensembles beat the best single model on 19/21 datasets (up to **−9.7%** on Wind), with the median-based strategy `(~)` winning most often; only `aus_electricity` and `weather` favor a solo model. The appendix in `benchmark.md:212-952` has per-dataset Top-10 ensembles.
318
+
319
+ See also [benchmark/optimisation_log.md](benchmark/optimisation_log.md) for inference latency optimisation history (LTO, Accelerate, etc.).
320
+
321
+ ---
322
+
323
+ ## Project structure
324
+
325
+ ```
326
+ .
327
+ ├── Cargo.toml # root workspace (so `cargo install --git https://github.com/amaye15/zsfm-rs zsfm` works)
328
+ ├── pyproject.toml # Python project (uv + maturin + pyo3, module `zsfm`)
329
+ ├── zsfm-rs/ # Rust workspace (all code lives here; also usable as `cargo build -p zsfm --manifest-path zsfm-rs/Cargo.toml`)
330
+ │ ├── Cargo.toml # workspace + shared [profile.release] (lto=fat, opt-level=3, strip)
331
+ │ ├── crates/
332
+ │ │ ├── zsfm/ # `zsfm` binary — one subcommand module per model (`cargo install zsfm`)
333
+ │ │ ├── zsfm-python/ # `zsfm` Python extension (pyo3, `import zsfm`)
334
+ │ │ ├── zsfm-gguf/ # GGUF reader/writer
335
+ │ │ ├── zsfm-hub/ # HF download/upload + canonical-F32 cache helpers
336
+ │ │ ├── zsfm-checkpoint/ # checkpoint loader (safetensors/pickle/ONNX/HDF5/npz/ckpt/gguf) + dtype casting
337
+ │ │ ├── zsfm-core/ # `Forecaster` trait, JSON envelope, config helpers
338
+ │ │ ├── zsfm-nn/ # shared candle tensor ops
339
+ │ │ ├── zsfm-bench/ # in-process benchmark + ensembling
340
+ │ │ └── models/ # one crate per model (arch + weight mapping + candle kernels)
341
+ │ │ ├── toto/ chronos/ timesfm/ sundial/ ttm/ lag_llama/ moment/
342
+ │ │ ├── moirai/ moirai2/ flowstate/ tirex/ # forecasters
343
+ │ │ └── mitra/ tabdpt/ tabicl/ tabpfn/ tabfm/ # tabular
344
+ │ ├── scripts/publish-crates.sh
345
+ │ └── tools/export-weights.py
346
+ ├── docs-guide/ # mdBook user guide (published to GitHub Pages /guide/)
347
+ │ └── src/
348
+ │ ├── introduction.md
349
+ │ ├── installation.md
350
+ │ ├── quickstart.md
351
+ │ ├── cli-overview.md
352
+ │ ├── models/time-series.md
353
+ │ ├── models/tabular.md
354
+ │ ├── python.md # Python bindings (uv + pyo3 + maturin)
355
+ │ ├── licensing.md
356
+ │ └── development.md
357
+ ├── benchmark/
358
+ │ ├── data/ # evaluation datasets (not all tracked; see .gitignore)
359
+ │ └── optimisation_log.md
360
+ ├── .github/
361
+ │ ├── workflows/ci.yml # cargo build + cargo test (Linux + macOS)
362
+ │ ├── workflows/release.yml # cross-platform binaries + crates.io publish (on v* tag)
363
+ │ └── workflows/docs.yml # mdBook + rustdoc → GitHub Pages
364
+ │ └── pages/ # custom landing page (guide + API cards)
365
+ ├── tests/
366
+ │ └── python/test_zsfm.py # pytest for Python bindings
367
+ ├── benchmark.md # pre-computed benchmark report (21 datasets, sweeps, ensembles)
368
+ └── LICENSE (MIT)
369
+ ```
370
+
371
+ Each model crate under `zsfm-rs/crates/models/` owns its architecture, checkpoint weight-name mapping, and candle kernels; `zsfm` (`zsfm-rs/crates/zsfm/`) only wires them to the CLI.
372
+
373
+ ---
374
+
375
+ ## Development
376
+
377
+ ```bash
378
+ # Rust
379
+ cd zsfm-rs
380
+ cargo build --release --workspace
381
+ cargo test --release --workspace # ~130 tests (GGUF round-trip, dtype casting, arch shapes, bench logic)
382
+
383
+ # Python (uv + pyo3 + maturin)
384
+ uv sync
385
+ uv run maturin develop # or: maturin develop --manifest-path zsfm-rs/crates/zsfm-python/Cargo.toml
386
+ uv run pytest tests/python -v # Python binding tests (import zsfm, list_models, delete, etc.)
387
+ uv run python -c "import zsfm; print(zsfm.list_models())"
388
+ ```
389
+
390
+ CI (`.github/workflows/ci.yml:1`) runs both on every push to `main` and every PR (Linux + macOS) — Rust (`cargo build`/`cargo test`) and Python (`uv run maturin develop` + `pytest`).
391
+
392
+ ### Adding a new model
393
+
394
+ 1. New crate at `zsfm-rs/crates/models/<name>/` (weight mapping + candle inference + request/response types).
395
+ 2. Module at `zsfm/src/<name>.rs` (`zsfm-rs/crates/zsfm/src/<name>.rs`) with `convert`/`infer` subcommands — follow the caching pattern in [The `zsfm` CLI](docs-guide/src/cli-overview.md#model-caching) (`zsfm_hub::canonical_gguf_path` + `zsfm_checkpoint::recast`).
396
+ 3. Wire it into `zsfm/src/main.rs:ModelCommand` (`zsfm-rs/crates/zsfm/src/main.rs`).
397
+ 4. Add a page under `docs-guide/src/models/` and a row in the model table.
398
+
399
+ See [Development](docs-guide/src/development.md) for benchmarking and release notes. Pushing a `v*` tag triggers `.github/workflows/release.yml:1` (cross-platform binaries via `cargo build -p zsfm` + GitHub Release + optional crates.io publish via `zsfm-rs/scripts/publish-crates.sh` — `cargo publish -p zsfm` is last).
400
+
401
+ ---
402
+
403
+ ## Documentation
404
+
405
+ - **User guide (mdBook):** `docs-guide/` → https://amaye15.github.io/zsfm-rs/guide/ — installation, quick start, CLI overview, per-model pages with exact JSON shapes and links to papers/code/weights.
406
+ - **API reference (rustdoc):** `cargo doc` for every crate → https://amaye15.github.io/zsfm-rs/api/
407
+ - **Landing page:** `.github/pages/index.html` — cards linking to guide + per-crate rustdoc.
408
+
409
+ Build the guide locally:
410
+
411
+ ```bash
412
+ cargo install mdbook
413
+ mdbook serve docs-guide
414
+ ```
415
+
416
+ ---
417
+
418
+ ## Licensing
419
+
420
+ **Code** in this repository (converters, GGUF writer/reader, CLI, candle kernels, bench) is **MIT** — see [LICENSE](LICENSE).
421
+
422
+ **Model weights** keep the license their original authors published. Converting with `zsfm <model> convert` downloads the original weights and re-encodes them as GGUF — it does not change ownership or terms. Check before using a GGUF beyond local experimentation:
423
+
424
+ | License | Models | Commercial use |
425
+ |---------|--------|----------------|
426
+ | Apache-2.0 | Toto-2, Chronos-2, TimesFM 2.5, Sundial, TTM, Lag-Llama, Mitra, TabDPT, FlowState-R1 | ✅ unrestricted |
427
+ | MIT | MOMENT | ✅ unrestricted |
428
+ | BSD-3-Clause | TabICL | ✅ unrestricted |
429
+ | NXAI Community | TiRex | ✅ unless your org's annual revenue > €100M *and* you ship TiRex in a commercial product/service |
430
+ | CC-BY-NC-4.0 | Moirai 1.0, Moirai 2.0 | ❌ non-commercial only |
431
+ | tabpfn-3-license-v1.0 | TabPFN-3 | ❌ non-commercial only |
432
+ | TabFM Non-Commercial v1.0 | TabFM | ❌ non-commercial only |
433
+
434
+ For the restricted models, see the license file in each HF repo (linked in the tables above) and [docs-guide/src/licensing.md](docs-guide/src/licensing.md). This project does not interpret or enforce weight licenses.
435
+
436
+ ---
437
+
438
+ ## Acknowledgments
439
+
440
+ This workspace is a packaging and portability layer — all modeling credit belongs to the original authors. Each crate and each page in [Time-series forecasters](docs-guide/src/models/time-series.md) / [Tabular foundation models](docs-guide/src/models/tabular.md) links back to the original Hugging Face weights, source repository, and paper. If you use these models in academic work, please cite the relevant paper(s) from those pages.
441
+
442
+ Built on [candle](https://github.com/huggingface/candle) (Hugging Face) and the [GGUF](https://github.com/ggerganov/ggml/blob/master/docs/gguf.md) format (ggml/ggerganov).
443
+
444
+ ---
445
+
446
+ *Maintained at [amaye15/zsfm-rs](https://github.com/amaye15/zsfm-rs). Issues and PRs welcome — see [Development](docs-guide/src/development.md). Feedback on the tooling itself: https://github.com/anomalyco/opencode.*
447
+