google-deepmind /gemma
Gemma open-weight LLM library, from Google DeepMind
★ 5,852⑂ 1,044👁 61⑃ 581● 205▤ 18
+3
日增长
5,852
stars
1,044
forks
61
watchers
581
prs
205
issues
18
releases
README
Gemma
Gemma is a family of open-weights Large Language
Model (LLM) by Google DeepMind, based on Gemini
research and technology.
This repository contains the implementation of the
gemma PyPI package. A
JAX library to use and fine-tune Gemma.
For examples and use cases, see our
documentation. Please
report issues and feedback in
our GitHub.
Installation
1. Install JAX for CPU, GPU or TPU. Follow the instructions on
the JAX website.
1. Run
sh
pip install gemma
Examples
Here is a minimal example to have a multi-turn, multi-modal conversation with
Gemma:
python
from gemma import gm
Model and parameters (Gemma 4)
model = gm.nn.Gemma4_E4B()
params = gm.ckpts.load_params(gm.ckpts.CheckpointPath.GEMMA4_E4B_IT)
Example of multi-turn conversation
sampler = gm.text.ChatSampler(
model=model,
params=params,
multi_turn=True,
)
prompt = """Which of the 2 images do you prefer ?
Image 1:
Image 2:
Write your answer as a poem."""
out0 = sampler.chat(prompt, images=[image1, image2])
out1 = sampler.chat('What about the other image ?')
The same ChatSampler API works with all Gemma versions (2, 3, 3n, 4).
Our documentation contains various Colabs and tutorials, including:
Sampling
Multi-modal
Fine-tuning
LoRA
...
Additionally, our
examples/ folder
contain additional scripts to fine-tune and sample with Gemma.
Learn more about Gemma
To use this library: Gemma documentation
Technical reports for metrics and model capabilities:
Gemma 1
Gemma 2
Gemma 3
Gemma 4
Other Gemma implementations and doc on the
Gemma ecosystem
Downloading the models
To download the model weights. See
our documentation.
System Requirements
Gemma can run on a CPU, GPU and TPU. For GPU, we recommend 8GB+ RAM on GPU for
The 2B checkpoint and 24GB+ RAM on GPU are used for the 7B checkpoint.
Contributing
We welcome contributions! Please read our Contributing Guidelines before submitting a pull request.
This is not an official Google product.Top issues
#169"RuntimeError: p.attn_bias_ptr is not correctly aligned" when using ``` in a prompt with images19 comments · 2025-03-13#622[BUG] Gemma 4 token repetition collapse during long generation — affects both 31b Dense and 26b MoE18 comments · 2026-04-11#408Contribution Guidelines link does not work12 comments · 2025-09-17#610[BUG] Gemma-4-26B-A4B: Deterministic Repetition Loop at 14th item in list ("Wait, I found it. The 14.")11 comments · 2026-04-04#293any RLHF reinforcement learning implementation?9 comments · 2025-05-12#115Gemma2 - 27B model with JAX/Flax implementation8 comments · 2025-02-18#513Tokenizer: clarify intended input validation and error handling for invalid inputs7 comments · 2026-01-21#85Getting jaxlib.xla_extension.XlaRuntimeError: RESOURCE_EXHAUSTED error while performing inference on gemma-2b on TPU7 comments · 2025-02-07
Discussions
#831Gemma 5 wishlist1 comments · 2026-11-10#830Narratives: an iPhone journal powered by Gemma 4 E2B on-device0 comments · 2026-11-09#828TranslateGemma 4B for live, two-way Discord translation0 comments · 2026-11-08#824NeonLib — an Android knowledge library powered by EmbeddingGemma0 comments · 2026-11-02#812Gemma 4 DualMode: generation + EmbeddingGemma-2-distilled retrieval from one shared backbone (E2B, HF + GGUF)0 comments · 2026-10-07#804I wanted a tiny decision model, so I built one with Gemma 270M0 comments · 2026-09-27#795Gemma 4 hybrid continuous-state reasoning0 comments · 2026-09-05#785Request for the next Gemma generation: a 150–250B MoE with ~8–12B active parameters0 comments · 2026-08-30
Latest release
v4.0.1 v4.0.1 2026-05-20- Fix dialog dependency requirement to be = 1.1.0.