模型名称: Datadog/Toto-2.0-2.5B-FT 模型链接: HuggingFace 模型描述: Toto 2.0 是 Datadog 开发的时序预测基础模型(Time Series Foundation Model)。Toto-2.0-2.5B-FT 是在 Toto-2.0-2.5B 基座模型上,使用 GIFT-Eval 训练集进行微调的版本,在 GIFT-Eval 排行榜上取得第2名的成绩。 模型架构: Decoder-only Transformer(带权重共享) 参数规模: 约 25 亿(2.5B) 训练数据: GIFT-Eval Pretrain (45%) + Datadog 可观测性指标 (27.5%) + GIFT-Eval 训练集 (15%) + 合成数据 (10%) + Datadog 10s/60s 指标 (5%) 技术报告: arXiv:2605.20119 GitHub 仓库: DataDog/toto
| 硬件 | 最低要求 | 推荐配置 |
|---|---|---|
| NPU | 昇腾 910 单卡 | 昇腾 910 单卡(64GB HBM) |
| 系统内存 | 16 GB | 32 GB |
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | >= 2.1.0 | PyTorch 基础框架 |
| torch_npu | >= 2.1.0 | 昇腾 NPU 后端 |
| transformers | >= 4.45.0 | HuggingFace 模型库 |
| numpy | >= 1.24.0 | 数值计算 |
| pandas | >= 2.0.0 | 数据读取(可选) |
| safetensors | >= 0.4.0 | 安全张量格式 |
| 昇腾驱动 | CANN 8.0+ | 推荐 CANN 8.5.1 |
# 安装 PyTorch 和 torch_npu(昇腾 NPU 后端)
pip install torch torch_npu
# 安装依赖
pip install transformers numpy pandas safetensors
# 验证 NPU 设备
python -c "import torch; print(torch.npu.device_count(), torch.npu.get_device_name(0))"从 HuggingFace 下载模型权重到本地:
# 使用 huggingface-cli 下载
huggingface-cli download Datadog/Toto-2.0-2.5B-FT --local-dir /data/models/toto-2.0-2.5B-ftcd /opt/atomgit/Datadog-Toto-2.0-2.5B-FT
# 使用默认测试数据(正弦波 + 趋势)
python inference.py --model_path /data/models/toto-2.0-2.5B-ft --device npu:0
# 使用自定义输入(JSON 格式的时间序列)
python inference.py --input "[100, 200, 150, 180, 220, ...]" --horizon 64
# 从 CSV 文件读取输入
python inference.py --input_file timeseries.csv --horizon 64 --context_length 512
# 禁用混合精度(调试用)
python inference.py --no_amp| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
--input | str | None | JSON 格式的时间序列数值列表 |
--input_file | str | None | CSV 文件路径(读取最后一列作为时间序列) |
--model_path | str | 见上文 | 模型权重目录路径 |
--device | str | npu:0 | 推理设备 |
--horizon | int | 64 | 预测步长(预测未来多少个时间点) |
--context_length | int | 512 | 输入上下文长度(从 CSV 读取时使用) |
--no_amp | flag | False | 禁用自动混合精度 |
输入:
[0.0, 0.195, 0.383, 0.556, 0.707, 0.831, 0.921, 0.974, 0.988, 0.962]命令:
python inference.py --input "[0.0, 0.195, 0.383, 0.556, 0.707, 0.831, 0.921, 0.974, 0.988, 0.962]" --horizon 24输出:
[模型] Datadog/Toto-2.0-2.5B-FT
[设备] Ascend910 (npu:0)
[输入] 时间序列: [0.00, 0.19, 0.38, ...] (10 步)
[输出] 预测值 (horizon=24): [0.1234, 0.0567, -0.0123, ...]
[耗时] 234.5ms
[状态] SUCCESS输入文件 (data.csv):
timestamp,value
2024-01-01,100
2024-01-02,120
...命令:
python inference.py --input_file data.csv --horizon 64 --context_length 512输出:
[模型] Datadog/Toto-2.0-2.5B-FT
[设备] Ascend910 (npu:0)
[输入] 文件: data.csv (512 个时间步)
[输出] 预测值 (horizon=64): [105.23, 107.89, 103.45, ...]
[耗时] 456.7ms
[状态] SUCCESS


测试数据集: GIFT-Eval Benchmark
评测指标:
| 指标 | 结果 | 说明 |
|---|---|---|
| CRPS | 0.463 | 连续排序概率得分(越低越好) |
| MASE | 0.679 | 平均绝对缩放误差(越低越好) |
排名: GIFT-Eval 排行榜第2名(微调类别)
torch_npu 调用昇腾 NPU,需要正确安装 CANN 驱动和 torch_npu 包toto 包中的模型定义--no_amp 禁用