jsjs1258/Datadog-Toto-2.0-22m-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

Datadog/Toto-2.0-22m — Ascend NPU

#NPU

Datadog/Toto-2.0-22m is a 21.9M parameter multivariate time-series foundation model (Toto 2.0 family) built by Datadog. It is a u-μP-scaled transformer with alternating time/variate attention and quantile-based probabilistic forecasting. This repository adapts the model to run on a single Ascend 910 NPU (npu:0) via torch_npu.

模型简介

  • Model: Datadog/Toto-2.0-22m (revision 685e4ae3e2be8d8998025e53dd98e7fdcb296a89)
  • Task: multivariate time-series forecasting (probabilistic, 9 quantile levels [0.1, 0.2, ..., 0.9])
  • Architecture: alternating time/variate attention transformer, patch size 32, 6 layers, d_model 512, unit scaling (u-μP)
  • Parameters: 21,915,584 (21.916M)
  • Output: quantiles (9, batch, n_variates, horizon) — identical to the official HuggingFace API contract
  • License: Apache-2.0
  • Reference: DataDog/toto · Model Card

数据契约

Default evaluation data is the real traceable ETTh1 hourly series from ETDataset (zhouhaoyi) (ETT-small/ETTh1.csv, 17,420 rows, hourly, 2016-07-01 00:00 to 2018-06-26 19:00).

项值
数据源https://github.com/zhouhaoyi/ETDataset (ETTh1.csv)
时间列date (hourly, UTC)
通道OT (oil temperature)
轴顺序(batch, n_variates, time)
context_length512 (最后 512 个观测)
prediction_length / horizon96
频率hourly
缩放模型内置 PatchedCausalStdScaler + asinh,输出已反缩放回真实量纲
缺失值本样例无缺失 (has_missing_values=False)

模型权重新先下载到工作区再从本地加载,正式推理不隐式联网下载权重。

环境

  • Ascend 910 NPU (Ascend910_9362, SOC_VERSION=ascend910_9391)
  • CANN 8.5.1, torch 2.9.0 + torch_npu 2.9.0
  • Python 3.11
  • 单卡 npu:0,峰值显存约 146 MiB

安装

pip install -r requirements.txt

如需运行默认评测,先把 ETTh1.csv 放到 data/ETTh1.csv(或在命令行用 --data 指定)。

NPU 推理

默认命令(无需任何参数):

python inference.py

脚本会从 HuggingFace 镜像下载权重到本地缓存并加载到 npu:0。使用本地权重目录时可显式指定:

python inference.py --model-dir /path/to/Datadog/Toto-2.0-22m --data /path/to/ETTh1.csv --context 512 --prediction-length 96

输出 9 个分位点(0.1–0.9)的未来 96 小时预测,并打印同步耗时、分位数单调性检查与 [STATUS] NPU inference PASS。

真实结果

数据:ETTh1 OT 通道最后 512 个观测,预测未来 96 小时(context=512, horizon=96, channel=1, dtype=float32)。

指标值
中位数预测均值 (96h)9.0227
中位数预测 min/max7.9774 / 11.0002
分位数单调性True(9 个分位点单调递增)

前 8 步分位数预测(0.1→0.9):

step 1: [8.981 9.128 9.212 9.273 9.333 9.391 9.457 9.535 9.650]
step 2: [8.618 8.822 8.949 9.039 9.122 9.201 9.287 9.390 9.547]
step 3: [8.439 8.676 8.822 8.922 9.014 9.104 9.201 9.322 9.504]
step 4: [8.319 8.589 8.752 8.872 8.978 9.085 9.199 9.337 9.545]
step 5: [8.215 8.526 8.707 8.842 8.962 9.074 9.195 9.346 9.567]
step 6: [8.102 8.462 8.654 8.800 8.933 9.058 9.191 9.354 9.598]
step 7: [7.947 8.345 8.552 8.703 8.839 8.974 9.115 9.291 9.547]
step 8: [7.760 8.207 8.433 8.599 8.747 8.889 9.040 9.221 9.502]

一致性

CPU 与 NPU 使用完全相同的权重、数据切片、预处理、seed(42)、eval 模式和 dtype(float32),分别保存原始分位数组后对比:

指标值
输出 shape(9, 1, 1, 96)(CPU 与 NPU 一致)
max_abs_error1.24e-05
mean_abs_error3.66e-06
atol / rtol1e-4 / 1e-3
CPU 分位数单调True
NPU 分位数单调True
结果PASS(smoke consistency,单窗口)

阈值说明:模型以 float32 推理,分位数输出量纲为真实温度(约 3–15), atol=1e-4, rtol=1e-3 远高于浮点误差,NPU 与 CPU 在 1e-5 量级内一致。

性能

单卡 npu:0,context=512,horizon=96,batch=1,channel=1,dtype=float32。 计时前后均调用 torch.npu.synchronize()。

指标值
首次运行(含编译)238.1 ms
稳定 avg32.2 ms
min / max30.1 / 33.5 ms
p50 / p90 / p9532.0 / 33.3 / 33.4 ms
吞吐31.07 windows/s
峰值显存146.5 MiB
迭代次数1(编译)+ 9(稳定)

预处理(CSV 读取、窗口切片)不计入推理耗时;显存为 torch.npu.max_memory_allocated() 峰值。

证据图

以下三张图由 xterm.js 根据本次真实日志生成(非手工绘制),仅展示真实命令输出:

图片说明
assets/agent_workflow.png侦察、数据检查、下载、加载、NPU 推理、一致性、benchmark 与提交校验完整工作流
assets/npu_device_call.pngnpu-smi、NPU 可用性、设备名、模型参数 device/dtype、输入输出 Tensor device
assets/model_result.png默认 python inference.py 的真实完整输出(schema/窗口摘要、真实预测、同步耗时、状态)

限制

  • 本仓为单窗口 smoke consistency 与推理验证,不构成完整 benchmark 排名(官方 BOOM/GIFT-Eval 排行见模型卡)。
  • 默认仅验证单变量(channel=1);多变量(n_variates>1)与缺失值场景为同一推理路径,但未在此验证。
  • 输出为概率分位数,中位数以外的分位点用于不确定性区间估计。
  • 模型权重约 87.7 MB,需自行下载;本仓不提交权重文件。