Model: Melady/TEMPO (TEMPO-80M_v1, 80M params, GPT2 backbone, 6 layers, d_model 768) adapted for Huawei Ascend 910B npu:0
Task: Long-term univariate time series forecasting (context 336 → horizon 96), point forecast (regression)
Tags: NPU Ascend Ascend910 Time-Series Forecasting #NPU TEMPO Foundation-Model
TEMPO (Prompt-based Generative Pre-trained Transformer for Time Series Forecasting, ICLR 2024) 是首个开源时序基础模型之一,基于 GPT2 (6层) + LoRA + RevIN + Patching (patch_size 16, stride 8) + Prompt 机制,在6个领域数据集 (ETTm1/ETTh1/ETTm2/electricity/traffic/weather) 上预训练,支持零样本预测。本仓将权重 TEMPO-80M_v1.pth (280MB) 适配到单卡 Ascend 910B npu:0,输入 [B=1, L=336, M=1],输出 [B=1, H=96, M=1],dtype float32。
Melady/TEMPO @ 2d2f7386e10c1666ce67605a2e40948230867870 (config.json sha 376da4acd326c5c41564cfc21f8a0729889d1520b1e9772bb37b4deb0a52e799, checkpoint TEMPO-80M_v1.pth 292795929 bytes)TEMPO.predict(np_array, pred_length=96)Melady/TEMPO/all_six_datasets/ETT-small/ETTh1.csv (17421行, 8列: date,HUFL,HULL,MUFL,MULL,LUFL,LULL,OT),公开可追溯,验证时固定使用 OT 列最后336点作为 context。[B, seq_len, num_nodes] 其中 seq_len=336, num_nodes=1, dtype float32/float64 (自动转 float32)RevIn.norm → moving_avg → map_trend/season/resid → patching (patch_num = (336-16)//8+2 = 42)[H=96, M=1] 或 [B, H, M],已通过 RevIn.denorm 恢复原量纲,单位与输入 OT 一致inference.py 校验输入长度,若 L >336 截断末336,若 L <336 重复或零填充到336。npu:0, dtype float32, batch_size 1, context 336, horizon 96, channel 1376da4acd326c5c41564cfc21f8a0729889d1520b1e9772bb37b4deb0a52e79952ed518cpip install -r requirements.txt
# 或直接 pip install torch torch_npu transformers einops peft omegaconf pandas numpypython inference.py默认自动探测 npu:0,若可用则全模型参数驻留 npu:0 (122 params, 82M, float32 ~328MB),首参 npu:0,输入/输出 Tensor 均在 npu:0,前后均 torch.npu.synchronize() 计时,打印同步耗时和状态 SUCCESS。权重若本地不存在则通过 huggingface_hub.hf_hub_download 自动从 Melady/TEMPO 拉取 (HF_ENDPOINT=https://hf-mirror.com 生效)。
OT 最后336点 mean 9.2219 std 1.9239 min 3.658 max 14.351 (prefix 52ed518c)mean 16.3687 std 0.4112 min 15.4857 max 17.3655[:5] [16.83110809 16.64466476 16.39447975 16.30843735 16.29175758] [-5:] [17.12719727 17.22995758 17.30492783 17.02014923 16.85120392]avg 8.23 ms (10次, warmup 2), 吞吐 ~121.5 windows/s 或 11662 points/s, 峰值 HBM ~5010 MB / 65536同输入随机 seed 0 合成数据测试: CPU mean 0.2469 vs NPU mean 0.2521 的对比见一致性节。
TEMPO-80M_v1.pth,同一预处理、seed 42、eval 模式、float32ETTh1 OT 同一切片,CPU/NPU 同输入compare_outputs.py --task regression --atol 1e-4 --rtol 1e-3 比较原始 forecast (96,)max_abs 5.72e-06, mean_abs 1.48e-06, passed true, shape 相同且有限值,allclose(atol=1e-4, rtol=1e-3) = True1e-4/1e-3,受 NPU 浮点累积差异影响但远小于任务噪声;分类指标不适用故用回归。npu:0, 输入输出亦在 npu:0, torch.npu.synchronize() 正常)。Ascend910_9362 npu:0, dtype float32, batch 1, context 336, horizon 96, channel 1torch.npu.synchronize()5010 MB, 吞吐 121.5 windows/s (11662 points/s), 不含 CSV 读取/预处理计时,仅模型 forward+denorm。windows/s 与 points/s 双报告,预处理 (RevIN/patching) 已包含在计时内,逆缩放亦包含。assets/agent_workflow.png - 侦察/检查/下载/加载/NPU推理/一致性/benchmark/校验 完整流水 (xterm.js 根据真实日志渲染)assets/npu_device_call.png - npu-smi info + torch.npu.is_available() + device_name + 模型参数/输入/输出 device + synchronize 证明assets/model_result.png - python inference.py 默认输出完整摘要与 SUCCESS以上三图由 scripts/render_xterm_evidence.mjs --style raw 根据本次真实日志生成,深灰背景白字,提示符 atomgit@pod-a94f8701860f4700b161b00e290de466:~$,仅展示标签非主机证明。
num_nodes=1,多变量需扩展 enc_in 与数据管线 (当前 c_out=1)seq_len 336,更短/更长输入按重复或截断处理,可能影响精度pool prompt 池,TopK 机制未验证npu:0,未测试分布式/量化/BF16gpt2,离线时 fallback 为零向量 prompt