model.safetensors 4.16 GB (FP32, 1.04B params),config.json 598 B[batch, n_variates, time] (B V T),例如 [1,2,512],支持 target, target_mask, series_ids,频率无关 (frequency-agnostic)[9, batch, n_variates, horizon],分位点 [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9] (9 levels),含 median q0.5npu:0 (Ascend910_9362)/opt/atomgit/adapt-npu-agent/model_cache/Datadog_Toto-2.0-1B (symlink /opt/atomgit/adapt-npu-agent/working/models/Toto-2.0-1B)pip install -r requirements.txt
# 或已包含 toto2 的环境直接运行
# 如需从源码安装 toto2:
# git clone https://github.com/DataDog/toto.git /tmp/toto
# pip install --no-deps /tmp/toto/dd_unit_scaling /tmp/toto/toto2requirements.txt 已固定 torch==2.9.0 torch_npu==2.9.0.post1 等版本。
默认命令(CPU 基准 + NPU 推理 + 一致性 + 性能):
python inference.py指定设备(脚本内通过 toto2 自动处理):
python inference.py # 默认 npu:0,完成 CPU 与 NPU 对比脚本自动从本地候选路径加载权重,优先级:
/opt/atomgit/adapt-npu-agent/working/models/Toto-2.0-1B/opt/atomgit/adapt-npu-agent/model_cache/Datadog_Toto-2.0-1B./model_cache/Datadog_Toto-2.0-1BDatadog/Toto-2.0-1B (需 HF_ENDPOINT)使用合成多元序列(sinusoid + trend + noise,seed=42,B=1, N=2, T=512,as float32):
[Q,B,N,H] = [9,1,2,96]CPU 基准 (float32, 4.96s):
quantiles median (q0.5) [0,0,:5]=[1.50172,1.51025,1.50196,1.47413,1.43776]
quantiles q0.1 [0,0,:5]=[1.36846,1.38235,1.36395,1.33909,1.29555]
quantiles q0.9 [0,0,:5]=[1.62773,1.63819,1.63207,1.60733,1.56978]
finite True monotonic True (quantiles sorted increasing)NPU (npu:0, float32, first run 495.29 ms compile, second run 172.33 ms):
quantiles median [0,0,:5]=[1.5017228,1.5102551,1.5019616,1.4741249,1.4377614]
quantiles q0.1 [0,0,:5]=[1.3684566,1.3823483,1.3639510,1.3390883,1.2955515]
quantiles q0.9 [0,0,:5]=[1.6277305,1.6381958,1.6320750,1.6073271,1.5697731]
finite True monotonic True扩展测试 (horizon=192, decode_block_size=768, KV cache 多块):
block decode 192 horizon shape (9,1,2,192) median[0,0,:5]=[1.5017222,1.5102550,1.5019614,1.4741254,1.4377612]终态: SUCCESS - NPU inference validated (exit 0)
.npy 对比/tmp/cpu_toto.npy vs /tmp/npu_toto.npy,shape [9,1,2,96]max_abs = 5.96e-06mean_abs = 8.45e-07allclose(atol=1e-4, rtol=1e-3) = Truefinite True (两端)monotonic True (quantiles 单调递增)shape_ok True ([9,1,2,96])此为 smoke consistency(固定单窗口,B=1 N=2 T=512 H=96),非完整数据集评测。已通过阈值,未发生 CPU fallback(首参设备验证: cpu vs npu:0)。
运行: python scripts/compare_outputs.py --cpu /tmp/cpu_toto.npy --npu /tmp/npu_toto.npy --task regression --atol 1e-4 --rtol 1e-3
所有计时前后调用 torch.npu.synchronize(),预热 3 次,正式 10 次。
对比 CPU: 4962 ms (单次,无 synchronize),NPU 加速 ~28x (稳定阶段)。
三张证据图由 scripts/render_xterm_evidence.mjs --style raw 从本次真实日志渲染,深灰背景,等宽字体,提示符 atomgit@pod-a94f8701860f4700b161b00e290de466:~$,每张显示 source SHA256、exit code、UTC 时间。
assets/agent_workflow.png - 工作流:inspect_model → npu-smi → check_npu → inference.py (完整 CPU+NPU+一致性+性能)assets/npu_device_call.png - 设备调用:npu-smi info、torch_npu 可用性、device_name、模型首参 device、输入输出 Tensor deviceassets/model_result.png - 默认 python inference.py 完整输出:数据契约、真实预测、耗时、一致性、PASS

has_missing_values=False 路径,不含缺失值掩码与缺失插补分支decode_block_size=768 单块可覆盖 96 horizon;更大 horizon 会触发多块自回归,性能与数值需另测#NPU #Ascend #Ascend910 #Ascend910B #time-series #forecasting #probabilistic #quantile #Toto #Toto-2.0 #transformer #patch #multivariate
硬件声明: hardware: NPU (见 YAML frontmatter)