Update Readme
Browse files
README.md
CHANGED
@@ -13,10 +13,13 @@ widget:
|
|
13 |
---
|
14 |
|
15 |
|
16 |
-
# A zero-shot classifier based on bertin-roberta-base-
|
|
|
|
|
|
|
17 |
|
18 |
## Usage (HuggingFace Transformers)
|
19 |
-
|
20 |
|
21 |
```python
|
22 |
from transformers import pipeline
|
@@ -26,7 +29,7 @@ classifier = pipeline("zero-shot-classification",
|
|
26 |
classifier(
|
27 |
"El autor se perfila, a los 50 años de su muerte, como uno de los grandes de su siglo",
|
28 |
candidate_labels=["cultura", "sociedad", "economia", "salud", "deportes"],
|
29 |
-
hypothesis_template="
|
30 |
)
|
31 |
```
|
32 |
|
@@ -34,6 +37,8 @@ The `hypothesis_template` parameter is important and should be in Spanish. **In
|
|
34 |
|
35 |
## Training
|
36 |
|
|
|
|
|
37 |
**Dataset**
|
38 |
|
39 |
We used a collection of datasets of Natural Language Inference as training data:
|
@@ -41,15 +46,7 @@ We used a collection of datasets of Natural Language Inference as training data:
|
|
41 |
- [SNLI](https://nlp.stanford.edu/projects/snli/), automatically translated
|
42 |
- [MultiNLI](https://cims.nyu.edu/~sbowman/multinli/), automatically translated
|
43 |
|
44 |
-
The whole dataset used is available [here](https://huggingface.co/datasets/hackathon-pln-es/
|
45 |
-
|
46 |
-
## Full Model Architecture
|
47 |
-
```
|
48 |
-
SentenceTransformer(
|
49 |
-
(0): Transformer({'max_seq_length': 514, 'do_lower_case': False}) with Transformer model: RobertaModel
|
50 |
-
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False})
|
51 |
-
)
|
52 |
-
```
|
53 |
|
54 |
## Authors
|
55 |
|
|
|
13 |
---
|
14 |
|
15 |
|
16 |
+
# A zero-shot classifier based on bertin-roberta-base-spanish
|
17 |
+
This model was trained on the basis of the model `bertin-roberta-base-spanish` using **Cross encoder** for NLI task. A CrossEncoder takes a sentence pair as input and outputs a label so it learns to predict the labels: "contradiction": 0, "entailment": 1, "neutral": 2.
|
18 |
+
|
19 |
+
You can use it with Hugging Face's Zero-shot pipeline to make **zero-shot classifications**. Given a sentence and an arbitrary set of labels/topics, it will output the likelihood of the sentence belonging to each of the topic.
|
20 |
|
21 |
## Usage (HuggingFace Transformers)
|
22 |
+
The simplest way to use the model is the huggingface transformers pipeline tool. Just initialize the pipeline specifying the task as "zero-shot-classification" and select "hackathon-pln-es/bertin-roberta-base-zeroshot-esnli" as model.
|
23 |
|
24 |
```python
|
25 |
from transformers import pipeline
|
|
|
29 |
classifier(
|
30 |
"El autor se perfila, a los 50 años de su muerte, como uno de los grandes de su siglo",
|
31 |
candidate_labels=["cultura", "sociedad", "economia", "salud", "deportes"],
|
32 |
+
hypothesis_template="Esta oración es sobre {}."
|
33 |
)
|
34 |
```
|
35 |
|
|
|
37 |
|
38 |
## Training
|
39 |
|
40 |
+
We used [sentence-transformers](https://www.SBERT.net) to train the model.
|
41 |
+
|
42 |
**Dataset**
|
43 |
|
44 |
We used a collection of datasets of Natural Language Inference as training data:
|
|
|
46 |
- [SNLI](https://nlp.stanford.edu/projects/snli/), automatically translated
|
47 |
- [MultiNLI](https://cims.nyu.edu/~sbowman/multinli/), automatically translated
|
48 |
|
49 |
+
The whole dataset used is available [here](https://huggingface.co/datasets/hackathon-pln-es/nli-es).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
## Authors
|
52 |
|