Update README.md
Browse files
README.md
CHANGED
|
@@ -6,31 +6,14 @@ tags:
|
|
| 6 |
- text-generation
|
| 7 |
- recipe-generation
|
| 8 |
pipeline_tag: text2text-generation
|
| 9 |
-
widget:
|
| 10 |
-
- text: "provolone cheese, bacon, bread, ginger"
|
| 11 |
-
- text: "sugar, crunchy jif peanut butter, cornflakes"
|
| 12 |
-
- text: "sweet butter, confectioners sugar, flaked coconut, condensed milk, nuts, vanilla, dipping chocolate"
|
| 13 |
-
- text: "macaroni, butter, salt, bacon, milk, flour, pepper, cream corn"
|
| 14 |
-
- text: "hamburger, sausage, onion, regular, american cheese, colby cheese"
|
| 15 |
-
- text: "chicken breasts, onion, garlic, great northern beans, black beans, green chilies, broccoli, garlic oil, butter, cajun seasoning, salt, oregano, thyme, black pepper, basil, worcestershire sauce, chicken broth, sour cream, chardonnay wine"
|
| 16 |
-
- text: "serrano peppers, garlic, celery, oregano, canola oil, vinegar, water, kosher salt, salt, black pepper"
|
| 17 |
-
---
|
| 18 |
-
|
| 19 |
-

|
| 20 |
-
|
| 21 |
-
# Chef Transformer (T5)
|
| 22 |
-
> This is part of the
|
| 23 |
-
[Flax/Jax Community Week](https://discuss.huggingface.co/t/recipe-generation-model/7475), organized by [HuggingFace](https://huggingface.co/) and TPU usage sponsored by Google.
|
| 24 |
-
|
| 25 |
-
Want to give it a try? Then what's the wait, head over to Hugging Face Spaces [here](https://huggingface.co/spaces/flax-community/chef-transformer).
|
| 26 |
-
|
| 27 |
|
| 28 |
## Team Members
|
| 29 |
-
-
|
| 30 |
-
-
|
| 31 |
-
-
|
| 32 |
-
-
|
| 33 |
-
-
|
|
|
|
| 34 |
|
| 35 |
## Dataset
|
| 36 |
|
|
@@ -80,7 +63,7 @@ pip install transformers
|
|
| 80 |
from transformers import FlaxAutoModelForSeq2SeqLM
|
| 81 |
from transformers import AutoTokenizer
|
| 82 |
|
| 83 |
-
MODEL_NAME_OR_PATH = "
|
| 84 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME_OR_PATH, use_fast=True)
|
| 85 |
model = FlaxAutoModelForSeq2SeqLM.from_pretrained(MODEL_NAME_OR_PATH)
|
| 86 |
|
|
@@ -157,10 +140,11 @@ def generation_function(texts):
|
|
| 157 |
```
|
| 158 |
|
| 159 |
```python
|
| 160 |
-
items = [
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
|
|
|
| 164 |
generated = generation_function(items)
|
| 165 |
for text in generated:
|
| 166 |
sections = text.split("\n")
|
|
@@ -223,24 +207,4 @@ Output:
|
|
| 223 |
- 6: Place the sandwich in the skillet and cook until the cheese is melted and the bread is golden brown.
|
| 224 |
----------------------------------------------------------------------------------------------------------------------------------
|
| 225 |
```
|
| 226 |
-
|
| 227 |
-
## Evaluation
|
| 228 |
-
Since the test set is not available, we will evaluate the model based on a shared test set. This test set consists of 5% of the whole test (*= 5,000 records*),
|
| 229 |
-
and we will generate five recipes for each input(*= 25,000 records*).
|
| 230 |
-
The following table summarizes the scores obtained by the **Chef Transformer** and **RecipeNLG** as our baseline.
|
| 231 |
-
|
| 232 |
-
| Model | COSIM | WER | ROUGE-2 | BLEU | GLEU | METEOR |
|
| 233 |
-
|:------------------------------------------------------------------------:|:----------:|:----------:|:----------:|:----------:|:----------:|:----------:|
|
| 234 |
-
| [RecipeNLG](https://huggingface.co/mbien/recipenlg) | 0.5723 | 1.2125 | 0.1354 | 0.1164 | 0.1503 | 0.2309 |
|
| 235 |
-
| [Chef Transformer](huggingface.co/flax-community/t5-recipe-generation) * | **0.7282** | **0.7613** | **0.2470** | **0.3245** | **0.2624** | **0.4150** |
|
| 236 |
-
|
| 237 |
-
*From the 5 generated recipes corresponding to each NER (food items), only the highest score was taken into account in the WER, COSIM, and ROUGE metrics. At the same time, BLEU, GLEU, Meteor were designed to have many possible references.*
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
## Copyright
|
| 241 |
-
|
| 242 |
-
Special thanks to those who provided these fantastic materials.
|
| 243 |
-
- [Anatomy](https://www.flaticon.com/free-icon)
|
| 244 |
-
- [Chef Hat](https://www.vecteezy.com/members/jellyfishwater)
|
| 245 |
-
- [Moira Nazzari](https://pixabay.com/photos/food-dessert-cake-eggs-butter-3048440/)
|
| 246 |
-
- [Instagram Post](https://www.freepik.com/free-psd/recipes-ad-social-media-post-template_11520617.htm)
|
|
|
|
| 6 |
- text-generation
|
| 7 |
- recipe-generation
|
| 8 |
pipeline_tag: text2text-generation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
## Team Members
|
| 11 |
+
- Prajay ([JustAPR](https://huggingface.co/JustAPR))
|
| 12 |
+
- Ajitesh
|
| 13 |
+
- Umesh
|
| 14 |
+
- Avinash
|
| 15 |
+
- Vikas
|
| 16 |
+
- Varshith
|
| 17 |
|
| 18 |
## Dataset
|
| 19 |
|
|
|
|
| 63 |
from transformers import FlaxAutoModelForSeq2SeqLM
|
| 64 |
from transformers import AutoTokenizer
|
| 65 |
|
| 66 |
+
MODEL_NAME_OR_PATH = "JustAPR/resGen"
|
| 67 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME_OR_PATH, use_fast=True)
|
| 68 |
model = FlaxAutoModelForSeq2SeqLM.from_pretrained(MODEL_NAME_OR_PATH)
|
| 69 |
|
|
|
|
| 140 |
```
|
| 141 |
|
| 142 |
```python
|
| 143 |
+
items = []
|
| 144 |
+
a = input()
|
| 145 |
+
for x in range(3):#to generate 3 recipies on given ingridents
|
| 146 |
+
items.append(a)
|
| 147 |
+
|
| 148 |
generated = generation_function(items)
|
| 149 |
for text in generated:
|
| 150 |
sections = text.split("\n")
|
|
|
|
| 207 |
- 6: Place the sandwich in the skillet and cook until the cheese is melted and the bread is golden brown.
|
| 208 |
----------------------------------------------------------------------------------------------------------------------------------
|
| 209 |
```
|
| 210 |
+
## Copyright
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|