mliooh commited on
Commit
b1eae89
·
1 Parent(s): 5a2205a

update space

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -2,11 +2,14 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
2
 
3
  #pipe = pipeline("text-generation", model="distilbert/distilgpt2")
4
 
 
5
  # Load model directly
6
 
7
  tokenizer = AutoTokenizer.from_pretrained("distilbert/distilgpt2")
8
  model = AutoModelForCausalLM.from_pretrained("distilbert/distilgpt2")
9
 
 
 
10
  # set custom system message tailored to mental health context
11
 
12
  system_message = "You are a compassionate and empathetic mental health chatbot. Your goal is to listen carefully, provide comforting support, and offer helpful guidance to users who are feeling down, anxious, or stressed. Always respond with kindness and understanding, making the user feel safe and heard."
 
2
 
3
  #pipe = pipeline("text-generation", model="distilbert/distilgpt2")
4
 
5
+
6
  # Load model directly
7
 
8
  tokenizer = AutoTokenizer.from_pretrained("distilbert/distilgpt2")
9
  model = AutoModelForCausalLM.from_pretrained("distilbert/distilgpt2")
10
 
11
+ # Set the pad_token to eos_token (since distilgpt2 does not have a pad_token by default)
12
+ tokenizer.pad_token = tokenizer.eos_token
13
  # set custom system message tailored to mental health context
14
 
15
  system_message = "You are a compassionate and empathetic mental health chatbot. Your goal is to listen carefully, provide comforting support, and offer helpful guidance to users who are feeling down, anxious, or stressed. Always respond with kindness and understanding, making the user feel safe and heard."