commit from nbouali
Browse files- .ipynb_checkpoints/README-checkpoint.md +0 -0
- README.md +36 -0
- config.json +98 -0
- merges.txt +0 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- tokenizer_config.json +1 -0
- vocab.json +0 -0
.ipynb_checkpoints/README-checkpoint.md
ADDED
File without changes
|
README.md
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# FlauBert finetuned on French cooking recipes
|
2 |
+
|
3 |
+
This model is finetuned on a sequence classification task that associate each sequence to the appropriate recipe category.
|
4 |
+
|
5 |
+
### How to use it ?
|
6 |
+
|
7 |
+
```python
|
8 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
9 |
+
from transformers import TextClassificationPipeline
|
10 |
+
|
11 |
+
loaded_tokenizer = AutoTokenizer.from_pretrained("nbouali/flaubert-base-uncased-finetuned-cooking")
|
12 |
+
loaded_model = AutoModelForSequenceClassification.from_pretrained("nbouali/flaubert-base-uncased-finetuned-cooking")
|
13 |
+
|
14 |
+
nlp = TextClassificationPipeline(model=loaded_model,tokenizer=loaded_tokenizer,task="Recipe classification")
|
15 |
+
|
16 |
+
print(nlp("Lasagnes à la bolognaise"))
|
17 |
+
```
|
18 |
+
|
19 |
+
```
|
20 |
+
[{'label': 'LABEL_6', 'score': 0.9921900033950806}]
|
21 |
+
```
|
22 |
+
### Label encoding
|
23 |
+
|
24 |
+
| label | Recipe Category |
|
25 |
+
|:------:|:--------------:|
|
26 |
+
| 0 |'Accompagnement' |
|
27 |
+
| 1 | 'Amuse-gueule' |
|
28 |
+
| 2 | 'Boisson' |
|
29 |
+
| 3 | 'Confiserie' |
|
30 |
+
| 4 | 'Dessert'|
|
31 |
+
| 5 | 'Entrée' |
|
32 |
+
| 6 |'Plat principal' |
|
33 |
+
| 7 | 'Sauce' |
|
34 |
+
|
35 |
+
|
36 |
+
If you would like to know more about this model you can refer to [our blog post](https://medium.com/unify-data-office/a-cooking-language-model-fine-tuned-on-dozens-of-thousands-of-french-recipes-bcdb8e560571)
|
config.json
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"amp": 1,
|
3 |
+
"architectures": [
|
4 |
+
"FlaubertForSequenceClassification"
|
5 |
+
],
|
6 |
+
"asm": false,
|
7 |
+
"attention_dropout": 0.1,
|
8 |
+
"bos_index": 0,
|
9 |
+
"bos_token_id": 0,
|
10 |
+
"bptt": 512,
|
11 |
+
"causal": false,
|
12 |
+
"clip_grad_norm": 5,
|
13 |
+
"dropout": 0.1,
|
14 |
+
"emb_dim": 768,
|
15 |
+
"embed_init_std": 0.02209708691207961,
|
16 |
+
"encoder_only": true,
|
17 |
+
"end_n_top": 5,
|
18 |
+
"eos_index": 1,
|
19 |
+
"fp16": true,
|
20 |
+
"gelu_activation": true,
|
21 |
+
"group_by_size": true,
|
22 |
+
"id2label": {
|
23 |
+
"0": "LABEL_0",
|
24 |
+
"1": "LABEL_1",
|
25 |
+
"2": "LABEL_2",
|
26 |
+
"3": "LABEL_3",
|
27 |
+
"4": "LABEL_4",
|
28 |
+
"5": "LABEL_5",
|
29 |
+
"6": "LABEL_6",
|
30 |
+
"7": "LABEL_7"
|
31 |
+
},
|
32 |
+
"id2lang": {
|
33 |
+
"0": "fr"
|
34 |
+
},
|
35 |
+
"init_std": 0.02,
|
36 |
+
"is_encoder": true,
|
37 |
+
"label2id": {
|
38 |
+
"LABEL_0": 0,
|
39 |
+
"LABEL_1": 1,
|
40 |
+
"LABEL_2": 2,
|
41 |
+
"LABEL_3": 3,
|
42 |
+
"LABEL_4": 4,
|
43 |
+
"LABEL_5": 5,
|
44 |
+
"LABEL_6": 6,
|
45 |
+
"LABEL_7": 7
|
46 |
+
},
|
47 |
+
"lang2id": {
|
48 |
+
"fr": 0
|
49 |
+
},
|
50 |
+
"lang_id": 0,
|
51 |
+
"langs": [
|
52 |
+
"fr"
|
53 |
+
],
|
54 |
+
"layer_norm_eps": 1e-12,
|
55 |
+
"layerdrop": 0.0,
|
56 |
+
"lg_sampling_factor": -1,
|
57 |
+
"lgs": "fr",
|
58 |
+
"mask_index": 5,
|
59 |
+
"mask_token_id": 0,
|
60 |
+
"max_batch_size": 0,
|
61 |
+
"max_position_embeddings": 512,
|
62 |
+
"max_vocab": -1,
|
63 |
+
"mlm_steps": [
|
64 |
+
[
|
65 |
+
"fr",
|
66 |
+
null
|
67 |
+
]
|
68 |
+
],
|
69 |
+
"model_type": "flaubert",
|
70 |
+
"n_heads": 12,
|
71 |
+
"n_langs": 1,
|
72 |
+
"n_layers": 12,
|
73 |
+
"output_hidden_states": true,
|
74 |
+
"pad_index": 2,
|
75 |
+
"pad_token_id": 2,
|
76 |
+
"pre_norm": false,
|
77 |
+
"sample_alpha": 0,
|
78 |
+
"share_inout_emb": true,
|
79 |
+
"sinusoidal_embeddings": false,
|
80 |
+
"start_n_top": 5,
|
81 |
+
"summary_activation": null,
|
82 |
+
"summary_first_dropout": 0.1,
|
83 |
+
"summary_proj_to_labels": true,
|
84 |
+
"summary_type": "first",
|
85 |
+
"summary_use_proj": true,
|
86 |
+
"tokens_per_batch": -1,
|
87 |
+
"unk_index": 3,
|
88 |
+
"use_lang_emb": true,
|
89 |
+
"vocab_size": 67542,
|
90 |
+
"word_blank": 0,
|
91 |
+
"word_dropout": 0,
|
92 |
+
"word_keep": 0.1,
|
93 |
+
"word_mask": 0.8,
|
94 |
+
"word_mask_keep_rand": "0.8,0.1,0.1",
|
95 |
+
"word_pred": 0.15,
|
96 |
+
"word_rand": 0.1,
|
97 |
+
"word_shuffle": 0
|
98 |
+
}
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1e6bba1825513a12f9986fdc4af4db785a855d9d6f5d9b7187e7538ac73fa4f1
|
3 |
+
size 549355707
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"bos_token": "<s>", "unk_token": "<unk>", "sep_token": "</s>", "pad_token": "<pad>", "cls_token": "</s>", "mask_token": "<special1>", "additional_special_tokens": ["<special0>", "<special1>", "<special2>", "<special3>", "<special4>", "<special5>", "<special6>", "<special7>", "<special8>", "<special9>"]}
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"do_lowercase": true, "do_lower_case": true, "model_max_length": 512}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|