| --- |
| license: apache-2.0 |
| datasets: |
| - MIMEDIS/newton-media-unlabeled |
| language: |
| - sk |
| base_model: |
| - gerulata/slovakbert |
| pipeline_tag: text-classification |
| tags: |
| - Stance |
| --- |
| |
|
|
|
|
| # Stance Detection Model for Slovak |
|
|
| This model is fine-tuned from [gerulata/slovakbert](https://huggingface.co/gerulata/slovakbert) for stance detection on Slovak text. It classifies text into three stance categories: Negative, Neutral, and Positive. |
|
|
| ## Model Details |
|
|
| - **Base Model**: gerulata/slovakbert |
| - **Task**: Stance Detection / Sentiment Classification |
| - **Language**: Slovak (sk) |
| - **Number of Labels**: 3 |
|
|
| ## Label Mappings |
|
|
| | Label ID | Stance | |
| |----------|--------| |
| | 0 | Negative | |
| | 1 | Neutral | |
| | 2 | Positive | |
|
|
| ## Usage |
|
|
| ### Quick Start |
|
|
| ```python |
| from transformers import AutoModelForSequenceClassification, AutoTokenizer |
| import torch |
| |
| # Load model and tokenizer |
| model_name = "MIMEDIS/stance-headlines-model" |
| model = AutoModelForSequenceClassification.from_pretrained(model_name) |
| tokenizer = AutoTokenizer.from_pretrained(model_name) |
| |
| # Example text |
| text = "Toto je skvelý nápad a plne ho podporujem!" |
| |
| # Tokenize and predict |
| inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512) |
| outputs = model(**inputs) |
| predictions = torch.softmax(outputs.logits, dim=-1) |
| |
| # Get predicted label |
| label_id = torch.argmax(predictions, dim=-1).item() |
| label_map = {0: "Negative", 1: "Neutral", 2: "Positive"} |
| |
| print(f"Text: {text}") |
| print(f"Predicted stance: {label_map[label_id]}") |
| print(f"Confidence scores: Negative={predictions[0][0]:.3f}, Neutral={predictions[0][1]:.3f}, Positive={predictions[0][2]:.3f}") |
| ``` |