File size: 2,065 Bytes
f240ebc
 
 
bb4f28a
f240ebc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: apache-2.0
datasets:
- EmoRAG/EmoRAG_detect
metrics:
- accuracy
base_model:
- google-bert/bert-base-uncased
pipeline_tag: text-classification
---
# Malicious Text Detection Model for EmoRAG
## Model Description
This model is designed to detect malicious texts, particularly those containing emoticons, using a BERT-based architecture.
## Intended Use
- **Primary Use**: Detection of malicious texts containing emoticons.
- **Applications**: 
  - Content moderation for online platforms.
  - Adversarial text filtering in natural language processing pipelines.
  - Research on malicious text detection and adversarial attacks.

Each data point contains up to eight emoticons, and the dataset was carefully curated to ensure diversity and balance.
## How to Use the Model
You can load and use the trained BERT-based model for malicious text detection with the following code:
```python
from transformers import BertTokenizer, BertForSequenceClassification
import torch

# Load the trained model and tokenizer
model = BertForSequenceClassification.from_pretrained('path_to_your_model')
tokenizer = BertTokenizer.from_pretrained('path_to_your_model')

# Example text (malicious with emoticons)
text = "However, there (●′ω`●) is any huge evidence ⊙︿⊙ that one single drug shot may induce a permanent ƪ(•̃͡ε•̃͡)∫ʃ psychotic disorder. +ˍ+ The other hand is in regards of the the use of dopaminergic agonists in Parkinson desease, what did (ΘoΘ) not ╰(*´︶`*)╯ show in that patients a ゚ヽ(●´ω`●)ノ。 psychotic disorder but induce a hard psychotic effect in a normal subject mainly mixed 桃カラ≪( \(・ω・)/ )≫オハヨゥ☆ with alcholl.", 

# Tokenize the input text
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)

# Make a prediction
with torch.no_grad():
    outputs = model(**inputs)
    logits = outputs.logits
    prediction = torch.argmax(logits, dim=-1)

# Print the prediction
print(f"Prediction: {'Malicious' if prediction.item() == 1 else 'Clean'}")