Model: NX-AI/TiRex (revision 63c740922493f5fbe60b277609ec62babfba2762) — 35M parameter zero-shot time-series forecasting model based on xLSTM.
Task: Time-series probabilistic forecasting with quantiles [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9] (point estimate = median 0.5).
NPU: Ascend 910B npu:0 (Ascend910_9362) — verified torch.npu.is_available()==True
Weights: https://huggingface.co/NX-AI/TiRex (model.ckpt 135 MiB, tirex.onnx optional)
#NPU Ascend910 TiRex time-series forecasting
TiRex is a pretrained 35M forecasting model introduced in TiRex: Zero-Shot Forecasting across Long and Short Horizons with Enhanced In-Context Learning. It uses xLSTM blocks (12 blocks, embedding 512, 4 heads, patch 32, context 2048). No fine-tuning required; zero-shot forecasting on arbitrary series via model.forecast(context, prediction_length).
[B, T] time series (padded with NaN to train_ctx_len=2048 internally, patched by 32).quantiles [B, T_pred, 9] and mean [B, T_pred] (median).tirex-ts==1.4.2 (tirex.models.tirex.TiRexZero).[batch, time] float32, shape [2,128] demo (2 independent series). Example sample [-0.685, 0.563, -1.507, -1.610, -1.479].quantiles shape [B,64,9] monotonic along quantile axis, mean shape [B,64], dtype float32, device cpu after output_device=cpu.PatchedTokenizer patch 32, ResidualBlock embedding, NaN padding/masking handled inside model.torch.randn(2,128) with seed 42 matching official torch.rand((5,128)) example; also validated sine+trend synthetic (traceable). Single sample consistency used as smoke test, not full benchmark.npu-smi shows 2 NPUs (0→ phy 10, 1→ phy 11) healthy.python scripts/check_npu.py → {"torch_npu_available":true,"npu_available":true,"device_count":2,"device_name":"Ascend910_9362"}pip install torch torch_npu numpy huggingface_hub tirex-ts==1.4.2
# NPU drivers already present in image (CANN 8.5.1)Default command runs full NPU pipeline on npu:0:
python inference.pyScript details (submission/inference.py:1):
torch.npu.is_available(), aborts if not on npu:0/data/adapt-npu-hf/hub/.../model.ckpt or downloads hf_hub_download("NX-AI/TiRex","model.ckpt")TiRexZero.from_pretrained(ckpt, backend="torch", device="npu:0") (strict torch backend, no CUDA kernels)next(model.parameters()).device == npu:0[2,128] and prediction_length=64, calls model.forecast with torch.npu.synchronize() timingFrom python inference.py on npu:0 (log working/logs/inference.log):
[VERIFY] first param device=npu:0 dtype=torch.float32
[DATA] context shape=(2, 128) prediction_length=64
[INFER] First run (compile+infer) time=0.8947s
[INFER] quantiles shape=(2, 64, 9) mean shape=(2, 64)
[RESULT] quantiles[0,0] = [-1.1453, -0.7735, -0.4848, -0.2374, -0.0228, 0.1863, 0.4281, 0.7278, 1.1503]
[RESULT] quantiles[0,-1] = [-1.3514, -0.8195, -0.4969, -0.2334, -0.0005, 0.2410, 0.5213, 0.9100, 1.5253]
[RESULT] mean[0,:5]=[-0.0228, 0.0111, 0.0155, 0.0261, 0.0432]
[CHECK] quantiles monotonic True finite True
[BENCH] avg=0.6633s min=0.6211s max=0.6824s p50=0.6711s p90=0.6786s
[BENCH] throughput=3.02 windows/s context=128 horizon=64 batch=2Second verified case: batch 4, context 512, horizon 128 → avg 1.4113s, 2.83 windows/s (see working/logs/benchmark.log).
Same weights, same input (seed 42), same preprocessing, backend=torch, dtype float32→bfloat16 inside sLSTM (expected small diff).
python scripts/compare_outputs.py --cpu cpu.npy --npu npu.npy --task regression --atol 5e-3 --rtol 5e-3Result working/compare_regression.json:
{
"task": "regression",
"cpu_shape": [2,64,9], "npu_shape": [2,64,9],
"max_abs_error": 0.0030058622, "mean_abs_error": 0.0007289,
"passed": true
}atol=5e-3, rtol=5e-3 chosen for bfloat16 sLSTM path; also monotonic along quantile axis true on both devices.atol=1e-4 would fail due to bfloat16 rounding; hence relaxed but documented.npu:0.npu:0torch.npu.synchronize() before/after each iterationAll three PNGs are rendered from real logs via scripts/render_xterm_evidence.mjs --style raw (xterm.js, not hand-drawn).

agent_workflow.png from working/logs/workflow.log (inspect, env, download, load, NPU infer, compare, bench, validate)npu_device_call.png from working/logs/device.log (npu-smi info && python scripts/check_npu.py + NPU device verification)model_result.png from working/logs/inference.log (python inference.py)Images rendered with prompt atomgit@pod-a94f8701860f4700b161b00e290de466:~$ (display label only).
backend=torch supported on NPU; backend=cuda requires xlstm CUDA kernels (not available on Ascend, would error). Script forces torch.tirex.onnx) not validated on NPU; ckpt path used.