rolmaxx/MediGuide-QLoRA
137
1---2base_model: Qwen/Qwen2.5-1.5B-Instruct3library_name: peft4pipeline_tag: text-generation5tags:6- base_model:adapter:Qwen/Qwen2.5-1.5B-Instruct7- lora8- qlora9- transformers10- peft11- medical12---13 14# MediGuide QLoRA15 16MediGuide is a fine-tuned medical conversational assistant based on `Qwen/Qwen2.5-1.5B-Instruct`.17 18This repository contains the **QLoRA adapter weights** trained for the MediGuide project. The base Qwen model is not included and must be loaded separately.19 20## Model Details21 22- **Base model:** `Qwen/Qwen2.5-1.5B-Instruct`23- **Fine-tuning method:** QLoRA24- **PEFT method:** LoRA25- **LoRA rank:** 1626- **LoRA alpha:** 3227- **LoRA dropout:** 0.0528- **Task:** Medical dialogue generation29- **Framework:** Hugging Face Transformers + PEFT30- **PEFT version:** 0.20.031- **License:** See the base model's license and the MediGuide project repository for applicable terms.32 33## Intended Use34 35This adapter is intended for research and educational experimentation with medical dialogue generation and parameter-efficient fine-tuning.36 37It is not intended to replace a qualified healthcare professional, provide definitive diagnoses, or make medical decisions.38 39## Out-of-Scope Use40 41Do not use this model as an autonomous clinical decision-maker, for emergency medical guidance, or as a substitute for professional medical advice.42 43## Training44 45The adapter was trained on the cleaned MediDialog-derived MediGuide dataset used in the project.46 47The project uses an 80/10/10 train/validation/test split and compares multiple parameter-efficient fine-tuning approaches, including LoRA, QLoRA, and Prompt Tuning.48 49### QLoRA Configuration50 51The adapter targets:52 53- `q_proj`54- `k_proj`55- `v_proj`56- `o_proj`57- `gate_proj`58- `up_proj`59- `down_proj`60 61The adapter configuration uses `r=16`, `alpha=32`, and `dropout=0.05`.62 63## Evaluation64 65On the MediGuide evaluation setup, QLoRA achieved:66 67| Metric | QLoRA |68|---|---:|69| ROUGE-1 | 0.1319 |70| ROUGE-2 | 0.0269 |71| ROUGE-L | 0.1319 |72| BLEU | 2.40 |73| Perplexity | 14.65 |74 75These results come from the project's current evaluation setup and should not be interpreted as clinical performance benchmarks.76 77## How to Use78 79Install the required packages:80 81```bash82pip install transformers peft torch83```84 85Load the base model and adapter:86 87```python88import torch89from transformers import AutoTokenizer, AutoModelForCausalLM90from peft import PeftModel91 92base_model_id = "Qwen/Qwen2.5-1.5B-Instruct"93adapter_id = "rolmaxx/MediGuide-QLoRA"94 95tokenizer = AutoTokenizer.from_pretrained(base_model_id)96 97model = AutoModelForCausalLM.from_pretrained(98 base_model_id,99 torch_dtype=torch.float16,100 device_map="auto"101)102 103model = PeftModel.from_pretrained(model, adapter_id)104 105prompt = "What are common symptoms of the flu?"106 107inputs = tokenizer(prompt, return_tensors="pt").to(model.device)108 109with torch.no_grad():110 outputs = model.generate(111 **inputs,112 max_new_tokens=256,113 temperature=0.7,114 do_sample=True115 )116 117print(tokenizer.decode(outputs[0], skip_special_tokens=True))118```119 120## Repository121 122GitHub: https://github.com/lxzy8/MediGuide123 124## Files125 126- `adapter_config.json` — PEFT/LoRA adapter configuration127- `adapter_model.safetensors` — trained adapter weights128 129The base Qwen model is not included in this repository.130 131## Limitations132 133The model was trained on a relatively small dataset and evaluated using automated text-generation metrics. Automated metrics such as ROUGE and BLEU do not establish medical correctness, safety, or clinical usefulness.134 135Model outputs may contain incorrect, incomplete, or unsafe medical information. Human review is required for any real-world medical application.136 137## Citation138 139If you use this adapter in your work, please cite the MediGuide project repository:140 141```text142MediGuide — QLoRA fine-tuned medical conversational assistant.143https://github.com/lxzy8/MediGuide144```145 146## Framework Versions147 148- PEFT: 0.20.0149 