凤
weixin_44093752/T0-Alpha-Ascend-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

theforecastingcompany/t0-alpha Ascend NPU 适配

本仓对应官方 Hugging Face 模型 theforecastingcompany/t0-alpha,使用 tfc-t0==0.3.0 在真实 Ascend910 npu:0 上执行多步概率时间序列预测。官方页面于 2026-08-22 核实为约 411 MB,权重文件为 model.safetensors,约 102M 参数。

适配内容

  • 保留官方 T0Forecaster.from_pretrained 加载方式与 safetensors 权重。
  • inference.py 支持 cpu、npu 和 auto,显式指定 NPU 不可用时直接失败。
  • 固定随机种子和输入形状,CPU/NPU 使用同一 [1,512] 输入,并输出 16 步、3 个分位数预测。
  • NPU 运行加载 CANN 8.5.1 的 TBE Python 环境,模型输入和模型均转移到 npu:0。

真实 Ascend910 验证

指标CPUNPU (Ascend910 npu:0)
模型加载0.5361 s0.7971 s
单次推理0.1612 s0.4338 s
输出 shape[1,16,3][1,16,3]
输出 dtypefloat32float32
全有限值truetrue

同一输入 CPU/NPU 对拍:余弦相似度 0.9999998808,最大绝对误差 1.0729e-6,平均绝对误差 2.6923e-7,precision_pass=true。设备检查确认两张逻辑 Ascend910 芯片 Health 为 OK,实际推理设备为 npu:0。

权重 SHA-256:16c030d3fd70f06dc4238e9a8356e9b5a631d07f80f1bc76ba539991aed5897f。

证据

Model Agent CPU/NPU 推理工作流

Model Agent CPU/NPU 推理工作流

Ascend NPU 设备调用

Ascend NPU 设备调用

CPU/NPU 精度验证结果

CPU/NPU 精度验证结果

运行

模型目录需包含 config.json 和 model.safetensors。在已加载 CANN 环境的 Ascend 容器内执行:

python inference.py --model-path /opt/atomgit/models/t0-alpha --device npu --context-length 512 --horizon 16

依赖见 requirements.txt。原始模型:theforecastingcompany/t0-alpha。