Instructions to use google/gemma-2-27b-it with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/gemma-2-27b-it with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="google/gemma-2-27b-it") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-27b-it") model = AutoModelForCausalLM.from_pretrained("google/gemma-2-27b-it") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use google/gemma-2-27b-it with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "google/gemma-2-27b-it" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/gemma-2-27b-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/google/gemma-2-27b-it
- SGLang
How to use google/gemma-2-27b-it 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-27b-it" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/gemma-2-27b-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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-27b-it" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/gemma-2-27b-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use google/gemma-2-27b-it with Docker Model Runner:
docker model run hf.co/google/gemma-2-27b-it
Build Real-Time Conversational Agents with 56+ Models via NexaAPI (Gemini Flash Alternative)
1
#44 opened about 2 months ago
by
nickyni
Install & run google/gemma-2-27b-it easily using llmpm
#43 opened 2 months ago
by
sarthak-saxena
Generate unknown output
👀 1
6
#42 opened about 1 year ago
by
raminh921
Gemma enable system prompt
👍 3
3
#40 opened over 1 year ago
by
muhammedalkhy
Can't replicate MMLU results for 27b...
4
#39 opened over 1 year ago
by
cinjonr
What is the difference between "google/gemma-2-27b-it" and "google/gemma-2-27b models"
3
#38 opened over 1 year ago
by
GeniusMind
Can multiple NVIDIA T4 GPUs be used to deploy Gemma2-27B-IT?
2
#36 opened over 1 year ago
by
armanZhou
Update bitsandbytes examples
2
#33 opened almost 2 years ago
by
mdouglas
4 bit and 8 bit bnb quants only generate empty strings or one token repeated endlessly
3
#32 opened almost 2 years ago
by
nicorinn-google
gemma-2-27b-it Model Access
2
#30 opened almost 2 years ago
by
RAGUWING
BIG UPDATE?
5
#26 opened almost 2 years ago
by
GPT007
Does mac book pro m3max 48GB can load gemma2-27b?
3
#23 opened almost 2 years ago
by
omenlyd
__ output
3
#19 opened almost 2 years ago
by
BigDeeper
What code was this trained on?
3
#18 opened almost 2 years ago
by
grothetr
Exl Quants Please
2
#15 opened almost 2 years ago
by
rjmehta
JAX/Flax Implementation
🤝 1
12
#13 opened almost 2 years ago
by
lemon-mint
Model repeating information and "spitting out" random characters
4
#12 opened almost 2 years ago
by
brazilianslib
RuntimeError: CUDA error: device-side assert triggered
👍 9
5
#11 opened almost 2 years ago
by
Dramilio
Citation URL redirects to Gemma-1
3
#8 opened almost 2 years ago
by
yumemio
Asking same thing twice or thrice in hugging face chat breaks it , same thing on ollama
2
#7 opened almost 2 years ago
by
Jayakumark