Sundial (Timer 3.0) is a family of generative time-series foundation models developed by THUML (Tsinghua). sundial-base-128m is the 128M-parameter base model (12 layers, hidden 768, 12 heads, input_token_len 16, output_token_lens 720) pre-trained on 1 trillion time points (UTSD + Lotsa + Chronos datasets). It is a decoder-only Transformer with TimeFlow loss for point and probabilistic forecasting, supporting zero-shot predictions for arbitrary lookback/forecast lengths. This repository provides Ascend 910 NPU adaptation (npu:0) validated for time-series forecasting with context 512 and horizon 96 (also tested 2880 context, 720 horizon). Architecture: Causal Transformer with RoPE and Flow matching. Licence Apache-2.0. Paper: https://arxiv.org/pdf/2502.00816. GIFT-Eval 1st MASE (ICML 2025 Oral).
Original weight URL: https://huggingface.co/thuml/sundial-base-128m (revision 3212e42564493f520593e5414af4367fc4b49226)
GitCode NPU repository: this model repository (public, type=model, topics: NPU, Ascend, Ascend910).
forecasting / time-series-forecasting (point and probabilistic, pipeline_tag: time-series-forecasting)[batch, time] float32, context_length=512 (validated, flexible up to 2880), univariate (num_channels=1), axis order [B,T] strictly, no [B,T,C] transpose without code change.revin=True).seed 2025, batch=2, t=0..511, freq=0.02+batch*0.01, s=sin(2π freq t)+0.1*randn
mean=0.0119, std=0.7144, min=-1.20, max=1.27context 512, horizon 96 (validated), prediction_length corresponds to max_output_length in model forward; num_samples=2 for probabilistic samples.logits / forecast [batch, num_samples, horizon] float32, de-normalized (RevIN denorm), same scale as input. Example shape [2,2,96] for batch 2, 2 samples, 96 steps.input_token_len=16, unfold with mask), no external DataFrame preprocessing. Same fitted state (weights) reused for CPU/NPU.表格数据 (time-series forecasting under tabular umbrella).batch=2, context 512, horizon 96, num_samples 2 with fixed seed 123 for deterministic sampling.torch.npu.is_available()==True, device npu:0 Ascend910_9362, device count 2AutoModelForCausalLM.from_pretrained(local_dir, trust_remote_code=True, local_files_only=True) then model.to("npu:0"), patched modeling_sundial.py for transformers 4.57 compatibility (get_usable_length fallback, attention mask handling), all tensors explicitly moved to npu:0, torch.npu.synchronize() before/after timing.pip install -r requirements.txt
# requirements cover: torch, torch_npu, transformers, huggingface_hub, numpy, safetensors, accelerate
# For Ascend NPU, ensure CANN 8.5.1 is installed and torch_npu matches torch versionDefault command (verified on 910B):
python inference.py/tmp/sundial-base-128m if exists (or working/models/sundial-base-128m), otherwise downloads from thuml/sundial-base-128m via snapshot_download (requires HF_ENDPOINT, may need patch for transformers compatibility).npu:0, synchronizes.next(model.parameters()).device=="npu:0" and output.device=="npu:0").Example output (truncated):
[INFO] model_name: thuml/sundial-base-128m
[INFO] device: npu:0, npu_device_name: Ascend910_9362
[INFO] first param device after to(npu:0): npu:0
[INFO] output shape: (2, 2, 96), device: npu:0
[PERF] avg: 81.74 ms, throughput: 24.47 series/s
[SUCCESS] NPU inference completed on device: npu:0(2, 2, 96) device npu:0, dtype float32[-0.0092, 0.1987, 0.1048, 0.3017, 0.4716] (synthetic sinusoid)[1.0263, 0.9952, 0.9894, 0.9329, 0.9127] (CPU identical within 1.5e-06)python .opencode/skills/npu-adapt-skills/scripts/compare_outputs.py --cpu /tmp/cpu_sundial_fixed.npy --npu /tmp/npu_sundial_fixed.npy --task forecasting --atol 1e-4 --rtol 1e-3Three PNGs generated by xterm.js from real logs via node scripts/render_xterm_evidence.mjs --style raw (prompt atomgit@pod-a94f8701860f4700b161b00e290de466:~$):
assets/agent_workflow.png – workflow (env check, model fetch, inspect, NPU inference, consistency, benchmark, validation).assets/npu_device_call.png – npu-smi info + check_npu.py + param device logs, proving calls on npu:0.assets/model_result.png – default python inference.py full stdout (input/output preview, sync timing, SUCCESS).
Images are xterm.js rendered from logs; not simulated via Pillow/Matplotlib. See scripts/render_xterm_evidence.mjs rendering logs with fixed prompt; screenshots are not claimed as raw desktop.

generate() with KV cache still has known compatibility issue with transformers 4.57 (position_ids raw vs token mismatch); workaround uses single forward model(x, max_output_length=horizon) which is recommended for zero-shot. The generate path requires patching as done in inference.py.npu:0 only; multi-NPU or data-parallel not tested.