Downloads · 30 days
18
12% of all-time downloads
sumanthmandavalli/SmallMedLM
SmallMedLM is a machine learning model from sumanthmandavalli. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
SmallMedLM is a fine-tuned distilgpt2 model trained on medical text data about diseases, symptoms, and treatments.
Downloads · 30 days
18
12% of all-time downloads
All-time downloads
146
Public
Parameters
81.9M
983 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors328 MB · 100%
From the Hugging Face model README
SmallMedLM is a fine-tuned distilgpt2 model trained on medical text data about diseases, symptoms, and treatments.
This model is designed for generating medical information given a disease or symptom prompt.
It can output possible symptoms for a disease or suggest treatment directions based on symptoms.
⚠️ Disclaimer: This model is for research/educational purposes only. It is not a substitute for professional medical advice. Always consult a qualified healthcare professional.
distilgpt2from transformers import GPT2LMHeadModel, GPT2Tokenizer
model_name = "sumanthmandavalli/SmallMedLM"
tokenizer = GPT2Tokenizer.from_pretrained(model_name)
model = GPT2LMHeadModel.from_pretrained(model_name)
def generate_medical_info(disease_name, max_length=100):
prompt = f"Disease: {disease_name} | Symptoms: "
inputs = tokenizer.encode(prompt, return_tensors="pt")
outputs = model.generate(
inputs,
max_length=max_length,
num_return_sequences=1,
no_repeat_ngram_size=2,
top_k=50,
top_p=0.95,
temperature=0.7,
do_sample=True
)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generate_medical_info("Diabetes"))