--- license: mit language: en tags: - recipe-recommendation - gpt2 - lora - cooking - food base_model: gpt2 --- # Recipe GPT-2 LoRA Model A fine-tuned GPT-2 model for recipe recommendations using LoRA (Low-Rank Adaptation). ## Model Description This model generates personalized recipe suggestions based on: - Available ingredients - Dietary preferences - Cooking time constraints - Cuisine preferences ## Usage ```python 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) ``` ## Training Data Trained on a recipe dataset with user interactions and ratings, fine-tuned to provide conversational recipe recommendations. ## Model Details - **Base Model**: GPT-2 - **Fine-tuning Method**: LoRA (Low-Rank Adaptation) - **Training Framework**: Transformers + PEFT - **Language**: English - **Task**: Conversational recipe recommendation ## Limitations - English language only - May generate fictional recipe names - Nutritional information not guaranteed to be accurate - Requires proper prompt format for optimal results ## Prompt Format 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: ``` ## Citation 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} } ```