C-MELT: Contrastive Enhanced Masked Auto-Encoders for ECG-Language Pre-Training
Paper
• 2410.02131 • Published
transformers
from transformers import AutoModel
import torch
model = AutoModel.from_pretrained("Manhph2211/D-BETA", trust_remote_code=True)
model.eval()
ecgs = torch.randn(2, 12, 5000) # [batch, leads, length]
with torch.no_grad():
output = model(ecgs)
ecg_features = output.pooler_output
print(ecg_features.shape) # (2, 768)
Clone the project and prepare the environment:
git clone https://github.com/manhph2211/D-BETA.git && cd D-BETA
conda create -n dbeta python=3.9
conda activate dbeta
pip install -r requirements.txt
import torch
from models.processor import get_model, get_ecg_feats
model = get_model(config_path='configs/config.json', checkpoint_path='checkpoints/pytorch_model.bin')
ecgs = torch.randn(2, 12, 5000) # [batch, leads, length]
ecg_features = get_ecg_feats(model, ecgs)
print(ecg_features.shape) # (2, 768)
If you find this work useful, please consider citing our paper:
@inproceedings{
hung2025boosting,
title={Boosting Masked {ECG}-Text Auto-Encoders as Discriminative Learners},
author={Manh Pham Hung and Aaqib Saeed and Dong Ma},
booktitle={Forty-second International Conference on Machine Learning},
year={2025},
}