arnabdhar commited on
Commit
b9df927
1 Parent(s): 3fa1fd7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +39 -1
README.md CHANGED
@@ -6,4 +6,42 @@ library_name: transformers
6
  pipeline_tag: zero-shot-classification
7
  tags:
8
  - ORTModelForSequenceClassification
9
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  pipeline_tag: zero-shot-classification
7
  tags:
8
  - ORTModelForSequenceClassification
9
+ ---
10
+
11
+ # DeBERTa-v3-base-onnx-quantized
12
+
13
+ This model has been quantized using the base model: [sileod/deberta-v3-base-tasksource-nli](https://huggingface.co/sileod/deberta-v3-base-tasksource-nli), To use this model you need to have `onnxruntime` installed on your machine.
14
+ To use this model, you can check out my [Huggingface Spaces](https://huggingface.co/spaces/arnabdhar/Zero-Shot-Classification-DeBERTa-Quantized).
15
+
16
+ The source code for the Huggingface Application can be found on [GitHub](https://github.com/arnabd64/Zero-Shot-Text-Classification).
17
+
18
+ To run this model on your machine use the following code. Note that this model is optimized for CPU with AVX2 support.
19
+
20
+ 1. Install dependencies
21
+
22
+ ```bash
23
+ pip install transformers optimum[onnxruntime]
24
+ ```
25
+
26
+ 2. Run the model:
27
+
28
+ ```python
29
+ # load libraries
30
+ from transformers import AutoTokenizer
31
+ from optimum.onnxruntime import ORTModelForSequenceClassification
32
+ from optimum.pipelines import pipeline
33
+
34
+ # load model components
35
+ MODEL_ID = "pitangent-ds/deberta-v3-nli-onnx-quantized"
36
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
37
+ model = ORTModelForSequenceClassification.from_pretrained(MODEL_ID)
38
+
39
+ # load the pipeline
40
+ classifier = pipeline("zero-shot-classification", tokenizer=tokenizer, model=model)
41
+
42
+ # inference
43
+ text = "The jacket that I bought is awesome"
44
+ candidate_labels = ["positive", "negative"]
45
+
46
+ results = classifier(text, candidate_labels)
47
+ ```