Downloads · 30 days
13
10% of all-time downloads
hoangtung386/medical-gpt-oss-20b-qlora
medical-gpt-oss-20b-qlora is a machine learning model from hoangtung386. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
A specialized Language Model adapter fine-tuned for medical reasoning and healthcare applications. This LoRA adapter extends the unsloth/gpt-oss-20b base model with domain-specific medical knowledge derived from the O…
Downloads · 30 days
13
10% of all-time downloads
All-time downloads
130
Public
Repo size
43.8 MB
Likes
2
Public
Click a slice to open those files.
.json27.9 MB · 64%
From the Hugging Face model README
A specialized Language Model adapter fine-tuned for medical reasoning and healthcare applications. This LoRA adapter extends the unsloth/gpt-oss-20b base model with domain-specific medical knowledge derived from the OpenMed Medical-Reasoning-SFT dataset.
This is a LoRA adapter that requires the base model unsloth/gpt-oss-20b to function. The adapter implements parameter-efficient fine-tuning through Low-Rank Adaptation (LoRA), enabling efficient inference and deployment on resource-constrained hardware.
Before using this adapter, ensure you have the required dependencies installed:
pip install transformers peft unsloth torch
Hardware Requirements:
Unsloth provides optimized inference and automatic base model loading: from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="hoangtung386/medical-gpt-oss-20b-qlora",
max_seq_length=2048,
load_in_4bit=True,
)
FastLanguageModel.for_inference(model)
messages = [
{"role": "system", "content": "You are a helpful medical assistant."},
{"role": "user", "content": "What are the symptoms of diabetes?"},
]
prompt = "<|start|>system<|message|>You are a helpful medical assistant.<|end|>"
prompt += "<|start|>user<|message|>What are the symptoms of diabetes?<|end|>"
prompt += "<|start|>assistant<|channel|>final<|message|>"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0]))
For manual integration with existing codebases:
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"unsloth/gpt-oss-20b",
load_in_4bit=True,
device_map="auto"
)
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "hoangtung386/medical-gpt-oss-20b-qlora")
tokenizer = AutoTokenizer.from_pretrained("hoangtung386/medical-gpt-oss-20b-qlora")
This model uses the Harmony format from GPT-OSS for prompt construction:
<|start|>system<|message|>...<|end|><|start|>user<|message|>...<|end|><|start|>assistant<|channel|>final<|message|>...<|return|>Apache 2.0 (inherited from base model)
This model was trained 2x faster with Unsloth and Hugging Face's TRL library.