Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,37 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
language:
|
4 |
+
- fr
|
5 |
---
|
6 |
+
|
7 |
+
This is an 8bit version of [distilcamembert-base-ner](https://huggingface.co/cmarkea/distilcamembert-base-ner) obtained with
|
8 |
+
[Intel® Neural Compressor](https://github.com/intel/neural-compressor) on [wikiner_fr](https://huggingface.co/datasets/Jean-Baptiste/wikiner_fr)
|
9 |
+
dataset.
|
10 |
+
|
11 |
+
### Get Started
|
12 |
+
|
13 |
+
First, install libraries:
|
14 |
+
|
15 |
+
```
|
16 |
+
pip install --upgrade-strategy eager "optimum[neural-compressor]" > null
|
17 |
+
```
|
18 |
+
|
19 |
+
Second, use `INCModelForTokenClassification` from optimum.intel . It can be used in the similar way as
|
20 |
+
an ordinary `DistilBertForTokenClassification`:
|
21 |
+
|
22 |
+
```python
|
23 |
+
from transformers import AutoModelForTokenClassification, AutoTokenizer
|
24 |
+
from optimum.intel import INCModelForTokenClassification
|
25 |
+
|
26 |
+
|
27 |
+
model = INCModelForTokenClassification.from_pretrained('konverner/8bit-distilcamembert-base-ner')
|
28 |
+
tokenizer = AutoTokenizer.from_pretrained('konverner/8bit-distilcamembert-base-ner')
|
29 |
+
|
30 |
+
text = "Meta Platforms ou Meta, anciennement connue sous le nom de Facebook, est une multinationale américaine fondée en 2004 par Mark Zuckerberg."
|
31 |
+
|
32 |
+
model_input = tokenizer(text, return_tensors='pt')
|
33 |
+
model_output = model(**model_input)
|
34 |
+
print(model_output.logits.argmax(2))
|
35 |
+
# tensor([[0, 4, 4, 4, 4, 4, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0,
|
36 |
+
# 0, 0, 0, 2, 2, 2, 2, 2, 0, 0]])
|
37 |
+
```
|