Jiva commited on
Commit
2ba088b
1 Parent(s): a973561

fixes readme scores

Browse files
Files changed (1) hide show
  1. README.md +20 -12
README.md CHANGED
@@ -10,8 +10,8 @@ license: mit
10
  pipeline_tag: zero-shot-classification
11
  widget:
12
  - text: "La seconda guerra mondiale vide contrapporsi, tra il 1939 e il 1945, le cosiddette potenze dell'Asse e gli Alleati che, come già accaduto ai belligeranti della prima guerra mondiale, si combatterono su gran parte del pianeta; il conflitto ebbe inizio il 1º settembre 1939 con l'attacco della Germania nazista alla Polonia e terminò, nel teatro europeo, l'8 maggio 1945 con la resa tedesca e, in quello asiatico, il successivo 2 settembre con la resa dell'Impero giapponese dopo i bombardamenti atomici di Hiroshima e Nagasaki."
13
- candidate_labels: "storia, geografia, moda, politica, macchine, cibo"
14
- multi_class: true
15
  ---
16
 
17
  # XLM-roBERTa-large-it-mnli
@@ -37,7 +37,7 @@ The model can be loaded with the `zero-shot-classification` pipeline like so:
37
  ```python
38
  from transformers import pipeline
39
  classifier = pipeline("zero-shot-classification",
40
- model="Jiva/xlm-roberta-large-it-mnli", device=0, use_fast=True)
41
  ```
42
  You can then classify in any of the above languages. You can even pass the labels in one language and the sequence to
43
  classify in another:
@@ -48,17 +48,15 @@ sequence_to_classify = "La Sardegna è una regione italiana a statuto speciale d
48
  candidate_labels = ["geografia", "politica", "macchine", "cibo", "moda"]
49
  classifier(sequence_to_classify, candidate_labels)
50
  # {'labels': ['geografia', 'moda', 'politica', 'macchine', 'cibo'],
51
- # 'scores': [0.5027586221694946, 0.19790762662887573, 0.1900099515914917, 0.10961027443408966, 0.07802766561508179]}
52
  ```
53
- The default hypothesis template is the English, `This text is {}`. If you are working strictly within one language, it
54
- may be worthwhile to translate this to the language you are working with:
55
  ```python
56
  sequence_to_classify = "La Sardegna è una regione italiana a statuto speciale di 1 592 730 abitanti con capoluogo Cagliari, la cui denominazione bilingue utilizzata nella comunicazione ufficiale è Regione Autonoma della Sardegna / Regione Autònoma de Sardigna."
57
- candidate_labels = ["geografia", "politica", "macchine", "cibo", "moda"]
58
- hypothesis_template = "si parla di {}""
59
  classifier(sequence_to_classify, candidate_labels, hypothesis_template=hypothesis_template)
60
- # {'labels': ['geografia', 'moda', 'politica', 'macchine', 'cibo'],
61
- # 'scores': [0.5027586221694946, 0.19790762662887573, 0.1900099515914917, 0.10961027443408966, 0.07802766561508179]}
62
  ```
63
  #### With manual PyTorch
64
  ```python
@@ -67,7 +65,7 @@ from transformers import AutoModelForSequenceClassification, AutoTokenizer
67
  nli_model = AutoModelForSequenceClassification.from_pretrained('Jiva/xlm-roberta-large-it-mnli')
68
  tokenizer = AutoTokenizer.from_pretrained('Jiva/xlm-roberta-large-it-mnli')
69
  premise = sequence
70
- hypothesis = f'si parla di{ label}.'
71
  # run through model pre-trained on MNLI
72
  x = tokenizer.encode(premise, hypothesis, return_tensors='pt',
73
  truncation_strategy='only_first')
@@ -81,7 +79,17 @@ prob_label_is_true = probs[:,1]
81
  ## Training
82
 
83
  ## Version 0.1
