David
commited on
Commit
•
d78fdb9
1
Parent(s):
e023a6a
Add model card
Browse files
README.md
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: es
|
3 |
+
tags:
|
4 |
+
- zero-shot-classification
|
5 |
+
- nli
|
6 |
+
- pytorch
|
7 |
+
datasets:
|
8 |
+
- xnli
|
9 |
+
license: mit
|
10 |
+
pipeline_tag: zero-shot-classification
|
11 |
+
widget:
|
12 |
+
- text: "El autor se perfila, a los 50 años de su muerte, como uno de los grandes de su siglo"
|
13 |
+
candidate_labels: "cultura, sociedad, economia, salud, deportes"
|
14 |
+
---
|
15 |
+
|
16 |
+
# bert-base-spanish-wwm-cased-xnli
|
17 |
+
|
18 |
+
## Model description
|
19 |
+
|
20 |
+
This model is a fine-tuned version of the [spanish BERT model](https://huggingface.co/dccuchile/bert-base-spanish-wwm-cased) with the Spanish portion of the XNLI dataset. You can have a look at the [training script](https://huggingface.co/Recognai/bert-base-spanish-wwm-cased-xnli/blob/main/zeroshot_training_script.py) for details of the training.
|
21 |
+
|
22 |
+
### How to use
|
23 |
+
|
24 |
+
You can use this model with Hugging Face's [zero-shot-classification pipeline](https://discuss.huggingface.co/t/new-pipeline-for-zero-shot-text-classification/681):
|
25 |
+
```python
|
26 |
+
from transformers import pipeline
|
27 |
+
classifier = pipeline("zero-shot-classification",
|
28 |
+
model="Recognai/bert-base-spanish-wwm-cased-xnli")
|
29 |
+
|
30 |
+
classifier(
|
31 |
+
"El autor se perfila, a los 50 años de su muerte, como uno de los grandes de su siglo",
|
32 |
+
candidate_labels=["cultura", "sociedad", "economia", "salud", "deportes"]
|
33 |
+
)
|
34 |
+
"""output
|
35 |
+
{'sequence': 'El autor se perfila, a los 50 años de su muerte, como uno de los grandes de su siglo',
|
36 |
+
'labels': ['cultura', 'sociedad', 'economia', 'salud', 'deportes'],
|
37 |
+
'scores': [0.38897448778152466,
|
38 |
+
0.22997373342514038,
|
39 |
+
0.1658431738615036,
|
40 |
+
0.1205764189362526,
|
41 |
+
0.09463217109441757]}
|
42 |
+
"""
|
43 |
+
```
|
44 |
+
## Eval results
|
45 |
+
|
46 |
+
|
47 |
+
Accuracy for the test set:
|
48 |
+
|
49 |
+
| | XNLI-es |
|
50 |
+
|-----------------------------|---------|
|
51 |
+
|bert-base-spanish-wwm-cased-xnli | 79.9% |
|