winvoker/turkish-sentiment-analysis-dataset
Viewer • Updated • 490k • 1.05k • 47
# Turkish Sentiment Modern BERT
This model is a fine-tuned ModernBERT for Turkish Sentiment Analysis. It was trained on the winvoker/turkish-sentiment-analysis-dataset and is designed to classify Turkish text into sentiment categories, such as Positive, Negative, and Neutral.
The model was trained for 2 epochs with the following results:
| Epoch | Training Loss | Validation Loss | Accuracy | F1 Score |
|---|---|---|---|---|
| 1 | 0.2182 | 0.1920 | 92.16% | 84.57% |
| 2 | 0.1839 | 0.1826 | 92.58% | 86.05% |
Here’s an example of how to use the model for sentiment analysis of Turkish text:
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
# Load the pre-trained model and tokenizer
model_name = "bayrameker/turkish-sentiment-modern-bert"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Example texts for prediction
texts = ["bu ürün çok iyi", "bu ürün berbat"]
# Tokenize the inputs
inputs = tokenizer(texts, padding=True, truncation=True, return_tensors="pt")
# Make predictions
with torch.no_grad():
logits = model(**inputs).logits
# Get the predicted sentiment labels
predictions = torch.argmax(logits, dim=-1)
labels = ["Negative", "Neutral", "Positive"] # Adjust based on your label mapping
for text, pred in zip(texts, predictions):
print(f"Text: {text} -> Sentiment: {labels[pred.item()]}")
Text: bu ürün çok iyi -> Sentiment: Positive
Text: bu ürün berbat -> Sentiment: Negative
To use this model, first install the required dependencies:
pip install transformers
pip install torch
pip install datasets
This model is licensed under the MIT License. See the LICENSE file for more details.
Base model
answerdotai/ModernBERT-base