K-ON111111/cisco-time-series-model-1.0-preview
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

cisco-time-series-model-1.0-preview — 昇腾 NPU 适配模型

赛事: 昇腾 Model Agent 模型适配大赛(第二季) 引擎: torch_npu + TimesFM(多分辨率解码器) 硬件: Ascend 910B 系列(实测 Ascend910B4) 标签: npu ascend pytorch transformers

📖 模型简介

属性值
原始模型cisco-ai/cisco-time-series-model-1.0-preview
架构Cisco Time Series Model(TimesFM 派生,多分辨率 MR 解码器)
参数量~1B(50 层 / 1280 hidden)
任务类型多分辨率时序预测(Time Series Forecasting)
输入格式细粒度时序(context 512 点,聚合 60 → 粗粒度)
输出格式未来 128 步预测(mean + 9 个分位数)

🔧 环境依赖与代码获取

⚠️ 本仓库不包含模型权重(交付件仅 inference.py / readme.md / requirements.txt / assets/), 推理前必须先从原始模型仓单独下载权重。

依赖清单(requirements.txt):

  • torch / torch_npu(昇腾 NPU 环境)
  • timesfm[torch]==1.3.0(Google TimesFM 框架,pip 默认的 timesfm 2.x 是错误包)
  • numpy

代码获取:inference.py 首次运行会自动从官方 GitHub(splunk/cisco-time-series-model)下载 modeling/ 多分辨率解码器代码(cisco_tsm_mr.py、patched_decoder_multi_resolution.py、rope.py、constants.py)。

🚀 推理步骤

# 1. 安装依赖
pip install -r requirements.txt -i https://repo.huaweicloud.com/repository/pypi/simple/

# 2. 下载模型权重(仓库不含权重,必须单独下载)
git clone https://gitcode.com/hf_mirrors/cisco-ai/cisco-time-series-model-1.0-preview.git .
git lfs pull   # 含 model.safetensors / torch_model.pt

# 3. 运行 NPU 推理(默认 512 点细粒度上下文,预测 128 步)
python3 inference.py --model_path . --device npu:0

🧪 测试用例

用例 1: 多分辨率时序预测(512 点 → 128 步)

python3 inference.py --model_path . --device npu:0

预期输出:

[Model Agent] ✅ NPU 设备就绪: Ascend910B4
[Model Agent] ✅ 模型加载完成 → npu:0
[Model Agent] 📊 输入 512 点细粒度时序, 预测 128 步, agg=60
[Model Agent] ✅ 推理完成 → 预测 128 步, 耗时 507 ms
[Model Agent] 📈 预测均值(前5): [62.61, 63.31, 63.9, 60.47, 60.2]
[Model Agent] ✅ 结果已保存 → inference_result.json

📁 目录结构

.
├── inference.py          # NPU 推理脚本
├── readme.md             # 本文件
├── requirements.txt      # 依赖清单
└── assets/               # 截图素材

📝 适配说明

本模型由 昇腾 Model Agent 自动完成 NPU 适配。 Cisco Time Series Model(TimesFM 多分辨率派生)迁移至昇腾 NPU:

  • inference.py 首次运行自动下载官方 modeling/ 代码,trust_remote_code 风格加载;
  • 使用 timesfm[torch]==1.3.0(注意 pip 默认 timesfm 2.x 为错误包,无 TimesFmHparams);
  • 关键适配:output_patch_len 设为 horizon_length(128)以匹配 checkpoint 的 horizon_ff_layer 维度;
  • 设备选择 patch 到 npu:0,forecast() 多分辨率自回归生成预测。