w
gcw_uQ09W7jl/xECG_base_model_v1-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

riccardolunelli/xECG_base_model_v1 on Ascend NPU

模型与任务

  • 模型:riccardolunelli/xECG_base_model_v1
  • Revision:b06053253a9bd21445d8189b21813484929a3ffa
  • 适配路线:ecg-representation
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "numpy": "1.26.4",
  "python": "3.11.14",
  "device_name": "Ascend910_9362",
  "npu_count": 2,
  "model_dir": "/opt/atomgit/adapt-npu-agent/model_cache/xECG_base_model_v1",
  "model_weight_bytes": 228099912
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sampling_freq": 100,
  "lead_order": [
    "i",
    "ii",
    "iii",
    "avr",
    "avl",
    "avf",
    "v1",
    "v2",
    "v3",
    "v4",
    "v5",
    "v6"
  ],
  "channels": 12,
  "window_samples": 2500,
  "window_seconds": 25.0,
  "patch_size": 25,
  "num_patches": 100,
  "dtype": "float32",
  "batch": 1,
  "sha256": "ab7b0459adb75b08856d10e88d30343c151aed7ff7385ed7b49106eb6bb6a599",
  "input_shape": [
    1,
    2500,
    12
  ],
  "normalization": "raw synthetic (gaussian + QRS peaks)*lead_scales seed 0"
}

真实推理结果

{
  "cls_shape": [
    1,
    1024
  ],
  "patches_shape": [
    1,
    100,
    1024
  ],
  "dtype": "float32",
  "cls_mean": -0.006283886730670929,
  "cls_std": 2.2876667976379395,
  "patches_mean": -0.006283873226493597,
  "finite": true,
  "device_proof": "first_param:npu:0 input:npu:0 output:npu:0 synchronize:torch.npu.synchronize()"
}

CPU-NPU 一致性

{
  "cls_cosine": 1.0,
  "cls_max_abs_diff": 0.000552058219909668,
  "cls_mean_abs_diff": 5.568023345858819e-05,
  "patches_max_abs_diff": 0.0015462636947631836,
  "patches_mean_abs_diff": 9.846652442888626e-05,
  "atol_cls": 0.001,
  "rtol_cls": 0.001,
  "atol_patches": 0.002,
  "rtol_patches": 0.001,
  "passed": true,
  "note": "仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证;单条合成ECG smoke consistency,非全量PTB-XL评测。"
}

性能

{
  "avg_ms": 280.84,
  "records_per_s": 3.56,
  "window_samples": 2500,
  "sampling_freq": 100,
  "num_warmup": 3,
  "num_stable": 10,
  "device": "npu:0",
  "dtype": "float32",
  "note": "计时前后调用 torch.npu.synchronize(),区分首次编译与稳定推理"
}

自验证截图

Agent workflow

NPU device call

Model result

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。

标签

#NPU #Ascend #Ascend910