File size: 1,077 Bytes
0959610
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: cc0-1.0
datasets:
- kairaamilanii/cyberbullying-indonesia
language:
- id
metrics:
- accuracy
- confusion_matrix
base_model:
- indolem/indobertweet-base-uncased
pipeline_tag: text-classification
---

This model is based on a BERT model trained with a few bullying detection datasets. It is trained exclusively in the Indonesian language.

```python
from transformers import BertTokenizer, AutoModelForSequenceClassification

model_path = 'kairaamilanii/IndoBERT-Bullying-Classifier'
tokenizer = BertTokenizer.from_pretrained(model_path)
model = AutoModelForSequenceClassification.from_pretrained(model_path)

text = "KOK JELEK BANGET SIH" # Example text for prediction

inputs = tokenizer(text, return_tensors="pt")
with torch.no_grad():
    outputs = model(**inputs)
    predicted_class = torch.argmax(outputs.logits, dim=-1).item()
print(f"Predicted class: {predicted_class}")

if predicted_class == 1:
    print("Prediction: Bullying")
else:
    print("Prediction: Non-bullying")
```
example output:
```python
[{'Predicted class': 1, 'Prediction': Bullying}]
```