Update README.md
Browse files
README.md
CHANGED
@@ -17,4 +17,41 @@ tags:
|
|
17 |
- MEDIA
|
18 |
---
|
19 |
|
20 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
- MEDIA
|
18 |
---
|
19 |
|
20 |
+
# vpelloin/MEDIA_NLU_flaubert_uncased
|
21 |
+
|
22 |
+
This is a Natural Language Understanding (NLU) model for the French [MEDIA benchmark](https://catalogue.elra.info/en-us/repository/browse/ELRA-S0272/).
|
23 |
+
It maps each input words into outputs concepts tags (76 available).
|
24 |
+
|
25 |
+
This model is a fine-tuning of [`flaubert_base_uncased`](https://huggingface.co/flaubert/flaubert_base_uncased).
|
26 |
+
|
27 |
+
## Usage with Pipeline
|
28 |
+
```python
|
29 |
+
from transformers import pipeline
|
30 |
+
|
31 |
+
generator = pipeline(model="vpelloin/MEDIA_NLU_flaubert_finetuned", task="token-classification")
|
32 |
+
|
33 |
+
print(generator)
|
34 |
+
```
|
35 |
+
|
36 |
+
## Usage with AutoTokenizer/AutoModel
|
37 |
+
```python
|
38 |
+
from transformers import (
|
39 |
+
AutoTokenizer,
|
40 |
+
AutoModelForTokenClassification
|
41 |
+
)
|
42 |
+
|
43 |
+
tokenizer = AutoTokenizer.from_pretrained("vpelloin/MEDIA_NLU_flaubert_uncased")
|
44 |
+
model = AutoModelForTokenClassification.from_pretrained("vpelloin/MEDIA_NLU_flaubert_uncased")
|
45 |
+
|
46 |
+
sentences = [
|
47 |
+
"je voudrais réserver une chambre à paris pour demain et lundi",
|
48 |
+
"d'accord pour l'hôtel à quatre vingt dix euros la nuit",
|
49 |
+
"deux nuits s'il vous plait",
|
50 |
+
"dans un hôtel avec piscine à marseille"
|
51 |
+
]
|
52 |
+
inputs = tokenizer(sentences, padding=True, return_tensors='pt')
|
53 |
+
|
54 |
+
outptus = model(**inputs).logits
|
55 |
+
|
56 |
+
print([[model.config.id2label[i] for i in b] for b in outptus.argmax(dim=-1).tolist()])
|
57 |
+
```
|