Downloads · 30 days
115
23% of all-time downloads
convaiinnovations/medgemma-4b-ecginstruct
medgemma-4b-ecginstruct 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.
[](https://colab.research.google.com/drive/19VGxD03skunSLLRe7gIMszHMj9TolQ?usp=sharing)
Downloads · 30 days
115
23% of all-time downloads
All-time downloads
510
Public
Parameters
4.3B
8.6 GB on disk
Likes
3
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: ConvAI Innovations
Base Model: google/medgemma-4b-it
Training Infrastructure: AIRAWAT (C-DAC) - 8x NVIDIA A100 40GB GPUs
Training Duration: 72 hours (3 days)
Final Token Accuracy: 86.83%
Final Training Loss: 0.6188
GPU-Hours: 576
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"
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:
Training Metrics:
| Metric | Value |
|---|---|
| Token Accuracy | 86.83% |
| Final Loss | 0.6188 |
| Training Time | 72 hours |
| GPU-Hours | 576 |
Inference Metrics (A100 GPU):
| Metric | Value |
|---|---|
| TTFT (Time to First Token) | ~150ms |
| ISL (Input Sequence Length) | 2048 tokens |
| OSL (Output Sequence Length) | 512 tokens |
| End-to-End Latency | 2-3 seconds |
| Throughput | ~45 tokens/sec |
⚠️ MEDICAL DISCLAIMER
This model is for RESEARCH AND EDUCATIONAL PURPOSES ONLY.
- ❌ NOT validated for clinical use
- ❌ NOT FDA/CE approved
- ❌ NOT a substitute for professional medical diagnosis
- ❌ Should NOT be used for patient care decisions
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.