Text Generation
PEFT
English
Spanish
oncology
medical
lora
qwen3
amd
rocm
mi300x
clinical
fine-tuned
Instructions to use lablab-ai-amd-developer-hackathon/OncoAgent-v1.0-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use lablab-ai-amd-developer-hackathon/OncoAgent-v1.0-9B with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen3.5-9B
|
| 4 |
+
tags:
|
| 5 |
+
- oncology
|
| 6 |
+
- medical
|
| 7 |
+
- lora
|
| 8 |
+
- peft
|
| 9 |
+
- qwen3
|
| 10 |
+
- amd
|
| 11 |
+
- rocm
|
| 12 |
+
- mi300x
|
| 13 |
+
- clinical
|
| 14 |
+
- fine-tuned
|
| 15 |
+
datasets:
|
| 16 |
+
- MaximoLopezChenlo/OncoAgent-Clinical-266K
|
| 17 |
+
language:
|
| 18 |
+
- en
|
| 19 |
+
- es
|
| 20 |
+
pipeline_tag: text-generation
|
| 21 |
+
library_name: peft
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
# 🧬 OncoAgent v1.0 — 9B (Tier 1)
|
| 25 |
+
|
| 26 |
+
**QLoRA Fine-tuned LoRA Adapter for Clinical Oncology Triage**
|
| 27 |
+
|
| 28 |
+
[](https://www.amd.com/en/products/accelerators/instinct/mi300x.html)
|
| 29 |
+
[](https://rocm.docs.amd.com/)
|
| 30 |
+
[](https://opensource.org/licenses/Apache-2.0)
|
| 31 |
+
|
| 32 |
+
> **AMD Developer Hackathon 2026** · Trained on AMD Instinct™ MI300X · ROCm 7.2
|
| 33 |
+
|
| 34 |
+
## Model Description
|
| 35 |
+
|
| 36 |
+
OncoAgent v1.0 9B is a **QLoRA fine-tuned LoRA adapter** built on top of [Qwen/Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B), specialized for **clinical oncology triage and treatment recommendation**.
|
| 37 |
+
|
| 38 |
+
This is the **Tier 1 (fast triage)** model in the OncoAgent multi-agent system, optimized for:
|
| 39 |
+
- Rapid cancer type classification and routing
|
| 40 |
+
- Clinical entity extraction (symptoms, staging, biomarkers)
|
| 41 |
+
- First-pass treatment recommendations based on NCCN/ESMO guidelines
|
| 42 |
+
|
| 43 |
+
## Training Details
|
| 44 |
+
|
| 45 |
+
| Parameter | Value |
|
| 46 |
+
|---|---|
|
| 47 |
+
| **Base Model** | Qwen/Qwen3.5-9B |
|
| 48 |
+
| **Method** | QLoRA (4-bit NormalFloat4) |
|
| 49 |
+
| **Framework** | Unsloth + PEFT + TRL |
|
| 50 |
+
| **Hardware** | AMD Instinct™ MI300X (192GB HBM3) |
|
| 51 |
+
| **Software** | ROCm 7.2 · PyTorch 2.3+ |
|
| 52 |
+
| **LoRA Rank** | 32 |
|
| 53 |
+
| **LoRA Alpha** | 32 |
|
| 54 |
+
| **Target Modules** | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
|
| 55 |
+
| **Training Samples** | 240,168 (+ 26,686 eval) |
|
| 56 |
+
| **Max Sequence Length** | 2,048 tokens |
|
| 57 |
+
| **Batch Size** | 8 (gradient accumulation: 2 → effective: 16) |
|
| 58 |
+
| **Learning Rate** | 2e-4 (cosine schedule) |
|
| 59 |
+
| **Epochs** | 1 |
|
| 60 |
+
| **Precision** | BF16 (native MI300X) |
|
| 61 |
+
| **Seed** | 42 (reproducible) |
|
| 62 |
+
|
| 63 |
+
## Dataset
|
| 64 |
+
|
| 65 |
+
Trained on [MaximoLopezChenlo/OncoAgent-Clinical-266K](https://huggingface.co/datasets/MaximoLopezChenlo/OncoAgent-Clinical-266K), a curated oncology dataset combining:
|
| 66 |
+
|
| 67 |
+
- **PMC-Patients** — Real clinical case presentations
|
| 68 |
+
- **PubMedQA** — Evidence-based medical Q&A
|
| 69 |
+
- **OncoCoT** — Chain-of-thought oncology reasoning (synthetic)
|
| 70 |
+
- **NCCN/ESMO Guidelines** — Structured guideline extracts
|
| 71 |
+
|
| 72 |
+
## Usage
|
| 73 |
+
|
| 74 |
+
```python
|
| 75 |
+
from peft import PeftModel
|
| 76 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 77 |
+
|
| 78 |
+
# Load base model
|
| 79 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
| 80 |
+
"Qwen/Qwen3.5-9B",
|
| 81 |
+
device_map="auto",
|
| 82 |
+
torch_dtype="bfloat16",
|
| 83 |
+
)
|
| 84 |
+
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3.5-9B")
|
| 85 |
+
|
| 86 |
+
# Load LoRA adapter
|
| 87 |
+
model = PeftModel.from_pretrained(
|
| 88 |
+
base_model,
|
| 89 |
+
"MaximoLopezChenlo/OncoAgent-v1.0-9B",
|
| 90 |
+
)
|
| 91 |
+
|
| 92 |
+
# Inference
|
| 93 |
+
messages = [
|
| 94 |
+
{"role": "system", "content": "You are a clinical oncology specialist."},
|
| 95 |
+
{"role": "user", "content": "55yo female, Grade 1 endometrioid adenocarcinoma..."},
|
| 96 |
+
]
|
| 97 |
+
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt")
|
| 98 |
+
outputs = model.generate(inputs, max_new_tokens=1024)
|
| 99 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
## vLLM Deployment (AMD MI300X)
|
| 103 |
+
|
| 104 |
+
```bash
|
| 105 |
+
# Serve with vLLM on ROCm
|
| 106 |
+
python -m vllm.entrypoints.openai.api_server \
|
| 107 |
+
--model Qwen/Qwen3.5-9B \
|
| 108 |
+
--enable-lora \
|
| 109 |
+
--lora-modules oncoagent=MaximoLopezChenlo/OncoAgent-v1.0-9B \
|
| 110 |
+
--dtype bfloat16 \
|
| 111 |
+
--tensor-parallel-size 1 \
|
| 112 |
+
--gpu-memory-utilization 0.45
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
## Architecture
|
| 116 |
+
|
| 117 |
+
OncoAgent v1.0 9B serves as the **Tier 1** model in a dual-tier architecture:
|
| 118 |
+
|
| 119 |
+
```
|
| 120 |
+
Clinical Case → Router → [Tier 1: 9B] → Specialist → Critic → Output
|
| 121 |
+
↓
|
| 122 |
+
(Complex cases)
|
| 123 |
+
↓
|
| 124 |
+
[Tier 2: 27B] → Specialist → Critic → Output
|
| 125 |
+
```
|
| 126 |
+
|
| 127 |
+
## Links
|
| 128 |
+
|
| 129 |
+
- 🔗 **Demo:** [HF Space](https://huggingface.co/spaces/MaximoLopezChenlo/OncoAgent)
|
| 130 |
+
- 🔗 **GitHub:** [maximolopezchenlo-lab/OncoAgent](https://github.com/maximolopezchenlo-lab/OncoAgent)
|
| 131 |
+
- 🔗 **Tier 2 Model:** [OncoAgent-v1.0-27B](https://huggingface.co/MaximoLopezChenlo/OncoAgent-v1.0-27B)
|
| 132 |
+
- 🔗 **Dataset:** [OncoAgent-Clinical-266K](https://huggingface.co/datasets/MaximoLopezChenlo/OncoAgent-Clinical-266K)
|
| 133 |
+
|
| 134 |
+
## Citation
|
| 135 |
+
|
| 136 |
+
```bibtex
|
| 137 |
+
@misc{oncoagent2026,
|
| 138 |
+
title={OncoAgent: Multi-Agent Oncology Triage System},
|
| 139 |
+
author={Lopez Chenlo, Maximo},
|
| 140 |
+
year={2026},
|
| 141 |
+
howpublished={AMD Developer Hackathon 2026},
|
| 142 |
+
url={https://github.com/maximolopezchenlo-lab/OncoAgent}
|
| 143 |
+
}
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
## License
|
| 147 |
+
|
| 148 |
+
Apache 2.0 — This adapter is for **research and educational purposes only**. Not intended for direct clinical use without professional medical oversight.
|