Downloads · 30 days
12
7% of all-time downloads
SamanthaStorm/abusedetector
abusedetector is a text classification model from SamanthaStorm. 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.
⚠️ Content Warning: This model is designed to detect patterns of abuse in text conversations. It may be triggering for survivors of abuse.
Downloads · 30 days
12
7% of all-time downloads
All-time downloads
176
Public
Repo size
266 MB
Likes
0
Public
Click a slice to open those files.
.bin266 MB · 100%
From the Hugging Face model README
⚠️ Content Warning: This model is designed to detect patterns of abuse in text conversations. It may be triggering for survivors of abuse.
AbuseDetector v2.0 is a role-aware abuse pattern detection model that distinguishes between victim and abuser communication styles. This breakthrough version was trained on real conversation data with speaker role awareness, making it the first AI model to understand the difference between abuse tactics and healthy boundary-setting responses.
Key Innovation: Unlike previous models, this version understands that when someone says "This is abusive behavior," that's healthy boundary setting, not abuse detection.
The model detects 8 different categories with role awareness:
import torch
from transformers import AutoTokenizer, AutoModel
import torch.nn as nn
# Define the model architecture
class AbusePatternDetector(nn.Module):
def __init__(self, model_name, num_labels):
super().__init__()
self.bert = AutoModel.from_pretrained(model_name)
self.dropout = nn.Dropout(0.3)
self.classifier = nn.Linear(self.bert.config.hidden_size, num_labels)
def forward(self, input_ids, attention_mask):
outputs = self.bert(input_ids=input_ids, attention_mask=attention_mask)
pooled_output = outputs.last_hidden_state[:, 0]
pooled_output = self.dropout(pooled_output)
logits = self.classifier(pooled_output)
return logits
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("distilbert-base-uncased")
model = AbusePatternDetector("distilbert-base-uncased", 8)
# Load weights (download pytorch_model.bin from this repo)
# checkpoint = torch.load('pytorch_model.bin', weights_only=False)
# model.load_state_dict(checkpoint['model_state_dict'])
# Pattern categories (role-aware)
label_columns = [
'surveillance_accusation', 'darvo', 'gaslighting', 'boundary_violation',
'emotional_manipulation', 'victim_blaming', 'healthy_boundary_setting', 'no_abuse_pattern'
]
def detect_abuse_patterns(text, threshold=0.05):
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=512)
with torch.no_grad():
outputs = model(inputs['input_ids'], inputs['attention_mask'])
probabilities = torch.sigmoid(outputs).numpy()[0]
# Return patterns above threshold
detected_patterns = {}
for i, category in enumerate(label_columns):
prob = probabilities[i]
if prob > threshold:
detected_patterns[category] = prob
return detected_patterns
# Example usage - Role-aware detection
abuser_text = "I heard a voice when you were on the phone. You're making this up."
victim_text = "This is abusive behavior. I'm going to stop engaging now."
print("Abuser patterns:", detect_abuse_patterns(abuser_text))
# Expected: surveillance_accusation, gaslighting
print("Victim patterns:", detect_abuse_patterns(victim_text))
# Expected: healthy_boundary_setting
This model was trained with role awareness:
This revolutionary approach allows the model to understand that:
This model represents a breakthrough in understanding that:
If you or someone you know is experiencing abuse:
@misc{abusedetector2024v2,
author = {SamanthaStorm},
title = {AbuseDetector v2.0: Role-Aware Multi-Label Abuse Pattern Detection},
year = {2024},
publisher = {Hugging Face},
url = {https://huggingface.co/SamanthaStorm/abusedetector},
note = {First role-aware abuse detection model trained on real conversation data}
}
This model is released under the MIT License with additional ethical use guidelines.
⚠️ Remember: This model is designed for education and awareness. The role-aware training represents a breakthrough in understanding the difference between abuse tactics and healthy boundary setting. Always prioritize safety and seek professional support when dealing with abuse situations.
🎯 Innovation: World's first AI model that understands the difference between someone saying "This is abusive" (healthy boundary) vs "You're being oppressive" (DARVO tactic).