Downloads · 30 days
14
2% of all-time downloads
Zakia/gpt2-drugscom_depression_reviews
gpt2-drugscom_depression_reviews is a text generation model from Zakia. 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.
This model is a GPT-2-based language model fine-tuned on drug reviews for the depression medical condition from Drugs.com. The dataset used for fine-tuning is the Zakia/drugscomreviews dataset, which is filtered for t…
Downloads · 30 days
14
2% of all-time downloads
All-time downloads
577
Public
Parameters
124M
550 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors498 MB · 90%
From the Hugging Face model README
This model is a GPT-2-based language model fine-tuned on drug reviews for the depression medical condition from Drugs.com. The dataset used for fine-tuning is the Zakia/drugscom_reviews dataset, which is filtered for the condition 'Depression'. The base model for fine-tuning was the gpt2.
This model is intended to generate text that mimics patient reviews of depression medications, useful for understanding patient sentiments and experiences.
This model is not designed to diagnose or treat depression or to replace professional medical advice.
The model may inherit biases present in the dataset and should be used with caution in decision-making processes.
Use the model as a tool for generating synthetic patient reviews and for NLP research.
Use the code below to generate synthetic reviews with the model.
from transformers import GPT2LMHeadModel, GPT2Tokenizer
import torch
model_name = "Zakia/gpt2-drugscom_depression_reviews"
model = GPT2LMHeadModel.from_pretrained(model_name)
tokenizer = GPT2Tokenizer.from_pretrained(model_name)
# Function to generate text
def generate_review(prompt, model, tokenizer):
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
# Example usage for various scenarios
prompts = [
"After starting this new treatment, I felt",
"I was apprehensive about the side effects of",
"This medication has changed my life for the better",
"I've had a terrible experience with this medication",
"Since I began taking L-methylfolate, my experience has been"
]
for prompt in prompts:
print(f"Prompt: {prompt}")
print(generate_review(prompt, model, tokenizer))
print()
The model was fine-tuned on patient reviews related to depression, filtered from Drugs.com. This dataset is accessible from Zakia/drugscom_reviews on Hugging Face datasets (condition = 'Depression') for 'train'. Number of records in train dataset: 9069 rows.
The reviews were cleaned and preprocessed to remove quotes, HTML tags and decode HTML entities.
The model's performance was evaluated based on Training Loss.
The fine-tuning process yielded the following results:
| Epoch | Training Loss | Training Runtime | Training Samples | Training Samples per Second | Training Steps per Second |
|---|---|---|---|---|---|
| 5.0 | 0.5944 | 2:15:40.11 | 4308 | 2.646 | 1.323 |
The fine-tuning process achieved a final training loss of 0.5944 after 5 epochs, with the model processing approximately 2.646 samples per second and completing 1.323 training steps per second over a training runtime of 2 hours, 15 minutes, and 40 seconds.
GPT-2 model architecture was used, with the objective of generating coherent and contextually relevant text based on patient reviews.
The model was trained using a T4 GPU on Google Colab.
T4 GPU via Google Colab.
If you use this model, please cite the original GPT-2 paper:
BibTeX:
@article{radford2019language,
title={Language Models are Unsupervised Multitask Learners},
author={Radford, Alec and others},
year={2019}
}
APA:
Radford, A., et al. (2019). Language Models are Unsupervised Multitask Learners.
For further queries or issues with the model, please use the discussions section on this model's Hugging Face page.
For more information or inquiries regarding this model, please use the discussions section on this model's Hugging Face page.