File size: 2,546 Bytes
cb86f9f
 
 
 
 
76c98f7
cb86f9f
76c98f7
cb86f9f
76c98f7
cb86f9f
 
 
 
 
76c98f7
 
 
 
 
 
 
cb86f9f
76c98f7
cb86f9f
76c98f7
cb86f9f
76c98f7
cb86f9f
76c98f7
cb86f9f
76c98f7
cb86f9f
 
 
 
 
76c98f7
 
 
cb86f9f
76c98f7
cb86f9f
76c98f7
 
cb86f9f
 
 
76c98f7
 
 
cb86f9f
76c98f7
cb86f9f
 
 
76c98f7
 
 
cb86f9f
 
 
76c98f7
 
cb86f9f
76c98f7
cb86f9f
 
 
76c98f7
 
cb86f9f
76c98f7
 
 
 
 
 
cb86f9f
76c98f7
 
cb86f9f
76c98f7
 
cb86f9f
76c98f7
 
cb86f9f
76c98f7
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
base_model: microsoft/phi-2
library_name: peft
---

# Model Card for EmotiTrack Emotion & Sarcasm Classifier (`phi2_emotrack_finetuned`)

A fine-tuned `phi-2` language model for classifying emotional tone and detecting sarcasm in text messages. This model is part of the **EmotiTrack** project, designed for use in emotional journaling, mental health tech, and empathetic AI assistants.

---

## Model Details

### Model Description

- **Developed by:** Dennis Muturia for the EmotiTrack project  
- **Funded by:** Self-funded  
- **Shared by:** Dennis Muturia  
- **Model type:** Causal Language Model  
- **Language(s):** English  
- **License:** Apache 2.0 (inherits from `microsoft/phi-2`)  
- **Finetuned from model:** `microsoft/phi-2` using PEFT (LoRA)

This model is fine-tuned to detect **emotions** (based on GoEmotions) and **sarcasm** (modeled after `deepset/sarcasm-xlm-roberta-base`) in short-form user text.

---

## Model Sources

- **Repository:** [https://huggingface.co/dmuturia/phi2_emotrack_finetuned](https://huggingface.co/dmuturia/phi2_emotrack_finetuned)

---

## Uses

### Direct Use

- Emotion & sarcasm classification for conversational agents
- Tagging emotional states in journaling or logging apps
- Enriching sentiment understanding in chatbots and voice assistants

### Downstream Use

- Integrated into the EmotiTrack backend to drive real-time insight
- Supports longitudinal tracking of emotional states

### Out-of-Scope Use

- Not suitable for diagnosis or clinical use
- Not designed for multilingual inputs
- Not ideal for long or formal documents

---

## Bias, Risks, and Limitations

- May reflect bias from emotion/sarcasm datasets scraped from internet text
- Limited context window makes deep sarcasm or subtext detection unreliable
- Emotion misclassification may occur on neutral or ambiguous expressions

### Recommendations

- Use in user-facing applications should include disclaimers
- Avoid using outputs for automated decision-making in sensitive domains

---

## How to Get Started with the Model

```python
from transformers import pipeline

pipe = pipeline(
    "text-generation",
    model="dmuturia/phi2_emotrack_finetuned",
    tokenizer="dmuturia/phi2_emotrack_finetuned",
    device=0  # Use -1 for CPU
)

prompt = """### Instruction:
Classify the emotional tone and detect sarcasm in the following message.

### Input:
"I just love it when everything breaks right before a deadline."

### Response:
"""

output = pipe(prompt, max_new_tokens=60)[0]["generated_text"]
print(output)