Instructions to use Kiran2004/GPT2_MentalHealth_ChatBot with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Kiran2004/GPT2_MentalHealth_ChatBot with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Kiran2004/GPT2_MentalHealth_ChatBot") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Kiran2004/GPT2_MentalHealth_ChatBot") model = AutoModelForCausalLM.from_pretrained("Kiran2004/GPT2_MentalHealth_ChatBot", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Kiran2004/GPT2_MentalHealth_ChatBot with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Kiran2004/GPT2_MentalHealth_ChatBot" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kiran2004/GPT2_MentalHealth_ChatBot", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Kiran2004/GPT2_MentalHealth_ChatBot
- SGLang
How to use Kiran2004/GPT2_MentalHealth_ChatBot with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Kiran2004/GPT2_MentalHealth_ChatBot" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kiran2004/GPT2_MentalHealth_ChatBot", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Kiran2004/GPT2_MentalHealth_ChatBot" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kiran2004/GPT2_MentalHealth_ChatBot", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Kiran2004/GPT2_MentalHealth_ChatBot with Docker Model Runner:
docker model run hf.co/Kiran2004/GPT2_MentalHealth_ChatBot
Model description
This model is a fine-tuned version of openai-community/gpt2 on an MentalHealthConversational dataset. It is designed to generate text based on provided depression related prompts and can be used for a variety of natural language generation tasks. It's been trained on question-answer pairs, including unanswerable questions, for the task of Depression related Conversations for 10 Epochs and obtained following loss:
- Training Loss: 1.6727
Model Training
- Training Dataset: MentalHealthConversational Dataset
- Pretrained Model: GPT-2
Evaluation
The model's performance can be evaluated using various metrics such as F1 score, BLEU score, and ROUGE score.
- F1 Score: 0.0908
- BLEU Score: 2.910400064753437e-05
- ROUGE Score: 0.1498
Example Usage
from transformers import pipeline, GPT2Tokenizer, GPT2LMHeadModel
# Load tokenizer and model
model_name = "Kiran2004/GPT2_MentalHealth_ChatBot"
tokenizer = GPT2Tokenizer.from_pretrained(model_name)
model = GPT2LMHeadModel.from_pretrained(model_name)
# Generate text
generator = pipeline("text-generation", model=model, tokenizer=tokenizer)
prompt = "Your prompt goes here"
output = generator(prompt, max_length=50, num_return_sequences=1)
print(output[0]["generated_text"])
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 0.0001
- train_batch_size: 3
- eval_batch_size: 8
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- num_epochs: 10
Framework versions
- Transformers 4.38.2
- Pytorch 2.2.1+cu121
- Tokenizers 0.15.2
- Downloads last month
- 19
Model tree for Kiran2004/GPT2_MentalHealth_ChatBot
Base model
openai-community/gpt2