Update code snippet
Browse files
README.md
CHANGED
@@ -27,14 +27,16 @@ tags:
|
|
27 |
|
28 |
## How to Get Started With the Model
|
29 |
|
|
|
|
|
30 |
To load the quantized model and run inference using the Transformers [pipelines](https://huggingface.co/docs/transformers/main/en/main_classes/pipelines), you can do as follows:
|
31 |
|
32 |
```python
|
33 |
from transformers import AutoTokenizer, pipeline
|
34 |
-
from optimum.intel
|
35 |
|
36 |
model_id = "echarlaix/distilbert-sst2-inc-dynamic-quantization-magnitude-pruning-0.1"
|
37 |
-
model =
|
38 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
39 |
cls_pipe = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
40 |
text = "He's a dreadful magician."
|
|
|
27 |
|
28 |
## How to Get Started With the Model
|
29 |
|
30 |
+
This requires to install Optimum by doing `pip install optimum[neural-compressor]`
|
31 |
+
|
32 |
To load the quantized model and run inference using the Transformers [pipelines](https://huggingface.co/docs/transformers/main/en/main_classes/pipelines), you can do as follows:
|
33 |
|
34 |
```python
|
35 |
from transformers import AutoTokenizer, pipeline
|
36 |
+
from optimum.intel import INCModelForSequenceClassification
|
37 |
|
38 |
model_id = "echarlaix/distilbert-sst2-inc-dynamic-quantization-magnitude-pruning-0.1"
|
39 |
+
model = INCModelForSequenceClassification.from_pretrained(model_id)
|
40 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
41 |
cls_pipe = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
42 |
text = "He's a dreadful magician."
|