Downloads · 30 days
19
1% of all-time downloads
RyanDDD/empathy-mental-health-reddit-IP
empathy-mental-health-reddit-IP is a text classification model from RyanDDD. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
This model detects Interpretations - interpreting the seeker's situation or feelings in conversational responses, specifically designed for mental health support contexts.
Downloads · 30 days
19
1% of all-time downloads
All-time downloads
2K
Public
Parameters
252M
2 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1 GB · 100%
From the Hugging Face model README
This model detects Interpretations - interpreting the seeker's situation or feelings in conversational responses, specifically designed for mental health support contexts.
This is a BiEncoder model based on RoBERTa that classifies empathy levels in mental health support conversations. It uses a dual-encoder architecture with cross-attention:
Empathy Level Classification (3 classes):
Rationale Identification: Binary classification for each token indicating whether it contributes to empathy expression
This model is designed for:
Trained on Reddit mental health support conversations from subreddits focused on emotional support and mental health discussions.
pip install transformers torch
from transformers import AutoModel, AutoTokenizer, AutoConfig
import torch
# Load model and tokenizer
model_name = "RyanDDD/empathy-mental-health-reddit-IP"
tokenizer = AutoTokenizer.from_pretrained(model_name)
config = AutoConfig.from_pretrained(model_name, trust_remote_code=True)
model = AutoModel.from_pretrained(model_name, trust_remote_code=True)
# Example conversation
seeker_post = "I've been feeling really down lately and don't know what to do."
response_post = "I'm sorry you're going through this. It's completely normal to feel this way sometimes. Have you considered talking to someone about how you're feeling?"
# Tokenize
encoded_sp = tokenizer(
seeker_post,
max_length=64,
padding='max_length',
truncation=True,
return_tensors='pt'
)
encoded_rp = tokenizer(
response_post,
max_length=64,
padding='max_length',
truncation=True,
return_tensors='pt'
)
# Predict
model.eval()
with torch.no_grad():
outputs = model(
input_ids_SP=encoded_sp['input_ids'],
input_ids_RP=encoded_rp['input_ids'],
attention_mask_SP=encoded_sp['attention_mask'],
attention_mask_RP=encoded_rp['attention_mask']
)
logits_empathy = outputs[0]
logits_rationale = outputs[1]
# Get predictions
empathy_level = torch.argmax(logits_empathy, dim=1).item()
empathy_labels = ['Low', 'Medium', 'High']
print(f"Empathy Level (IP): {empathy_labels[empathy_level]}")
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = model.to(device)
prediction, rationale = model.predict(
seeker_post=seeker_post,
response_post=response_post,
tokenizer=tokenizer,
device=device
)
print(f"Empathy Level: {['Low', 'Medium', 'High'][prediction]}")
print(f"Rationale tokens: {rationale}")
Input: Seeker Post + Response Post
↓
[Seeker Encoder (RoBERTa)] ← frozen during training
↓
[Responder Encoder (RoBERTa)] ← fine-tuned
↓
[Cross-Attention Layer] ← attends to seeker context
↓
[Classification Head] → Empathy Level (3 classes)
↓
[Token Classifier] → Rationale (binary per token)
The model achieves strong performance on held-out test data:
⚠️ Important Limitations:
If you use this model in your research, please cite:
@misc{empathy-mental-health-ip,
author = {Your Name},
title = {Empathy Classification Model for Mental Health Support - IP},
year = {2024},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/RyanDDD/empathy-mental-health-reddit-IP}}
}
Created by the Empathy-Mental-Health project team.
For questions, issues, or collaboration opportunities:
This is part of a three-model suite for comprehensive empathy analysis:
Use all three models together for comprehensive empathy assessment!
MIT License - See LICENSE file for details.