prithivMLmods commited on
Commit
3b8fa86
·
verified ·
1 Parent(s): b1afbe1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +121 -1
README.md CHANGED
@@ -12,5 +12,125 @@ tags:
12
  - phi3
13
  - llama
14
  ---
15
-
16
  ![4.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/kfT6j0uZRKZiUxRT7F--f.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  - phi3
13
  - llama
14
  ---
 
15
  ![4.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/kfT6j0uZRKZiUxRT7F--f.png)
16
+
17
+ # **Phi-4 Empathetic [ Responsible Reasoning & Emotional Thought Generation ]**
18
+
19
+ `[Phi-4 Empathetic finetuned]` from Microsoft's Phi-4 is an advanced open model built upon a blend of high-quality synthetic datasets, data from filtered public domain websites, and carefully selected academic resources. It excels at **responsible human-like reasoning**, **empathetic dialogue**, and **emotional thought generation**. The model is designed to engage in nuanced, thoughtful conversations, with outputs that can include **special characters** and **emojis** for expressive communication. 🌟
20
+
21
+ Phi-4 Empathetic employs a sophisticated safety post-training approach, leveraging both open-source and proprietary datasets. Safety alignment is achieved using a combination of **SFT (Supervised Fine-Tuning)** and **DPO (Direct Preference Optimization)**, targeting responsible interaction and emotional awareness in diverse contexts.
22
+
23
+ ---
24
+
25
+ # **Dataset Info**
26
+
27
+ Phi-4 Empathetic is fine-tuned on a carefully curated dataset tailored for empathetic and responsible reasoning tasks. The dataset incorporates the **Chain of Thought (CoT)** methodology, emphasizing logical reasoning, emotional nuance, and step-by-step thought processes. Additionally, it includes data optimized for generating responses that resonate with human emotions, making it ideal for:
28
+
29
+ - **Emotional Support Applications** 🤗
30
+ - **Responsible Conversations** 💬
31
+ - **Thoughtful Problem-Solving** 🧠
32
+
33
+ ---
34
+
35
+ # **Run with Transformers**
36
+
37
+ ```python
38
+ # pip install accelerate
39
+ from transformers import AutoTokenizer, AutoModelForCausalLM
40
+ import torch
41
+
42
+ tokenizer = AutoTokenizer.from_pretrained("prithivMLmods/Phi-4-Empathetic")
43
+ model = AutoModelForCausalLM.from_pretrained(
44
+ "prithivMLmods/Phi-4-Empathetic",
45
+ device_map="auto",
46
+ torch_dtype=torch.bfloat16,
47
+ )
48
+
49
+ input_text = "Can you share some words of encouragement for someone feeling down?"
50
+ input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
51
+
52
+ outputs = model.generate(**input_ids, max_new_tokens=32)
53
+ print(tokenizer.decode(outputs[0]))
54
+ ```
55
+
56
+ You can ensure correct formatting for empathetic dialogue by using `tokenizer.apply_chat_template` as follows:
57
+
58
+ ```python
59
+ messages = [
60
+ {"role": "user", "content": "Can you share some words of encouragement for someone feeling down?"},
61
+ ]
62
+ input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True).to("cuda")
63
+
64
+ outputs = model.generate(**input_ids, max_new_tokens=256)
65
+ print(tokenizer.decode(outputs[0]))
66
+ ```
67
+
68
+ ---
69
+
70
+ # **Intended Use**
71
+
72
+ The Phi-4 Empathetic model is optimized for applications that require thoughtful and emotionally aware interactions. Below are some suggested use cases:
73
+
74
+ 1. **Emotional Support & Counseling** 💖
75
+ - Providing thoughtful responses to users seeking emotional encouragement or advice.
76
+ - Generating empathetic messages for mental health and well-being applications.
77
+
78
+ 2. **Responsible Dialogue Generation** 🗣️
79
+ - Engaging in nuanced conversations with a focus on fairness, safety, and ethical considerations.
80
+ - Ensuring that interactions remain respectful and aligned with safety guidelines.
81
+
82
+ 3. **Creative Writing Assistance** ✍️
83
+ - Helping users craft emotionally engaging content, including stories, poems, and personal messages.
84
+ - Assisting in generating content enriched with special characters and emojis for expressive communication.
85
+
86
+ 4. **Educational Tools** 🎓
87
+ - Offering step-by-step explanations with an empathetic tone for better understanding.
88
+ - Generating thoughtful Q&A responses for various subjects.
89
+
90
+ 5. **Customer Support** 🤝
91
+ - Automating empathetic responses to customer queries.
92
+ - Handling emotionally sensitive customer service interactions with care.
93
+
94
+ 6. **Social Media Engagement** 📱
95
+ - Generating creative, engaging, and emotionally resonant posts for social media platforms.
96
+ - Providing personalized message suggestions enriched with emojis and special characters.
97
+
98
+ ---
99
+
100
+ # **Limitations**
101
+
102
+ While Phi-4 Empathetic is highly capable, it has certain limitations users should be aware of:
103
+
104
+ 1. **Bias and Fairness**:
105
+ Despite extensive safety alignment, biases may still emerge in the model’s responses. Users should exercise discretion, particularly in sensitive contexts.
106
+
107
+ 2. **Emotional Nuance**:
108
+ The model may occasionally misinterpret the emotional tone of a prompt, leading to less relevant or inappropriate responses.
109
+
110
+ 3. **Real-Time Knowledge**:
111
+ The model's knowledge is based on the data it was trained on and does not include real-time or post-training updates. It may not reflect recent events or changes in knowledge.
112
+
113
+ 4. **Safety and Harmlessness**:
114
+ Although the model is aligned with safety standards, there may still be cases where outputs require human oversight to ensure appropriateness.
115
+
116
+ 5. **Resource Requirements**:
117
+ Running the model efficiently may require significant computational resources, especially in large-scale or real-time applications.
118
+
119
+ 6. **Ethical Considerations**:
120
+ The model must be used responsibly, avoiding any malicious applications such as generating harmful content or spreading misinformation.
121
+
122
+ 7. **Domain-Specific Limitations**:
123
+ While it performs well in general-purpose tasks, it may need further fine-tuning for highly specialized domains, such as legal, medical, or financial applications.
124
+
125
+ ---
126
+
127
+ # **Special Features**
128
+
129
+ 1. **Emojis & Special Characters** 🎉💡
130
+ The model can generate responses with emojis and special characters for expressive communication, making it ideal for social media and personal messaging applications.
131
+
132
+ 2. **Human-Like Reasoning** 🧠
133
+ Fine-tuned for **responsible reasoning** and **empathetic dialogue**, it excels at generating thoughtful and human-like responses.
134
+
135
+ 3. **Advanced Safety Alignment** 🔒
136
+ The model employs **iterative SFT** and **DPO** techniques to ensure that its outputs are helpful, harmless, and aligned with ethical standards.