Update README.md
Browse files
README.md
CHANGED
|
@@ -19,26 +19,32 @@ pipeline_tag: image-text-to-text
|
|
| 19 |
|
| 20 |
# MedGemma-4B ECGInstruct
|
| 21 |
|
|
|
|
|
|
|
| 22 |
Fine-tuned version of Google's MedGemma-4B-it model on the ECGInstruct dataset for automated ECG interpretation.
|
| 23 |
|
| 24 |
## Model Description
|
| 25 |
|
| 26 |
This is a fully merged fine-tuned version of [google/medgemma-4b-it](https://huggingface.co/google/medgemma-4b-it) trained on the [PULSE-ECG/ECGInstruct](https://huggingface.co/datasets/PULSE-ECG/ECGInstruct) dataset containing 1.15M ECG instruction-following examples. The LoRA adapter has been merged into the base model for easier deployment.
|
| 27 |
|
| 28 |
-
**Developed by:**
|
| 29 |
**Base Model:** google/medgemma-4b-it
|
| 30 |
**Training Infrastructure:** AIRAWAT (C-DAC) - 8x NVIDIA A100 40GB GPUs
|
| 31 |
-
**Training Duration:**
|
| 32 |
-
**Final Token Accuracy:**
|
|
|
|
|
|
|
| 33 |
**Model Size:** ~8.5 GB
|
| 34 |
|
| 35 |
## Training Details
|
| 36 |
|
| 37 |
### Training Data
|
| 38 |
-
- **Dataset:** PULSE-ECG/ECGInstruct
|
| 39 |
-
- **Samples:** 1,
|
| 40 |
-
- **Image Sources:** MIMIC-IV-ECG, PTB-XL, CODE-15
|
| 41 |
- **Task:** Vision-language instruction following for ECG interpretation
|
|
|
|
|
|
|
| 42 |
|
| 43 |
### Training Procedure
|
| 44 |
|
|
@@ -48,17 +54,20 @@ This is a fully merged fine-tuned version of [google/medgemma-4b-it](https://hug
|
|
| 48 |
|
| 49 |
**Training Configuration:**
|
| 50 |
- Fine-tuning method: LoRA (r=32, alpha=64, dropout=0.05)
|
| 51 |
-
-
|
| 52 |
-
-
|
|
|
|
| 53 |
- Optimizer: AdamW (fused)
|
| 54 |
- Precision: bfloat16
|
| 55 |
- Gradient checkpointing: Enabled
|
|
|
|
|
|
|
| 56 |
|
| 57 |
**Training Metrics:**
|
| 58 |
-
- Final training loss:
|
| 59 |
-
- Mean token accuracy:
|
| 60 |
-
-
|
| 61 |
-
- Total tokens processed:
|
| 62 |
|
| 63 |
## Usage
|
| 64 |
|
|
@@ -150,9 +159,22 @@ This model can:
|
|
| 150 |
|
| 151 |
## Performance
|
| 152 |
|
| 153 |
-
**
|
| 154 |
-
|
| 155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
|
| 157 |
## Limitations
|
| 158 |
|
|
@@ -165,7 +187,16 @@ This model can:
|
|
| 165 |
|
| 166 |
## Ethical Considerations
|
| 167 |
|
| 168 |
-
⚠️ **
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
|
| 170 |
**Important Notes:**
|
| 171 |
- This is an AI model and can make mistakes
|
|
@@ -173,6 +204,7 @@ This model can:
|
|
| 173 |
- Model outputs should be verified by trained clinicians
|
| 174 |
- Not approved for clinical use or diagnostic purposes
|
| 175 |
- Use responsibly and within appropriate medical oversight
|
|
|
|
| 176 |
|
| 177 |
## Intended Use
|
| 178 |
|
|
|
|
| 19 |
|
| 20 |
# MedGemma-4B ECGInstruct
|
| 21 |
|
| 22 |
+
[](https://colab.research.google.com/drive/19VGxD03skunSLLRe7gIMs_zHMj9_TolQ?usp=sharing)
|
| 23 |
+
|
| 24 |
Fine-tuned version of Google's MedGemma-4B-it model on the ECGInstruct dataset for automated ECG interpretation.
|
| 25 |
|
| 26 |
## Model Description
|
| 27 |
|
| 28 |
This is a fully merged fine-tuned version of [google/medgemma-4b-it](https://huggingface.co/google/medgemma-4b-it) trained on the [PULSE-ECG/ECGInstruct](https://huggingface.co/datasets/PULSE-ECG/ECGInstruct) dataset containing 1.15M ECG instruction-following examples. The LoRA adapter has been merged into the base model for easier deployment.
|
| 29 |
|
| 30 |
+
**Developed by:** ConvAI Innovations
|
| 31 |
**Base Model:** google/medgemma-4b-it
|
| 32 |
**Training Infrastructure:** AIRAWAT (C-DAC) - 8x NVIDIA A100 40GB GPUs
|
| 33 |
+
**Training Duration:** 72 hours (3 days)
|
| 34 |
+
**Final Token Accuracy:** 86.83%
|
| 35 |
+
**Final Training Loss:** 0.6188
|
| 36 |
+
**GPU-Hours:** 576
|
| 37 |
**Model Size:** ~8.5 GB
|
| 38 |
|
| 39 |
## Training Details
|
| 40 |
|
| 41 |
### Training Data
|
| 42 |
+
- **Dataset:** PULSE-ECG/ECGInstruct (1.15M samples)
|
| 43 |
+
- **Samples:** 1,156,110 ECG image-text pairs
|
| 44 |
+
- **Image Sources:** MIMIC-IV-ECG (~800K), PTB-XL (22K), CODE-15% (346K), ChapmanShaoxing
|
| 45 |
- **Task:** Vision-language instruction following for ECG interpretation
|
| 46 |
+
- **Demographics:** Age range 0-95 years, 52% male / 48% female
|
| 47 |
+
- **Disease Classes:** 5 superclasses (NORM, MI, STTC, CD, HYP), 24 subclasses
|
| 48 |
|
| 49 |
### Training Procedure
|
| 50 |
|
|
|
|
| 54 |
|
| 55 |
**Training Configuration:**
|
| 56 |
- Fine-tuning method: LoRA (r=32, alpha=64, dropout=0.05)
|
| 57 |
+
- Target modules: all-linear (including vision encoder)
|
| 58 |
+
- Learning rate: 1.2e-5 with cosine decay
|
| 59 |
+
- Batch size: 192 effective (4 per GPU × 8 GPUs × 6 gradient accumulation)
|
| 60 |
- Optimizer: AdamW (fused)
|
| 61 |
- Precision: bfloat16
|
| 62 |
- Gradient checkpointing: Enabled
|
| 63 |
+
- Max sequence length: 2048 tokens
|
| 64 |
+
- Max new tokens: 512
|
| 65 |
|
| 66 |
**Training Metrics:**
|
| 67 |
+
- Final training loss: 0.6188
|
| 68 |
+
- Mean token accuracy: 86.83%
|
| 69 |
+
- Training throughput: ~9.67 samples/sec
|
| 70 |
+
- Total tokens processed: 103M+
|
| 71 |
|
| 72 |
## Usage
|
| 73 |
|
|
|
|
| 159 |
|
| 160 |
## Performance
|
| 161 |
|
| 162 |
+
**Training Metrics:**
|
| 163 |
+
| Metric | Value |
|
| 164 |
+
|--------|-------|
|
| 165 |
+
| Token Accuracy | 86.83% |
|
| 166 |
+
| Final Loss | 0.6188 |
|
| 167 |
+
| Training Time | 72 hours |
|
| 168 |
+
| GPU-Hours | 576 |
|
| 169 |
+
|
| 170 |
+
**Inference Metrics (A100 GPU):**
|
| 171 |
+
| Metric | Value |
|
| 172 |
+
|--------|-------|
|
| 173 |
+
| TTFT (Time to First Token) | ~150ms |
|
| 174 |
+
| ISL (Input Sequence Length) | 2048 tokens |
|
| 175 |
+
| OSL (Output Sequence Length) | 512 tokens |
|
| 176 |
+
| End-to-End Latency | 2-3 seconds |
|
| 177 |
+
| Throughput | ~45 tokens/sec |
|
| 178 |
|
| 179 |
## Limitations
|
| 180 |
|
|
|
|
| 187 |
|
| 188 |
## Ethical Considerations
|
| 189 |
|
| 190 |
+
> ⚠️ **MEDICAL DISCLAIMER**
|
| 191 |
+
>
|
| 192 |
+
> **This model is for RESEARCH AND EDUCATIONAL PURPOSES ONLY.**
|
| 193 |
+
>
|
| 194 |
+
> - ❌ NOT validated for clinical use
|
| 195 |
+
> - ❌ NOT FDA/CE approved
|
| 196 |
+
> - ❌ NOT a substitute for professional medical diagnosis
|
| 197 |
+
> - ❌ Should NOT be used for patient care decisions
|
| 198 |
+
>
|
| 199 |
+
> **Always consult qualified healthcare professionals for medical decisions.**
|
| 200 |
|
| 201 |
**Important Notes:**
|
| 202 |
- This is an AI model and can make mistakes
|
|
|
|
| 204 |
- Model outputs should be verified by trained clinicians
|
| 205 |
- Not approved for clinical use or diagnostic purposes
|
| 206 |
- Use responsibly and within appropriate medical oversight
|
| 207 |
+
- Has not been tested on external clinical datasets
|
| 208 |
|
| 209 |
## Intended Use
|
| 210 |
|