Model Name: ibm-granite/granite-timeseries-flowstate-r1
Revision: 05effc6cb39ee16dce9dd0064ed1a76e4b8ff464 (main)
Model Weight URL: https://huggingface.co/ibm-granite/granite-timeseries-flowstate-r1
Model Type: FlowState (State Space Model + Functional Basis Decoder)
Task Type: forecasting (probabilistic time-series forecasting with quantile head)
Architecture Family: Time-Series / SSM (S5 encoder + LEGS decoder)
Pipeline Tag: time-series-forecasting
Weights: model.safetensors (36 MB, 9.06M parameters, FP32)
Config: context_length=2048, decoder_patch_len=24, decoder_dim=256, embedding_feature_dim=512, encoder_num_layers=6, encoder_state_dim=512, encoder_num_hippo_blocks=8, quantiles=[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]
FlowState is the first time-scale adjustable Time Series Foundation Model open-sourced by IBM Research, combining SSM Encoder with Functional Basis Decoder for timescale-invariant coefficient space and continuous forecasts. Supports zero-shot forecasting with adjustable scale_factor.
| Field | Value |
|---|---|
| Input Format | [batch, context_length, channels] e.g. [2,2048,1] (batch_first=True) or [2048, batch, 1] if batch_first=False |
| Axis Order | B T N (batch, time, channel) default; alternative T B N when batch_first=False |
| Context Length | 2048 (min_context, also context_length) |
| Prediction Length (horizon) | 96 (tested; also 24,48,192) -> decoder produces horizon/24 patches |
| Channels | 1 (univariate validated, supports multivariate N>1) |
| Frequency / Scale Factor | Adjustable via scale_factor: 1.0 hourly (default), 0.25 for 15min, 3.43 daily weekly etc. Tested 1.0 and 0.25 |
| Scaling | Causal RevIN (per-series norm/denorm, with_missing=True) |
| Missing Handling | with_missing=True, NaN as missing, contiguous patch masking supported |
| Dtype | float32 (model dtype) |
| Preprocessing | No external scaling; internal RevIN handles normalization; NaN -> mask |
| Data Source | Synthetic sinusoidal: sin(2π t/50 + b) + 0.005·t + N(0,0.1), t=[0,2048), seed=42, deterministic |
| SHA256 | Deterministic synthetic (no external dataset) |
| Output | prediction_outputs: [B,96,1] (point mean forecast), quantile_outputs: [B,9,96,1] (probabilistic, 9 quantiles) |
No fit() required; zero-shot inference.
torch.npu.is_available()==True, device Ascend910_9362, device_count 2, target npu:0npu-smi info and scripts/check_npu.pypip install -r requirements.txt
# requirements: torch, torch_npu, transformers, einops, numpy, safetensors, huggingface_hub, pandas, scikit-learnModel weights are expected at /opt/atomgit/adapt-npu-agent/working/models/granite-timeseries-flowstate-r1 or will be downloaded from HuggingFace ibm-granite/granite-timeseries-flowstate-r1 via huggingface_hub on first run. No tokenizer.
Default command (runs synthetic demo with NPU):
python inference.pyExpected output includes:
model_name, task_type, backend, device_count, device_name, target_deviceconfig: context_length=2048, decoder_patch_len=24, ...past_values shape, sample values, statsfirst_param device: npu:0, input device: npu:0, NPU prediction_outputs shape: [2,96,1] device: npu:0first run (compile) time with torch.npu.synchronize() and second run timemax_abs, mean_abs, quantile monotonic, allcloseFinal state: SUCCESSSupports scale_factor adjustment and variable prediction_length (must be multiple of 24 or will round via decoder patches).
Run: python inference.py (batch=2, context=2048, channels=1, horizon=96, scale_factor=1.0, float32, npu:0)
Input:
past_values [2,2048,1], sample [0.0496, 0.1165, 0.3234, 0.5354, 0.4783], mean 5.1189 std 3.0307Output:
prediction[0,:5,0] = [10.04125, 10.11249, 10.14362, 10.21258, 10.32474]prediction[0,:5,0] = [10.04125, 10.11249, 10.14361, 10.21257, 10.32474] (max_abs 7.0e-05)CPU [10.03239, 10.11970, 10.15185, 10.23014, 10.34451] vs NPU same diff 9.2e-05quantile_outputs [2,9,96,1], quantiles monotonic True, finite TrueTiming (npu:0, synchronized, batch=2):
No CPU fallback; all tensors on npu:0.
Saved CPU/NPU outputs as .npy and compared with scripts/compare_outputs.py:
python scripts/compare_outputs.py --cpu cpu_pred.npy --npu npu_pred.npy --task regression --atol 1e-4 --rtol 1e-3
# {"task":"regression","cpu_shape":[2,96,1],"npu_shape":[2,96,1],"max_abs_error":2.36e-05,"mean_abs_error":1.01e-05,"passed":true}
python scripts/compare_outputs.py --cpu cpu_quant.npy --npu npu_quant.npy --task regression --atol 1e-4 --rtol 1e-3
# {"task":"regression","cpu_shape":[2,9,96,1],"npu_shape":[2,9,96,1],"max_abs_error":3.37e-05,"mean_abs_error":1.03e-05,"passed":true}Thresholds atol=1e-4, rtol=1e-3 chosen for FP32. Single-window smoke consistency (not full benchmark). Quantiles checked for monotonicity and finiteness.
| Metric | Value |
|---|---|
| Compile / First Run | 1913.87 ms |
| Avg (10 runs) | 1624.84 ms |
| Min / Max | 1619.87 / 1637.49 ms |
| p50 / p90 / p95 | 1623.34 / 1628.99 / 1633.24 ms |
| Batch Size | 2 |
| Shape | [2,2048,1] → [2,96,1] + [2,9,96,1] |
| Dtype | float32 |
| Throughput | 0.62 windows/s, 1.23 samples/s (batch=2) |
| Peak Memory | 167.49 MB allocated, 536 MB reserved |
| Horizon Scaling | 24/48/96/192 all similar (decoder parallel) |
| Batch Scaling | 1->767ms, 4->3338ms, 8->6966ms |
Timing measured with torch.npu.synchronize() before/after each iteration; first run separately reported (compilation). Preprocessing (synthetic generation) not included. scale_factor does not affect timing significantly.
All three PNGs are generated by xterm.js (scripts/render_xterm_evidence.mjs --style raw) from real logs; not manual screenshots or Matplotlib.
assets/agent_workflow.png – reconnaissance, download, NPU inference, consistency, benchmark, submission validationassets/npu_device_call.png – npu-smi info, check_npu.py, torch.npu.is_available, device name, model param device npu:0, input/output device npu:0assets/model_result.png – default python inference.py full output with sync timing and SUCCESS

torch_npu and Ascend910 with CANN 8.5.1; CPU fallback is failure.