CoolFace
Modelpublic

amaye15/flowstate-r1-gguf

sourceHugging Faceapache-2.0updated 16d agoView on Hugging Face
0likes185downloads
Model Card

FlowState-R1 (IBM Granite) — GGUF

GGUF conversion of IBM Granite's FlowState-R1 — a state-space encoder-decoder time-series model. Converted and run with **zsfm**, a Rust workspace that ports zero-shot forecasting and tabular foundation models to GGUF + candle. No PyTorch, no Python runtime required to run inference.

F32F16Q8_0
flowstate-r1-f32.ggufflowstate-r1-f16.ggufflowstate-r1-q8.gguf

F16 is generally the best size/accuracy trade-off; Q8_0 is smallest. This repo's default recommendation matches the upstream conversion default: F16.

There's no config.json in this repo — GGUF embeds its own architecture metadata for the CLI, but the Python bindings still need config.json from ibm-granite/granite-timeseries-flowstate-r1.

Context must be at least 32 timesteps (FlowState-R1 has no hard minimum, but 32 gives a meaningful example) — a shorter context fails with context too short. The examples below use a 32-value context.

Use it

Python (pip install zsfm)

bash
pip install zsfm huggingface_hub
python
import zsfm
from huggingface_hub import hf_hub_download

gguf_path = hf_hub_download("amaye15/flowstate-r1-gguf", "flowstate-r1-f16.gguf")
config_path = hf_hub_download("ibm-granite/granite-timeseries-flowstate-r1", "config.json")

model = zsfm.FlowStateModel(gguf_path, config_path)

context = [0.85, 0.93, 1.01, 1.09, 1.17, 1.25, 1.33, 1.06, 1.14, 1.22, 1.3, 1.38, 1.46, 1.54, 1.27, 1.35, 1.43, 1.51, 1.59, 1.67, 1.75, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 1.69, 1.77, 1.85, 1.93]
point = model.forecast(context, horizon=64)
# -> List[float], the median (q0.5) forecast

# full quantile distribution (added in zsfm 0.2.7)
quantile_matrix = model.forecast_quantiles(context, horizon=64)  # one row per level below
levels = model.quantiles()  # quantile_matrix[i] is the level[i] forecast, from config.json

config has no working default in practice — pass it explicitly (an omitted config falls back to a hardcoded path that almost never exists on your machine, raising an I/O error).

Rust / CLI (cargo install zsfm)

bash
cargo install zsfm --locked
bash
# downloads the original weights and converts to GGUF locally
# (produces the same bytes as flowstate-r1-f16.gguf in this repo) — `convert` also caches config.json exactly where `infer --config` defaults to, so it's omitted below:
zsfm flowstate convert --dtype f16 -o gguf/flowstate-r1-f16.gguf
echo '{"context": [0.85, 0.93, 1.01, 1.09, 1.17, 1.25, 1.33, 1.06, 1.14, 1.22, 1.3, 1.38, 1.46, 1.54, 1.27, 1.35, 1.43, 1.51, 1.59, 1.67, 1.75, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 1.69, 1.77, 1.85, 1.93], "horizon": 64}' \
  | zsfm flowstate infer --gguf gguf/flowstate-r1-f16.gguf

-m/--model takes the full HuggingFace repo id (default ibm-granite/granite-timeseries-flowstate-r1) — there's only one published checkpoint for this architecture, so you normally don't need to change it. -o/--output defaults to gguf/flowstate-r1-f16.gguf regardless of --dtype, so always pass -o explicitly (as above) — otherwise repeated runs overwrite the same file under a name that may not even match the dtype you chose:

bash
zsfm flowstate convert --dtype f32 -o gguf/flowstate-r1-f32.gguf
zsfm flowstate convert --dtype q8  -o gguf/flowstate-r1-q8.gguf

To skip conversion and run a file already published here:

bash
huggingface-cli download amaye15/flowstate-r1-gguf flowstate-r1-f16.gguf --local-dir .
huggingface-cli download ibm-granite/granite-timeseries-flowstate-r1 config.json --local-dir .
echo '{"context": [0.85, 0.93, 1.01, 1.09, 1.17, 1.25, 1.33, 1.06, 1.14, 1.22, 1.3, 1.38, 1.46, 1.54, 1.27, 1.35, 1.43, 1.51, 1.59, 1.67, 1.75, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 1.69, 1.77, 1.85, 1.93], "horizon": 64}' \
  | zsfm flowstate infer --gguf flowstate-r1-f16.gguf --config config.json

Source, the other 9 time-series forecasters + 5 tabular models, and full docs: [amaye15/zsfm-rs](https://github.com/amaye15/zsfm-rs).

Response format

json
{
  "id": "forecast-000001932b7a1234",
  "object": "forecast",
  "created": 1736290000,
  "model": "flowstate",
  "choices": [{
    "index": 0,
    "forecast": {
      "point": [2.1, 2.3, 2.5],
      "quantiles": {
        "0.10": [1.8, 2.0, 2.2],
        "0.50": [2.1, 2.3, 2.5],
        "0.90": [2.4, 2.6, 2.8]
      }
    },
    "finish_reason": "stop"
  }],
  "usage": {"context_length": 32, "forecast_length": 64}
}

point is the median (q0.5); all 9 quantile levels (q0.10–q0.90) are included.

Pass a batch of series ("context": [[...], [...]]) for one choice per series.

Architecture

FlowState-R1 is an encoder-decoder model:

  • —Encoder: State-space model backbone that encodes the context window into a conditioning latent
  • —Decoder: Projects the latent through a Legendre polynomial basis to produce quantile forecasts at arbitrary horizons
  • —Output: Multi-quantile forecasts (one row per future timestep, one column per quantile level)

License

Conversion code: MIT (amaye15/zsfm-rs). Weights: Apache-2.0, per IBM Granite's original release — unrestricted, including commercial use.