Timer-S1 是字节跳动研究院推出的 83亿参数MoE(32个专家,Top-2路由) 时序基础模型,在 GIFT-Eval 评测中取得了领先水平。该模型采用仅解码器MoE Transformer架构,并结合 TimeSTP 序列缩放机制,实现多步预测。
核心规格:
本仓库提供基于 torch_npu + FastAPI 的服务,用于在 昇腾NPU 上运行 Timer-S1。
| 组件 | 版本 |
|---|---|
| Python | 3.11.14 |
| torch | 2.9.0 |
| torch_npu | 2.9.0.post1 |
| transformers | 4.57.6 |
| CANN | 8.5.1 |
| NPU | Ascend 910(64GB HBM) |
python3 download_model.py权重文件已从 hf-mirror.com 下载至 /data/.cache/models/bytedance-research/Timer-S1/。
bash start_serve.sh
# or manually:
python3 server.py服务器默认在8041端口启动。可通过设置TIMER_S1_PORT来更改端口。
python3 make_test_data.py # generate demo time series
python3 test_server.py # test HTTP APIPOST /v1/forecast — 预测未来的时间序列值
{
"past_values": [1.0, 2.0, ...],
"forecast_length": 96,
"context_length": 1152,
"use_cache": false,
"revin": true
}回复:
{
"quantiles": [0.1, 0.2, ..., 0.9],
"median": [...],
"predictions": [[9, forecast_length]],
"horizon": 96,
"latency_ms": 1234.5,
"model": "Timer-S1"
}python3 inference.py --forecast 96 --context 1152python3 verify_npu_vs_cpu.pyuse_cache=False,以节省内存。| 文件 | 说明 |
|---|---|
inference.py | Timer-S1 推理引擎(基于 torch_npu) |
server.py | FastAPI 服务端 |
download_model.py | 权重下载工具(支持 hf-mirror 镜像) |
make_test_data.py | 演示数据生成器 |
test_server.py | HTTP 测试客户端 |
verify_npu_vs_cpu.py | NPU 与 CPU 精度对比测试 |
start_serve.sh | 一键启动脚本 |
requirements.txt | Python 依赖列表 |
.gitignore | 忽略权重文件与缓存目录 |