Gemma Medical QA LoRA (ChatDoctor-HealthCareMagic)
This repository contains a LoRA adapter fine-tuned on a medical Q&A dataset to adapt google/gemma-2-2b-it for healthcare-style question answering.
It is not a full model checkpoint; you must load the base model and then attach this LoRA adapter.
Model Details
Model Description
- Model type: LoRA adapter for a decoder-only causal language model (Gemma-2B-IT)
- Base model:
google/gemma-2-2b-it (gated on Hugging Face; requires access + authentication)
- Task: Medical question answering / health advice style responses (English)
- Training method: Parameter-efficient fine-tuning (PEFT) with QLoRA (4-bit quantization + LoRA)
- Language(s): English
- License: Same usage constraints as the base model and the dataset; check both before deployment
Model Sources
- Base model:
google/gemma-2-2b-it
- Dataset:
lavita/ChatDoctor-HealthCareMagic-100k
Intended Use
Direct Use
- Educational / research use for demonstrating QLoRA + LoRA fine-tuning on a medical QA dataset
- Running inference for medical-QA style prompts with safety disclaimers
Out-of-Scope Use
- Not for real-world medical diagnosis, triage, or treatment decisions
- Not a substitute for licensed clinical advice
- High-risk usage (children, pregnancy, emergencies, prescription decisions) should be avoided without professional oversight
Bias, Risks, and Limitations
- Medical datasets may contain incorrect, outdated, or unsafe advice.
- The model may hallucinate facts, miss contraindications, or fail to identify emergencies.
- Outputs can reflect dataset biases and may under-serve certain populations or rare conditions.
- This adapter was trained for demonstration purposes and may not be clinically validated.
Recommendations
- Always include a disclaimer that outputs are informational and not medical advice.
- Encourage users to consult a clinician for diagnosis/treatment.
- Do not use as a standalone triage tool; consider adding rule-based safety filters for red-flag symptoms.
- Evaluate on curated clinical benchmarks before any serious use.
How to Get Started
1) Install dependencies
pip install -U transformers accelerate bitsandbytes peft
Load Base Model + Attach LoRA Adapter & Run Inference
Important
google/gemma-2-2b-it is a gated model on Hugging Face.
You must have access to the model and be authenticated (e.g. huggingface-cli login) before running the code below.
1) Load the Base Model and Attach the LoRA Adapter
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
from peft import PeftModel
BASE_MODEL = "google/gemma-2-2b-it"
ADAPTER_REPO = "KULLANICI_ADIN/gemma-medical-qa-lora" # change to your Hugging Face repo id
# 4-bit quantization config (QLoRA-style loading)
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.float16,
bnb_4bit_use_double_quant=True,
)
# Load tokenizer and base model
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL, token=True)
base_model = AutoModelForCausalLM.from_pretrained(
BASE_MODEL,
device_map="auto",
quantization_config=bnb_config,
token=True,
)
# Attach LoRA adapter
model = PeftModel.from_pretrained(base_model, ADAPTER_REPO)
model.eval()
How to Get Started with the Model
Use the code below to get started with the model.
[More Information Needed]
Training Details
Training Data
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
[More Information Needed]
Training Procedure
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
Preprocessing [optional]
[More Information Needed]
Training Hyperparameters
- Training regime: [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
Speeds, Sizes, Times [optional]
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
[More Information Needed]
Evaluation
<!-- This section describes the evaluation protocols and provides the results. -->
Testing Data, Factors & Metrics
Testing Data
<!-- This should link to a Dataset Card if possible. -->
[More Information Needed]
Factors
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
[More Information Needed]
Metrics
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
[More Information Needed]
Results
[More Information Needed]
Summary
Model Examination [optional]
<!-- Relevant interpretability work for the model goes here -->
[More Information Needed]
Environmental Impact
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
- Hardware Type: [More Information Needed]
- Hours used: [More Information Needed]
- Cloud Provider: [More Information Needed]
- Compute Region: [More Information Needed]
- Carbon Emitted: [More Information Needed]
Technical Specifications [optional]
Model Architecture and Objective
[More Information Needed]
Compute Infrastructure
[More Information Needed]
Hardware
[More Information Needed]
Software
[More Information Needed]
Citation [optional]
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
Glossary [optional]
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
[More Information Needed]
More Information [optional]
[More Information Needed]
Model Card Authors [optional]
[More Information Needed]
Model Card Contact
[More Information Needed]
Framework versions