eardoi/ttm-r3-npu
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

TinyTimeMixer ttm-r3 - 昇腾 NPU 适配模型

TinyTimeMixer(ttm-r3)是 IBM 开源的小型时序基础模型, 输入 512 步历史序列,预测未来 30 步。本仓库为 华为昇腾 NPU (Ascend 910B 系列)推理适配版,支持 npu:0 一键推理。

模型简介

项目说明
模型ibm-research/ttm-r3(TinyTimeMixerForPrediction)
架构TinyTimeMixer(轻量 MLP 时序基础模型)
规模1.7 M 参数(FP32)
输入时序 (B, 512, 1)
输出未来 30 步预测 (B, 30, 1)
任务时间序列预测
原始仓库huggingface.co/ibm-research/ttm-r3
LicenseApache-2.0

环境要求

项目要求
硬件Ascend 910B 系列(≥1 卡,本仓库基于 910B4 验证)
CANN≥ 8.0
Python3.10 – 3.11
torch / torch_npu2.9.0 / 2.9.0.post2
transformers5.15.0
依赖库tsfm_public(提供 TinyTimeMixerForPrediction)

模型权重

注意:本仓库不包含模型权重文件(model.safetensors)。

权重请从以下镜像获取:

curl -L -C - -A "Mozilla/5.0" -o model.safetensors \
  "https://hf-mirror.com/ibm-research/ttm-r3/resolve/main/model.safetensors"

推理

python3 inference.py --device npu [--model_path ./model_src]

实测输出(昇腾 910B4)

$ python3 inference.py --device npu
[info] device = npu:0
[info] model arch     : TinyTimeMixerForPrediction (ttm-r3)
[info] context_length : 512, prediction: 30
      参数: 1.7 M
[info] inference done : 185.1 ms on npu
[info] 预测输出       : (1, 30, 1)
[info] 设备确认       : npu:0
[PASS] ttm-r3 NPU inference OK

适配说明

  • 模型由 tsfm_public 库提供 TinyTimeMixerForPrediction 类,无 CUDA 特有 API。
  • transformers 5.15 兼容修复:补丁 download_url/is_offline_mode 等 已移除工具函数,并设置 all_tied_weights_keys = {} 兼容 tied-weights 检查。
  • 加载使用 local_files_only=True 完全离线。