Update README.md
Browse files
README.md
CHANGED
|
@@ -3,12 +3,83 @@ license: mit
|
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
base_model:
|
| 6 |
-
- google/gemma-
|
| 7 |
tags:
|
| 8 |
- empathy
|
| 9 |
- emotion
|
| 10 |
-
-
|
| 11 |
- feeling
|
| 12 |
-
-
|
| 13 |
pipeline_tag: text-generation
|
| 14 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
base_model:
|
| 6 |
+
- google/gemma-1.3b-it
|
| 7 |
tags:
|
| 8 |
- empathy
|
| 9 |
- emotion
|
| 10 |
+
- chatbot
|
| 11 |
- feeling
|
| 12 |
+
- friendly-ai
|
| 13 |
pipeline_tag: text-generation
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# 🧸 Empathy Chatbot — Fine-tuned GEMMA for Emotional Conversations
|
| 17 |
+
|
| 18 |
+
**Model ID:** [`sajeewa/empathy-chat-gemma`](https://huggingface.co/sajeewa/empathy-chat-gemma)
|
| 19 |
+
This is a fine-tuned version of `google/gemma-1.3b-it` designed to respond with **care, warmth, and empathy** in emotional conversations. It's trained on the [EmpatheticDialogues](https://huggingface.co/datasets/empathetic_dialogues) dataset to make it emotionally aware and conversationally comforting — like a caring friend who calls you “baby” or “cutey” and sprinkles in sweet emojis 🧸💖.
|
| 20 |
+
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
## 🧠 Model Details
|
| 24 |
+
|
| 25 |
+
- **Base model**: `google/gemma-1.3b-it`
|
| 26 |
+
- **Fine-tuned with**: [Unsloth](https://github.com/unslothai/unsloth) + 🤗 TRL
|
| 27 |
+
- **Dataset**: [EmpatheticDialogues](https://huggingface.co/datasets/empathetic_dialogues)
|
| 28 |
+
- **Training location**: Kaggle (2×T4 GPUs)
|
| 29 |
+
- **Intended use**: Friendly, emotionally supportive chatbots
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
## 💬 Chat Template & Interface
|
| 34 |
+
|
| 35 |
+
This model uses Hugging Face’s chat template format. The chatbot behaves like a **sweet and caring friend** who responds with **emotionally intelligent and supportive language**, using **cute nicknames** and **emojis**. Here's how you can interact with it:
|
| 36 |
+
|
| 37 |
+
```python
|
| 38 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, TextStreamer
|
| 39 |
+
import torch
|
| 40 |
+
|
| 41 |
+
model_id = "sajeewa/empathy-chat-gemma"
|
| 42 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 43 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 44 |
+
model_id,
|
| 45 |
+
torch_dtype=torch.float16,
|
| 46 |
+
device_map="auto"
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
chat_history = [
|
| 50 |
+
{
|
| 51 |
+
"role": "system",
|
| 52 |
+
"content": (
|
| 53 |
+
"You are an empathetic AI and your friend. Always give lovely caring messages. "
|
| 54 |
+
"Understand the user's feelings. Then provide a caring response. "
|
| 55 |
+
"Please give responses as a good friend, using lovely words like 'baby', 'my cutey', etc. 💖 "
|
| 56 |
+
"Use emojis to be calming 😊. Continue conversations with a warm tone."
|
| 57 |
+
)
|
| 58 |
+
}
|
| 59 |
+
]
|
| 60 |
+
|
| 61 |
+
user_input = "I'm feeling lonely today."
|
| 62 |
+
chat_history.append({"role": "user", "content": user_input})
|
| 63 |
+
|
| 64 |
+
prompt = tokenizer.apply_chat_template(
|
| 65 |
+
chat_history,
|
| 66 |
+
tokenize=False,
|
| 67 |
+
add_generation_prompt=True,
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 71 |
+
|
| 72 |
+
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
| 73 |
+
|
| 74 |
+
output = model.generate(
|
| 75 |
+
**inputs,
|
| 76 |
+
max_new_tokens=128,
|
| 77 |
+
temperature=0.7,
|
| 78 |
+
top_p=0.95,
|
| 79 |
+
top_k=50,
|
| 80 |
+
do_sample=True,
|
| 81 |
+
streamer=streamer
|
| 82 |
+
)
|
| 83 |
+
|
| 84 |
+
response = tokenizer.decode(output[0], skip_special_tokens=True)
|
| 85 |
+
print(response)
|