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

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

cisco-time-series-model-1.0-preview 是 Cisco 时序基础模型:多分辨率(粗/细双流 + 分辨率嵌入 + 特殊分隔 token)Patched Decoder 时序预测模型,基于 TimesFM 解码器架构,输出 0.1~0.9 九分位 + 均值概率预测。

模型规格

项目值
模型cisco-ai/cisco-time-series-model-1.0-preview
架构PatchedTSMultiResolutionDecoder(TimesFM 基类扩展)
参数量498,832,800(约 0.5B,fp32 权重 1.995 GB)
结构50 层 / 16 头(16 KV 头)/ hidden 1280 / patch 32 / horizon patch 128
输入细粒度单变量时序(建议 ≥512 点,粗流按 agg_factor=60 聚合)
输出horizon 128 步的均值 + 9 分位预测
许可证Apache-2.0(模型代码);权重按 Cisco AI 模型许可
精度float32

环境要求

  • 硬件:Ascend 910B 系列(≥1 卡)
  • CANN ≥ 8.0(source /usr/local/Ascend/ascend-toolkit/set_env.sh)
  • Python 3.10 – 3.11
  • torch 2.9.0 / torch_npu 2.9.0.post1
  • timesfm==1.3.0 / utilsforecast / safetensors

环境准备

export PIP_INDEX_URL=https://repo.huaweicloud.com/repository/pypi/simple/
pip install torch torch_npu timesfm==1.3.0 utilsforecast safetensors numpy

模型权重

权重(model.safetensors 2GB + config.json)从 Hugging Face 获取:

export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download cisco-ai/cisco-time-series-model-1.0-preview --local-dir model_src

推理

export CISCO_TS_MODEL_DIR=/path/to/weights  # 含 model.safetensors + config.json
python3 inference.py --device npu --horizon 128 --agg-factor 60

输出摘录(三用例:真实权重 MSE 全面低于 naive 基线与随机初始化对照):

[gate1] load_state_dict: missing=0 unexpected=0 mismatched=0 -> PASS
[gate2] config audit -> PASS
[case:sine]           MSE model=0.0255 naive=1.4493 skill=+98.2%
[case:random_walk]    MSE model=0.0465 naive=0.0672  skill=+30.8%
[case:multi_seasonal] MSE model=0.0076 naive=1.5753 skill=+99.5%
[gate3] random-init control beaten by real weights on ALL cases -> PASS
[perf] avg=40.2 ms | peak HBM alloc=2002 MB

验证结果

  • 设备:Ascend 910B(npu:0)
  • 推理:✅ 通过(三道门禁全部 PASS)
    1. 权重加载:load_state_dict missing=0 / unexpected=0 / mismatched=0
    2. config 审计:全部 26 键逐一比对一致
    3. 随机初始化对照:真权重在三用例全面胜出
  • 性能:avg 40.2ms / 样本,峰值显存 2002MB
  • 验证日期:2026-08-22

适配说明

模型代码来自 splunk/cisco-time-series-model(Apache-2.0),基类来自 pip 包 timesfm==1.3.0。PatchedTSMultiResolutionDecoder 直接 .to("npu:0") 迁移,无 CUDA 专属算子,无需改动架构。

目录结构

├── inference.py       # NPU 推理脚本(含三道门禁验证)
├── config.json        # 模型配置
├── model.safetensors  # 权重(不推送)
├── README.md          # 本模型卡片
├── requirements.txt   # 依赖
└── assets/            # 截图素材

引用

Cisco Time Series Model 1.0 preview
https://huggingface.co/cisco-ai/cisco-time-series-model-1.0-preview