File size: 2,675 Bytes
144668a
 
6f65091
 
 
 
 
 
 
 
144668a
6f65091
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---

license: apache-2.0
language:
- tr
metrics:
- accuracy
- f1
base_model:
- dbmdz/bert-base-turkish-cased
pipeline_tag: text-classification
---

# byunal/bert-base-turkish-cased-stance

![Model card](https://huggingface.co./front/assets/huggingface_logo.svg)

This repository contains a fine-tuned BERT model for stance detection in Turkish. The base model for this fine-tuning is [dbmdz/bert-base-turkish-cased](https://huggingface.co./dbmdz/bert-base-turkish-cased). The model has been specifically trained on a uniquely collected Turkish stance detection dataset.

## Model Description

- **Model Name**: byunal/bert-base-turkish-cased-stance
- **Base Model**: [dbmdz/bert-base-turkish-cased](https://huggingface.co./dbmdz/bert-base-turkish-cased)
- **Task**: Stance Detection
- **Language**: Turkish

The model predicts the stance of a given text towards a specific target. Possible stance labels include:

- **Favor**: The text supports the target
- **Against**: The text opposes the target
- **Neutral**: The text does not express a clear stance on the target

## Installation

To install the necessary libraries and load the model, run:

```bash
pip install transformers
```

## Usage
Here’s a simple example of how to use the model for stance detection in Turkish:

```bash
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch

# Load the model and tokenizer
model_name = "byunal/bert-base-turkish-cased-stance"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)

# Example text
text = "Bu konu hakkında kesinlikle karşıyım."

# Tokenize input
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)

# Perform prediction
with torch.no_grad():
    outputs = model(**inputs)

# Get predicted stance
predictions = torch.argmax(outputs.logits, dim=-1)
stance_label = predictions.item()

# Display result
labels = ["Favor", "Against", "Neutral"]
print(f"The stance is: {labels[stance_label]}")
```

## Training
This model was fine-tuned using a specialized Turkish stance detection dataset that uniquely reflects various text contexts and opinions. The dataset includes diverse examples from social media, news articles, and public comments, ensuring a robust understanding of stance detection in real-world applications.

- Epochs: 10
- Batch Size: 32
- Learning Rate: 5e-5
- Optimizer: AdamW

## Evaluation
The model was evaluated using Accuracy and Macro F1-score on a validation dataset. The results confirm the model's effectiveness in stance detection tasks in Turkish.
- Accuracy Score: % 81.0 
- Macro F1 Score: % 81.0