Gemma in Minutes: 3 ways to run Gemma’s latest version!

Google for DevelopersAbout 4 min readApr 9, 2025Watch original
THE SUMMARYAI-generated

Key Concepts

Gemma, Gemma 3, Google GenAI SDK, API key, Keras, Keras Hub, Jax, PyTorch, TensorFlow, Google Colab, Kaggle, Ollama, Large Language Models (LLMs), GPU, Google AI Developer pages.

Gemma 3 via Google GenAI SDK

  • Main Topic: Using the Google GenAI SDK to access and run Gemma 3 via API.
  • Step-by-Step Process:
    1. Install the Google GenAI SDK using pip install.
    2. Obtain an API key from Google AI Studio by clicking "Create API Key" twice and copying the key.
    3. Write a Python script that:
      • Imports the SDK.
      • Creates a client using the API key.
      • Calls the desired Gemma model with a prompt.
    4. Run the Python script from the terminal.
  • Key Points:
    • Gemma 3 is available through an API for prototyping.
    • The Google GenAI SDK simplifies interaction with the Gemma 3 API.
    • API key is required for authentication.
  • Example: The video demonstrates a simple text generation task using a prompt.

Gemma 3 with Keras in Google Colab

  • Main Topic: Running Gemma 3 using Keras in a Google Colab environment.
  • Step-by-Step Process:
    1. Create a Kaggle account (or sign in with Google).
    2. Request access to the Gemma model on Kaggle and accept the terms of use.
    3. Create a new notebook in Google Colab.
    4. Change the runtime type to include a T4 GPU (Hardware accelerator).
    5. Connect Colab to Kaggle by:
      • Creating a new token on Kaggle's Account tab, which downloads a kaggle.json file.
      • Creating two secrets in Colab (Kaggle username and Kaggle key) and pasting the values from the kaggle.json file.
    6. Write Python code in Colab to:
      • Set environment variables for Kaggle username and key.
      • Install Keras, Keras Hub, and a backend (Jax, PyTorch, or TensorFlow).
      • Import necessary Keras packages.
      • Create a model using the from_preset method.
      • Generate text using the model.
  • Key Points:
    • Keras Hub provides pre-implemented models runnable on Jax, PyTorch, and TensorFlow.
    • Google Colab offers a free, cloud-based Jupyter Notebook environment.
    • Access to Gemma models on Kaggle requires accepting terms of use.
    • A GPU is recommended for running Gemma models efficiently.
    • Keras 3 allows choosing between TensorFlow, Jax, and PyTorch as a backend.
  • Technical Terms:
    • Keras Hub: A collection of models implemented in Keras.
    • Jax, PyTorch, TensorFlow: Backend options for Keras 3.
  • Example: The video demonstrates generating simple text after loading the Gemma model.

Gemma 3 with Ollama

  • Main Topic: Running Gemma 3 locally using Ollama.
  • Step-by-Step Process:
    1. Download and install the Ollama software from the Ollama website.
    2. Verify the installation by running ollama version in the terminal.
    3. Download the Gemma 3 model using the ollama pull command.
    4. Verify the model download by running ollama list.
    5. Run Gemma 3 with a prompt using Ollama.
  • Key Points:
    • Ollama simplifies running Large Language Models (LLMs) locally.
    • Ollama handles downloading, managing, and running AI models.
    • The Ollama installation package does not include models by default.
  • Technical Terms:
    • Ollama: A tool for running Large Language Models (LLMs) locally.
    • LLMs: Large Language Models.
  • Example: The video demonstrates running Gemma 3 with a prompt and displaying the response in the terminal.
  • Additional Information: Ollama can be used to deploy Gemma on a GPU-enabled cloud run service.

Synthesis/Conclusion

The video demonstrates three different methods for setting up and running Gemma 3 models: using the Google GenAI SDK via API, using Keras in Google Colab, and using Ollama locally. The presenter emphasizes the ease of use and quick setup time for each method, highlighting the accessibility of Gemma models for developers and researchers. The documentation on the Google AI Developer pages is recommended as a valuable resource for getting started with Gemma. The main takeaway is that Gemma models are readily available and can be experimented with quickly using various tools and platforms.

AI summaries can miss context or contain errors. Check important details against the original video.

MAKE IT YOURS

Read. Remember. Reuse.

Free tools

Go a little deeper.

Have a question about this video? Load its transcript to open the video chat.