#NPU Ascend 910B Ascend910 TiRex time-series-forecasting probabilistic
Model: NX-AI/TiRex (TiRexZero) - 35M parameter zero-shot forecasting based on xLSTM, 12 sLSTM blocks, embedding 512, patch 32.
Revision: local download 2026-08-20 from https://huggingface.co/NX-AI/TiRex - ckpt 141,230,262 bytes, onnx 136MB.
Provided via huggingface_hub snapshot_download, loaded from local /opt/atomgit/adapt-npu-agent/working/models/TiRex/model.ckpt with backend=torch, device=npu:0.
Probabilistic time-series forecasting: given univariate context [B, T] -> quantiles [B, horizon, 9] + mean [B, horizon] (median as point estimate). Quantiles = [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]. Uses internal PatchedTokenizer instance norm, no external scaler. No training/fit required - zero-shot inference only.
Source: /opt/atomgit/adapt-npu-agent/working/input.csv (real market 5-min K-line, SHA256 aa5efe0121b7cc098db1a169ed38f9878681ef14a93c85d54a618fd073048899, 2500 rows, 147854 bytes).
Schema: columns [timestamps(str), open(float64), high(float64), low(float64), close(float64), volume(float64), amount(float64)], no missing, duplicate_rows 0.
Time column: timestamps (string, 5-min interval, naive timezone, sorted), e.g. 2024-06-18 11:15:00 -> 2024-07-03.
Target: close (156 unique, float64) univariate. Also OHLCVA available but TiRex univariate -> only close used for this demo; multi-series by stacking [B,T].
Axis order: [B, T] = [1, 512] for this run, dtype float32, device npu:0 for compute, output moved to cpu by model API (output_device=cpu default).
Preprocessing: pandas read_csv, slice first 512 as context, no external scaling; tokenizer handles NaN padding and instance norm internally; no categoricals; missing filled with nan_mask_value 0 after tokenizer.
Context length: 512, horizon (prediction_length): 32, max_context_length: 2016, train_ctx_len: 2048, patch 32.
Validation strategy: smoke consistency on single window (512->32) CPU vs NPU same seed, weight, input; full benchmark not claimed.
Ascend 910_9362 (Ascend910), CANN 8.5.1, 2 devices (4->0,4->1), npu-smi 25.5.5. Python 3.11.14, torch 2.9.0+cpu, torch_npu 2.9.0.post1+gitee7ba04, tirex-ts 1.4.2, transformers 4.57.6, pandas 3.0.2, numpy 1.26.4. Device: npu:0 (explicit), fallback cpu if npu unavailable. Memory budget: weight 135MB, peak alloc 275.9MB within 64GB HBM.
pip install -r requirements.txt
# torch-npu must match CANN; on Ascend use: pip install torch-npu==2.9.0.post1 -f https://repo.ascend.gitcode.com
pip install tirex-ts==1.4.2 pandas numpy scikit-learn huggingface-hubWeights downloaded once via huggingface_hub snapshot_download (HF_ENDPOINT=https://hf-mirror.com):
from huggingface_hub import snapshot_download
snapshot_download(repo_id="NX-AI/TiRex", local_dir="./working/models/TiRex")
# or single file
from huggingface_hub import hf_hub_download
hf_hub_download(repo_id="NX-AI/TiRex", filename="model.ckpt")inference.py first checks /opt/atomgit/adapt-npu-agent/working/models/TiRex/model.ckpt, then local relative, then HF cache; no implicit net download during NPU inference if local exists.
Default command (real NPU synchronized):
python inference.pyBehavior: resolves ckpt, loads TiRexZero.from_pretrained(ckpt, backend=torch, device=npu:0), prints param device/dtype/horizon, reads CSV 512 context, moves input to npu:0, calls model.forecast(context=t_npu, prediction_length=32) with torch.npu.synchronize() before/after, reports time, shape [1,32,9] quantiles / [1,32] mean, finite/monotonic checks, previews median/q10/q90, benchmarks 10 runs after 3 warmup, prints throughput and memory, saves /tmp/tirex_quantiles.npy. Output device is cpu (model returns cpu by design via output_device param) but compute is on npu:0 (verified via param device npu:0 and input device npu:0, CPU fallback not triggered).
CPU vs NPU same weight, input, seed, dtype float32, eval mode:
Three PNGs rendered by xterm.js from real logs (prompt atomgit@pod-a94f8701860f4700b161b00e290de466:~$), style raw, deep gray background:
node scripts/render_xterm_evidence.mjs --manifest evidence.json --output-dir submission/assets --style raw

NXAI Community License (see original model LICENSE) - same as https://huggingface.co/NX-AI/TiRex/blob/main/LICENSE