Skip to content

Conversation

@jethac
Copy link
Collaborator

@jethac jethac commented Oct 22, 2025

Adds the necessary configurations to support the Gemma 3 QAT (quantization-aware training) models.

This includes:

  • Adding build steps to cloudbuild.yaml for the 1b, 4b, 12b, and 27b QAT models.
  • Updating the model name mappings in converter.go to include the new QAT model variants.

Adds the necessary configurations to support the Gemma 3 QAT
(quantization-aware training) models.

This includes:
- Adding build steps to cloudbuild.yaml for the 1b, 4b, 12b, and 27b
  QAT models.
- Updating the model name mappings in converter.go to include the
  new QAT model variants.
@jethac jethac requested a review from inardini October 22, 2025 22:18
@gemini-code-assist
Copy link

Summary of Changes

Hello @jethac, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces foundational support for Gemma 3 Quantization-Aware Training (QAT) models within the Cloudrun demo environment. It extends the existing infrastructure to recognize, build, and integrate these optimized model variants, allowing for their seamless deployment and use. The changes primarily involve updating build configurations and model name mappings to accommodate the new QAT models.

Highlights

  • Gemma QAT Model Support: Added comprehensive support for Gemma 3 Quantization-Aware Training (QAT) models, specifically the 1b, 4b, 12b, and 27b variants.
  • Cloud Build Configuration: Integrated new build steps into cloudbuild.yaml to create Docker images for each of the Gemma 3 QAT models, ensuring they are part of the automated build process.
  • Model Mapping Updates: Updated the converter.go file to include mappings for the new Gemma 3 QAT model variants, facilitating their correct identification and conversion between Gemini and OpenAI model naming conventions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@jethac
Copy link
Collaborator Author

jethac commented Oct 22, 2025

I would have updated README.md as well but I guess we would have to internally push new pre-built docker images.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for Gemma QAT models by updating the cloudbuild.yaml with new build steps and converter.go with new model mappings. The changes in converter.go look good. For cloudbuild.yaml, I've identified significant code duplication in the new build steps and suggested a refactoring using YAML anchors to improve maintainability. Overall, the changes are in the right direction.

Comment on lines +34 to +65
- id: 'Build gemma3 1b QAT Image'
name: 'gcr.io/cloud-builders/docker:latest'
dir: 'Demos/Gemma-on-Cloudrun/' # in CI cloudbuild.yaml's context is the root of the repo.
env:
- 'MODEL=gemma3:1b-it-qat'
script: |
set -x
docker build --pull --build-arg MODEL=${MODEL} . -t "${_LOCATION}-docker.pkg.dev/${PROJECT_ID}/${_REPO}/gemma/gemma3-1b-it-qat:latest"
- id: 'Build gemma3 4b QAT Image'
name: 'gcr.io/cloud-builders/docker:latest'
dir: 'Demos/Gemma-on-Cloudrun/' # in CI cloudbuild.yaml's context is the root of the repo.
env:
- 'MODEL=gemma3:4b-it-qat'
script: |
set -x
docker build --pull --build-arg MODEL=${MODEL} . -t "${_LOCATION}-docker.pkg.dev/${PROJECT_ID}/${_REPO}/gemma/gemma3-4b-it-qat:latest"
- id: 'Build gemma3 12b QAT Image'
name: 'gcr.io/cloud-builders/docker:latest'
dir: 'Demos/Gemma-on-Cloudrun/' # in CI cloudbuild.yaml's context is the root of the repo.
env:
- 'MODEL=gemma3:12b-it-qat'
script: |
set -x
docker build --pull --build-arg MODEL=${MODEL} . -t "${_LOCATION}-docker.pkg.dev/${PROJECT_ID}/${_REPO}/gemma/gemma3-12b-it-qat:latest"
- id: 'Build gemma3 27b QAT Image'
name: 'gcr.io/cloud-builders/docker:latest'
dir: 'Demos/Gemma-on-Cloudrun/' # in CI cloudbuild.yaml's context is the root of the repo.
env:
- 'MODEL=gemma3:27b-it-qat'
script: |
set -x
docker build --pull --build-arg MODEL=${MODEL} . -t "${_LOCATION}-docker.pkg.dev/${PROJECT_ID}/${_REPO}/gemma/gemma3-27b-it-qat:latest"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

These four new build steps are nearly identical, which creates code duplication and makes the configuration harder to maintain. You can use YAML anchors to define a template for the repeated parts.

By defining the script once with an anchor and using an additional TAG environment variable, you can significantly reduce the repetition. This makes the steps cleaner and easier to update in the future. This approach could be extended to template the name and dir fields as well for even less duplication.

  - id: 'Build gemma3 1b QAT Image'
    name: 'gcr.io/cloud-builders/docker:latest'
    dir: 'Demos/Gemma-on-Cloudrun/' # in CI cloudbuild.yaml's context is the root of the repo.
    env:
      - 'MODEL=gemma3:1b-it-qat'
      - 'TAG=gemma3-1b-it-qat'
    script: &qat_build_script |
      set -x
      docker build --pull --build-arg MODEL=${MODEL} . -t "${_LOCATION}-docker.pkg.dev/${PROJECT_ID}/${_REPO}/gemma/${TAG}:latest"
  - id: 'Build gemma3 4b QAT Image'
    name: 'gcr.io/cloud-builders/docker:latest'
    dir: 'Demos/Gemma-on-Cloudrun/' # in CI cloudbuild.yaml's context is the root of the repo.
    env:
      - 'MODEL=gemma3:4b-it-qat'
      - 'TAG=gemma3-4b-it-qat'
    script: *qat_build_script
  - id: 'Build gemma3 12b QAT Image'
    name: 'gcr.io/cloud-builders/docker:latest'
    dir: 'Demos/Gemma-on-Cloudrun/' # in CI cloudbuild.yaml's context is the root of the repo.
    env:
      - 'MODEL=gemma3:12b-it-qat'
      - 'TAG=gemma3-12b-it-qat'
    script: *qat_build_script
  - id: 'Build gemma3 27b QAT Image'
    name: 'gcr.io/cloud-builders/docker:latest'
    dir: 'Demos/Gemma-on-Cloudrun/' # in CI cloudbuild.yaml's context is the root of the repo.
    env:
      - 'MODEL=gemma3:27b-it-qat'
      - 'TAG=gemma3-27b-it-qat'
    script: *qat_build_script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant