|
--- |
|
datasets: |
|
- keivalya/MedQuad-MedicalQnADataset |
|
- turquise/Comprehensive_Medical_QA_Dataset |
|
language: |
|
- en |
|
base_model: |
|
- meta-llama/Llama-3.1-8B-Instruct |
|
tags: |
|
- medical |
|
--- |
|
# Fine-Tuning Llama-3.1 with Comprehensive Medical Q&A Dataset |
|
|
|
This project fine-tunes the **Llama-3.1 8B Model** using the **Comprehensive Medical Q&A Dataset** to build a specialized model capable of answering medical questions. |
|
|
|
--- |
|
|
|
## π Features |
|
|
|
- Fine-tuned on a diverse dataset of over **43,000 medical Q&A pairs**. |
|
- Supports **31 distinct types of medical queries**, including treatments, chronic diseases, and protocols. |
|
- Provides answers sourced from doctors, nurses, and pharmacists. |
|
|
|
--- |
|
|
|
## π Dataset Overview |
|
|
|
### **Comprehensive Medical Q&A Dataset** |
|
|
|
- **Source:** [Huggingface Hub](https://huggingface.co./datasets/keivalya/MedQuad-MedicalQnADataset) |
|
- **License:** CC0 1.0 Universal (Public Domain Dedication) |
|
|
|
#### **Key Details** |
|
- **Total Questions:** 43,000+ |
|
- **Categories:** 31 medical question types (`qtype`) |
|
- **Columns:** |
|
- `qtype`: Type of medical question (e.g., Treatment, Symptoms). |
|
- `Question`: Patient's medical question. |
|
- `Answer`: Expert response (from doctors, nurses, and pharmacists). |
|
|
|
### **How the Dataset is Used** |
|
- **Filtering:** Questions are filtered by `qtype` for domain-specific fine-tuning. |
|
- **Analysis:** Queries are analyzed to understand patterns, such as correlations between treatments and chronic conditions. |
|
- **Applications:** Insights can be applied to build medical educational tools, predictive models, and virtual assistants. |
|
|
|
For more details, check the [dataset documentation](https://huggingface.co./datasets/keivalya/MedQuad-MedicalQnADataset). |
|
|
|
--- |
|
|
|
## π» How to Use This Model |
|
|
|
The fine-tuned model is available on Hugging Face under the repository: [`turquise/MedQA_q4`](https://huggingface.co./turquise/MedQA_q4). Below are several ways to use the model: |
|
|
|
### **Using llama-cpp-python Library** |
|
```python |
|
from llama_cpp import Llama |
|
|
|
# Load the model |
|
llm = Llama.from_pretrained( |
|
repo_id="turquise/MedQA_q4", |
|
filename="MedQA.Q4_K_M.gguf", |
|
) |
|
|
|
# Query the model |
|
output = llm( |
|
"What is Medullary Sponge Kidney?", |
|
max_tokens=512, |
|
echo=True |
|
) |
|
print(output) |
|
``` |
|
|
|
### **Using llama.cpp** |
|
#### **Install via Homebrew** |
|
```bash |
|
brew install llama.cpp |
|
|
|
llama-cli \ |
|
--hf-repo "turquise/MedQA_q4" \ |
|
--hf-file MedQA.Q4_K_M.gguf \ |
|
-p "What is Medullary Sponge Kidney?" |
|
``` |
|
#### **Use Pre-Built Binary** |
|
```bash |
|
# Download pre-built binary from: |
|
# https://github.com/ggerganov/llama.cpp/releases |
|
|
|
./llama-cli \ |
|
--hf-repo "turquise/MedQA_q4" \ |
|
--hf-file MedQA.Q4_K_M.gguf \ |
|
-p "What is Medullary Sponge Kidney?" |
|
``` |
|
#### **Build from Source Code** |
|
```bash |
|
git clone https://github.com/ggerganov/llama.cpp.git |
|
cd llama.cpp |
|
cmake -B build -DLLAMA_CURL=ON |
|
cmake --build build -j --target llama-cli |
|
|
|
./build/bin/llama-cli \ |
|
--hf-repo "turquise/MedQA_q4" \ |
|
--hf-file MedQA.Q4_K_M.gguf \ |
|
-p "What is Medullary Sponge Kidney?" |
|
``` |
|
|
|
--- |
|
|
|
## π€ Example Usages |
|
This model can assist with the following tasks: |
|
|
|
- Answering medical questions: |
|
```python |
|
question = "What are the symptoms of diabetes?" |
|
output = llm(question, max_tokens=512) |
|
print(output) |
|
``` |
|
- Providing insights for healthcare education: Example: Answering queries about diseases, treatments, and chronic conditions. |
|
- Supporting virtual assistants by handling frequently asked healthcare-related questions. |
|
|
|
--- |
|
|
|
## β οΈ Disclaimer |
|
|
|
- This model **does not provide medical advice** and should not replace professional medical consultation. |
|
- For any health-related questions or concerns, please consult a doctor or a licensed healthcare professional. |
|
|
|
--- |
|
|
|
## π€ Applications |
|
|
|
This fine-tuned model can be used to: |
|
- Build **virtual assistants** and chatbots for healthcare-related queries. |
|
- Assist healthcare professionals by handling routine inquiries. |
|
- Enhance **medical education platforms** with AI-powered insights. |
|
|
|
--- |
|
|
|
## π Acknowledgements |
|
|
|
- Dataset: [Huggingface Hub - MedQuad](https://huggingface.co./datasets/keivalya/MedQuad-MedicalQnADataset). |
|
- Fine-tuning framework: [Unsloth](https://github.com/unslothai/unsloth). |
|
|
|
If you use this project or dataset in your research, please credit the original authors. |
|
|
|
--- |
|
|
|
## π License |
|
|
|
This project is open-sourced under the **CC0 1.0 Universal License**. See the dataset [license details](https://creativecommons.org/publicdomain/zero/1.0/). |
|
|
|
--- |
|
|
|
## π§ Contact |
|
|
|
For questions or collaboration, reach out via [HF Model Community](https://huggingface.co./turquise/MedQA_q4/discussions). |