MoritzLaurer HF staff commited on
Commit
121ad0f
1 Parent(s): 94062d4

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +90 -0
README.md ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-base-zeroshot-v1
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-base-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.