Skip to main content

Gemma open-weight LLM library from Google DeepMind.

Project description

Gemma

Unittests PyPI version Documentation Status

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.

  2. Run

    pip install gemma
    

Examples

Here is a minimal example to have a multi-turn, multi-modal conversation with Gemma:

from gemma import gm

# Model and parameters
model = gm.nn.Gemma3_4B()
params = gm.ckpts.load_params(gm.ckpts.CheckpointPath.GEMMA3_4B_IT)

# Example of multi-turn conversation
sampler = 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:

Additionally, our examples/ folder contain additional scripts to fine-tune and sample with Gemma.

Learn more about Gemma

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gemma-3.1.0.tar.gz (114.5 kB view details)

Uploaded Source

Built Distribution

gemma-3.1.0-py3-none-any.whl (181.0 kB view details)

Uploaded Python 3

File details

Details for the file gemma-3.1.0.tar.gz.

File metadata

  • Download URL: gemma-3.1.0.tar.gz
  • Upload date:
  • Size: 114.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for gemma-3.1.0.tar.gz
Algorithm Hash digest
SHA256 e94e8d4c2bd4f35d9d2580a256900457ddb23ae187543823e564e5e4812854ee
MD5 e203d762071d0ba981263f4d9dbac7f8
BLAKE2b-256 ceb7757766a37d0f400f883becf2679fceff78cde663f7aae8b316d1af71ca14

See more details on using hashes here.

File details

Details for the file gemma-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: gemma-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 181.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for gemma-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c05ce372b7515678c659625edd9fe30f577c16e329cc8a994f869611b0cfba50
MD5 5673ea9f389ebe0d63f641e14ded72ba
BLAKE2b-256 13f939e6aba5c621bc4f7b76d267abee6d4a6cb043c6be369acbd9203c88bb39

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page