#NPU
A standalone single-card Ascend 910 NPU inference adaptation of
ibm-research/test-patchtst,
an IBM PatchTST time-series forecasting checkpoint pre-trained on the
ETTh1 dataset (Apache-2.0). The checkpoint is loaded through
transformers.PatchTSTForPrediction and runs entirely on npu:0 — no
network access, random weights, or CPU fallback during the forward pass.
| Field | Value |
|---|---|
| Model | ibm-research/test-patchtst (PatchTST, namctin/patchtst_etth1_forecast weights) |
| Architecture | PatchTSTForPrediction (transformers, model_type=patchtst) |
| Task | Time-series forecasting, point forecast (loss=mse, inverse-scaled output) |
| Context | 512 hours |
| Horizon | 96 hours |
| Channels | 7 (HUFL, HULL, MUFL, MULL, LUFL, LULL, OT) |
| Weights | 614,496 params, model.safetensors ≈ 2.4 MB, float32 |
| Revision | a8c54ceeaf3c9c4d864a33d650b156cc18b3ab53 |
ETTh1.csv from the ETDataset
(mirrored at raw.gitcode.com/gh_mirrors/et/ETDataset/.../ETTh1.csv),
SHA-256 f18de3ad269cef59bb07b5438d79bb3042d3be49bdeecf01c1cd6d29695ee066.date, HUFL, HULL, MUFL, MULL, LUFL, LULL, OT.[0, 8640), val [8640, 11520), test [11520, 14400).data[13888:14400]), ground truth = next 96 rows (data[14400:14496]).
The window never crosses the data boundary.past_values shape [1, 512, 7] float32; output shape [1, 96, 7],
inverse-scaled forecasts in original data units.pip install torch torch-npu transformers modelscope numpy pandaspython inference.py # auto-download model+data, run on npu:0
python inference.py --bench # include 10-run timing benchmark
python inference.py --device cpu # CPU baseline for comparisonThe first NPU call includes on-device compilation; steady-state inference is
timed with torch.npu.synchronize() around every forward pass.
npu:0, model params on npu:0, input/output tensors on npu:0, dtype float32.117.4 ms; steady-state avg 2.58 ms/window (≈ 387 windows/s),
min 2.53, max 2.62, p50 2.59, p90 2.62, p95 2.62.2.4 MB.| Metric (96h OT) | Value |
|---|---|
| MAE (all channels) | 1.7906 |
| RMSE (all channels) | 3.7150 |
| MAE (OT) | 2.1592 |
| RMSE (OT) | 2.4664 |
| SMAPE (OT) | 109.75 % |
Same weights, data window, seed, eval mode and float32 dtype on both devices.
compare_outputs.py --task regression --atol 1e-3 --rtol 1e-3 passes:
max absolute error 8.6e-4, mean absolute error 1.6e-4 across [1,96,7]
outputs. Only 2/672 elements differ by ≤ 0.86e-3 absolute (≤ 0.77% relative)
at the small-magnitude MUFL channel; tolerance is set relative to the ~2.5
forecast scale and is documented as the FP32 NPU threshold.
The three images below are rendered by the xterm.js renderer from this task's real logs (workflow / device / inference), not from simulated screenshots:
assets/agent_workflow.png — inspection, data, compare, submission validation.assets/npu_device_call.png — npu-smi, check_npu.py, model/tensor device+dtype on npu:0.assets/model_result.png — default python inference.py full output on npu:0.test-* checkpoint is a lightweight sample; the forecast is a point
forecast (no quantile head in this config).