MoritzLaurer HF staff commited on
Commit
3acbfe2
·
1 Parent(s): 6b62f83

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +85 -67
README.md CHANGED
@@ -1,72 +1,90 @@
1
  ---
2
- license: mit
3
- base_model: microsoft/deberta-v3-large
4
  tags:
5
- - generated_from_trainer
6
- metrics:
7
- - accuracy
8
- model-index:
9
- - name: deberta-v3-large-zeroshot-v1.1-none
10
- results: []
11
  ---
12
 
13
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
14
- should probably proofread and complete it, then remove this comment. -->
15
-
16
- # deberta-v3-large-zeroshot-v1.1-none
17
-
18
- This model is a fine-tuned version of [microsoft/deberta-v3-large](https://huggingface.co/microsoft/deberta-v3-large) on an unknown dataset.
19
- It achieves the following results on the evaluation set:
20
- - Loss: 0.2186
21
- - F1 Macro: 0.6981
22
- - F1 Micro: 0.7601
23
- - Accuracy Balanced: 0.7396
24
- - Accuracy: 0.7601
25
- - Precision Macro: 0.7117
26
- - Recall Macro: 0.7396
27
- - Precision Micro: 0.7601
28
- - Recall Micro: 0.7601
29
-
30
  ## Model description
31
-
32
- More information needed
33
-
34
- ## Intended uses & limitations
35
-
36
- More information needed
37
-
38
- ## Training and evaluation data
39
-
40
- More information needed
41
-
42
- ## Training procedure
43
-
44
- ### Training hyperparameters
45
-
46
- The following hyperparameters were used during training:
47
- - learning_rate: 9e-06
48
- - train_batch_size: 16
49
- - eval_batch_size: 64
50
- - seed: 42
51
- - gradient_accumulation_steps: 2
52
- - total_train_batch_size: 32
53
- - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
54
- - lr_scheduler_type: linear
55
- - lr_scheduler_warmup_ratio: 0.06
56
- - num_epochs: 3
57
-
58
- ### Training results
59
-
60
- | Training Loss | Epoch | Step | Validation Loss | F1 Macro | F1 Micro | Accuracy Balanced | Accuracy | Precision Macro | Recall Macro | Precision Micro | Recall Micro |
61
- |:-------------:|:-----:|:-----:|:---------------:|:--------:|:--------:|:-----------------:|:--------:|:---------------:|:------------:|:---------------:|:------------:|
62
- | 0.1822 | 1.0 | 30789 | 0.3109 | 0.8675 | 0.8798 | 0.8658 | 0.8798 | 0.8692 | 0.8658 | 0.8798 | 0.8798 |
63
- | 0.1334 | 2.0 | 61579 | 0.3410 | 0.8735 | 0.8860 | 0.8696 | 0.8860 | 0.8780 | 0.8696 | 0.8860 | 0.8860 |
64
- | 0.0829 | 3.0 | 92367 | 0.4505 | 0.8753 | 0.8869 | 0.8737 | 0.8869 | 0.8771 | 0.8737 | 0.8869 | 0.8869 |
65
-
66
-
67
- ### Framework versions
68
-
69
- - Transformers 4.33.3
70
- - Pytorch 1.11.0+cu113
71
- - Datasets 2.14.6
72
- - Tokenizers 0.12.1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - en
4
  tags:
5
+ - text-classification
6
+ - zero-shot-classification
7
+ pipeline_tag: zero-shot-classification
8
+ library_name: transformers
9
+ license: mit
 
10
  ---
11
 
12
+ # deberta-v3-large-zeroshot-v1.1-all-33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  ## Model description
14
+ The model is designed for zero-shot classification with the Hugging Face pipeline.
15
+ The model should be substantially better at zero-shot classification than my other zero-shot models on the
16
+ Hugging Face hub: https://huggingface.co/MoritzLaurer.
17
+
18
+ The model can do one universal task: determine whether a hypothesis is `true` or `not_true`
19
+ given a text (also called `entailment` vs. `not_entailment`).
20
+ This task format is based on the Natural Language Inference task (NLI).
21
+ The task is so universal that any classification task can be reformulated into the task.
22
+
23
+ ## Training data
24
+ The model was trained on a mixture of 27 tasks and 310 classes that have been reformatted into this universal format.
25
+ 1. 26 classification tasks with ~400k texts:
26
+ 'amazonpolarity', 'imdb', 'appreviews', 'yelpreviews', 'rottentomatoes',
27
+ 'emotiondair', 'emocontext', 'empathetic',
28
+ 'financialphrasebank', 'banking77', 'massive',
29
+ 'wikitoxic_toxicaggregated', 'wikitoxic_obscene', 'wikitoxic_threat', 'wikitoxic_insult', 'wikitoxic_identityhate',
30
+ 'hateoffensive', 'hatexplain', 'biasframes_offensive', 'biasframes_sex', 'biasframes_intent',
31
+ 'agnews', 'yahootopics',
32
+ 'trueteacher', 'spam', 'wellformedquery'.
33
+ See details on each dataset here: https://docs.google.com/spreadsheets/d/1Z18tMh02IiWgh6o8pfoMiI_LH4IXpr78wd_nmNd5FaE/edit?usp=sharing
34
+ 3. Five NLI datasets with ~885k texts: "mnli", "anli", "fever", "wanli", "ling"
35
+
36
+ Note that compared to other NLI models, this model predicts two classes (`entailment` vs. `not_entailment`)
37
+ as opposed to three classes (entailment/neutral/contradiction)
38
+
39
+
40
+ ### How to use the model
41
+ #### Simple zero-shot classification pipeline
42
+ ```python
43
+ from transformers import pipeline
44
+ classifier = pipeline("zero-shot-classification", model="MoritzLaurer/deberta-v3-large-zeroshot-v1")
45
+ sequence_to_classify = "Angela Merkel is a politician in Germany and leader of the CDU"
46
+ candidate_labels = ["politics", "economy", "entertainment", "environment"]
47
+ output = classifier(sequence_to_classify, candidate_labels, multi_label=False)
48
+ print(output)
49
+ ```
50
+
51
+ ### Details on data and training
52
+ The code for preparing the data and training & evaluating the model is fully open-source here: https://github.com/MoritzLaurer/zeroshot-classifier/tree/main
53
+
54
+ ## Limitations and bias
55
+ The model can only do text classification tasks.
56
+
57
+ Please consult the original DeBERTa paper and the papers for the different datasets for potential biases.
58
+
59
+ ## License
60
+ The base model (DeBERTa-v3) is published under the MIT license.
61
+ The datasets the model was fine-tuned on are published under a diverse set of licenses.
62
+ The following spreadsheet provides an overview of the non-NLI datasets used for fine-tuning.
63
+ The spreadsheets contains information on licenses, the underlying papers etc.: https://docs.google.com/spreadsheets/d/1Z18tMh02IiWgh6o8pfoMiI_LH4IXpr78wd_nmNd5FaE/edit?usp=sharing
64
+
65
+ In addition, the model was also trained on the following NLI datasets: MNLI, ANLI, WANLI, LING-NLI, FEVER-NLI.
66
+
67
+ ## Citation
68
+ If you use this model, please cite:
69
+ ```
70
+ @article{laurer_less_2023,
71
+ title = {Less {Annotating}, {More} {Classifying}: {Addressing} the {Data} {Scarcity} {Issue} of {Supervised} {Machine} {Learning} with {Deep} {Transfer} {Learning} and {BERT}-{NLI}},
72
+ issn = {1047-1987, 1476-4989},
73
+ shorttitle = {Less {Annotating}, {More} {Classifying}},
74
+ url = {https://www.cambridge.org/core/product/identifier/S1047198723000207/type/journal_article},
75
+ doi = {10.1017/pan.2023.20},
76
+ language = {en},
77
+ urldate = {2023-06-20},
78
+ journal = {Political Analysis},
79
+ author = {Laurer, Moritz and Van Atteveldt, Wouter and Casas, Andreu and Welbers, Kasper},
80
+ month = jun,
81
+ year = {2023},
82
+ pages = {1--33},
83
+ }
84
+ ```
85
+
86
+ ### Ideas for cooperation or questions?
87
+ If you have questions or ideas for cooperation, contact me at m{dot}laurer{at}vu{dot}nl or [LinkedIn](https://www.linkedin.com/in/moritz-laurer/)
88
+
89
+ ### Debugging and issues
90
+ Note that DeBERTa-v3 was released on 06.12.21 and older versions of HF Transformers seem to have issues running the model (e.g. resulting in an issue with the tokenizer). Using Transformers>=4.13 might solve some issues.