#NPU Ascend910 PatchTSMixer Time-Series Forecasting on Ascend 910
ibm-research/test-patchtsmixer (config _name_or_path: ibm/patchtsmixer-etth1-pretrain)929deb5554d0dc787505243f5372463b241f0c68 (snapshot_download)PatchTSMixerForPrediction (transformers 4.57.6, model_type patchtsmixer)pipeline_tag: time-series-forecastingcontext_length=512, prediction_length=96, num_input_channels=7, num_patches=32, patch_length=16, patch_stride=16, d_model=48, num_layers=2, mode=common_channel, scaling=true, distribution_output=student_t (but loss mse, point forecast)model.safetensors 789,328 bytes (~0.75 MB), 771K on disk, param_count 196,144, dtype float32Test checkpoint for PatchTSMixer ETTh1 pretrain. Small footprint, suitable for single-card NPU validation.
| Field | Value |
|---|---|
| Input format | past_values: FloatTensor [batch, seq_length, num_input_channels] [B,T,C] |
| Input shape | [2, 512, 7] (batch 2 tested, dynamic batch supported) |
| Channel semantics | multivariate 7 channels (ETTh-like) |
| Context length | 512 |
| Prediction length | 96 |
| Horizon | 96 steps ahead, 7 channels forecasted |
| dtype | float32 |
| Scaling | model internal scaling=true (reversible instance norm via loc/scale) |
| Observed mask | torch.ones_like(past_values) internal, no missing values in this test |
| Seed | 42 (deterministic torch.manual_seed) |
| Output | prediction_outputs: [2, 96, 7], plus loc [2,1,7], scale [2,1,7], last_hidden_state [2,7,32,48] |
| Preprocessing | none beyond Tensor creation; values sampled from N(0,1) for synthetic validation; real ETTh data would be normalized via same pipeline |
No CSV/Parquet dataset required for this synthetic validation; model accepts raw Tensor. For real data, maintain column order and channel count =7.
npu:0, npu-smi info verified/usr/local/Ascend/cann-8.5.1torch.npu.is_available()==True, device_count=2, torch.npu.get_device_name(0)==Ascend910_9362pip install torch==2.9.0 torch-npu==2.9.0.post1 transformers==4.57.6 numpy==1.26.4 huggingface_hub safetensors
# or
pip install -r requirements.txtModel is downloaded on first run via snapshot_download if models/test-patchtsmixer not present; subsequent runs use local files only. Cache path models/test-patchtsmixer is excluded from GitCode submission.
python inference.pyDefault behavior (no args) does:
./models/test-patchtsmixer or HF download)torch.npu.set_device(0) and move model + Tensor to npu:0[2,512,7] with seed 42torch.npu.synchronize() before/afterExplicit NPU device trace in output:
target_device: npu:0
model device: npu:0
input device: npu:0
output device: npu:0No CPU fallback; warnings about allow_internal_format=False are harmless and indicate NPU execution.
npu:0 in this pod)First run (post-warmup): 1.57 ms for batch 2
Stable benchmark (10 runs): avg 1.63 ms | min 1.57 ms | max 1.73 ms | p50 1.62 ms | p90 1.69 ms | p95 1.71 ms
Throughput: 1225 windows/s (batch 2), series/s equivalent
Peak NPU memory: 1.9 MB
Output shape torch.Size([2, 96, 7]) dtype float32 device npu:0
Sample forecast [0, :3, :3]:
tensor([[ 0.7755, -0.0929, -0.7411],
[ 0.7456, -0.0931, -0.4562],
[ 0.8253, -0.1361, -0.3123]])Forecast stats: mean -0.036455, std 0.234339, min -0.893713, max 0.825281
Input sample [0,0,:3]: [1.9269, 1.4872, 0.9007], mean 0.0083, std 1.0021
Logs captured in evidence images below; these numbers are from real NPU execution, not simulation.
Using identical weights, input, seed, dtype, eval mode:
python .claude/skills/npu-adapt-skills/scripts/compare_outputs.py --cpu working/cpu_output.npy --npu working/npu_output.npy --task regression --atol 1e-4 --rtol 1e-3Result:
{
"task": "regression",
"cpu_shape": [2, 96, 7],
"npu_shape": [2, 96, 7],
"max_abs_error": 6.62e-05,
"mean_abs_error": 1.73e-05,
"passed": true
}Threshold atol=1e-4, rtol=1e-3 for float32 point forecast. Single-window smoke consistency (not full ETTh benchmark). Classification metrics not applicable; forecast tensors compared directly.
1.63 ms avg (see benchmark above)npu:0 with torch.npu.synchronize() around each measurementImages below are rendered from real terminal logs via xterm.js (scripts/render_xterm_evidence.mjs --style raw), not manually drawn. Fixed prompt atomgit@pod-a94f8701860f4700b161b00e290de466:~$ is display-only.



Manifest evidence.json SHA256 of logs recorded in PNG footer.
npu:0 only; multi-NPU not tested.num_targets=3 in config but forward returns 7 channels (all); filtering to prediction_channel_indices not exercised.python .claude/skills/npu-adapt-skills/scripts/validate_submission.py submission
# [PASS] required files and strict whitelist
# [PASS] three valid xterm evidence PNG filesSubmission contains only inference.py, readme.md, requirements.txt, assets/*.png; no weights, caches, logs, or credentials.