eardoi/test-patchtst-npu
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

PatchTST (test) - 昇腾 NPU 适配模型

PatchTST 是基于 Patch 的时间序列预测模型(IBM test 权重), 输入 512 步 × 7 通道历史序列,输出未来预测。 本仓库为 华为昇腾 NPU(Ascend 910B 系列)推理适配版,支持 npu:0 一键推理。

模型简介

项目说明
模型ibm-research/test-patchtst(PatchTSTForPrediction)
架构PatchTST(Transformer 补丁化时序建模)
规模602.1 K 参数(FP32)
输入时序 (B, 512, 7)
输出未来预测(last_hidden_state)
任务时间序列预测
原始仓库huggingface.co/ibm-research/test-patchtst
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

模型权重

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

权重请从以下镜像获取:

git clone --depth 1 https://gitcode.com/hf_mirrors/ibm-research/test-patchtst.git model_src

推理

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

实测输出(昇腾 910B4)

$ python3 inference.py --device npu
[info] device = npu:0
[info] model arch     : PatchTSTForPrediction
      参数: 602.1 K
[info] input          : (1, 512, 7) (512 x 7通道)
[info] inference done : 211.7 ms on npu
[info] 输出字段       : ['last_hidden_state', 'loc', 'scale', 'patch_input']
[info] 设备确认       : npu:0
[PASS] test-patchtst NPU inference OK

适配说明

  • 模型为标准 transformers PatchTST 架构,无 CUDA 特有 API,直接 .npu() 迁移即可。
  • 输入要求固定 512 步 × 7 通道(与 config 一致)。
  • 加载使用 local_files_only=True 完全离线。