#NPU · Model: qcw2333/YingLong_110m (revision main) · Task: zero-shot time-series forecasting (99-quantile probabilistic output)
This repository adapts the YingLong 110M time-series foundation model to run on a single Ascend 910B NPU (npu:0). The original checkpoint uses CUDA-only custom ops (flash_attn, xformers.ops.SwiGLU, dropout_layer_norm, rotary_emb); this adaptation replaces them with mathematically equivalent standard PyTorch operations so the real pretrained weights run on Ascend NPU with no CPU fallback.
| Field | Value |
|---|---|
| Model | qcw2333/YingLong_110m |
| Architecture | YingLong (GPT-style, 12 layers, n_embd=768, patch_size=32, unet decoder, Haar wavelet tokenizer) |
| Params | 120,464,736 (~110M) |
| Weights | bfloat16, model.safetensors (240,947,188 bytes) |
| License | CC-BY-4.0 |
| Task | Time-series forecasting — outputs 99 quantiles per forecast step |
Validation uses the public ETT-small/ETTh1 dataset (Electricity Transformer Temperature, hourly, from the ETDataset repository):
| Item | Value |
|---|---|
| Source | https://github.com/zhouhaoyi/ETDataset/blob/main/ETT-small/ETTh1.csv |
| SHA-256 | c4477ee44965ae09b9206136b26b794305fd7b2f4fa869953a29bc73832a034e |
| Rows | 3262 (last incomplete row dropped) |
| Columns | date, HUFL, HULL, MUFL, MULL, LUFL, LULL, OT |
| Target | OT (oil temperature), float32, no missing values after drop |
| Context (lookback) | 2880 hourly steps |
| Horizon (prediction) | 96 hourly steps |
| Ground truth | the 96 values immediately following the context window |
The script validates missing columns, column order and non-convertible values. The model performs zero-shot inference (no per-dataset fit()); normalization is the model's built-in patch-wise mean/std scaling and is inverted on the output, so forecasts are in the original OT units (°C-like).
Validated on:
Ascend910_9362), 2 devices, target npu:0torch 2.9.0, torch_npu 2.9.0.post1pip install -r requirements.txtpython inference.pyOn first run the script downloads model.safetensors (from the model weight URL, default https://huggingface.co/qcw2333/YingLong_110m) and ETTh1.csv, then runs the 96-step zero-shot forecast on npu:0. You can point it at local files / a custom CSV:
python inference.py \
--model-dir ./model_weights \
--input-csv ./ETTh1.csv \
--target-col OT \
--lookback 2880 \
--prediction 96Custom input is supported via --input-csv and --target-col; the last lookback + prediction rows of the target column are used (first lookback = context, next prediction = ground truth).
Default python inference.py on the ETTh1 OT window (lookback=2880, horizon=96), model weights on npu:0, dtype bfloat16:
| Metric | Value |
|---|---|
| Output shape | [1, 96, 99] (96 steps × 99 quantiles) |
| MAE (median q≈0.50 vs ground truth) | 4.98 |
| RMSE | 5.35 |
| SMAPE | 28.65 % |
| First run (compile) | 0.31 s |
| Steady inference | 0.019 s |
| Peak NPU memory | 256 MB |
The forecast median at the last horizon step is ≈ 19.8 °C; ground truth at the same step is 19.8 °C. These are the real zero-shot model outputs — no fabricated scores.
CPU and NPU use identical weights, the same window, preprocessing, dtype (bfloat16) and seed:
| Check | Result |
|---|---|
| Output shape match | ✅ [1, 96, 99] on both |
| Finite outputs | ✅ |
| Max absolute error (bf16) | 0.5 (scale ≈ [-18, 42]) |
| Mean absolute error | 0.053 |
| Quantile monotonicity (99 quantiles) | ✅ monotonic on CPU and NPU |
Tolerance atol=0.6, rtol=0.02 is justified by the bf16 output scale (values range ≈ -18 to 42; bf16 has ~3 decimal digits). The comparison follows the skill tool convention [batch, quantiles, steps].
| Metric | Value |
|---|---|
| Warmup / runs | 3 / 10 |
| First run (compile) | 333.8 ms |
| avg / min / max | 18.25 / 17.81 / 19.38 ms |
| p50 / p90 / p95 | 18.22 / 18.44 / 18.91 ms |
| Peak memory | 255.8 MB |
| Throughput | 54.8 windows/s |
The following images are rendered by xterm.js from the real execution logs of this adaptation (not simulated screenshots):
| Image | Content |
|---|---|
![]() | Reconnaissance, data inspection, download, CPU baseline, NPU inference, consistency, benchmark and submission validation |
![]() | npu-smi, NPU availability, device name, model parameter device/dtype, input/output tensor device |
![]() | Default python inference.py full output: data contract, real forecast, timing, metrics, status |
model.py was adapted to replace CUDA-only custom ops — flash_attn (fused attention), xformers.ops.SwiGLU, dropout_layer_norm (fused RMSNorm), and rotary_emb (fused rotary) — with equivalent standard PyTorch operations. Parameter names are unchanged, so the original model.safetensors loads 1:1 (0 missing / 0 unexpected keys).