File size: 1,904 Bytes
110925c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7287889
110925c
 
d30d440
110925c
 
 
 
 
 
 
b0a3d86
110925c
 
 
 
 
 
 
 
 
 
 
 
 
 
ca85174
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
pipeline_tag: zero-shot-classification
tags:
  - zero-shot-classification
  - swedish
  - megatron-bert
language:
  - sv
datasets:
  - KBLab/overlim
widget:
  - example_title: Zero-shot
    text: Många skjuter upp sina tandläkarbesök
    candidate_labels: hälsa, politik, sport, religion
inference:
  parameters:
    hypothesis_template: Detta exempel handlar om {}.
---


# Megatron-BERT-large Swedish 165k for zero-shot classification


This model is based on Megatron-BERT-large-165k (https://huggingface.co/KBLab/megatron-bert-large-swedish-cased-165k). It was fine-tuned on the QNLI task and further fine-tuned on the MNLI task.
The model can be used with the Hugging Face zero-shot classification pipeline.

You can read more about the model on our [blog](https://kb-labb.github.io/posts/2023-02-12-zero-shot-text-classification/).

## Usage

```python
>>> from transformers import pipeline
>>> classifier = pipeline(
...     "zero-shot-classification",
...     model="KBlab/megatron-bert-large-swedish-cased-165-zero-shot"
... )
>>> classifier(
...     "Ruben Östlunds ”Triangle of sadness” nomineras till en Golden Globe i kategorin bästa musikal eller komedi.",
...     candidate_labels=["hälsa", "politik", "sport", "religion", "nöje"],
...     hypothesis_template="Detta exempel handlar om {}.",
... )
{'sequence': 'Ruben Östlunds ”Triangle of sadness” nomineras till en Golden Globe i kategorin bästa musikal eller komedi.',
 'labels': ['nöje', 'sport', 'religion', 'hälsa', 'politik'],
 'scores': [0.9274595379829407,
  0.025105971843004227,
  0.018440095707774162,
  0.017049923539161682,
  0.011944468133151531]}
```

## Citation

```
@misc{sikora2023swedish,
  author = {Sikora, Justyna},
  title = {The KBLab Blog: Swedish zero-shot classification model},
  url = {https://kb-labb.github.io/posts/2023-02-12-zero-shot-text-classification/},
  year = {2023}
}
```