Downloads · 30 days
0
VaibhavSxn/scandinavian-medical-gpt-oss-20b
scandinavian-medical-gpt-oss-20b is a text generation model from VaibhavSxn. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
A specialized fine-tuned version of OpenAI's GPT-OSS 20B model optimized for natural, fluent medical writing in Swedish, Danish, and Norwegian. This model addresses the need for AI systems that can generate natural so…
Downloads · 30 days
0
Access
Public
Updated Aug 23, 2025
Repo size
59.7 MB
Likes
2
Public
Click a slice to open those files.
.safetensors31.9 MB · 53%
From the Hugging Face model README
A specialized fine-tuned version of OpenAI's GPT-OSS 20B model optimized for natural, fluent medical writing in Swedish, Danish, and Norwegian. This model addresses the need for AI systems that can generate natural sounding Scandinavian medical journal-style language with proper terminology and natural flow.
This fine-tuned model is specifically designed for healthcare professionals and researchers who need:
unsloth/gpt-oss-20b)["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]Norwegian Colossal Corpus (NCC) - 111 samples
Synthetic Medical Conversations - 1,500 samples
Training Configuration:
Epochs: 2
Total Steps: 202
Batch Size: 2 per device
Gradient Accumulation: 8 steps
Effective Batch Size: 16
Learning Rate: 1e-4
Scheduler: Cosine
Warmup Steps: 50
Optimizer: AdamW 8-bit
Weight Decay: 0.01
Max Sequence Length: 2048 tokens
LoRA Configuration:
Rank: 16
Alpha: 32
Dropout: 0.0
Bias: none
Use RSLoRA: false
pip install --upgrade uv
uv pip install \
"torch>=2.8.0" "triton>=3.4.0" numpy torchvision bitsandbytes "transformers>=4.55.3" \
"unsloth_zoo[base] @ git+https://github.com/unslothai/unsloth-zoo" \
"unsloth[base] @ git+https://github.com/unslothai/unsloth"
from unsloth import FastLanguageModel
import torch
# Load the fine-tuned model
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="VaibhavSxn/scandinavian-medical-gpt-oss-20b", # Path to your saved model
max_seq_length=2048,
dtype=None, # Auto-detection
load_in_4bit=True, # Memory efficient loading
)
print("Scandinavian Medical GPT-OSS model loaded successfully!")
from transformers import TextStreamer
messages = [
{
"role": "system",
"content": "Du är en erfaren läkare som skriver medicinska rapporter och journaler på svenska. Skriv naturligt och flytande med korrekt medicinsk terminologi."
},
{
"role": "user",
"content": "Skriv en kort medicinsk bedömning för en patient med diabetes typ 2 som behöver justera sin behandling."
}
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt",
return_dict=True,
reasoning_effort="medium", # GPT-OSS reasoning control
).to(model.device)
# Generate response
_ = model.generate(
**inputs,
max_new_tokens=300,
streamer=TextStreamer(tokenizer),
temperature=0.7,
do_sample=True
)
messages = [
{
"role": "system",
"content": "Du er en erfaren lege som skriver medisinske rapporter og journaler på norsk. Skriv naturlig og flytande med korrekt medicinsk terminologi."
},
{
"role": "user",
"content": "Skriv en postoperativ rapport for en pasient som har gjennomgått laparoskopisk kolecystektomi."
}
]
# Same inference pattern as above
messages = [
{
"role": "system",
"content": "Du er en erfaren læge, der skriver medicinske rapporter og journaler på dansk. Skriv naturligt og flydende med korrekt medicinsk terminologi."
},
{
"role": "user",
"content": "Skriv en behandlingsanbefaling for en patient med hypertension, der ikke responderer på nuværende terapi."
}
]
# Same inference pattern as above
One unique feature of GPT-OSS is adjustable reasoning effort:
# Available reasoning levels:
reasoning_effort_options = ["low", "medium", "high"]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt",
return_dict=True,
reasoning_effort="high", # For complex medical reasoning
).to(model.device)
If you use this model in your research, please cite:
@misc{scandinavian-medical-gpt-oss-2025,
title={Scandinavian Medical GPT-OSS: A Fine-tuned Model for Natural Medical Language Generation},
author={Vaibhav Saxena},
year={2025},
howpublished={Fine-tuned from OpenAI GPT-OSS 20B using Unsloth},
}
Contributions to improve the model are welcome! Please consider:
Apache 2.0, go bonkers!