| --- |
| 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}") |
| ``` |