🧠 BioBERT-Medical-Specialities2
BioBERT-Medical-Specialities2 is a fine-tuned
BioBERT model for multi-class medical text classification.
It classifies short medical questions or symptom descriptions into one of
35 clinical specialities.
📊 Labels
This model predicts the following 35 medical specialties:
None, Cardiology, Hematology, Oncology, Endocrinology, Respiratory, Allergy, Dermatology, Nephrology,
Gastroenterology, Rheumatology, Otorhinolaryngology, Anesthesiology, Biochemistry, Pharmacology, Psychiatry,
Microbiology, Physiology, Pathology, Obstetrics, Gynecology, Surgery, Emergency, Orthopedics, Neurology, Urology,
Anatomy, Genetics, Radiology, Ophthalmology, Odontology, Pediatrics, Geriatrics, Nursing, Chemistry, Psychology
📦 Model Details
- Base model:
dmis-lab/biobert-base-cased-v1.1
- Fine-tuned on:
martagm17/test
- Task: Multi-class medical text classification
- Languages: English 🇬🇧
- License: Apache 2.0
🚀 How to Use
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4# Load model and tokenizer
5model_name = "your-username/biobert-medical-specialities"
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForSequenceClassification.from_pretrained(model_name)
8
9# Example input
10text = "I have constant chest pain and shortness of breath."
11
12# Tokenize and predict
13inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
14with torch.no_grad():
15 logits = model(**inputs).logits
16
17predicted_class_id = logits.argmax().item()
18predicted_label = model.config.id2label[predicted_class_id]
19
20print(f"Predicted medical speciality: {predicted_label}")