Downloads · 30 days
38
6% of all-time downloads
auhide/chef-gpt-base
chef-gpt-base is a text generation model from auhide. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
GPT-2 architecture trained to generate recipes based on ingredients. Visit website.
Downloads · 30 days
38
6% of all-time downloads
All-time downloads
624
Public
Parameters
121M
9.9 GB on disk
Likes
1
Public
Click a slice to open those files.
.bin448 MB · 50%
How the weights are stored.
F32109M · 90%
From the Hugging Face model README
GPT-2 architecture trained to generate recipes based on ingredients. Visit website.
This is GPT-2 pretrained on a custom dataset of recipies in Bulgarian. You can find the dataset here.
import re
# Using this library to beautifully print the long recipe string.
from pprint import pprint
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load the model and tokenizer:
MODEL_ID = "auhide/chef-gpt-base"
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
chef_gpt = AutoModelForCausalLM.from_pretrained(MODEL_ID)
# Prepare the input:
ingredients = [
"1 ч.ч. брашно",
"4 яйца",
"1 кофичка кисело мляко",
"1/4 ч.л. сода",
]
input_text = f"[ING]{'[EOL]'.join(ingredients)}[REC]"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
# Generate text:
output = chef_gpt.generate(input_ids, max_length=150)
recipe = tokenizer.batch_decode(output)[0]
# Get the generated recipe - it is up until the 1st [SEP] token.
recipe = re.findall(r"\[REC\](.+?)\[SEP\]", recipe)[0]
print("Съставки/Ingredients:")
pprint(ingredients)
print("\nРецепта/Recipe:")
pprint(recipe)
Съставки/Ingredients:
['1 ч.ч. брашно', '4 яйца', '1 кофичка кисело мляко', '1/4 ч.л. сода']
Рецепта/Recipe:
('В дълбока купа се разбиват яйцата. Добавя се киселото мляко, в което '
'предварително е сложена содата, и се разбива. Добавя се брашното и се омесва '
'тесто. Ако е много гъсто се добавя още малко брашно, ако е много гъсто се '
'добавя още малко брашно. Фурната се загрява предварително на 180С градуса. '
'Когато тестото е готово, се вади от фурната и се разделя на три части.')