nanelimon/insult-dataset
Viewer • Updated • 15.2k • 16.3k
How to use nanelimon/bert-base-turkish-offensive with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="nanelimon/bert-base-turkish-offensive") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("nanelimon/bert-base-turkish-offensive")
model = AutoModelForSequenceClassification.from_pretrained("nanelimon/bert-base-turkish-offensive")This model is designed for text classification, specifically for identifying offensive content in Turkish text. The model classifies text into five categories: INSULT, OTHER, PROFANITY, RACIST, and SEXIST.
| INSULT | OTHER | PROFANITY | RACIST | SEXIST | |
|---|---|---|---|---|---|
| Precision | 0.901 | 0.924 | 0.978 | 1.000 | 0.980 |
| Recall | 0.920 | 0.980 | 0.900 | 0.980 | 1.000 |
| F1 Score | 0.910 | 0.9514 | 0.937 | 0.989 | 0.990 |
pip install torch torchvision torchaudio
pip install tf-keras
pip install transformers
pip install tensorflow
from transformers import AutoTokenizer, TFAutoModelForSequenceClassification, TextClassificationPipeline
# Load the tokenizer and model
model_name = "nanelimon/bert-base-turkish-offensive"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
# Create the pipeline
pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer, return_all_scores=True, top_k=2)
# Test the pipeline
print(pipe('Bu bir denemedir hadi sende dene!'))
Result;
[[{'label': 'OTHER', 'score': 1.000}, {'label': 'INSULT', 'score': 0.000}]]
gpl-3.0
Free Software, Hell Yeah!