echarlaix HF staff commited on
Commit
c4a47a4
1 Parent(s): 66e4329

Update code snippet

Browse files
Files changed (1) hide show
  1. README.md +4 -2
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.neural_compressor import IncQuantizedModelForSequenceClassification
35
 
36
  model_id = "echarlaix/distilbert-sst2-inc-dynamic-quantization-magnitude-pruning-0.1"
37
- model = IncQuantizedModelForSequenceClassification.from_pretrained(model_id)
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."