Sahajtomar
commited on
Commit
•
7efb333
1
Parent(s):
031f255
Update README.md
Browse files
README.md
CHANGED
@@ -1 +1,51 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: multilingual
|
3 |
+
tags:
|
4 |
+
- text-classification
|
5 |
+
- pytorch
|
6 |
+
- nli
|
7 |
+
- xnli
|
8 |
+
- de
|
9 |
+
datasets:
|
10 |
+
- xnli
|
11 |
+
|
12 |
+
pipeline_tag: zero-shot-classification
|
13 |
+
|
14 |
+
---
|
15 |
+
|
16 |
+
# German Zeroshot
|
17 |
+
|
18 |
+
## Model Description
|
19 |
+
|
20 |
+
This model has [GBERT Large](https://huggingface.co/deepset/gbert-large) as base model and fine-tuned it on xnli de dataset
|
21 |
+
|
22 |
+
#### Zero-shot classification pipeline
|
23 |
+
|
24 |
+
```python
|
25 |
+
from transformers import pipeline
|
26 |
+
classifier = pipeline("zero-shot-classification",
|
27 |
+
model="Sahajtomar/German_Zeroshot")
|
28 |
+
|
29 |
+
# we will classify the Russian translation of, "Who are you voting for in 2020?"
|
30 |
+
sequence = "Letzte Woche gab es einen Selbstmord in einer nahe gelegenen kolonie"
|
31 |
+
candidate_labels = ["Verbrechen","Tragödie","Stehlen"]
|
32 |
+
hypothesis_template = "In deisem geht es um {}." ## Since monolingual model,its sensitive to hypothesis template. This can be experimented
|
33 |
+
|
34 |
+
classifier(sequence, candidate_labels, hypothesis_template=hypothesis_template)
|
35 |
+
# {'labels': ['politics', 'Europe', 'public health'],
|
36 |
+
# 'scores': [0.9048484563827515, 0.05722189322113991, 0.03792969882488251],
|
37 |
+
# 'sequence': 'За кого вы голосуете в 2020 году?'}
|
38 |
+
```
|
39 |
+
|
40 |
+
The default hypothesis template is the English, `This text is {}`. If you are working strictly within one language, it
|
41 |
+
may be worthwhile to translate this to the language you are working with:
|
42 |
+
|
43 |
+
```python
|
44 |
+
sequence_to_classify = "¿A quién vas a votar en 2020?"
|
45 |
+
candidate_labels = ["Europa", "salud pública", "política"]
|
46 |
+
hypothesis_template = "Este ejemplo es {}."
|
47 |
+
classifier(sequence_to_classify, candidate_labels, hypothesis_template=hypothesis_template)
|
48 |
+
"""{'labels': ['Tragödie', 'Verbrechen', 'Stehlen'],
|
49 |
+
'scores': [0.8328856854438782, 0.10494536352157593, 0.06316883927583696],
|
50 |
+
'sequence': 'Letzte Woche gab es einen Selbstmord in einer nahe gelegenen Kolonie'}"""
|
51 |
+
```
|