Timer-S1 is a time series foundation model with 8.3B total parameters, 0.75B activated parameters per token, and context length up to 11,520. It is a decoder-only Mixture-of-Experts (MoE) Transformer supporting zero-shot probabilistic forecasting at quantile levels [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9].
This adaptation runs the real weight on single Ascend 910B npu:0 via torch_npu.
torch.Tensor [batch, time] or [batch, time] float32/bfloat16, here batch=1, lookback=512 (smoke) and lookback=11520 supported; no external CSV required for smoke, but can load CSV with past_values convention.revin=True inside generate(); handles mean/std internally.Tensor [batch, 9, forecast_length] quantile forecasts; median is index 4 (q0.5). No extra scaling needed beyond RevIN inverse.[batch, time] for input, [batch, quantile, horizon] for output.torch_dtype: bfloat16); NPU bfloat16 fully supported.npu:0 (64 GB HBM)trust_remote_code=True)Verify NPU:
npu-smi info
python -c "import torch; print(torch.npu.is_available(), torch.npu.device_count(), torch.npu.get_device_name(0))"
python .claude/skills/npu-adapt-skills/scripts/check_npu.pypip install -r requirements.txt
# requirements includes torch==2.9.0 torch-npu==2.9.0.post1 transformers==4.57.1 accelerate safetensors numpy pandasModel weights must be downloaded once:
# from HF (requires trust_remote_code)
# already in ./model via snapshot_download
# or: python -c "from huggingface_hub import snapshot_download; snapshot_download('bytedance-research/Timer-S1', local_dir='./model', local_dir_use_symlinks=False)"
ls ./model # should contain config.json, modeling_TimerS1.py, model-0000*.safetensors (4 shards, 16.6GB)python inference.py
# Expected output: [1, 9, 64] quantile forecasts, median printed, timing with torch.npu.synchronize()Example log (NPU):
[INFO] Using device: npu:0
[INFO] NPU available: True
[INFO] First param device: npu:0, dtype: torch.bfloat16
[INFO] Input seqs shape: torch.Size([1, 512]), device: npu:0
[INFO] Generate done in 1.2s
[INFO] Output shape: torch.Size([1, 9, 64])
[INFO] Quantile monotonic (first step): TrueAdvanced: full context
seqs = torch.randn(1, 11520).to("npu:0")
output = model.generate(seqs, max_new_tokens=256, revin=True) # [1,9,256]CPU vs NPU consistency (same seed, same input, same dtype):
scripts/compare_outputs.py with cpu.npy and npu.npy (forecast tensors). Tolerance atol=1e-3 for bfloat16, rtol=1e-3. Small numeric differences expected due to bfloat16 matmul order.# Save CPU and NPU outputs as .npy then:
python .claude/skills/npu-adapt-skills/scripts/compare_outputs.py --cpu cpu.npy --npu npu.npy --task regression --atol 1e-3 --rtol 1e-3
# For probabilistic forecast, median is primary.
# Timing must use torch.npu.synchronize() before/after.assets/npu_device_call.png – log showing npu:0 device and first param deviceassets/model_result.png – log showing output shape [1,9,64] and quantile valuesassets/agent_workflow.png – full workflow logtrust_remote_code=True required (custom modeling_TimerS1.py). Code has been audited: no network, subprocess, or file writes beyond cache.use_cache=True); disable via model.config.use_cache=False if OOM for long horizon.@article{liu2026timer,
title={Timer-S1: A Billion-Scale Time Series Foundation Model with Serial Scaling},
author={Liu, Yong et al.},
journal={arXiv preprint arXiv:2603.04791},
year={2026}
}