YAML Metadata Warning: The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other

FLAN-T5-Small Recipe Generator

Model Description

This model is a fine-tuned version of google/flan-t5-small specifically optimized for recipe generation. It can create detailed, step-by-step cooking instructions based on a list of ingredients.

Model Details

  • Base Model: google/flan-t5-small (80M parameters)
  • Fine-tuning Method: LoRA (Low-Rank Adaptation)
  • Training Data: High-quality recipe dataset with professional cooking instructions
  • Model Size: ~3.4 MB (LoRA adapter only)
  • Precision: Float32
  • Max Input Length: 512 tokens

Key Features

Instruction-Following: Responds to natural language prompts ✅ Detailed Recipes: Generates step-by-step cooking instructions ✅ Professional Quality: Includes temperatures, timing, and techniques ✅ Memory Efficient: Uses LoRA for minimal storage requirements ✅ CPU Compatible: Optimized for CPU inference with 16GB RAM

Usage

Quick Start

from transformers import T5ForConditionalGeneration, T5Tokenizer
from peft import PeftModel

# Load base model and tokenizer
base_model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-small")
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-small")

# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "Chama99/flan-t5-small-recipe-generator")

# Generate recipe
def generate_recipe(ingredients):
    prompt = f"Create a detailed recipe using these ingredients: {ingredients}. Include step-by-step cooking instructions:"

    inputs = tokenizer(prompt, return_tensors="pt", max_length=512, truncation=True)

    with torch.no_grad():
        outputs = model.generate(
            **inputs,
            max_length=400,
            num_beams=5,
            temperature=0.8,
            do_sample=True,
            repetition_penalty=1.4,
            no_repeat_ngram_size=3
        )

    recipe = tokenizer.decode(outputs[0], skip_special_tokens=True)
    return recipe.replace(prompt, "").strip()

# Example usage
ingredients = "chicken, mushrooms, garlic, cream"
recipe = generate_recipe(ingredients)
print(recipe)
Downloads last month
9
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Chama99/flan-t5-small-recipe-generator

Adapter
(54)
this model

Space using Chama99/flan-t5-small-recipe-generator 1