bayrameker commited on
Commit
c569ed0
·
verified ·
1 Parent(s): fa9789a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +107 -1
README.md CHANGED
@@ -8,4 +8,110 @@ metrics:
8
  - accuracy
9
  base_model:
10
  - answerdotai/ModernBERT-base
11
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  - accuracy
9
  base_model:
10
  - answerdotai/ModernBERT-base
11
+ ---
12
+
13
+ ```markdown
14
+ # Turkish Sentiment Modern BERT
15
+ ```
16
+ This model is a fine-tuned **ModernBERT** for **Turkish Sentiment Analysis**. It was trained on the [winvoker/turkish-sentiment-analysis-dataset](https://huggingface.co/datasets/winvoker/turkish-sentiment-analysis-dataset) and is designed to classify Turkish text into sentiment categories, such as **Positive**, **Negative**, and **Neutral**.
17
+
18
+ ## Model Overview
19
+
20
+ - **Model Type**: ModernBERT (BERT variant)
21
+ - **Task**: Sentiment Analysis
22
+ - **Languages**: Turkish
23
+ - **Dataset**: [winvoker/turkish-sentiment-analysis-dataset](https://huggingface.co/datasets/winvoker/turkish-sentiment-analysis-dataset)
24
+ - **Labels**: Positive, Negative, Neutral
25
+ - **Fine-Tuning**: Fine-tuned for sentiment classification.
26
+
27
+ ## Performance Metrics
28
+
29
+ The model was trained for **2 epochs** with the following results:
30
+
31
+ | Epoch | Training Loss | Validation Loss | Accuracy | F1 Score |
32
+ |-------|---------------|-----------------|-----------|-----------|
33
+ | 1 | 0.2182 | 0.1920 | 92.16% | 84.57% |
34
+ | 2 | 0.1839 | 0.1826 | 92.58% | 86.05% |
35
+
36
+ - **Training Loss**: Measures the model's fit to the training data.
37
+ - **Validation Loss**: Measures the model's generalization to unseen data.
38
+ - **Accuracy**: The percentage of correct predictions over all examples.
39
+ - **F1 Score**: A balanced metric between precision and recall.
40
+
41
+ ## Model Inference Example
42
+
43
+ Here’s an example of how to use the model for sentiment analysis of Turkish text:
44
+
45
+ ```python
46
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
47
+ import torch
48
+
49
+ # Load the pre-trained model and tokenizer
50
+ model_name = "your_huggingface_username/turkish-sentiment-modern-bert"
51
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
52
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
53
+
54
+ # Example texts for prediction
55
+ texts = ["bu ürün çok iyi", "bu ürün berbat"]
56
+
57
+ # Tokenize the inputs
58
+ inputs = tokenizer(texts, padding=True, truncation=True, return_tensors="pt")
59
+
60
+ # Make predictions
61
+ with torch.no_grad():
62
+ logits = model(**inputs).logits
63
+
64
+ # Get the predicted sentiment labels
65
+ predictions = torch.argmax(logits, dim=-1)
66
+ labels = ["Negative", "Neutral", "Positive"] # Adjust based on your label mapping
67
+ for text, pred in zip(texts, predictions):
68
+ print(f"Text: {text} -> Sentiment: {labels[pred.item()]}")
69
+ ```
70
+
71
+ ### Example Output:
72
+
73
+ ```
74
+ Text: bu ürün çok iyi -> Sentiment: Positive
75
+ Text: bu ürün berbat -> Sentiment: Negative
76
+ ```
77
+
78
+ ## Installation
79
+
80
+ To use this model, first install the required dependencies:
81
+
82
+ ```bash
83
+ pip install transformers
84
+ pip install torch
85
+ pip install datasets
86
+ ```
87
+
88
+ ## Model Card
89
+
90
+ - **Model Name**: turkish-sentiment-modern-bert
91
+ - **Hugging Face Repo**: [Link to Model Repository](https://huggingface.co/your_huggingface_username/turkish-sentiment-modern-bert)
92
+ - **License**: MIT (or another applicable license)
93
+ - **Author**: Bayram Eker
94
+ - **Date**: 2024-12-21
95
+
96
+ ## Training Details
97
+
98
+ - **Model**: ModernBERT (Base variant)
99
+ - **Framework**: PyTorch
100
+ - **Training Time**: 34 minutes (2 epochs)
101
+ - **Batch Size**: 32
102
+ - **Learning Rate**: 8e-5
103
+ - **Optimizer**: AdamW
104
+
105
+ ## Acknowledgments
106
+
107
+ - The model was trained on the [winvoker/turkish-sentiment-analysis-dataset](https://huggingface.co/datasets/winvoker/turkish-sentiment-analysis-dataset).
108
+ - Special thanks to the Hugging Face community and all contributors to the transformers library.
109
+
110
+ ## Future Work
111
+
112
+ - Expand the model with more complex sentiment labels (e.g., multi-class sentiment, aspect-based sentiment analysis).
113
+ - Fine-tune the model on a larger, more diverse dataset for better generalization across various domains.
114
+
115
+ ## License
116
+
117
+ This model is licensed under the MIT License. See the LICENSE file for more details.