gcw_6a3w2yXz/compressionkit-ecg-2x-v1.0
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

Ambiq/compressionkit-ecg-2x-v1.0 on Ascend NPU

模型与任务

  • 模型:Ambiq/compressionkit-ecg-2x-v1.0
  • Revision:4d07900f24978ee3830ee2a6a4e2becaa0880645
  • 适配路线:biosignal-compression
  • 设备:npu:0

环境依赖

{
  "soc": "Ascend910_9362",
  "torch": "2.9.0+cpu",
  "torch_npu": "2.9.0.post1+gitee7ba04",
  "python": "3.11.14",
  "cann": "8.5.1",
  "device_count": 2
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "source": "MIT-BIH Arrhythmia Database record 219 (via official demo_recordings.npz, ODC-By-1.0)",
  "start_seconds": 657.7722222222222,
  "sample_rate_hz": 256,
  "window_samples": 512,
  "dtype": "float32",
  "frame_sha256": "b2745021e277617ea000498cc08e54f59a8eac7acab07c47505422fd0667b6cb",
  "normalization": "per_frame_layer_norm(mean, sqrt(var+1e-3))",
  "mean": -0.941533,
  "std": 0.479822
}

真实推理结果

{
  "latent_shape": [
    1,
    16,
    1,
    256
  ],
  "rvq_indices_levels": 4,
  "index_bytes_per_frame": 1024,
  "uniform_byte_ratio": "2048/1024 = 2.0:1",
  "reconstruction_shape": [
    1,
    1,
    1,
    512
  ],
  "prd_vs_input_raw_pct": 0.7491,
  "snr_db": 42.51,
  "cosine_normalized": 0.99986433
}

CPU-NPU 一致性

{
  "baseline": "PyTorch float32 port on CPU vs same weights on npu:0, identical signal/preprocessing/seed",
  "recon_max_abs_diff": 0.008339762687683105,
  "recon_mean_abs_diff": 0.0002696468109206762,
  "recon_cosine_cpu_vs_npu": 0.9999996736,
  "rvq_index_agreement_per_level": [
    1.0,
    1.0,
    0.984375,
    0.984375
  ],
  "prd_raw_cpu_pct": 0.7456,
  "prd_raw_npu_pct": 0.7491,
  "prd_delta_pp": 0.0035,
  "thresholds": {
    "max_abs_diff": 0.02,
    "mean_abs_diff": 0.0005,
    "cosine": 0.9999,
    "prd_delta_pp": 0.05,
    "note": "thresholds fixed from measured float32 baseline before final validation; normalized-domain recon has unit std"
  },
  "official_tflite_parity": {
    "encoder_max_abs_diff": 1.46e-06,
    "decoder_max_abs_diff": 1.43e-06
  }
}

性能

{
  "first_call_ms": 1.39,
  "warmup_iters": 3,
  "timed_iters": 20,
  "steady_ms_per_window": 1.441,
  "windows_per_s": 693.9,
  "samples_per_s": 355259,
  "peak_npu_mem_mib": 16.21,
  "timing_note": "torch.npu.synchronize() before/after timed region; first-call (graph compile) reported separately"
}

自验证截图

Agent workflow

NPU device call

Model result

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • 一致性为单窗口 smoke consistency(MIT-BIH 记录 219 单帧),非完整数据集评测。
  • RVQ 深层码字索引在 CPU/NPU 上存在近邻并列时的翻转(level2/3 一致率 98.4%),重建波形不受影响。
  • 权重许可证为 Ambiq Model Weights License,本仓库仅包含适配与验证代码,不含权重。

标签

#NPU #Ascend #Ascend910