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 contain the implementation of the gemma PyPI package. A JAX library to use and fine-tune Gemma.

For examples and uses-cases, see our documentation. Please report issues and feedback in our GitHub.

Installation

  1. Install JAX for CPU, GPU or TPU. Follow instructions at 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,
    mult_turn=True,
)

prompt = """Which of the 2 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 contain various Colabs and tutorial, 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 a 8GB+ RAM on GPU for the 2B checkpoint and 24GB+ RAM on GPU for the 7B checkpoint.

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.0.0.tar.gz (80.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gemma-3.0.0-py3-none-any.whl (121.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gemma-3.0.0.tar.gz
Algorithm Hash digest
SHA256 4f2572db51014fb0010f5f3b2ad072e37a4f9282f59b9cb10894df0d0f9c1b58
MD5 4cf4a8f4f5844a1f71012c6e27e07f3a
BLAKE2b-256 a7662be79ab17994f534dba321596abaf51752cb450a5ec1251db86fa0c9c839

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gemma-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c5505f2d8273c75f338ed55fdee7e3513cc74e6cdf3ed85eb31183889568b18e
MD5 deb76c24c31bffa4700d650867a2af96
BLAKE2b-256 6c825915394892c21b69cad54598a6c14e3fee5ca2d32b70ff9b0c334838df15

See more details on using hashes here.

Supported by

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