#NPU
ibm-granite/granite-timeseries-patchtsmixer (PatchTSMixerForPrediction)90dc5a88d45f032b7dceefb5d814ca2af54f2ff9PatchTSMixer (TSMixer: Lightweight MLP-Mixer Model for Multivariate Time Series Forecasting) is an MLP-Mixer-based forecaster. This IBM Granite checkpoint is pretrained on ETTh1 (7 channels: HUFL, HULL, MUFL, MULL, LUFL, LULL, OT) with context_length=512, prediction_length=96, patch_length=16, patch_stride=16, num_patches=32, d_model=48, num_layers=2, expansion_factor=3, gated_attn=True, head_aggregation=max_pool, scaling=True (StdScaler inside model), distribution_output=student_t, loss=mse, mode=common_channel. It forecasts 96 steps for all 7 variates from 512 past steps. Architecture: patch embedding -> 2 x Mixer layers (token+channel mixing) -> distribution head (loc/scale + prediction).
past_values [batch, 512, 7] float32, optional past_observed_mask (ones)prediction_outputs [batch, 96, 7] float32 point forecasts + loc [B,1,7] and scale [B,1,7]| Field | Value |
|---|---|
| task_type | forecasting |
| architecture_family | time-series PatchTSMixer |
| loading_backend | transformers.PatchTSMixerForPrediction.from_pretrained |
| dtype | float32 |
| context_length | 512 |
| prediction_length | 96 |
| num_input_channels / num_targets | 7 / 3 (config) but outputs 7 channels |
| patch_length / stride / num_patches | 16 / 16 / 32 |
| scaling | true (PatchTSMixer StdScaler, loc/scale returned) |
| distribution_output | student_t (mean used) |
| mode | common_channel |
| input_shape | [B, T=512, C=7] |
| output_shape | [B, H=96, C=7] forecast |
| preprocessing | none external; scaler inside model on past_values |
| axis order | [B,T,C] (no transpose) |
| missing handling | observed_mask all True |
| validation_strategy | CPU vs NPU forecast tensor compare (forecasting) atol=1e-4 rtol=1e-3 |
Demo input: deterministic synthetic sine-wave multisignal (seed 0): past = 0.1*randn[B,512,7] + sin(linspace 0..4π)[B,T,1] * linspace 0.2..1.0[1,1,C] . SHA256 bc4da4e77f40c4d5 for past_values.
Ascend910_9362 (npu:0), driver 25.5.5, 2 NPUs/usr/local/Ascend/cann-8.5.1npu-smi info both NPUs OK, HBM 3108/65536 MBtorch.npu.is_available()==True, device_count==2, torch.npu.get_device_name(0)==Ascend910_9362HF_ENDPOINT=https://hf-mirror.com (env proxy, no manual override)/tmp/patchtsmixer_verifyDependencies: see requirements.txt (torch, torch_npu, transformers, safetensors, huggingface_hub, numpy).
pip install -r requirements.txt
# weights auto-download via HF mirror if /tmp/patchtsmixer_verify missing; snapshot_download with local_dir fallbackDefault (NPU):
python inference.pySteps in script:
torch.npu.is_available() on npu:0 (fail fast if not)./tmp/patchtsmixer_verify (or fallback snapshot_download) via PatchTSMixerForPrediction.from_pretrained.model.to("npu:0"), assert next(model.parameters()).device == npu:0.past_values [2,512,7] (seed 0), move to npu:0.torch.npu.synchronize() before/after each forward; warmup compile run + 2 extra warmups.prediction_outputs [2,96,7] preview, stats, SHA256, device checks, success flag; no CPU fallback.From python inference.py on npu:0 batch=2:
[INFO] model_name=ibm-granite/granite-timeseries-patchtsmixer revision=90dc5a88d45f032b7dceefb5d814ca2af54f2ff9
[INFO] config context_length=512 prediction_length=96 num_input_channels=7 d_model=48 num_layers=2 patch_length=16
[INFO] past_values stats mean -0.001386 std 0.472104 min -1.181783 max 1.217511 preview ch0 first5 [0.176405, -0.010217, 0.054219, 0.080103, 0.172919]
[CHECK] first param device npu:0 output device npu:0 fallback_detected False
[RESULT] prediction_outputs shape (2, 96, 7) device npu:0 dtype torch.float32 loc [2,1,7] scale [2,1,7]
[RESULT] output preview batch0 first5 ch0 [0.104764, 0.106123, 0.079585, 0.051965, 0.022495]
[RESULT] output preview 3x3 [[0.1047 0.0180 0.0258] [0.1061 -0.0302 -0.0061] [0.0795 -0.0655 -0.0314]]
[RESULT] output stats mean -0.155916 std 0.085205 min -0.390869 max 0.106124 SHA256 6596bf9f5a26eddc
[RESULT] finite True shape_ok True
[PERF] compile/first-run 156.87 ms
[PERF] stable 10 runs avg 1.63 ms min 1.59 max 1.74 p50 1.61 p90 1.66 p95 1.70 (batch 2)
[PERF] throughput 1228.60 windows/s batch2
[PERF] npu memory allocated 1014272 bytes
[SUCCESS] NPU inference completed on npu:0CPU reference (same seed 0): mean -0.155913 std 0.085203 preview ch0 [0.104777, 0.106134, 0.079594, 0.051973, 0.022503] . NPU mean -0.155916 difference 3.6e-05 within FP32 tolerance.
CPU vs NPU identical weights/input/preprocess/dtype/seed (seed 0, float32):
python .opencode/skills/npu-adapt-skills/scripts/compare_outputs.py --cpu /tmp/patchtsmixer_cpu2.npy --npu /tmp/patchtsmixer_npu2.npy --task regression --atol 1e-4 --rtol 1e-3{
"task": "regression",
"cpu_shape": [2, 96, 7],
"npu_shape": [2, 96, 7],
"finite": true,
"atol": 1e-04, "rtol": 1e-03,
"max_abs_error": 3.623e-05,
"mean_abs_error": 5.99e-06,
"passed": true
}Threshold atol=1e-4 rtol=1e-3 for FP32 PatchTSMixer (MLP-Mixer + LayerNorm). Max_abs 3.62e-05 < atol. Single-window smoke consistency (not full ETTh1 benchmark). No CPU fallback; both tensors from same prediction_outputs.
torch.npu.synchronize() each side, pre-warm 3, measure 10npu:0 verified via first param device and output device; fallback 0Three PNGs rendered by scripts/render_xterm_evidence.mjs --style raw from real logs (xterm.js, dark bg, prompt atomgit@pod-a94f8701860f4700b161b00e290de466:~$):

Manifest working/evidence_patchtsmixer.json maps each PNG to source log, command, exit_code, UTC time. Logs are raw stdout/stderr (ANSI stripped, tokens redacted). Images generated by xterm.js from actual logs, not simulated.
num_parallel_samples=100) not validated.fit) – inference only.