Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- bg
|
4 |
+
license: mit
|
5 |
+
pipeline_tag: text-generation
|
6 |
+
model-index:
|
7 |
+
- name: chef-gpt-en
|
8 |
+
results: []
|
9 |
+
---
|
10 |
+
|
11 |
+
|
12 |
+
# chef-gpt
|
13 |
+
|
14 |
+
Fine-tuned GPT-2 on recipe generation. [This](https://www.kaggle.com/datasets/thedevastator/better-recipes-for-a-better-life) is the dataset that it's trained on.
|
15 |
+
|
16 |
+
## Usage
|
17 |
+
```python
|
18 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
19 |
+
|
20 |
+
|
21 |
+
MODEL_ID = "auhide/chef-gpt-en"
|
22 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
|
23 |
+
chef_gpt = AutoModelForCausalLM.from_pretrained(MODEL_ID)
|
24 |
+
|
25 |
+
ingredients = ", ".join([
|
26 |
+
"spaghetti",
|
27 |
+
"tomatoes",
|
28 |
+
"basel",
|
29 |
+
"salt",
|
30 |
+
"chicken",
|
31 |
+
])
|
32 |
+
prompt = f"Ingredients: {ingredients}; Recipe:"
|
33 |
+
tokens = chef_gpt.tokenizer(prompt, return_tensors="pt")
|
34 |
+
|
35 |
+
recipe = chef_gpt.generate(**tokens, max_length=124)
|
36 |
+
print(recipe)
|
37 |
+
```
|
38 |
+
Here is a sample result of the prompt:
|
39 |
+
```bash
|
40 |
+
Ingredients: spaghetti, tomatoes, basel, salt, chicken; Recipe: Bring a large pot of water to a boil in a medium heat; add enough water to cover the bottom of the pot. Squeeze cooked pasta out of the water,
|
41 |
+
```
|