This project implements a Medical AI Assistant by fine-tuning the TinyLlama-1.1B model on the Medical Flashcards dataset using LoRA (Low-Rank Adaptation).
Medical_Assistant_Fine_Tuning.ipynb: Jupyter Notebook for data preprocessing, model fine-tuning, and evaluation. tailored for Google Colab (Free Tier).app.py: Gradio web application for interacting with the fine-tuned model.requirements.txt: List of Python dependencies.
- Upload
Medical_Assistant_Fine_Tuning.ipynbto Google Colab. - Change the runtime type to T4 GPU.
- Run all cells to fine-tune the model.
- The fine-tuned adapter will be saved. You can download the
medical_assistant_adapterfolder.
- Install dependencies:
pip3 install -r requirements.txt
- Ensure you have the
medical_assistant_adapterfolder in the same directory (or update the path inapp.py). - Run the app:
python3 app.py
- Open the provided local URL in your browser.
Note: If you are running on macOS or a machine without NVIDIA GPU, the app will automatically load the model in full precision (which requires ~4GB RAM) instead of 4-bit mode.
- Model: TinyLlama-1.1B-Chat-v1.0 (Quantized to 4-bit)
- Dataset: medalpaca/medical_meadow_medical_flashcards
- Technique: Parameter-Efficient Fine-Tuning (PEFT) using LoRA.
- Metrics: BLEU and ROUGE scores for evaluation.
The fine-tuned model demonstrates improved ability to answer medical queries compared to the base model, specifically in maintaining the Q&A format and domain relevance.