Downloads · 30 days
0
nutrientartcd/recipe-gpt2-lora
recipe-gpt2-lora is a machine learning model from nutrientartcd. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
A fine-tuned GPT-2 model for recipe recommendations using LoRA (Low-Rank Adaptation).
Downloads · 30 days
0
Access
Public
Updated Aug 25, 2025
Repo size
4.7 MB
Likes
0
Public
Click a slice to open those files.
.safetensors4.7 MB · 50%
From the Hugging Face model README
A fine-tuned GPT-2 model for recipe recommendations using LoRA (Low-Rank Adaptation).
This model generates personalized recipe suggestions based on:
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
# Load base model and tokenizer
base_model = AutoModelForCausalLM.from_pretrained("gpt2")
tokenizer = AutoTokenizer.from_pretrained("gpt2")
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "nutrientartcd/recipe-gpt2-lora")
# Generate recipe suggestion
prompt = "User: I have chicken, garlic, rice. I'm looking for something ready in about 30 minutes.\nAssistant: "
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=100, temperature=0.7)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
Trained on a recipe dataset with user interactions and ratings, fine-tuned to provide conversational recipe recommendations.
The model expects prompts in this conversation format:
User: I have [ingredients]. I'm looking for something ready in about [time] minutes. Preferences: [preferences].
Assistant:
If you use this model, please cite:
@misc{nutrient-recipe-gpt2-lora,
title={Recipe GPT-2 LoRA Model},
author={NutrientAI},
year={2025},
url={https://huggingface.co/nutrientartcd/recipe-gpt2-lora}
}