Edit model card

chef-gpt

This model is a fine-tuned version of auhide/chef-gpt-base. Visit this website to test it out.

Model Description

This is GPT-2 pretrained on a custom Bulgarian dataset. You can find the dataset here.

The difference between this one and the base version is that this one can also generate recipes based on recipe name.

Usage

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"
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
chef_gpt = AutoModelForCausalLM.from_pretrained(MODEL_ID)

# Prepare the input:
title = "Пиле с ориз"
input_text = f"[TTL]{title}[ING]"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids

# Generate the 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. It includes the ingredients.
recipe = re.findall(r"\[ING\](.+?)\[SEP\]", recipe)[0]

# Format the output text:
recipe = recipe.replace("[ING]", "- ")
recipe = recipe.replace("[EOL]", "\n- ")
recipe = recipe.replace("[REC]", "\n\n")


print("Име на рецепта/Recipe name:")
print(title)
print("\nРецепта/Recipe:")
pprint(recipe)
Име на рецепта/Recipe name:
Пиле с ориз

Рецепта/Recipe:
('- 2 бр. пилешки бутчета\n'
 '- 1 кг зеле\n'
 '- 1 ч.ч. ориз\n'
 '- 1 ч.ч. доматено пюре\n'
 '- 1 глава лук\n'
 '- олио\n'
 '- червен пипер, черен пипер, сол, джоджен, чубрица\n'
 '- целина\n'
 '\n'
 'Бутчетата се сваряват, обезкостяват и месото се накъсва. Лукът се нарязва на '
 'полумесеци е се задушава в олио. Прибавя се нарязаното на ивици зеле. Когато '
 'зелето омекне се слага оризът, а като стане прозрачен се добавят '
 'подправките. Разбърква се добре, полива се с доматеното пюре и 3 ч.ч. от '
 'бульона, в който е вряло месото. Оставя се да ври на тих огън около 20-30 '
 'минути. Ястието се прехвърля в тава и се пече на 250С докато изври водата.')
Downloads last month
0
Inference Examples
Inference API (serverless) has been turned off for this model.

Finetuned from