chainyo commited on
Commit
1a10ab9
1 Parent(s): 94850e5

Update README.md

Browse files

add quantized onnx model

Files changed (1) hide show
  1. README.md +18 -2
README.md CHANGED
@@ -10,12 +10,12 @@ widget:
10
  DistilCamemBERT-NER
11
  ===================
12
 
13
- We present DistilCamemBERT-NER which is [DistilCamemBERT](https://huggingface.co/cmarkea/distilcamembert-base) fine tuned for the NER (Named Entity Recognition) task for the French language. The work is inspired by [Jean-Baptiste/camembert-ner](https://huggingface.co/Jean-Baptiste/camembert-ner) based on the [CamemBERT](https://huggingface.co/camembert-base) model. The problem of the modelizations based on CamemBERT is at the scaling moment, for the production phase for example. Indeed, inference cost can be a technological issue. To counteract this effect, we propose this modelization which **divides the inference time by 2** with the same consumption power thanks to [DistilCamemBERT](https://huggingface.co/cmarkea/distilcamembert-base).
14
 
15
  Dataset
16
  -------
17
 
18
- The dataset used is [wikiner_fr](https://huggingface.co/datasets/Jean-Baptiste/wikiner_fr) which represents ~170k sentences labelized in 5 categories :
19
  * PER: personality ;
20
  * LOC: location ;
21
  * ORG: organization ;
@@ -125,6 +125,22 @@ result
125
  'end': 409}]
126
  ```
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  Citation
129
  --------
130
  ```bibtex
 
10
  DistilCamemBERT-NER
11
  ===================
12
 
13
+ We present DistilCamemBERT-NER, which is [DistilCamemBERT](https://huggingface.co/cmarkea/distilcamembert-base) fine-tuned for the NER (Named Entity Recognition) task for the French language. The work is inspired by [Jean-Baptiste/camembert-ner](https://huggingface.co/Jean-Baptiste/camembert-ner) based on the [CamemBERT](https://huggingface.co/camembert-base) model. The problem of the modelizations based on CamemBERT is at the scaling moment, for the production phase, for example. Indeed, inference cost can be a technological issue. To counteract this effect, we propose this modelization which **divides the inference time by two** with the same consumption power thanks to [DistilCamemBERT](https://huggingface.co/cmarkea/distilcamembert-base).
14
 
15
  Dataset
16
  -------
17
 
18
+ The dataset used is [wikiner_fr](https://huggingface.co/datasets/Jean-Baptiste/wikiner_fr), which represents ~170k sentences labeled in 5 categories :
19
  * PER: personality ;
20
  * LOC: location ;
21
  * ORG: organization ;
 
125
  'end': 409}]
126
  ```
127
 
128
+ ### Optimum + ONNX
129
+ ```python
130
+ from optimum.onnxruntime import ORTModelForTokenClassification
131
+ from transformers import AutoTokenizer, pipeline
132
+
133
+ HUB_MODEL = "cmarkea/distilcamembert-base-nli"
134
+ tokenizer = AutoTokenizer.from_pretrained(HUB_MODEL)
135
+ model = ORTModelForTokenClassification.from_pretrained(HUB_MODEL)
136
+ onnx_qa = pipeline("token-classification", model=model, tokenizer=tokenizer)
137
+
138
+ # Quantized onnx model
139
+ quantized_model = ORTModelForTokenClassification.from_pretrained(
140
+ HUB_MODEL, file_name="model_quantized.onnx"
141
+ )
142
+ ```
143
+
144
  Citation
145
  --------
146
  ```bibtex