Downloads · 30 days
26
100% of all-time downloads
xjc1022/MELP-Encoder-repro
MELP-Encoder-repro is a feature extraction model from xjc1022. Use it when you need embeddings to search or compare text. It is set up for transformers. The card lists the license as apache-2.0.
The ECG tower of a MELP model trained from this fork: HKU-MedAI/MELP4. Same architecture and packaging as fuyingw/MELPEncoder, so it is a drop-in replacement. Original paper: From Token to Rhythm: A Multi-Scale Approa…
Downloads · 30 days
26
100% of all-time downloads
All-time downloads
26
Public
Parameters
65.6M
131 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors131 MB · 100%
From the Hugging Face model README
The ECG tower of a MELP model trained from this fork:
HKU-MedAI/MELP#4. Same architecture and
packaging as fuyingw/MELP_Encoder, so
it is a drop-in replacement. Original paper: From Token to Rhythm: A Multi-Scale
Approach for ECG-Language Pretraining (ICML 2025),
Wang, Xu & Yu — all credit for the method belongs to the authors.
import torch
from transformers import AutoModel
model = AutoModel.from_pretrained("xjc1022/MELP-Encoder-repro", trust_remote_code=True).eval()
ecg = torch.rand(1, 12, 5000) # 12 leads, 10 s at 500 Hz, scaled to [0, 1]
with torch.no_grad():
out = model(ecg)
# out["proj_ecg_emb"] (B, 256) rhythm level, the zero-shot embedding
# out["ecg_beat_emb"] (B, 12, 256) beat level
# out["ecg_token_emb"] (B, 128, 768) token level
Lead order is I, II, III, aVR, aVF, aVL, V1-V6, and each record is min-max scaled to [0, 1] over the whole 12x5000 array — the same preprocessing the training data used.
Six-dataset mean AUROC from scripts/zeroshot/test_zeroshot.py (the paper's protocol),
test splits:
| Rhythm | Form | Sub | Super | CPSC2018 | CSN | Average | |
|---|---|---|---|---|---|---|---|
| This run | 86.43 | 70.32 | 77.65 | 77.22 | 84.18 | 74.58 | 78.40 |
| Paper (Table 3) | 85.4 | 69.1 | 81.2 | 76.2 | 84.2 | 77.6 | 79.0 |
Those numbers describe the full MELP model this encoder came from: zero-shot needs the text tower as well, which is not part of this repo. What is published here is the ECG tower alone, for use as a feature extractor.
Text tower fuyingw/heart_bert, ECG tower initialised from an ECG-FM wav2vec2-CMSC
checkpoint, trained on MIMIC-IV-ECG report pairs. 4x RTX 3090, batch 64/device,
lr 1e-4, n_queries_contrast=12, loss weights 1.0 / 2.0 / 0.2. Best checkpoint by
validation zero-shot AUROC, epoch 4.
Three things mattered more than any hyperparameter here, and all three are fixes in the linked PR:
Pretrained on MIMIC-IV-ECG, which is PhysioNet credentialed-access data. These are model weights rather than data, but check the PhysioNet data use agreement before redistributing anything derived from them.