czxichen/timesfm3.0-balanced
036
简体中文 · English
TimesFM 3.0 · FP16 Balanced 量化权重(纯 Rust 引擎版,推荐)
这是什么
- 基座模型:Google TimesFM 3.0 —— 约 3.3 亿参数、20 层双注意力(序列 + 变量)MixingTransformer,
model_dims=1280、16 头 × 80。 - 本仓库:官方 FP32 权重的 FP16 混合精度(Balanced)量化版(730 MB),由 `timesfm3` 纯 Rust 引擎的
quantize --preset balanced离线产出。敏感层(输出头、前置残差块、末尾若干 Transformer 层)自动保留 FP32,体积缩减 45%,最坏误差约为全量 FP16 的 1/5 —— 推荐首选。 - ⚠️ 兼容性说明:权重为 safetensors + 引擎私有
config.json格式,仅能被 timesfm3 引擎加载;无法用 PyTorch /transformers直接读取。请与引擎配套使用。
仓库文件
精度(与官方 PyTorch 对齐)
场景:ETTh1 · 7 变量 × ctx1024 → horizon 24,与官方 PyTorch 逐值对比:
Windows 10 同场景复测:$7.6 \times 10^{-4}$ / $1.4 \times 10^{-3}$,与 macOS 结论一致。155 场景矩阵中本档(vs 引擎 f32)worst $5.9 \times 10^{-3}$。详细报告见引擎仓库 report/accuracy_report.md。
使用
git clone https://github.com/czxichen/timesfm3
cd timesfm3 && cargo build --release
# 解压本仓库 → ./ckpt_balanced 后:
cargo run --release --bin forecast -- ckpt_balanced 96 path/to/context.csv
# 常用 flag:--seasonal <P> --robust-znorm --threads <N> --precision f16自行量化(复现)
cargo run --release --bin quantize -- <官方FP32目录> ckpt_balanced f16 --preset balanced许可与致谢
- 权重为 TimesFM 官方权重的量化派生,遵循 `timesfm-non-commercial-license-v1.0`(仅限非商用研究),完整许可文本见官方下载源与本仓
LICENSE;原权重 © Google。 - 量化/推理引擎源码为 Apache-2.0:`czxichen/timesfm3`。
