sheepss/NX-AI-TiRex-1.1-gifteval-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

TiRex-1.1-gifteval - Zero-Shot Time Series Forecasting on Ascend NPU

#NPU · Model: NX-AI/TiRex-1.1-gifteval (revision 01b1ebc83a87e82b119f907fe7e43d015db23e9d) · Task: Zero-shot probabilistic time-series forecasting

TiRex is a 35.29M parameter pre-trained time series forecasting model based on xLSTM (sLSTM blocks). It performs zero-shot forecasting without any training on your data, returning both point estimates (median) and quantile estimates for every horizon step. Version 1.1-gifteval adds long period normalisation (applied only at inference) and the pretraining dataset was cleaned to remove overlaps with the GIFT-Eval test set. This repository adapts TiRex-1.1-gifteval to run real inference on a single Ascend NPU (npu:0, Ascend910_9362).

Data Contract

  • Source: ETTh1 (Electricity Transformer, hourly) — ETTh1.csv
  • Target column: OT (oil temperature)
  • Series length: 17420 steps; we use the trailing context = 512 steps
  • Prediction length (horizon): 64
  • Quantile levels: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
  • Output layout: quantiles [batch, horizon, num_quantiles], mean [batch, horizon]
  • Data sha256: f18de3ad269cef59bb07b5438d79bb3042d3be49bdeecf01c1cd6d29695ee066

Environment

  • torch 2.9.0+cpu, torch_npu 2.9.0.post1
  • CANN 8.5.1, npu-smi 25.5.5, device Ascend910_9362 (2 devices, uses npu:0)
  • Python 3.11.14

Installation

pip install tirex-ts
# weights are at ./model.ckpt (or place model.ckpt in the repo root)

NPU Inference

python inference.py                       # default: npu:0, ETTh1 OT, context=512, horizon=64
python inference.py --bench               # stable latency benchmark (warmup 3, runs 10)
python inference.py --consistency         # CPU vs NPU consistency check
python inference.py --device cpu          # CPU baseline

The model and all participating tensors are moved to npu:0. The internal sLSTM cell computes in bfloat16 (as in the official torch backend).

Real Result (npu:0)

  • Model params on npu:0, dtype float32; peak NPU memory ≈ 289 MB (64 GB device)
  • Context (1, 512) → horizon (1, 64), quantiles (1, 64, 9)
  • Forecast median[0, :5] = [9.2906, 9.0569, 8.9219, 8.8551, 8.8220]
  • Mean[0, :5] = [9.2906, 9.0569, 8.9219, 8.8551, 8.8220]

Consistency (CPU vs NPU)

Same weights, input, dtype and seed on CPU and npu:0:

  • same_shape = True, finite = True, quantiles monotonic = True
  • max_abs_error = 0.0093, mean_abs_error = 0.0040
  • PASS within atol=0.05, rtol=0.01 (BF16 sLSTM path)

Performance (npu:0, horizon=64, context=512)

  • warmup = 3, runs = 10 (each timed with torch.npu.synchronize())
  • avg = 787.31 ms, min = 775.75 ms, max = 798.76 ms
  • p50 = 788.73 ms, p90 = 793.68 ms, p95 = 796.22 ms
  • peak NPU memory ≈ 289 MB; throughput ≈ 1.27 windows/s

Evidence (generated by xterm.js from this adaptation's real logs)

AssetDescription
assets/agent_workflow.pngFull adaptation workflow: discovery, dataset, CPU/NPU, consistency, benchmark, validation
assets/npu_device_call.pngnpu-smi, NPU availability, device name, param device/dtype, input/output tensors
assets/model_result.pngReal python inference.py output: schema, forecasts, latency, status

Limitations

  • TiRex sLSTM internal path uses bfloat16 (official torch backend); CPU-NPU agreement is within BF16 tolerance, not bit-exact.
  • Only inference (zero-shot) is adapted to NPU; no training/fine-tuning is run.
  • Random context is used only for smoke testing; the reported business result uses real ETTh1 OT data.