#NPU
Datadog/Toto-2.0-313mhttps://huggingface.co/Datadog/Toto-2.0-313ma7bab288f5e95f8606f8306f86659357e1c001ef (main)d_ff 2736, qk_dim 64, v_dim 64, residual_mult 0.75, use_xpos truePatchedCausalStdScaler 因果标准化与分块解码本仓库为昇腾 910 (Ascend910_9362) 单卡 NPU 适配,基于 toto-2==2.0.0 推理管线,真实权重在 npu:0 完成验证,权重 1.25GB (safetensors)。
[batch, n_variate, time] 浮点张量,非图像、非表格分类
batch=1, n_variate=1, context=512 (需 ctx % patch_size==0, patch_size=32)torch.randn(1,1,512) seed=42, target_mask 全 True, series_ids 全 0has_missing_values=False, 启用 Fast path[B, C, T] (batch, variate, time), 内部按 patch 重排, 禁止经验性转置PatchedCausalStdScaler 因果标准化, 输出已逆缩放为分位数, 无外部 scalerquantiles 形状 [9, batch, n_variate, horizon] horizon=96, decode_block_size=768
[0.0335, 0.0282, 0.0249, 0.0268, 0.0249]torch.manual_seed(42) np.random.seed(42) 固定, eval mode, dtype float32, 同一输入张量 CPU 生成后搬运至 NPU 以保证一致性pip install -r requirements.txt
# 需 CANN 8.5.1 + torch_npu 配套requirements.txt 已包含:
torch==2.9.0
torch-npu==2.9.0.post1
einops>=0.8.0
numpy==1.26.4
safetensors>=0.4.0
huggingface-hub>=0.20.0
jaxtyping>=0.2.25
dd-unit-scaling>=0.1.0
unit-scaling>=0.3.5
toto-2>=2.0.0
pandas>=2.0python inference.py/opt/atomgit/.cache/huggingface/hub/models--Datadog--Toto-2.0-313m/.../a7bab288 加载, 若不存在则从 Datadog/Toto-2.0-313m 自动下载 (依赖 HF_ENDPOINT=https://hf-mirror.com 走代理直连, 无需手动设代理)torch.npu.is_available(), 显式 model.to(npu:0), 输入 target.to(npu:0), 校验首参 device==npu:0 dtype==float32cpu_output_313m.npy / npu_output_313m.npy (原始 quantiles, 未四舍五入)npu:0 完成前向, 不得 CPU fallback, 不得更换为 dummy 模型target shape (1,1,512) 随机正态 seed=42, horizon=96, decode_block_size=768[9,1,1,96] mean 0.016640 std 0.769092[0,0,0,:5] [-1.2206363677978516, -1.2161133289337158, -1.2267074584960938, -1.2202595472335815, -1.2257647514343262][0,0,0,:5] [0.03355651721358299, 0.028246330097317696, 0.024992527440190315, 0.026810619980096817, 0.02494671382009983][9,1,1,96] mean 0.016640 std 0.769092[0,0,0,:5] [-1.2206370830535889, -1.2161146402359009, -1.2267075777053833, -1.2202587127685547, -1.2257667779922485][0,0,0,:5] [0.03355659171938896, 0.028246574103832245, 0.024992525577545166, 0.02681080810725689, 0.02494688332080841]torch.npu.synchronize())SUCCESS 退出码 0, 完整日志见 assets/model_result.png数值为本次真实 NPU 推理直接输出, 非估算, 日志已通过 xterm.js 渲染存证。
.npy 后比较python scripts/compare_outputs.py --cpu /tmp/cpu_output_313m.npy --npu /tmp/npu_output_313m.npy --task regression --atol 1e-4 --rtol 1e-3max_abs 4.17e-06 mean_abs 6.3e-07 passed=True (FP32 阈值 1e-4/1e-3)atol=1e-4 rtol=1e-3 起步, 本模型残差极小故放宽至 1e-4 已充足; 分位数单调性与 finite 检查均通过torch.npu.synchronize()model.forecast 前向, 不含 torch.randn 与数据搬运assets/agent_workflow.png: 侦察、环境检查、模型下载 (1.25GB)、加载、CPU/NPU 推理、一致性、性能 benchmark、校验全流程 (由真实 workflow.log 渲染)assets/npu_device_call.png: npu-smi info + torch.npu.is_available() + device_name Ascend910_9362 + 首参 device npu:0 + 输入输出 device npu:0 (由真实 device.log 渲染)assets/model_result.png: python inference.py 真实完整输出 (输入 schema、预测分位数、同步耗时、峰值显存、SUCCESS 状态, 退出码 0, 由真实 inference.log 渲染)图片由 node scripts/render_xterm_evidence.mjs --manifest evidence.json --output-dir assets --style raw 基于本次真实日志生成, 深灰背景、白色等宽字体, 提示符 atomgit@pod-a94f8701860f4700b161b00e290de466:~$, 非原始桌面截图, 仅展示标签。

dd-unit-scaling 0.1.0 补丁, ignore-requires-python)has_missing_values=False 时启用最优路径, 有缺失值需设为 True 并验证掩码decode_block_size=768 分块解码以降低峰值显存, 短 horizon 可设 None 单次前向float64 自动 cast 为 float32 ( Warn: Device do not support double ), 已验证与 CPU float32 一致性 <5e-06@misc{khwaja2026toto20timeseries,
title={Toto 2.0: Time Series Forecasting Enters the Scaling Era},
author={Emaad Khwaja and Chris Lettieri and Gerald Woo and Eden Belouadah and Marc Cenac and Guillaume Jarry and Enguerrand Paquin and Xunyi Zhao and Viktoriya Zhukov and Othmane Abou-Amal and Chenghao Liu and Ameet Talwalkar and David Asker},
year={2026},
eprint={2605.20119},
archivePrefix={arXiv},
url={https://arxiv.org/abs/2605.20119}
}