CoolFace
Modelpublic

ltg/norbert3-base_sentence-sentiment

sourceHugging Facecc-by-4.0updated 2y agoView on Hugging Face
3likes51downloads
Model Card

Sentence-level Sentiment Analysis model for Norwegian text

This model is a fine-tuned version of ltg/norbert3-base for text classification.

Training data

The dataset used for fine-tuning is ltg/norec_sentence, the mixed subset with four sentement categories:

[0]:  Negative,  
[1]:  Positive,  
[2]:  Neutral
[0,1]: Mixed  

Quick start

You can use this model for inference as follows:

>>> from transformers import pipeline
>>> origin = "ltg/norbert3-base_sentence-sentiment"
>>> pipe = transformers.pipeline( "text-classification",
...                             model = origin,
...                             trust_remote_code=origin.startswith("ltg/norbert3"),
...                             config= origin,
...                             tokenizer = AutoTokenizer.from_pretrained(origin)
...             )
>>> preds = pipe(["Hans hese, litt såre stemme kler bluesen, men denne platen kommer neppe til å bli blant hans største kommersielle suksesser.",
...              "Borten-regjeringen gjorde ikke jobben sin." ])
>>> for p in preds:
...     print(p)

Output:

The model 'NorbertForSequenceClassification' is not supported for text-classification. Supported models are ['AlbertForSequenceClassification', ...
{'label': 'Mixed', 'score': 0.9230353236198425}
{'label': 'Negative', 'score': 0.7348112463951111}

Training hyperparameters

  • —perdevicetrainbatchsize: 16
  • —learning_rate: 1e-05
  • —gradientaccumulationsteps: 1
  • —numtrainepochs: 10 (best epoch 5)

Evaluation

CategoryF1
Negative_F10.580247<img width=400/>
Positive_F10.781699
Neutral_F10.825197
Mixed_F10.648649
WeightedavgF10.763806