Text Generation
Transformers
Safetensors
English
t5
text2text-generation
LoRA
recipe
cooking
fine-tuning
text-generation-inference
Instructions to use MahmutCanBoran/t5-recipe-card-en-lora-merged with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MahmutCanBoran/t5-recipe-card-en-lora-merged with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MahmutCanBoran/t5-recipe-card-en-lora-merged")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("MahmutCanBoran/t5-recipe-card-en-lora-merged") model = AutoModelForSeq2SeqLM.from_pretrained("MahmutCanBoran/t5-recipe-card-en-lora-merged") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MahmutCanBoran/t5-recipe-card-en-lora-merged with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MahmutCanBoran/t5-recipe-card-en-lora-merged" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MahmutCanBoran/t5-recipe-card-en-lora-merged", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/MahmutCanBoran/t5-recipe-card-en-lora-merged
- SGLang
How to use MahmutCanBoran/t5-recipe-card-en-lora-merged with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "MahmutCanBoran/t5-recipe-card-en-lora-merged" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MahmutCanBoran/t5-recipe-card-en-lora-merged", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "MahmutCanBoran/t5-recipe-card-en-lora-merged" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MahmutCanBoran/t5-recipe-card-en-lora-merged", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use MahmutCanBoran/t5-recipe-card-en-lora-merged with Docker Model Runner:
docker model run hf.co/MahmutCanBoran/t5-recipe-card-en-lora-merged
# Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("MahmutCanBoran/t5-recipe-card-en-lora-merged")
model = AutoModelForSeq2SeqLM.from_pretrained("MahmutCanBoran/t5-recipe-card-en-lora-merged")Quick Links
π³ Recipe Card Generator (T5-small + LoRA merged)
This model generates recipe cards (title, ingredients, and step-by-step directions) from a list of ingredients.
It is fine-tuned from t5-small using LoRA adapters and merged into a standalone checkpoint.
β¨ Model Details
- Base model:
t5-small - Fine-tuning method: LoRA (rank=16, Ξ±=32, dropout=0.05, query/value projection layers)
- Dataset: Custom JSONL (
input_text,target_textpairs), originally prepared from a Kaggle recipe dataset. - Task: Text-to-Text Generation
π₯ Usage
from transformers import T5ForConditionalGeneration, T5TokenizerFast
tok = T5TokenizerFast.from_pretrained("MahmutCanBoran/t5-recipe-card-en-lora-merged")
model = T5ForConditionalGeneration.from_pretrained("MahmutCanBoran/t5-recipe-card-en-lora-merged").eval()
prompt = "STRICT=yes | Ingredients: 1 cup sugar, 2 cups flour, 1/2 cup butter"
enc = tok(prompt, return_tensors="pt")
out = model.generate(
**enc,
max_new_tokens=160,
num_beams=4,
length_penalty=0.8,
no_repeat_ngram_size=3
)
print(tok.decode(out[0], skip_special_tokens=True))
π Example
Input:
STRICT=yes | Ingredients: 1 cup milk, 2 eggs, 1 cup flour
Output:
Title: Pancakes
Ingredients:
- 1 cup milk
- 2 eggs
- 1 cup flour
Directions:
1. Whisk eggs and milk.
2. Add flour slowly.
3. Cook on pan.
Time: 20-60 minutes
Servings: 4
## π Features
- **Input**: Raw ingredient list (e.g., `"chicken breast, yogurt, garlic, salt, pepper"`).
- **Output**: Structured **recipe card** with:
- Title suggestion π
- Ingredients (cleaned + normalized) π§
- Step-by-step cooking instructions π²
- Optional serving tips π½οΈ
- Supports **strict** and **flexible** generation modes:
- `STRICT=yes` β Uses **only** given ingredients
- `STRICT=no` β Allows creative variations
---
## βοΈ Installation
```bash
# Clone repo
git clone https://github.com/<your-username>/recipe-card-t5-lora.git
cd recipe-card-t5-lora
# Create environment
python -m venv venv
source venv/bin/activate # (Windows: venv\Scripts\activate)
# Install dependencies
pip install -r requirements.txt
pip install transformers peft torch
from transformers import pipeline
pipe = pipeline("text2text-generation", model="MahmutCanBoran/t5-recipe-card-en-lora-merged")
β οΈ Limitations
Time/Servings fields are currently fixed values (20-60 minutes, Servings: 4).
Model may hallucinate instructions if STRICT=no mode is used (future work: add dataset with variable strictness).
Optimized for English outputs.
- Downloads last month
- 17
Model tree for MahmutCanBoran/t5-recipe-card-en-lora-merged
Base model
google-t5/t5-small
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MahmutCanBoran/t5-recipe-card-en-lora-merged")