m
mengsihan/compressionkit-ppg-2x
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

Ambiq/compressionkit-ppg-2x on Ascend NPU

模型与任务

  • 模型:Ambiq/compressionkit-ppg-2x
  • Revision:af00d62fcdd8e8c12a2929bae9d22911ab518966
  • 适配路线:biosignal-compression
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0",
  "torch_npu": "2.9.0.post1",
  "cann": "8.5.1",
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "python": "3.11.14",
  "hf_home": "/data/adapt-npu-hf",
  "model_dir": "/tmp/ppg2x"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "sample_rate_hz": 64,
  "frame_size": 320,
  "duration_seconds": 5.0,
  "channels": 1,
  "batch": 4,
  "input_shape_nchw": [
    4,
    1,
    1,
    320
  ],
  "signal_source": "sample_stimulus.npz inputs (10,1,320,1) + demo_recordings.npz BIDMC PPG",
  "dtype": "float32",
  "normalization": "per-frame mean approx 0, std 0.987 (model internal)"
}

真实推理结果

{
  "output_shape_nchw": [
    4,
    1,
    1,
    320
  ],
  "output_shape_channels_last": [
    4,
    1,
    320,
    1
  ],
  "latent_shape": [
    4,
    16,
    1,
    160
  ],
  "compression_ratio": 2,
  "recon_mean": -0.0001,
  "recon_std": 0.9894,
  "rvq_levels": 4,
  "codebook_entries": 256,
  "embedding_dim": 16
}

CPU-NPU 一致性

{
  "max_abs_diff": 0.011693,
  "mean_abs_diff": 0.000442,
  "atol": 0.02,
  "rtol": 0.001,
  "passed": true,
  "cpu_device": "cpu",
  "npu_device": "npu:0"
}

性能

{
  "warmup": 3,
  "stable_runs": 10,
  "batch_size": 4,
  "avg_latency_ms_per_batch": 0.95,
  "samples_per_second": 4210.3,
  "windows_per_second": 4210.3,
  "dtype": "float32",
  "synchronize": "torch.npu.synchronize() before and after timing",
  "peak_memory_mb": "~3107 HBM used"
}

自验证截图

Agent workflow

NPU device call

Model result

已知限制

  • 仅对本次记录的模型 revision、输入契约 64Hz/320samples/2x、float32 与 Ascend910_9362 环境完成验证。

标签

#NPU #Ascend #Ascend910