You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Install JAX for CPU, GPU or TPU. Follow the instructions on
the JAX website.
Run
pip install gemma
Examples
Here is a minimal example to have a multi-turn, multi-modal conversation with
Gemma:
fromgemmaimportgm# Model and parametersmodel=gm.nn.Gemma3_4B()
params=gm.ckpts.load_params(gm.ckpts.CheckpointPath.GEMMA3_4B_IT)
# Example of multi-turn conversationsampler=gm.text.ChatSampler(
model=model,
params=params,
multi_turn=True,
)
prompt="""Which of the two images do you prefer?Image 1: <start_of_image>Image 2: <start_of_image>Write your answer as a poem."""out0=sampler.chat(prompt, images=[image1, image2])
out1=sampler.chat('What about the other image ?')
Our documentation contains various Colabs and tutorials, including: