#NPU
MOMENT-1-base 是 CMU Auton Lab 发布的时序基础模型(T5-encoder 主干,113M 级参数,MIT 协议)。本仓在单卡昇腾
Ascend910(npu:0)上加载官方预训练权重,使用预训练 reconstruction head 的 short_forecast
机制做零样本点预测(context=512 → horizon=96),并给出真实数据上的 CPU/NPU 一致性、业务指标与性能结果。
| 项 | 值 |
|---|---|
| 模型 | AutonLab/MOMENT-1-base |
| 权重 revision | 5e44b0ea26376a176360f87831124e018f876d96 |
| 权重文件 | model.safetensors(453,940,120 B) |
| 加载方式 | momentfm==0.1.4(本地权重,无 remote code) |
| 架构 | T5-encoder(d_model=768, 12 层, 12 头)+ 预训练 reconstruction head |
| 任务 | 时间序列零样本点预测(forecasting,点预测) |
| 设备 | npu:0(Ascend910, 65 GB HBM) |
| dtype | fp32 |
| 参数量 | 109,641,608(实际加载模型) |
ibm-research/patchtsmixer-etth1-test-data(公开 Hugging Face dataset,真实 ETTh1 测试窗口)。forecast_batch.pt,含 past_values[64,512,7] 与 future_values[64,96,7]。[batch, channels, time];7 通道 HUFL,HULL,MUFL,MULL,LUFL,LULL,OT;频率 1h;无缺失步。data/。torch.npu.is_available() == True,设备数 2,目标设备 npu:0。pip install torch torch_npu momentfm==0.1.4 transformers huggingface_hub numpy safetensors昇腾 CANN 与 torch_npu 请按官方文档安装。
# 默认在 npu:0 上跑零样本点预测(首次自动下载权重与数据)
python inference.py
# 指定本地权重/数据目录
python inference.py --model-dir /path/to/weights --data-dir /path/to/data
# 稳定阶段性能基准(预热 3 次、测试 10 次)
python inference.py --bench默认运行(seed=42,ETTh1 第 0 个窗口,context=512,horizon=96,npu:0,fp32):
forecast shape=(7, 96) device=npu:0
forecast OT ch6[:6] = [-1.0103, -1.0188, -0.8169, -0.9538, -0.9294, -0.6924]
forecast stat = mean=-0.4246 std=0.4891
MAE=0.7930 RMSE=1.0766 SMAPE=1.3299(对真实 future_values 计算,未缩放)
FINAL STATUS: PASS相同权重、相同输入窗口、相同 seed、eval 模式、fp32:
(7, 96),均有限值。atol=1e-4, rtol=1e-3)→ PASS。| 项 | 值 |
|---|---|
| 首轮(含编译) | 0.22 s |
| 稳定 avg / min / max | 11.95 / 11.66 / 12.68 ms |
| p50 / p90 / p95 | 11.69 / 12.58 / 12.63 ms |
| 吞吐 | 83.67 windows/s |
| 峰值显存 | 492 MB |
计时前后均执行 torch.npu.synchronize();不含 CSV/预处理读取。
npu-smi、NPU 可用性、模型参数 device/dtype、输入输出 Tensor device。python inference.py 的真实完整输出。图片为 xterm.js 终端渲染,非原始桌面截图。
short_forecast 复用预训练 reconstruction head 做零样本预测,未针对 ETTh1 微调;
forecasting/classification 专用 head 需自行微调后使用。