Downloads · 30 days
15
14% of all-time downloads
convaiinnovations/medgemma-4b-ecginstruct-merged
medgemma-4b-ecginstruct-merged is a image-text-to-text model from convaiinnovations. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
Fine-tuned version of Google's MedGemma-4B-it model on the ECGInstruct dataset for automated ECG interpretation.
Downloads · 30 days
15
14% of all-time downloads
All-time downloads
110
Public
Parameters
4.3B
8.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors8.6 GB · 100%
From the Hugging Face model README
Fine-tuned version of Google's MedGemma-4B-it model on the ECGInstruct dataset for automated ECG interpretation.
This is a fully merged fine-tuned version of google/medgemma-4b-it trained on the PULSE-ECG/ECGInstruct dataset containing 1.15M ECG instruction-following examples. The LoRA adapter has been merged into the base model for easier deployment.
Developed by: convaiinnovations
Base Model: google/medgemma-4b-it
Training Infrastructure: AIRAWAT (C-DAC) - 8x NVIDIA A100 40GB GPUs
Training Duration: ~40 hours (1 epoch)
Final Token Accuracy: 88.23%
Model Size: ~8.5 GB
Hardware:
Training Configuration:
Training Metrics:
pip install transformers pillow torch
from transformers import AutoModelForImageTextToText, AutoProcessor
from PIL import Image
# Load model and processor
model_id = "convaiinnovations/medgemma-4b-ecginstruct-merged"
model = AutoModelForImageTextToText.from_pretrained(
model_id,
torch_dtype="auto",
device_map="auto"
)
processor = AutoProcessor.from_pretrained(model_id)
# Load ECG image
image = Image.open("ecg_image.png").convert("RGB")
# Prepare prompt using chat template
messages = [
{
"role": "user",
"content": [
{"type": "image"},
{"type": "text", "text": "Analyze this ECG and provide a detailed interpretation."}
]
}
]
# Process input
text = processor.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
inputs = processor(text=[text], images=[[image]], return_tensors="pt", padding=True)
inputs = {k: v.to(model.device) for k, v in inputs.items()}
# Generate interpretation
outputs = model.generate(
**inputs,
max_new_tokens=512,
do_sample=False
)
# Decode and print
response = processor.decode(outputs[0], skip_special_tokens=True)
print(response)
# Detailed interpretation
"Analyze this ECG and provide a detailed interpretation."
# Specific abnormality detection
"What abnormalities are present in this ECG?"
# Diagnosis suggestion
"Based on this ECG, what is the most likely diagnosis?"
# Question answering
"Does this ECG show signs of atrial fibrillation?"
# Rate and rhythm
"What is the heart rate and rhythm in this ECG?"
This model can:
⚠️ Medical Disclaimer: This model is intended for research and educational purposes only. It should NOT be used as a substitute for professional medical advice, diagnosis, or treatment. Always consult qualified healthcare professionals for medical decisions.
Important Notes:
Appropriate Uses:
Inappropriate Uses:
If you use this model in your research, please cite:
@misc{medgemma-ecginstruct,
author = {convaiinnovations},
title = {MedGemma-4B ECGInstruct: Fine-tuned ECG Interpretation Model},
year = {2025},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/convaiinnovations/medgemma-4b-ecginstruct}}
}
Apache 2.0 (following base model license)
For questions or issues, please open an issue on the model repository or contact the maintainers.