nanelimon/turkish-social-media-offensive-dataset
Viewer • Updated • 3.39k • 41
How to use nanelimon/bert-base-turkish-bullying with Transformers:
# Use a pipeline as a high-level helper
# Warning: Pipeline type "translation" is no longer supported in transformers v5.
# You must load the model directly (see below) or downgrade to v4.x with:
# 'pip install "transformers<5.0.0'
from transformers import pipeline
pipe = pipeline("translation", model="nanelimon/bert-base-turkish-bullying") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("nanelimon/bert-base-turkish-bullying")
model = AutoModelForSequenceClassification.from_pretrained("nanelimon/bert-base-turkish-bullying")It is a Turkish bert-based model created to determine the types of bullying that people use against each other in social media. Included classes;
3388 tweets were used in the training of the model. Accordingly, the success rates in education are as follows;
| Cinsiyetçilik | Irkçılık | Kızdırma | Nötr | |
|---|---|---|---|---|
| Precision | 0.925 | 0.878 | 0.824 | 0.915 |
| Recall | 0.831 | 0.896 | 0.843 | 0.935 |
| F1 Score | 0.875 | 0.887 | 0.833 | 0.925 |
| Accuracy : 0.886 |
pip install torch torchvision torchaudio
pip install tf-keras
pip install transformers
pip install tensorflow
from transformers import AutoTokenizer, TextClassificationPipeline, TFBertForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("nanelimon/bert-base-turkish-bullying")
model = TFBertForSequenceClassification.from_pretrained("nanelimon/bert-base-turkish-bullying", from_pt=True)
pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer, return_all_scores=True, top_k=2)
print(pipe('Bu bir denemedir hadi sende dene!'))
Result;
[[{'label': 'Nötr', 'score': 0.999175488948822}, {'label': 'Cinsiyetçi Zorbalık', 'score': 0.00042115405085496604}]]
gpl-3.0
Free Software, Hell Yeah!