corbt/all-recipes
Viewer • Updated • 2.15M • 5.1k • 60
How to use ClaireLee2429/gemma-2b-recipes-gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="ClaireLee2429/gemma-2b-recipes-gguf", filename="model.q4_k_m.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
How to use ClaireLee2429/gemma-2b-recipes-gguf with llama.cpp:
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf ClaireLee2429/gemma-2b-recipes-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf ClaireLee2429/gemma-2b-recipes-gguf:Q4_K_M
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf ClaireLee2429/gemma-2b-recipes-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf ClaireLee2429/gemma-2b-recipes-gguf:Q4_K_M
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf ClaireLee2429/gemma-2b-recipes-gguf:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf ClaireLee2429/gemma-2b-recipes-gguf:Q4_K_M
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf ClaireLee2429/gemma-2b-recipes-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf ClaireLee2429/gemma-2b-recipes-gguf:Q4_K_M
docker model run hf.co/ClaireLee2429/gemma-2b-recipes-gguf:Q4_K_M
How to use ClaireLee2429/gemma-2b-recipes-gguf with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "ClaireLee2429/gemma-2b-recipes-gguf"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ClaireLee2429/gemma-2b-recipes-gguf",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/ClaireLee2429/gemma-2b-recipes-gguf:Q4_K_M
How to use ClaireLee2429/gemma-2b-recipes-gguf with Ollama:
ollama run hf.co/ClaireLee2429/gemma-2b-recipes-gguf:Q4_K_M
How to use ClaireLee2429/gemma-2b-recipes-gguf with Unsloth Studio:
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for ClaireLee2429/gemma-2b-recipes-gguf to start chatting
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for ClaireLee2429/gemma-2b-recipes-gguf to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for ClaireLee2429/gemma-2b-recipes-gguf to start chatting
How to use ClaireLee2429/gemma-2b-recipes-gguf with Docker Model Runner:
docker model run hf.co/ClaireLee2429/gemma-2b-recipes-gguf:Q4_K_M
How to use ClaireLee2429/gemma-2b-recipes-gguf with Lemonade:
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ClaireLee2429/gemma-2b-recipes-gguf:Q4_K_M
lemonade run user.gemma-2b-recipes-gguf-Q4_K_M
lemonade list
Quantized GGUF version of google/gemma-2b fine-tuned on recipe data for recipe generation.
| Base model | google/gemma-2b |
| LoRA adapter | ClaireLee2429/gemma-2b-recipes-lora |
| Training data | corbt/all-recipes |
| Quantization | Q4_K_M (4-bit, K-means) |
| File size | ~1.5 GB |
| Context length | 8192 tokens |
| Format | GGUF (llama.cpp compatible) |
convert_hf_to_gguf.py from llama.cppllama-quantizefrom huggingface_hub import hf_hub_download
from llama_cpp import Llama
model_path = hf_hub_download(
repo_id="ClaireLee2429/gemma-2b-recipes-gguf",
filename="model.q4_k_m.gguf",
)
llm = Llama(model_path=model_path, n_threads=8, n_ctx=2048)
output = llm.create_completion(
"Recipe for chocolate chip cookies:\n",
max_tokens=256,
temperature=0.7,
top_p=0.9,
repeat_penalty=1.2,
)
print(output["choices"][0]["text"])
./llama-cli -m model.q4_k_m.gguf -p "Recipe for pasta carbonara:" -n 256
Recipe for chocolate chip cookies:
- 1/2 cup butter
- 1/3 cup sugar
- 1 egg
- 1/4 teaspoon vanilla
- 2/3 cup white flour
- 1/3 cup all-purpose flour
- 1/8 teaspoon baking soda
- 1/8 teaspoon salt
- 1/2 teaspoon cinnamon
- 1/4 cup chocolate chips
Directions:
- Sift together the flours.
- Add in salt and baking powder and mix.
- Add in vanilla, egg and sugar and mix well.
- Roll out on a lightly floured board and cut into desired shapes
and place on an ungreased cookie sheet.
- Bake at 375 degrees for 10-12 minutes.
Benchmarked on Apple M-series (Metal) and estimated for CPU-only server:
| Environment | Time to first token | Tokens/sec |
|---|---|---|
| Apple Silicon (Metal) | ~0.1s | ~90 tok/s |
| 8 vCPU server (CPU only) | ~1-2s | ~10-20 tok/s |
4-bit
Base model
google/gemma-2b