tirex-rs
Pure-Rust GGUF converter and inference engine for TiRex β a 35M parameter sLSTM-based zero-shot time-series forecasting model from NXAI.
Pre-converted GGUF files are available at amaye15/tirex-gguf.
Build
cargo build --release
Convert
Download NX-AI/TiRex and convert to GGUF (reads model.ckpt directly β no Python required):
# All dtypes at once
bash scripts/convert_all.sh
# Single dtype
./target/release/tirex-rs convert --dtype f32 --output gguf/tirex-f32.gguf
./target/release/tirex-rs convert --dtype f16 --output gguf/tirex-f16.gguf
./target/release/tirex-rs convert --dtype q8 --output gguf/tirex-q8.gguf
Supported dtypes: f32, f16, q8.
Infer
./target/release/tirex-rs infer \
--gguf gguf/tirex-f32.gguf \
--data "1.0,2.1,3.3,2.8,1.9,3.1,4.0,3.5" \
--horizon 32
Add --all-outputs to include all 9 quantile forecasts (q0.1βq0.9) in the JSON response.
The output is OpenAI-compatible JSON:
{
"choices": [{
"forecast": {
"point": [...],
"quantiles": { "0.10": [...], "0.50": [...], "0.90": [...] }
}
}]
}
Architecture
TiRex is a 35M parameter sLSTM-based time-series foundation model:
- Input: Patch context of fixed length 2048 (left-padded with NaN if shorter), patch size 32 β 64 patches
- Normalization: Per-series StandardScaler (non-causal mean/std over full context)
- Patch embedding:
ResidualBlock(64β2048β512)over concatenated [values | mask] - Backbone: 12 Γ sLSTM blocks (sequential recurrence over 64 tokens)
- Pre-RMSNorm β 4 headwise-linear gate projections (NH=4, DH=128) β sLSTM cell β MultiHeadLayerNorm β residual
- Pre-RMSNorm β SiLU gated FFN (512β1408β512) β residual
- Output:
ResidualBlock(512β2048β288)β 9 quantiles Γ 32 patch offsets per token - Decoding: AR loop: take last token's prediction, extend context with NaN, repeat
Python binding
uv add --dev maturin
uv run maturin develop --release
import tirex_rs
model = tirex_rs.TiRex("gguf/tirex-f32.gguf")
result = model.forecast([1.0, 2.1, 3.3, 2.8, 1.9], horizon=32, all_outputs=True)
print(result["choices"][0]["forecast"]["point"])
- Downloads last month
- 207
Hardware compatibility
Log In to add your hardware
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support
Model tree for amaye15/tirex-gguf
Base model
NX-AI/TiRex