Downloads · 30 days
14
8% of all-time downloads
Branis333/symptom-gpt2-chatbot
symptom-gpt2-chatbot is a text generation model from Branis333. Use it when you need the model to write or continue text. The card lists the license as mit.
A specialized GPT-2 model fine-tuned on medical Q&A data to assist with symptom analysis, disease information, and health-related questions.
Downloads · 30 days
14
8% of all-time downloads
All-time downloads
175
Public
Parameters
124M
498 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors498 MB · 100%
From the Hugging Face model README
A specialized GPT-2 model fine-tuned on medical Q&A data to assist with symptom analysis, disease information, and health-related questions.
This model is based on GPT-2 and has been fine-tuned on a comprehensive medical dataset combining:
⚠️ IMPORTANT DISCLAIMER: This model is for informational and educational purposes only. Always consult qualified healthcare professionals for medical advice, diagnosis, or treatment.
| Epoch | Train Loss | Val Loss | Perplexity |
|---|---|---|---|
| 1 | 0.5518 | 0.4664 | 1.59 |
| 2 | 0.4553 | 0.4366 | 1.55 |
| 3 | 0.4162 | 0.4196 | 1.52 |
| 4 | 0.3865 | 0.4088 | 1.51 |
| 5 | 0.3621 | 0.4015 | 1.49 |
| 6 | 0.3415 | 0.3975 | 1.49 |
| 7 | 0.3233 | 0.3988 | 1.49 |
| 8 | 0.3069 | 0.3984 | 1.49 |
| 9 | 0.2917 | 0.3977 | 1.49 |
| 10 | 0.2781 | 0.4024 | 1.50 |
Final Model Performance:
from transformers import GPT2Tokenizer, GPT2LMHeadModel
import torch
# Load model and tokenizer
model_name = "Branis333/symptom-gpt2-chatbot"
tokenizer = GPT2Tokenizer.from_pretrained(model_name)
model = GPT2LMHeadModel.from_pretrained(model_name)
# Set device
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
model.eval()
# Generate response
question = "I have fever and cough. What could this be?"
prompt = f"User: {question} Bot:"
inputs = tokenizer(prompt, return_tensors="pt").to(device)
outputs = model.generate(
**inputs,
max_new_tokens=150,
do_sample=True,
temperature=0.7,
top_p=0.9,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
answer = response.split("Bot:")[-1].strip()
print(answer)
User: I have fever and cough. What could this be?
Bot: You may be experiencing a respiratory infection...
User: What are the symptoms of diabetes?
Bot: Common symptoms include increased thirst, frequent urination...
MIT License - Free to use with attribution
Built with ❤️ using Hugging Face Transformers
Last Updated: October 2024