File size: 2,146 Bytes
f211d39
 
 
 
 
 
 
 
 
 
 
 
 
 
2583708
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: apache-2.0
datasets:
- MIMEDIS/migration-stance-content
language:
- sk
base_model:
- gerulata/slovakbert
pipeline_tag: text-classification
tags:
- stance-classification
- text-classification
- slovakbert
- slovak
---

# Migration Stance Classification Model

This model categorizes the stance expressed in text regarding migration into three categories: **Positive**, **Negative**, or **Neutral**.

## Model Description

This model is fine-tuned to detect stance in migration-related content. It can identify whether a text expresses support for migration (positive), opposition to migration (negative), or presents factual/neutral information.

**Key Features:**
- **3-class classification**: POSITIVE, NEGATIVE, NEUTRAL
- **Domain-specific**: Optimized for migration and immigration discourse in Slovakia

## Labels

- **0 - NEGATIVE**: Text expressing opposition, concerns, or negative views about migration
- **1 - NEUTRAL**: Factual statements, balanced reporting, or no clear stance
- **2 - POSITIVE**: Text expressing support, benefits, or positive views about migration

## Usage

### Basic Usage
```python
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch

# Load model and tokenizer
model_name = "MIMEDIS/stance-model"
model = AutoModelForSequenceClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)

# Prepare input
text = "Migrácia obohacuje našu spoločnosť o nové perspektívy a kultúry."
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=512)

# Get predictions
with torch.no_grad():
    outputs = model(**inputs)
    predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
    predicted_class = torch.argmax(predictions, dim=-1).item()

# Map class to label
labels = {0: "NEGATIVE", 1: "NEUTRAL", 2: "POSITIVE"}

print(f"Text: {text}")
print(f"Predicted stance: {labels[predicted_class]}")
print(f"Confidence: {predictions[0][predicted_class]:.4f}")
print(f"All probabilities: NEGATIVE={predictions[0][0]:.4f}, NEUTRAL={predictions[0][1]:.4f}, POSITIVE={predictions[0][2]:.4f}")
```