Instructions to use KBLab/emotional-classification with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use KBLab/emotional-classification with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("KBLab/emotional-classification") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - setfit
How to use KBLab/emotional-classification with setfit:
from setfit import SetFitModel model = SetFitModel.from_pretrained("KBLab/emotional-classification") - Notebooks
- Google Colab
- Kaggle
readme fixes
Browse files
README.md
CHANGED
|
@@ -13,8 +13,8 @@ language:
|
|
| 13 |
|
| 14 |
This is a [SetFit model](https://github.com/huggingface/setfit) that can be used for classification of emotions in Swedish text. The model supports seven basic emotions, listed below. The model has been trained using an efficient few-shot learning technique that involves:
|
| 15 |
|
| 16 |
-
1.
|
| 17 |
-
2. Training a classification head with features from the
|
| 18 |
|
| 19 |
Accuracy on a number of experiments on a minimal test set (35 examples) can be found in the figure below.
|
| 20 |
|
|
@@ -56,7 +56,7 @@ model = SetFitModel.from_pretrained("gilleti/emotional-classification")
|
|
| 56 |
preds = model(["Ingen tech-dystopi slår människans inre mörker", "Ina Lundström: Jag har två Bruce-tatueringar"])
|
| 57 |
```
|
| 58 |
|
| 59 |
-
This outputs predictions sadness/disappointment and absence of emotion.
|
| 60 |
|
| 61 |
## BibTeX entry and citation info
|
| 62 |
|
|
|
|
| 13 |
|
| 14 |
This is a [SetFit model](https://github.com/huggingface/setfit) that can be used for classification of emotions in Swedish text. The model supports seven basic emotions, listed below. The model has been trained using an efficient few-shot learning technique that involves:
|
| 15 |
|
| 16 |
+
1. Finetuning a [KBLab Sentence Transformer in Swedish](https://huggingface.co/KBLab/sentence-bert-swedish-cased) with contrastive learning.
|
| 17 |
+
2. Training a classification head with features from the finetuned Sentence Transformer.
|
| 18 |
|
| 19 |
Accuracy on a number of experiments on a minimal test set (35 examples) can be found in the figure below.
|
| 20 |
|
|
|
|
| 56 |
preds = model(["Ingen tech-dystopi slår människans inre mörker", "Ina Lundström: Jag har två Bruce-tatueringar"])
|
| 57 |
```
|
| 58 |
|
| 59 |
+
This outputs predictions sadness/disappointment and absence of emotion. Keep in mind that these examples are cherrypicked as most headlines (which is what the model is trained on) are rarely as clear.
|
| 60 |
|
| 61 |
## BibTeX entry and citation info
|
| 62 |
|