84
- The model has been now retrained on the full training set. Around 1000 sentences pairs have been removed from the set bacause their translation was botched by the translation model.
 
 
 
 
 
 
 
 
 
 
85
 
86
  ## Version 0.0
87
  This model was pre-trained on set of 100 languages, as described in
 
10
  pipeline_tag: zero-shot-classification
11
  widget:
12
  - text: "La seconda guerra mondiale vide contrapporsi, tra il 1939 e il 1945, le cosiddette potenze dell'Asse e gli Alleati che, come già accaduto ai belligeranti della prima guerra mondiale, si combatterono su gran parte del pianeta; il conflitto ebbe inizio il 1º settembre 1939 con l'attacco della Germania nazista alla Polonia e terminò, nel teatro europeo, l'8 maggio 1945 con la resa tedesca e, in quello asiatico, il successivo 2 settembre con la resa dell'Impero giapponese dopo i bombardamenti atomici di Hiroshima e Nagasaki."
13
+ candidate_labels: "storia, geografia, moda, politica, macchine, cibo"
14
+ multi_class: true
15
  ---
16
 
17
  # XLM-roBERTa-large-it-mnli
 
37
  ```python
38
  from transformers import pipeline
39
  classifier = pipeline("zero-shot-classification",
40
+ model="Jiva/xlm-roberta-large-it-mnli", device=0, use_fast=True, multi_label=True)
41
  ```
42
  You can then classify in any of the above languages. You can even pass the labels in one language and the sequence to
43
  classify in another:
 
48
  candidate_labels = ["geografia", "politica", "macchine", "cibo", "moda"]
49
  classifier(sequence_to_classify, candidate_labels)
50
  # {'labels': ['geografia', 'moda', 'politica', 'macchine', 'cibo'],
51
+ # 'scores': [0.38871392607688904, 0.22633370757102966, 0.19398456811904907, 0.13735772669315338, 0.13708525896072388]}
52
  ```
53
+ The default hypothesis template is the English, `This text is {}`. With this model better results are achieving when providing a translated template:
 
54
  ```python
55
  sequence_to_classify = "La Sardegna è una regione italiana a statuto speciale di 1 592 730 abitanti con capoluogo Cagliari, la cui denominazione bilingue utilizzata nella comunicazione ufficiale è Regione Autonoma della Sardegna / Regione Autònoma de Sardigna."
56
+ candidate_labels = ["geografia", "politica", "macchine", "cibo", "moda"]"
57
+ hypothesis_template = "si parla di {}"
58
  classifier(sequence_to_classify, candidate_labels, hypothesis_template=hypothesis_template)
59
+ 'scores': [0.6068345904350281, 0.34715887904167175, 0.32433947920799255, 0.3068877160549164, 0.18744681775569916]}
 
60
  ```
61
  #### With manual PyTorch
62
  ```python
 
65
  nli_model = AutoModelForSequenceClassification.from_pretrained('Jiva/xlm-roberta-large-it-mnli')
66
  tokenizer = AutoTokenizer.from_pretrained('Jiva/xlm-roberta-large-it-mnli')
67
  premise = sequence
68
+ hypothesis = f'si parla di {}.'
69
  # run through model pre-trained on MNLI
70
  x = tokenizer.encode(premise, hypothesis, return_tensors='pt',
71
  truncation_strategy='only_first')
 
79
  ## Training
80
 
81
  ## Version 0.1
82
+ The model has been now retrained on the full training set. Around 1000 sentences pairs have been removed from the set because their translation was botched by the translation model.
83
+
84
+ | metric | value |
85
+ |----------------- |------- |
86
+ | learnin_rate | 4e-6 |
87
+ | optimizer | AdamW |
88
+ | batch_size | 80 |
89
+ | mcc | 0.77 |
90
+ | train_loss | 0.34 |
91
+ | eval_loss | 0.40 |
92
+ | stopped_at_step | 9754 |
93
 
94
  ## Version 0.0
95
  This model was pre-trained on set of 100 languages, as described in