MoritzLaurer HF staff commited on
Commit
eb9ba8c
1 Parent(s): 29f90c4

added zero-shot pipeline

Browse files
Files changed (1) hide show
  1. README.md +12 -2
README.md CHANGED
@@ -21,8 +21,18 @@ The base model is [DeBERTa-v3-base from Microsoft](https://huggingface.co/micros
21
 
22
  For highest performance (but less speed), I recommend using https://huggingface.co/MoritzLaurer/DeBERTa-v3-large-mnli-fever-anli-ling-wanli.
23
 
24
- ## Intended uses & limitations
25
- #### How to use the model
 
 
 
 
 
 
 
 
 
 
26
  ```python
27
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
28
  import torch
 
21
 
22
  For highest performance (but less speed), I recommend using https://huggingface.co/MoritzLaurer/DeBERTa-v3-large-mnli-fever-anli-ling-wanli.
23
 
24
+
25
+ ### How to use the model
26
+ #### Simple zero-shot classification pipeline
27
+ ```python
28
+ from transformers import pipeline
29
+ classifier = pipeline("zero-shot-classification", model="MoritzLaurer/DeBERTa-v3-base-mnli-fever-docnli-ling-2c")
30
+ sequence_to_classify = "Angela Merkel is a politician in Germany and leader of the CDU ist eine Politikerin in Deutschland und Vorsitzende der CDU"
31
+ candidate_labels = ["politics", "economy", "entertainment", "environment"]
32
+ output = classifier(sequence_to_classify, candidate_labels, multi_label=False)
33
+ print(output)
34
+ ```
35
+ #### NLI use-case
36
  ```python
37
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
38
  import torch