Downloads · 30 days
63
6% of all-time downloads
AdamCodd/t5-small-recipes-ingredients
t5-small-recipes-ingredients is a text generation model from AdamCodd. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as cc-by-nc-4.0.
This model t5-small has been finetuned on a curated recipe dataset.
Downloads · 30 days
63
6% of all-time downloads
All-time downloads
1K
Public
Parameters
60.5M
61.6 GB on disk
Likes
2
Public
Click a slice to open those files.
.pt48.1 GB · 99%
From the Hugging Face model README
This model t5-small has been finetuned on a curated recipe dataset.
It achieves the following results on the evaluation set:
The idea behind this is to generate a few recipe names to consider, based on ingredient inputs. I think it's useful when we have some leftover ingredients and don't know what to cook with them. Ingredients should be input in english with commas between them as shown in the example below.
The license is cc-by-nc-4.0. For commercial use rights, please contact me ([email protected]).
The length of the negative prompt can be adjusted using the max_length parameter (50-60 is fine for recipe names). You can enhance the creativity of the outputs with the temperature setting (note: coherence may significantly degrade if the temperature exceeds 1.2). The parameters no_repeat_ngram_size and repetition_penalty can also be used to slightly improve coherence.
Use num_return_sequences to generate multiple recipes in a single pass (recommended).
from transformers import pipeline
# Initialize the recipe generation pipeline
recipe_generator = pipeline("text2text-generation", model="AdamCodd/t5-small-recipes-ingredients")
# Generate recipes
generated_texts = recipe_generator(
"penne pasta, cherry tomatoes, basil, mozzarella cheese, olive oil",
max_length=50,
do_sample=True,
temperature=1.0,
no_repeat_ngram_size=2,
repetition_penalty=1.2,
num_return_sequences=5,
)
# Extract and print the generated recipes
for i, output in enumerate(generated_texts):
print(f"Recipe {i+1}: {output['generated_text']}")
# Recipe 1: Pasta With Tomatoes And Basil
# Recipe 2: Pasta With Shredded Tomatoes And Mozzarella
# Recipe 3: Penne With Tomato And Basil
# Recipe 4: Penne Fagioli
# Recipe 5: Lemon-Basil Penne
This model has been trained on a not perfectly clean dataset, so the suggestions don't always make sense but it's a minor issue when returning multiple sequences at once. Still, improving the dataset will be the main focus for a future version.
More information needed
The following hyperparameters were used during training:
If you want to support me, you can here.