Instructions to use iimran/Qwen2.5-3B-R1-MedicalReasoner-lora-adapter with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use iimran/Qwen2.5-3B-R1-MedicalReasoner-lora-adapter with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("iimran/Qwen2.5-3B-R1-MedicalReasoner-lora-adapter", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Studio
How to use iimran/Qwen2.5-3B-R1-MedicalReasoner-lora-adapter with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for iimran/Qwen2.5-3B-R1-MedicalReasoner-lora-adapter to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for iimran/Qwen2.5-3B-R1-MedicalReasoner-lora-adapter to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for iimran/Qwen2.5-3B-R1-MedicalReasoner-lora-adapter to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="iimran/Qwen2.5-3B-R1-MedicalReasoner-lora-adapter", max_seq_length=2048, )
Improve language tag
#1
by lbourdois - opened
README.md
CHANGED
|
@@ -1,100 +1,112 @@
|
|
| 1 |
-
---
|
| 2 |
-
datasets:
|
| 3 |
-
- iimran/Medical-Intelligence-Questions
|
| 4 |
-
base_model:
|
| 5 |
-
- Qwen/Qwen2.5-3B
|
| 6 |
-
language:
|
| 7 |
-
-
|
| 8 |
-
|
| 9 |
-
-
|
| 10 |
-
-
|
| 11 |
-
-
|
| 12 |
-
-
|
| 13 |
-
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
-
|
| 22 |
-
-
|
| 23 |
-
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
##
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
#
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
This LoRA adapter is provided for research and educational purposes. It is intended to be used in combination with the **Qwen2.5-3B-R1-MedicalReasoner** base model. As with the base model, clinical outputs should be validated by qualified healthcare professionals before being used in any medical decision-making.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
datasets:
|
| 3 |
+
- iimran/Medical-Intelligence-Questions
|
| 4 |
+
base_model:
|
| 5 |
+
- Qwen/Qwen2.5-3B
|
| 6 |
+
language:
|
| 7 |
+
- zho
|
| 8 |
+
- eng
|
| 9 |
+
- fra
|
| 10 |
+
- spa
|
| 11 |
+
- por
|
| 12 |
+
- deu
|
| 13 |
+
- ita
|
| 14 |
+
- rus
|
| 15 |
+
- jpn
|
| 16 |
+
- kor
|
| 17 |
+
- vie
|
| 18 |
+
- tha
|
| 19 |
+
- ara
|
| 20 |
+
tags:
|
| 21 |
+
- medical
|
| 22 |
+
- text-generation-inference
|
| 23 |
+
- transformers
|
| 24 |
+
- unsloth
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
# Qwen2.5-3B-R1-MedicalReasoner LoRA Adapter
|
| 28 |
+
|
| 29 |
+
This repository contains the LoRA adapter weights and configuration for **Qwen2.5-3B-R1-MedicalReasoner**, a state-of-the-art clinical reasoning language model fine-tuned using GRPO. The adapter is designed to further optimize and customize model behavior for clinical reasoning tasks.
|
| 30 |
+
|
| 31 |
+
## Overview
|
| 32 |
+
|
| 33 |
+
- **Adapter Name:** Qwen2.5-3B-R1-MedicalReasoner LoRA Adapter
|
| 34 |
+
- **Purpose:** To modify and enhance the base model (Qwen2.5-3B-R1-MedicalReasoner) using Low-Rank Adaptation (LoRA) techniques without modifying the full model weights.
|
| 35 |
+
- **Use Case:** Ideal for users wishing to fine-tune, experiment, or deploy the clinical reasoning model with customized parameter-efficient adaptations.
|
| 36 |
+
|
| 37 |
+
## Key Features
|
| 38 |
+
|
| 39 |
+
- **Parameter-Efficient Adaptation:** LoRA allows for training a small number of additional parameters, making further fine-tuning efficient in time and resources.
|
| 40 |
+
- **Seamless Integration:** Easily integrated with the base model using the provided tools and functions in Unsloth and vLLM.
|
| 41 |
+
- **Optimized for Clinical Reasoning:** The adapter reinforces chain-of-thought generation and improves the clarity of diagnostic reasoning outputs.
|
| 42 |
+
|
| 43 |
+
## How to Use
|
| 44 |
+
|
| 45 |
+
### Integration with Base Model
|
| 46 |
+
|
| 47 |
+
To download and load the LoRA adapter into Qwen2.5-3B-R1-MedicalReasoner:
|
| 48 |
+
|
| 49 |
+
```python
|
| 50 |
+
from huggingface_hub import snapshot_download
|
| 51 |
+
from unsloth import FastLanguageModel
|
| 52 |
+
|
| 53 |
+
# Download the adapter weights:
|
| 54 |
+
lora_path = snapshot_download("iimran/Qwen2.5-3B-R1-MedicalReasoner-lora-adapter")
|
| 55 |
+
print("LoRA adapter downloaded to:", lora_path)
|
| 56 |
+
|
| 57 |
+
# Load base model:
|
| 58 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 59 |
+
model_name="iimran/Qwen2.5-3B-R1-MedicalReasoner",
|
| 60 |
+
load_in_4bit=False,
|
| 61 |
+
fast_inference=True
|
| 62 |
+
)
|
| 63 |
+
|
| 64 |
+
# Load the LoRA adapter:
|
| 65 |
+
model.load_lora(lora_path)
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## Fine-Tuning and Experimentation
|
| 69 |
+
|
| 70 |
+
This adapter was originally developed and fine-tuned using GRPO with customized reward functions to enhance chain-of-thought reasoning. Researchers who wish to further optimize the behavior of the clinical reasoning model with targeted adaptations can start from these adapter weights.
|
| 71 |
+
|
| 72 |
+
## Installation Requirements
|
| 73 |
+
|
| 74 |
+
* **Python Version:** 3.8 or higher
|
| 75 |
+
* **Dependencies:**
|
| 76 |
+
* unsloth
|
| 77 |
+
* vLLM
|
| 78 |
+
* huggingface-hub
|
| 79 |
+
* Other dependencies required by the base model and LoRA integration
|
| 80 |
+
|
| 81 |
+
Install the required packages using pip:
|
| 82 |
+
|
| 83 |
+
```bash
|
| 84 |
+
pip install unsloth vllm huggingface-hub
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
## Citation
|
| 88 |
+
|
| 89 |
+
If you use the LoRA adapter in your work, please cite:
|
| 90 |
+
|
| 91 |
+
```bibtex
|
| 92 |
+
@misc{Qwen2.5-3B-R1-MedicalReasoner-lora-adapter,
|
| 93 |
+
authors = {Imran Sarwar, Muhammad Rouf Mustafa},
|
| 94 |
+
title = {Qwen2.5-3B-R1-MedicalReasoner LoRA Adapter},
|
| 95 |
+
year = {2025},
|
| 96 |
+
publisher = {Hugging Face},
|
| 97 |
+
url = {https://huggingface.co/iimran/Qwen2.5-3B-R1-MedicalReasoner-lora-adapter}
|
| 98 |
+
}
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
## Contributing
|
| 102 |
+
|
| 103 |
+
Contributions to the LoRA adapter are welcome. If you have improvements for:
|
| 104 |
+
* Adapter performance or efficiency
|
| 105 |
+
* Documentation updates
|
| 106 |
+
* Additional experiments or fine-tuning strategies
|
| 107 |
+
|
| 108 |
+
Please open an issue or submit a pull request.
|
| 109 |
+
|
| 110 |
+
## Disclaimer
|
| 111 |
+
|
| 112 |
This LoRA adapter is provided for research and educational purposes. It is intended to be used in combination with the **Qwen2.5-3B-R1-MedicalReasoner** base model. As with the base model, clinical outputs should be validated by qualified healthcare professionals before being used in any medical decision-making.
|