AdamCodd's picture
Update README.md
a6053b0 verified
|
raw
history blame
3.31 kB
---
license: cc-by-nc-4.0
base_model: t5-small
model-index:
- name: t5-small-recipes-ingredients
results:
- task:
type: text-generation
name: Text Generation
metrics:
- type: loss
value: 0.0453
pipeline_tag: text2text-generation
inference: false
language:
- en
extra_gated_prompt: "To get access to this model, send an email to [email protected] and provide a brief description of your project or application. Requests without this information will not be considered, and access will not be granted under any circumstances."
extra_gated_fields:
Company/University: text
Country: country
---
## t5-small-recipes-ingredients
This model [t5-small](https://huggingface.co/google-t5/t5-small) has been finetuned on a curated recipe dataset.
It achieves the following results on the evaluation set:
* Loss: 0.0453
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]).
## Usage
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).
```python
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.
## Training and evaluation data
More information needed
## Training procedure
### Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 3e-05
- train_batch_size: 32
- eval_batch_size: 64
- seed: 42
- optimizer: AdamW with betas=(0.9,0.999) and epsilon=1e-08
- Mixed precision
- num_epochs: 3
- weight_decay: 0.01
### Framework versions
- Transformers 4.36.2
- Datasets 2.16.1
- Tokenizers 0.15.0
- Evaluate 0.4.1
If you want to support me, you can [here](https://ko-fi.com/adamcodd).