Downloads · 30 days
20
100% of all-time downloads
sandeshv12/gemma4pharma
gemma4pharma is a text generation model from sandeshv12. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
[](https://opensource.org/licenses/Apache-2.0) [](https://huggingface.co/google/gemma-4-E2B-it) [](https://github.com/huggingface/peft)
Downloads · 30 days
20
100% of all-time downloads
All-time downloads
20
Public
Repo size
76.3 MB
Likes
0
Public
Click a slice to open those files.
.safetensors44.1 MB · 58%
From the Hugging Face model README
An on-device, Software as a Medical Device (SaMD) aligned clinical pharmacology inference provider and diagnostic report summarizer. This model is a Parameter-Efficient Fine-Tuning (LoRA) adapter trained on top of Google Gemma-4-E2B-IT, designed to assist doctors, clinical pharmacists, and Primary Health Centre (PHC) healthcare professionals.
You can run inference using Hugging Face transformers and peft:
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
base_model_id = "google/gemma-4-E2B-it"
adapter_id = "sandeshv12/gemma4pharma"
# 1. Load Tokenizer
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
# 2. Load Base Model
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# 3. Load LoRA Adapter
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()
# 4. Formulate Clinical Query
messages = [
{
"role": "user",
"content": (
"Patient: 65-year-old male with Type 2 Diabetes and CKD Stage 4 (eGFR 22 mL/min/1.73m2).\n"
"Prescription: Metformin 1000mg BID, Ciprofloxacin 500mg BID, Lisinopril 20mg OD.\n"
"Task: Identify contraindications, DDI risks, and recommended renal dose adjustments."
)
}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.2,
do_sample=False
)
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
print(response)
google/gemma-4-E2B-itlinear)SFTTrainer) & PEFTThis model is intended for research, educational, and clinical decision support purposes only. It is not an autonomous diagnostic device. All pharmacological recommendations, dosage titrations, and clinical decisions must be reviewed and verified by a licensed healthcare professional or clinical pharmacologist.