模型名称: theforecastingcompany/t0-alpha
模型链接: HuggingFace
模型描述: T0-Alpha 是一个开源的时间序列预测基础模型,采用 decoder-style patch transformer 架构,输出概率性多步预测(quantile forecasts),原生支持多变量协变量。
模型架构: Decoder-style Patch Transformer (T0Forecaster)
参数规模: ~102M (101,641,536)
输入规格:
[batch, time] 或 [batch, variates, time]输出规格:
[batch, horizon, num_quantiles]| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | >= 2.1.0 | PyTorch 框架 |
| torch_npu | >= 2.1.0 | 昇腾 NPU 后端 |
| tfc-t0 | >= 0.3.0 | T0 模型库 |
| safetensors | >= 0.4.0 | 权重加载 |
| transformers | >= 4.30.0 | AutoConfig(可选) |
| 昇腾驱动 | CANN 8.0+ | 推荐 CANN 8.5.1 |
安装命令:
pip install torch-npu>=2.1.0 tfc-t0>=0.3.0 safetensors transformers# 检查 NPU 设备
npu-smi info
# 验证 torch_npu
python3 -c "import torch_npu; print(torch.npu.device_count(), torch.npu.get_device_name(0))"# 方式一:HuggingFace(需接受 gated 授权)
huggingface-cli download theforecastingcompany/t0-alpha --local-dir ./t0-alpha
# 方式二:AtomGit 镜像
git clone https://gitcode.com/<username>/theforecastingcompany_t0-alpha.git# 单条推理
python inference.py --model-path ./t0-alpha --context-len 96 --horizon 64
# 批量推理
python inference.py --model-path ./t0-alpha --benchmark --batch-size 8| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --model-path | str | 必填 | 模型 checkpoint 路径 |
| --context-len | int | 96 | 历史上下文长度 |
| --horizon | int | 64 | 预测步长 |
| --device | str | npu:0 | NPU 设备 |
| --benchmark | flag | False | 运行批量基准测试 |
| --batch-size | int | 8 | 批量大小 |
[Device] Ascend910_9362 (npu:0)
[Model] Parameters: 101641536
[Model] Quantile levels: (0.1, 0.25, 0.5, 0.75, 0.9)
[Inference] Single sample: context=96, horizon=64
[Inference] Quantiles shape: [1, 64, 5]
[Inference] Median shape: [1, 64]
[Inference] Latency: 499.6ms
[Inference] Median[:5]: [-0.1588, -0.1839, -0.1643, -0.0998, -0.0569]
[Inference] P10[:5]: [-1.2610, -0.7927, -0.1588, 0.5313, 1.1888]
[Inference] P90[:5]: [0.9432, 0.4249, -0.1588, -0.7307, -1.3025]
[Status] SUCCESS[Benchmark] Batch size=8, context=96, horizon=64
[Benchmark] Quantiles shape: [8, 64, 3]
[Benchmark] Batch latency: 89.0ms
[Benchmark] Per sample: 11.1ms
[Status] SUCCESS运行命令:
python inference.py --model-path ./t0-alpha --context-len 96 --horizon 64输出:
[Inference] Quantiles shape: [1, 64, 5]
[Inference] Latency: 499.6ms
[Inference] Median[:5]: [-0.1588, -0.1839, -0.1643, -0.0998, -0.0569]
[Status] SUCCESS运行命令:
python inference.py --model-path ./t0-alpha --benchmark --batch-size 8输出:
[Benchmark] Batch latency: 89.0ms
[Benchmark] Per sample: 11.1ms
[Status] SUCCESS


测试数据: FEV-Bench / GIFT-Eval(参考 HuggingFace model card)
评测指标:
| 指标 | 结果 | Baseline |
|---|---|---|
| Skill Score (FEV-Bench) | 42.2 | — |
| CRPS (GIFT-Eval) | 0.4941 | — |
| MASE (GIFT-Eval) | 0.7240 | — |
评测命令:
python -m t0.evaluation.predictor --model-path ./t0-alpha --dataset autogluon/fev-benchtfc-t0 库依赖 einops、jaxtyping、rotary-embedding-torch,安装时注意版本兼容