t0-alpha 是 The Forecasting Company 的开源概率时序预测基础模型 (transformer 架构,101.6M 参数),基于 patch 与 factorized attention, 原生支持多协变量,输出多分位点概率预测。
本项目完成其在**华为昇腾 NPU(Ascend 910B)**上的推理适配与验证。
| 项目 | 说明 |
|---|---|
| 网络 | T0Forecaster(transformer encoder) |
| 参数量 | 101.6M |
| 输入 | context(batch × time,固定窗口 512) |
| 输出 | 多分位点预测 quantiles(batch × horizon × n_quantiles) |
| 权重格式 | safetensors(model.safetensors) |
pip install tfc-t0cd /workspace/theforecastingcompany_t0-alpha
/usr/local/python3.11.14/bin/python3 inference.py \
--model_path /workspace/theforecastingcompany_t0-alpha_src \
--device npu:0| 参数 | 说明 | 默认值 |
|---|---|---|
--model_path | 权重目录 | .../theforecastingcompany_t0-alpha_src |
--batch | 序列条数 | 4 |
--context | 输入上下文长度 | 512 |
--horizon | 预测步长 | 64 |
--quantiles | 分位点(逗号分隔) | 0.1,0.5,0.9 |
--device | 推理设备(npu:0 / cpu) | npu:0 |
--output | 结果保存文件(可选,npy) | stdout |
输入:context (4, 512),horizon=64,quantiles=[0.1, 0.5, 0.9]
[info] model on npu:0: 101.6M params
[info] input: context (4, 512) horizon=64 quantiles=[0.1, 0.5, 0.9]
============================================================
[info] 输出 quantiles 形状: (4, 64, 3) (batch, horizon, n_quantiles)
[info] 输出 median 形状: (4, 64)
============================================================t0-alpha 在 NPU 上完成概率时序预测(输出 (4,64,3) 多分位点预测), NPU 推理链路完整跑通。
tfc-t0(注意 pip install t0 会装到 CERN 的 Tier-0 无关包)。T0Forecaster.from_pretrained(path) 加载权重后 .to('npu:0') 迁移。context 张量(batch × time),predict(context, horizon, quantiles) 输出分位点预测。resolve_device():NPU 可用性检测,失败自动回退 CPU。*.safetensors 已加入 .gitignore。.
├── README.md # 模型卡片(本文件)
├── inference.py # NPU 推理脚本
└── assets/ # 适配过程截图素材