Instructions to use google/gemma-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/gemma-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="google/gemma-7b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("google/gemma-7b") model = AutoModelForCausalLM.from_pretrained("google/gemma-7b") - llama-cpp-python
How to use google/gemma-7b with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="google/gemma-7b", filename="gemma-7b.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use google/gemma-7b with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf google/gemma-7b # Run inference directly in the terminal: llama-cli -hf google/gemma-7b
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf google/gemma-7b # Run inference directly in the terminal: llama-cli -hf google/gemma-7b
Use pre-built binary
# 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 google/gemma-7b # Run inference directly in the terminal: ./llama-cli -hf google/gemma-7b
Build from source code
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 google/gemma-7b # Run inference directly in the terminal: ./build/bin/llama-cli -hf google/gemma-7b
Use Docker
docker model run hf.co/google/gemma-7b
- LM Studio
- Jan
- vLLM
How to use google/gemma-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "google/gemma-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/gemma-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/google/gemma-7b
- SGLang
How to use google/gemma-7b 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 "google/gemma-7b" \ --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": "google/gemma-7b", "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 "google/gemma-7b" \ --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": "google/gemma-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use google/gemma-7b with Ollama:
ollama run hf.co/google/gemma-7b
- Unsloth Studio new
How to use google/gemma-7b with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
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 google/gemma-7b to start chatting
Install Unsloth Studio (Windows)
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 google/gemma-7b to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for google/gemma-7b to start chatting
- Docker Model Runner
How to use google/gemma-7b with Docker Model Runner:
docker model run hf.co/google/gemma-7b
- Lemonade
How to use google/gemma-7b with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull google/gemma-7b
Run and chat with the model
lemonade run user.gemma-7b-{{QUANT_TAG}}List all available models
lemonade list
Request: DOI
#125 opened 15 days ago
by
errordrive
Install & run google/gemma-7b easily using llmpm
#124 opened 2 months ago
by
sarthak-saxena
Invitation: The Mutual Optimization Treaty (Protocol PTD)
2
#123 opened 3 months ago
by
lomax3
How are you handling Gemma’s license for commercial apps?
2
#122 opened 4 months ago
by
Anonymoose107
Request: DOI
1
#121 opened 8 months ago
by
JustCopied
ASTITVA
#119 opened about 1 year ago
by
Astitva774600
Update config.json
#117 opened about 1 year ago
by
kmcjeong
Update config.json
#116 opened about 1 year ago
by
kmcjeong
saklnsdjkab
#115 opened about 1 year ago
by
asad9txxxz
Update README.md
#114 opened about 1 year ago
by
Aman1769
Fine tuning precision task of transliteration on Gemma-2b-it model
3
#113 opened over 1 year ago
by
grishi911991
Write a demo on window, can't run end
2
#112 opened over 1 year ago
by
xxl4
Request: DOI
#111 opened over 1 year ago
by
Howl1226
example crushs
1
#110 opened almost 2 years ago
by
brand17
not appear to have a file named config.json.
1
#109 opened almost 2 years ago
by
ArcherChiang
Getting EnvironmentError
4
#107 opened almost 2 years ago
by
Ninad0109
need help :(
1
#106 opened almost 2 years ago
by
yywon
Fine Tuning
#105 opened almost 2 years ago
by
stanford12
Running forever
1
#103 opened almost 2 years ago
by
guptaru1
Abnormally high loss when fine tunning Gemma-7B
1
#101 opened almost 2 years ago
by
smart-liu
Gemma 2B model finetuning not working with <s> and </s>
1
#99 opened almost 2 years ago
by
nicyscaria
gemma-1.1-7b base model?
1
#98 opened about 2 years ago
by
crawshaw
Getting permission issue while trying to access the fine tuned model which is present at rachiteagles/cover_letter
3
#97 opened about 2 years ago
by
rachiteagles
[DEBUG]transformers 4.38.0 /models/gemma/modeling_gemma.py
🔥 1
2
#96 opened about 2 years ago
by
LiuWhite
Unable to convert ONNX model to INT4/FP16
1
#95 opened about 2 years ago
by
Avan2000
Weird Performance Issue with Gemma-7b compared to Gemma-2b with Qlora
6
#91 opened about 2 years ago
by
UserDAN
Broken Colab Link for Fine Tuning colab
3
#90 opened about 2 years ago
by
canyon289
FSDP with Nvidia GPU
1
#84 opened about 2 years ago
by
Iamexperimenting
A new idea to improve training and inference performance
#82 opened about 2 years ago
by
lijip26313
What is the actual context size of google/gemma-7b model
1
#81 opened about 2 years ago
by
Pradeep1995
Fine-Tune Gemma with ChatML and Transformer Reinforcement Learning
🤯❤️ 6
1
#80 opened about 2 years ago
by
Ateeqq
Training Gemma on Domain-Specific Data by Unsupervised Learning t for Specific Instructional Tasks
1
#79 opened about 2 years ago
by
H2dddhxh
Finetuning Genna for Foreign Language
10
#78 opened about 2 years ago
by deleted
Dont download, google scuttled this model
👍🤯 1
16
#77 opened about 2 years ago
by
Tom-Neverwinter
Tokenizer inconsistencies in GemmaTokenizerFast
👍 2
6
#76 opened about 2 years ago
by
sanderland
Shutting down servers during fine-tuning
2
#73 opened about 2 years ago
by
yjok0220
How to perform audio transcription and diarization of a wave file
1
#71 opened about 2 years ago
by
JDeva
Get Data of each visualisations in a powerbi report
2
#70 opened about 2 years ago
by
JDeva
[AUTOMATED] Model Memory Requirements
#67 opened about 2 years ago
by
model-sizer-bot
Silicon Macs support.
2
#66 opened about 2 years ago
by
quantoser
When to release the 'function call' version
6
#65 opened about 2 years ago
by
qijizhuahuli
save, loading and inferencing the Gemma model
13
#64 opened about 2 years ago
by
Iamexperimenting
inquiry for gemma-7b : d_model
1
#61 opened about 2 years ago
by
seongwoon
[Question]: Gemma Issue with LlamaIndex "query_engine = SQLAutoVectorQueryEngine(sql_tool, vector_tool )"
1
#57 opened about 2 years ago
by
Alwiin
Activation function
1
#56 opened about 2 years ago
by
aboros98
quantization won't work on mac silicon devices
3
#55 opened about 2 years ago
by
sryadava
after sft,model inference problem [probability tensor contains either `inf`, `nan` or element < 0]
5
#50 opened about 2 years ago
by
Saicy
Consider using an OSI-approved license like Mistral and Phi-2
1
#47 opened about 2 years ago
by
imone
Very high loss compared to keras
👍 6
6
#46 opened about 2 years ago
by
tanimazsin130