模型名称: Datadog/Toto-Open-Base-1.0 (TOTEM)
模型链接: HuggingFace AtomGit 镜像: ai.gitcode.com/hf_mirrors GitHub 源码: datadog/totem
模型描述: TOTEM (Time-series Open Transformer Model) 是 Datadog 开源的时序预测基础模型。基于 Patch-based Transformer 架构,支持零样本和少样本时序预测。
模型架构: Encoder-only Transformer with Patch Embedding
参数规模: ~85M 参数
输入规格:
输出规格:
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | >= 2.1.0 | PyTorch 框架 |
| torch_npu | >= 2.1.0 | 昇腾 NPU 后端 |
| numpy | >= 1.24.0 | 数值计算 |
| transformers | >= 4.30.0 | HuggingFace Transformers |
| 昇腾驱动 | CANN 8.0+ | 推荐 CANN 8.5.1 |
安装命令:
pip install -r requirements.txt# 检查 NPU 设备
npu-smi info
# 验证 torch_npu
python3 -c "import torch_npu; print(torch.npu.device_count(), torch.npu.get_device_name(0))"方式一:HuggingFace(推荐)
huggingface-cli download Datadog/Toto-Open-Base-1.0 --local-dir ./totem_model方式二:AtomGit 镜像(HuggingFace 下载慢时使用)
huggingface-cli download Datadog/Toto-Open-Base-1.0 \
--local-dir ./totem_model \
--endpoint https://ai.gitcode.com/hf_mirrors# 单条推理
python inference.py --model-path ./totem_model
# 批量推理
python inference.py --model-path ./totem_model --seq-len 512
# 性能基准测试
python inference.py --model-path ./totem_model --benchmark --iterations 10| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --model-path | str | 必填 | 模型 checkpoint 路径 |
| --tensor-parallel-size | int | 1 | NPU 卡数 |
| --seq-len | int | 512 | 输入序列长度 |
| --benchmark | flag | False | 运行性能基准测试 |
| --iterations | int | 10 | 基准测试迭代次数 |
| --horizon | int | 24 | 预测步长 |
[TOTEM] Datadog/Toto-Open-Base-1.0 Inference on Ascend NPU
[设备] Ascend910_9362 (npu:0)
[输入] torch.Size([1, 512, 1])
[输出] loc: torch.Size([1, 8, 24]), scale: torch.Size([1, 8, 24]), df: torch.Size([1, 8, 24]), weight: torch.Size([1, 8, 24])
[耗时] 1222.24 ms
[状态] SUCCESS[基准测试] 5次推理统计:
平均: 678.50 ms
最小: 505.06 ms
最大: 789.63 ms
标准差: 121.37 ms
P50: 694.11 ms运行命令:
python3 inference.py --model-path /tmp/adapt_datadog_toto-open-base-1.0 --seq-len 512输出:
Input shape: torch.Size([1, 512, 1])
Output keys: ['loc', 'scale', 'df', 'weight']
loc shape: torch.Size([1, 8, 24])
scale shape: torch.Size([1, 8, 24])
df shape: torch.Size([1, 8, 24])
weight shape: torch.Size([1, 8, 24])
[状态] SUCCESS运行命令:
python3 inference.py --model-path /tmp/adapt_datadog_toto-open-base-1.0 --seq-len 512 --benchmark --iterations 5输出:
Forecast shape: torch.Size([4, 8, 24])
Forecast mean (first sample, first 5 patches, first 3 components):
[[ 0.7905689 0.32039538 0.04303531]
[ 0.5929822 0.26498923 0.15454505]
[ 0.6445113 0.274443 -0.18427925]
[ 0.727487 0.23388115 -0.0866795 ]
[ 0.8171033 0.35397997 0.00950419]]


测试数据: 合成随机时间序列 (batch=1, seq_len=512, features=1)
评测指标:
| 指标 | 结果 | 说明 |
|---|---|---|
| 模型参数量 | 85,184,352 (~85M) | 从 config.json 构建 |
| 单条推理延迟 | ~1222 ms | seq_len=512, batch=1, Ascend910 |
| 批量推理延迟 | ~1016 ms | seq_len=512, batch=4, Ascend910 |
| 平均推理延迟 | ~678 ms | seq_len=512, batch=1, 5次平均 |
| NPU 设备 | Ascend910_9362 | 2 卡可用 |
| CANN 版本 | 8.5.1 | 昇腾驱动版本 |
评测命令:
python3 inference.py --model-path ./totem_model --seq-len 512 --benchmark --iterations 5aten::_transformer_encoder_layer_fwd 当前在 NPU 后端不完全支持,会 fallback 到 CPU 执行。这影响了整体推理性能。建议后续跟进 vLLM-Ascend / torch_npu 对该算子的完整 NPU 支持。