Instructions to use auhide/chef-gpt-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use auhide/chef-gpt-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="auhide/chef-gpt-base")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("auhide/chef-gpt-base") model = AutoModelForCausalLM.from_pretrained("auhide/chef-gpt-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use auhide/chef-gpt-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "auhide/chef-gpt-base" # 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-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/auhide/chef-gpt-base
- SGLang
How to use auhide/chef-gpt-base 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-base" \ --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-base", "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-base" \ --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-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use auhide/chef-gpt-base with Docker Model Runner:
docker model run hf.co/auhide/chef-gpt-base
Update README.md
Browse files
README.md
CHANGED
|
@@ -19,9 +19,46 @@ You can find the dataset [here](https://www.kaggle.com/datasets/auhide/bulgarian
|
|
| 19 |
|
| 20 |
## Usage
|
| 21 |
```python
|
|
|
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
```
|
| 24 |
|
|
|
|
| 25 |
## Additional tokens
|
| 26 |
- [ING] - ingredients token; denotes the begining of the tokens representing the ingredients
|
| 27 |
- [EOL] - end-of-line token; equivalent to a newline
|
|
|
|
| 19 |
|
| 20 |
## Usage
|
| 21 |
```python
|
| 22 |
+
import re
|
| 23 |
|
| 24 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
# Load the model and tokenizer:
|
| 28 |
+
MODEL_ID = "auhide/chef-gpt-base"
|
| 29 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
|
| 30 |
+
chef_gpt = AutoModelForCausalLM.from_pretrained(MODEL_ID)
|
| 31 |
+
|
| 32 |
+
# Prepare the input:
|
| 33 |
+
ingredients = [
|
| 34 |
+
"1 ч.ч. брашно",
|
| 35 |
+
"4 яйца",
|
| 36 |
+
"1 кофичка кисело мляко",
|
| 37 |
+
"1/4 ч.л. сода",
|
| 38 |
+
]
|
| 39 |
+
input_text = f"[ING]{'[EOL]'.join(ingredients)}[REC]"
|
| 40 |
+
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
|
| 41 |
+
|
| 42 |
+
# Generate text:
|
| 43 |
+
output = chef_gpt.generate(input_ids, max_length=150)
|
| 44 |
+
recipe = tokenizer.batch_decode(output)[0]
|
| 45 |
+
# Get the generated recipe - it is up until the 1st [SEP] tag.
|
| 46 |
+
recipe = re.findall(r"\[REC\](.+?)\[SEP\]", recipe)[0]
|
| 47 |
+
|
| 48 |
+
print("Съставки/Ingredients:")
|
| 49 |
+
print(ingredients)
|
| 50 |
+
print("\nРецепта/Recipe:")
|
| 51 |
+
print(recipe)
|
| 52 |
+
```
|
| 53 |
+
```bash
|
| 54 |
+
Съставки/Ingredients:
|
| 55 |
+
['1 ч.ч. брашно', '4 яйца', '1 кофичка кисело мляко', '1/4 ч.л. сода']
|
| 56 |
+
|
| 57 |
+
Рецепта/Recipe:
|
| 58 |
+
В дълбока купа се разбиват яйцата. Добавя се киселото мляко, в което предварително е сложена содата, и се разбива. Добавя се брашното и се омесва тесто. Ако е много гъсто се добавя още малко брашно, ако е много гъсто се добавя още малко брашно. Фурната се загрява предварително на 180С градуса. Когато тестото е готово, се вади от фурната и се разделя на три части.
|
| 59 |
```
|
| 60 |
|
| 61 |
+
|
| 62 |
## Additional tokens
|
| 63 |
- [ING] - ingredients token; denotes the begining of the tokens representing the ingredients
|
| 64 |
- [EOL] - end-of-line token; equivalent to a newline
|