Instructions to use auhide/chef-gpt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use auhide/chef-gpt with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="auhide/chef-gpt")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("auhide/chef-gpt") model = AutoModelForCausalLM.from_pretrained("auhide/chef-gpt", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use auhide/chef-gpt with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "auhide/chef-gpt" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "auhide/chef-gpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/auhide/chef-gpt
- SGLang
How to use auhide/chef-gpt 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 "auhide/chef-gpt" \ --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": "auhide/chef-gpt", "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 "auhide/chef-gpt" \ --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": "auhide/chef-gpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use auhide/chef-gpt with Docker Model Runner:
docker model run hf.co/auhide/chef-gpt
Update README.md
Browse files
README.md
CHANGED
|
@@ -14,4 +14,56 @@ This model is a fine-tuned version of [auhide/chef-gpt-base](https://huggingface
|
|
| 14 |
This is GPT-2 pretrained on a custom dataset.
|
| 15 |
You can find the dataset [here](https://www.kaggle.com/datasets/auhide/bulgarian-recipes-dataset).
|
| 16 |
|
| 17 |
-
The difference between this one and the base version is that this one can also generate recipes based on recipe name.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
This is GPT-2 pretrained on a custom dataset.
|
| 15 |
You can find the dataset [here](https://www.kaggle.com/datasets/auhide/bulgarian-recipes-dataset).
|
| 16 |
|
| 17 |
+
The difference between this one and the base version is that this one can also generate recipes based on recipe name.
|
| 18 |
+
|
| 19 |
+
## Usage
|
| 20 |
+
```python
|
| 21 |
+
import re
|
| 22 |
+
# Using this library to beautifully print the long recipe string.
|
| 23 |
+
from pprint import pprint
|
| 24 |
+
|
| 25 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
# Load the model and tokenizer:
|
| 29 |
+
MODEL_ID = "auhide/chef-gpt"
|
| 30 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
|
| 31 |
+
chef_gpt = AutoModelForCausalLM.from_pretrained(MODEL_ID)
|
| 32 |
+
|
| 33 |
+
# Prepare the input:
|
| 34 |
+
title = "Пиле с ориз"
|
| 35 |
+
input_text = f"[ING]{title}[REC]"
|
| 36 |
+
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
|
| 37 |
+
|
| 38 |
+
# Generate the text:
|
| 39 |
+
output = chef_gpt.generate(input_ids, max_length=150)
|
| 40 |
+
recipe = tokenizer.batch_decode(output)[0]
|
| 41 |
+
# Get the generated recipe - it is up until the 1st [SEP] token. It includes the ingredients.
|
| 42 |
+
recipe = re.findall(r"\[ING\](.+?)\[SEP\]", recipe)[0]
|
| 43 |
+
|
| 44 |
+
print("Име на рецепта/Recipe name:")
|
| 45 |
+
pprint(title)
|
| 46 |
+
print("\nРецепта/Recipe:")
|
| 47 |
+
pprint(recipe)
|
| 48 |
+
```
|
| 49 |
+
```bash
|
| 50 |
+
Име на рецепта/Recipe name:
|
| 51 |
+
Пиле с ориз
|
| 52 |
+
|
| 53 |
+
Рецепта/Recipe:
|
| 54 |
+
('- 2 бр. пилешки бутчета\n'
|
| 55 |
+
'- 1 кг зеле\n'
|
| 56 |
+
'- 1 ч.ч. ориз\n'
|
| 57 |
+
'- 1 ч.ч. доматено пюре\n'
|
| 58 |
+
'- 1 глава лук\n'
|
| 59 |
+
'- олио\n'
|
| 60 |
+
'- червен пипер, черен пипер, сол, джоджен, чубрица\n'
|
| 61 |
+
'- целина\n'
|
| 62 |
+
'\n'
|
| 63 |
+
'Бутчетата се сваряват, обезкостяват и месото се накъсва. Лукът се нарязва на '
|
| 64 |
+
'полумесеци е се задушава в олио. Прибавя се нарязаното на ивици зеле. Когато '
|
| 65 |
+
'зелето омекне се слага оризът, а като стане прозрачен се добавят '
|
| 66 |
+
'подправките. Разбърква се добре, полива се с доматеното пюре и 3 ч.ч. от '
|
| 67 |
+
'бульона, в който е вряло месото. Оставя се да ври на тих огън около 20-30 '
|
| 68 |
+
'минути. Ястието се прехвърля в тава и се пече на 250С докато изври водата.')
|
| 69 |
+
```
|