Update README.md
Browse files
README.md
CHANGED
@@ -8,3 +8,54 @@ datasets:
|
|
8 |
- ltg/norec_sentence
|
9 |
pipeline_tag: text-classification
|
10 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
- ltg/norec_sentence
|
9 |
pipeline_tag: text-classification
|
10 |
---
|
11 |
+
|
12 |
+
# Sentence-level Sentiment Analysis model for Norwegian text
|
13 |
+
This model is a fine-tuned version of [ltg/norbert3-base](https://huggingface.co/ltg/norbert3-base) for text classification.
|
14 |
+
|
15 |
+
## Training data
|
16 |
+
The dataset used for fine-tuning is [ltg/norec_sentence](https://huggingface.co/datasets/ltg/norec_sentence), the `mixed` subset with four sentement categories:
|
17 |
+
```
|
18 |
+
[0]: Negative,
|
19 |
+
[1]: Positive,
|
20 |
+
[2]: Neutral
|
21 |
+
[0,1]: Mixed
|
22 |
+
```
|
23 |
+
|
24 |
+
## Quick start
|
25 |
+
You can use this model for inference as follows:
|
26 |
+
```
|
27 |
+
>>> from transformers import pipeline
|
28 |
+
>>> origin = "ltg/norbert3-large_sentence-sentiment"
|
29 |
+
>>> pipe = transformers.pipeline( "text-classification",
|
30 |
+
... model = origin,
|
31 |
+
... trust_remote_code=origin.startswith("ltg/norbert3"),
|
32 |
+
... config= origin,
|
33 |
+
... tokenizer = AutoTokenizer.from_pretrained(origin)
|
34 |
+
... )
|
35 |
+
>>> preds = pipe(["Hans hese, litt såre stemme kler bluesen, men denne platen kommer neppe til å bli blant hans største kommersielle suksesser.",
|
36 |
+
... "Borten-regjeringen gjorde ikke jobben sin." ])
|
37 |
+
>>> for p in preds:
|
38 |
+
... print(p)
|
39 |
+
```
|
40 |
+
Output:
|
41 |
+
```
|
42 |
+
The model 'NorbertForSequenceClassification' is not supported for text-classification. Supported models are ['AlbertForSequenceClassification', ...
|
43 |
+
{'label': 'Mixed', 'score': 0.7435498237609863}
|
44 |
+
{'label': 'Negative', 'score': 0.765734851360321}
|
45 |
+
```
|
46 |
+
|
47 |
+
## Training hyperparameters
|
48 |
+
- per_device_train_batch_size: 32
|
49 |
+
- learning_rate: 1e-05
|
50 |
+
- gradient_accumulation_steps: 1
|
51 |
+
- num_train_epochs: 10 (best epoch 2)
|
52 |
+
|
53 |
+
## Evaluation
|
54 |
+
| Metric | F1 | |
|
55 |
+
|:----------------|---------:|----:|
|
56 |
+
| Negative_F1 | 0.670241 |<img width=400/> |
|
57 |
+
| Positive_F1 | 0.832918 | |
|
58 |
+
| Neutral_F1 | 0.850082 | |
|
59 |
+
| Mixed_F1 | 0.580645 | |
|
60 |
+
| Weighted_avg_F1 | 0.799663 | |
|
61 |
+
|