Downloads · 30 days
11
10% of all-time downloads
krishna195/medgemma-anatomy-v1.2
medgemma-anatomy-v1.2 is a text generation model from krishna195. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Fine-tuned version of google/medgemma-4b-it specialized in anatomical and clinical reasoning.
Downloads · 30 days
11
10% of all-time downloads
All-time downloads
106
Public
Parameters
4.4B
4.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors4.6 GB · 99%
How the weights are stored.
U83.7B · 85%
From the Hugging Face model README
Fine-tuned version of google/medgemma-4b-it specialized in anatomical and clinical reasoning.
This model was fine-tuned on 183 high-quality medical Q&A pairs focusing on:
- Learning Rate: 1e-4
- Epochs: 5
- Batch Size: 1 (effective 16 with gradient accumulation)
- Max Sequence Length: 1024 tokens
- LoRA Rank: 16
- LoRA Alpha: 32
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_name = "krishna195/medgemma-anatomy-v1.2"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Ask a medical question
question = "A patient presents with shoulder pain after a fall. What is your diagnostic approach?"
prompt = f'''<start_of_turn>user
{question}<end_of_turn>
<start_of_turn>model
'''
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.7,
do_sample=True,
top_p=0.9
)
answer = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(answer.split("<start_of_turn>model")[-1])
from transformers import BitsAndBytesConfig
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16
)
model = AutoModelForCausalLM.from_pretrained(
model_name,
quantization_config=bnb_config,
device_map="auto"
)
NOT intended for: Clinical decision-making, patient diagnosis, or treatment planning without human oversight.
Dataset consists of Q&A pairs extracted from medical textbooks with focus on:
Average answer structure:
@misc{medgemma-anatomy-v1.2,
title={MedGemma-4B Anatomy Fine-tuned Model},
author={Your Name},
year={2025},
publisher={Hugging Face},
howpublished={\url{krishna195/medgemma-anatomy-v1.2}}
}
Apache 2.0 (following base model license)
For questions or issues, please open an issue on the model repository.