Instructions to use google/gemma-2-9b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/gemma-2-9b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="google/gemma-2-9b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b") model = AutoModelForCausalLM.from_pretrained("google/gemma-2-9b") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use google/gemma-2-9b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "google/gemma-2-9b" # 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-2-9b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/google/gemma-2-9b
- SGLang
How to use google/gemma-2-9b 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-2-9b" \ --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-2-9b", "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-2-9b" \ --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-2-9b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use google/gemma-2-9b with Docker Model Runner:
docker model run hf.co/google/gemma-2-9b
Why does this model use left-padding by default?
2
#42 opened over 1 year ago
by
smbslt3
Can't get repositories permissions for google/gemma-2-9b (can only see google/gemma-2-2b)
1
#40 opened over 1 year ago
by
Connor-Watts
What's the quantization format of 4bit / 8bit?
1
#39 opened over 1 year ago
by
WatermelonEast
Update README.md
#38 opened over 1 year ago
by
tylee123
Does Gemma 2 9B Support All Listed Languages on the Gemini 1.5 Page?
2
#33 opened almost 2 years ago
by
i18n-site
dtype: float32 in base model vs. dtype: bfloat16 in the instruction fine-tuned model
1
#32 opened almost 2 years ago
by
tanliboy
Update tokenizer_config.json
#31 opened almost 2 years ago
by
reach-vb
Issues with FSDP and DeepSpeed During Distributed Training for Gemma
👍 2
5
#30 opened almost 2 years ago
by
anandhperumal
AttributeError: module 'torch._dynamo' has no attribute 'mark_static_address'
🚀➕ 14
6
#29 opened almost 2 years ago
by
AsirAsir
CUDA usage is low
1
#28 opened almost 2 years ago
by
Max545
Fine-tuning Hyperparameters
8
#27 opened almost 2 years ago
by
tanliboy
Error
3
#25 opened almost 2 years ago
by
ImpactInsights
RuntimeError: Index put requires the source and destination dtypes match, got BFloat16 for the destination and Float for the source.
➕ 4
13
#24 opened almost 2 years ago
by
saireddy
Gemma 2's Flash attention 2 implementation is strange...
61
#23 opened almost 2 years ago
by
GPT007
Request: DOI
1
#21 opened almost 2 years ago
by
Benjitable
Inference error
9
#20 opened almost 2 years ago
by
gsasikiran
16 or 32 bit?
1
#19 opened almost 2 years ago
by
ChrisGoringe
model.generate is throwing AttributeError: 'HybridCache' object has no attribute 'float'
7
#18 opened almost 2 years ago
by
saireddy
ValueError: Transformers does not recognize this architecture.
5
#15 opened almost 2 years ago
by
mike202303
Model repeating information and "spitting out" random characters
8
#14 opened almost 2 years ago
by
brazilianslib
Update README.md
❤️ 1
#13 opened almost 2 years ago
by
Criztov
TypeError: arange() received an invalid combination of arguments
4
#12 opened almost 2 years ago
by
darrenbudiman
Aaa
1
#9 opened almost 2 years ago
by
mohamedzairi
Gemma2FlashAttention2 missing sliding_window variable
🚀 7
2
#8 opened almost 2 years ago
by
emozilla