This repository contains the NPU-adapted version of the xECG_base_model_v1 model, originally from riccardolunelli/xECG_base_model_v1.
The xECG model is an ECG (Electrocardiogram) foundation model based on xLSTM architecture, designed for ECG signal representation and analysis.

| Parameter | Value |
|---|---|
| Sampling Rate | 100 Hz |
| Number of Leads | 12 |
| Window Length | 5000 samples |
| Lead Order | ['i', 'ii', 'iii', 'avr', 'avl', 'avf', 'v1', 'v2', 'v3', 'v4', 'v5', 'v6'] |
| Embedding Size | 1024 |

| Metric | Value |
|---|---|
| Device | Ascend 910B (npu:0) |
| Inference Time | 1.1067 ± 0.0014 seconds |
| Records/s | 0.9036 |
| Peak Memory | 0.50 GB |
| CPU-NPU Cosine Similarity | 0.9977 |
The xECG model uses xLSTM with sLSTM blocks, which requires special handling for NPU adaptation:
pip install torch torch_npu xlstm safetensors huggingface_hubpython inference.pyThe script will:

============================================================
xECG_base_model_v1 NPU 推理
============================================================
[1] 设置 NPU 设备...
使用设备: npu:0
NPU 设备数量: 2
当前 NPU 设备: 0
[2] 创建模型配置...
creating xlstm with slstm at: [0, 1, 4, 5, 8]
[3] 加载权重...
权重加载结果: <All keys matched successfully>
[4] 将模型移动到 NPU...
模型设备: npu:0
[5] 创建测试输入...
输入 shape: torch.Size([1, 5000, 12])
输入 dtype: torch.float32
输入 device: npu:0
[6] 预热推理...
[7] 执行 NPU 推理...
推理时间: 1.1076 秒
嵌入 shape: torch.Size([1, 1024])
输出 shape: torch.Size([1, 200, 1024])
[8] 保存结果...
结果已保存到 result.json
============================================================
推理完成: PASS
============================================================The model weights are not included in this repository due to size constraints. Please download them from the original HuggingFace repository:
huggingface-cli download riccardolunelli/xECG_base_model_v1 --local-dir model_weightsMIT License