-
Notifications
You must be signed in to change notification settings - Fork 36
Reference Architecture for FP8 quantized Gemma-4-31b on TPU using Qwix library #543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
syeda-anjum
wants to merge
11
commits into
main
Choose a base branch
from
sanjum-gemma-fp8
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1d4a951
Fix typo in chat-template path for gemma-4 models, switch benchmark t…
syeda-anjum 6a23bab
Update cspell dictionary with qtype and qwix
syeda-anjum bf0fd24
Merge branch 'main' into sanjum-gemma-fp8
syeda-anjum 74f96a1
Enable vLLM batched RPA kernel for Gemma-4 Trillium deployment and fi…
syeda-anjum ec6cd9e
Remove commented-out CONTAINER_IMAGE_URL replacement block in v6e-gem…
syeda-anjum f6691b7
revert to previous benchmarking template
syeda-anjum 79fde83
Merge branch 'main' into sanjum-gemma-fp8
syeda-anjum 518f057
fix: resolve final new line and trailing whitespace lint errors in co…
syeda-anjum 947d015
fix: parameterize data-parallel-size in qwix tpu template
syeda-anjum 118bd18
fix: map DATA_PARALLEL_SIZE to container env in qwix template
syeda-anjum e7b0049
Merge branch 'main' into sanjum-gemma-fp8
syeda-anjum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,7 +58,9 @@ peft | |
| prereqs | ||
| pretrained | ||
| psutil | ||
| qtype | ||
| qwiklabs | ||
| qwix | ||
| rayutil | ||
| rtxpro | ||
| rueth | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
...kubernetes-manifests/online-inference-tpu/vllm/v6e-gemma-4-31b-it-qwix/kustomization.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| # Copyright 2025 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| --- | ||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
| kind: Kustomization | ||
|
|
||
| configMapGenerator: | ||
| - envs: | ||
| - runtime.env | ||
| name: runtime | ||
| namespace: replaced-by-kustomize | ||
|
|
||
| images: | ||
| - name: replaced-by-kustomize | ||
| newName: vllm/vllm-tpu | ||
| newTag: v0.26.0 | ||
|
|
||
| nameSuffix: -v6e-gemma-4-31b-qwix | ||
|
|
||
| patches: | ||
| - path: patch-vllm-args.yaml | ||
| target: | ||
| kind: Deployment | ||
| name: vllm | ||
| - path: patch-env.yaml | ||
| target: | ||
| kind: Deployment | ||
| name: vllm | ||
| - path: patch-nodeselector.yaml | ||
| - path: patch-resources.yaml | ||
|
|
||
|
|
||
| replacements: | ||
| - source: | ||
| fieldPath: data.APP_LABEL | ||
| kind: ConfigMap | ||
| name: runtime | ||
| targets: | ||
| - fieldPaths: | ||
| - spec.selector.matchLabels.app | ||
| - spec.template.metadata.labels.app | ||
| select: | ||
| kind: Deployment | ||
| - fieldPaths: | ||
| - spec.selector.app | ||
| select: | ||
| kind: Service | ||
| - source: | ||
| fieldPath: data.INFERENCE_KUBERNETES_NAMESPACE | ||
| kind: ConfigMap | ||
| name: deployment | ||
| targets: | ||
| - fieldPaths: | ||
| - metadata.namespace | ||
| select: | ||
| kind: ConfigMap | ||
| - fieldPaths: | ||
| - metadata.namespace | ||
| select: | ||
| kind: Deployment | ||
| - fieldPaths: | ||
| - metadata.namespace | ||
| select: | ||
| kind: Service | ||
| - fieldPaths: | ||
| - metadata.namespace | ||
| select: | ||
| kind: ServiceAccount | ||
| - source: | ||
| fieldPath: data.INFERENCE_KUBERNETES_SERVICE_ACCOUNT | ||
| kind: ConfigMap | ||
| name: deployment | ||
| targets: | ||
| - fieldPaths: | ||
| - spec.template.spec.serviceAccountName | ||
| select: | ||
| kind: Deployment | ||
| - fieldPaths: | ||
| - metadata.name | ||
| select: | ||
| kind: ServiceAccount | ||
| - source: | ||
| fieldPath: data.MODEL_BUCKET_NAME | ||
| kind: ConfigMap | ||
| name: deployment | ||
| targets: | ||
| - fieldPaths: | ||
| - spec.template.spec.volumes.[name=huggingface-hub-model-bucket].csi.volumeAttributes.bucketName | ||
| options: | ||
| delimiter: . | ||
| index: 0 | ||
| select: | ||
| kind: Deployment | ||
| - source: | ||
| fieldPath: data.MODEL_ID | ||
| kind: ConfigMap | ||
| name: runtime | ||
| targets: | ||
| - fieldPaths: | ||
| - spec.template.spec.volumes.[name=huggingface-hub-model-bucket].csi.volumeAttributes.mountOptions | ||
| options: | ||
| delimiter: "only-dir:" | ||
| index: 1 | ||
| select: | ||
| kind: Deployment | ||
| - fieldPaths: | ||
| - spec.template.spec.containers.[name=fetch-safetensors].volumeMounts.[name=huggingface-hub-model-bucket].mountPath | ||
| - spec.template.spec.containers.[name=inference-server].volumeMounts.[name=huggingface-hub-model-bucket].mountPath | ||
| options: | ||
| delimiter: / | ||
| index: 2 | ||
| select: | ||
| kind: Deployment | ||
| - source: | ||
| fieldPath: data.MODEL_NAME | ||
| kind: ConfigMap | ||
| name: runtime | ||
| targets: | ||
| - fieldPaths: | ||
| - spec.template.metadata.labels.[ai.gke.io/model] | ||
| select: | ||
| kind: Deployment | ||
|
|
||
| resources: | ||
| - ../base | ||
32 changes: 32 additions & 0 deletions
32
...rch/kubernetes-manifests/online-inference-tpu/vllm/v6e-gemma-4-31b-it-qwix/patch-env.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Copyright 2025 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| - op: add | ||
| path: /spec/template/spec/containers/1/env/- | ||
| value: | ||
| name: MODEL_IMPL_TYPE | ||
| value: "flax_nnx" | ||
| - op: add | ||
| path: /spec/template/spec/containers/1/env/- | ||
| value: | ||
| name: USE_BATCHED_RPA_KERNEL | ||
| value: "1" | ||
| - op: add | ||
| path: /spec/template/spec/containers/1/env/- | ||
| value: | ||
| name: DATA_PARALLEL_SIZE | ||
| valueFrom: | ||
| configMapKeyRef: | ||
| name: runtime | ||
| key: DATA_PARALLEL_SIZE |
24 changes: 24 additions & 0 deletions
24
...netes-manifests/online-inference-tpu/vllm/v6e-gemma-4-31b-it-qwix/patch-nodeselector.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Copyright 2025 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| --- | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: vllm | ||
| namespace: replaced-by-kustomize | ||
| spec: | ||
| template: | ||
| spec: | ||
| nodeSelector: | ||
| cloud.google.com/compute-class: tpu-v6e-2x4 |
29 changes: 29 additions & 0 deletions
29
...bernetes-manifests/online-inference-tpu/vllm/v6e-gemma-4-31b-it-qwix/patch-resources.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Copyright 2025 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| --- | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: vllm | ||
| namespace: replaced-by-kustomize | ||
| spec: | ||
| template: | ||
| spec: | ||
| containers: | ||
| - name: inference-server | ||
| resources: | ||
| limits: | ||
| google.com/tpu: "8" | ||
| requests: | ||
| google.com/tpu: "8" |
38 changes: 38 additions & 0 deletions
38
...bernetes-manifests/online-inference-tpu/vllm/v6e-gemma-4-31b-it-qwix/patch-vllm-args.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Copyright 2025 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| - op: add | ||
| path: /spec/template/spec/containers/1/args/- | ||
| value: "--chat-template=/gcs/google/gemma-4-31b-it/chat_template.jinja" | ||
| - op: add | ||
| path: /spec/template/spec/containers/1/args/- | ||
| value: "--data-parallel-size=$(DATA_PARALLEL_SIZE)" | ||
| - op: add | ||
| path: /spec/template/spec/containers/1/args/- | ||
| value: "--block-size=256" | ||
| - op: add | ||
| path: /spec/template/spec/containers/1/args/- | ||
| value: "--kv-cache-dtype=fp8" | ||
| - op: add | ||
| path: /spec/template/spec/containers/1/args/- | ||
| value: "--limit-mm-per-prompt={\"image\": 0, \"video\": 0, \"audio\": 0}" | ||
| - op: add | ||
| path: /spec/template/spec/containers/1/args/- | ||
| value: "--mm-processor-cache-gb=0" | ||
| - op: add | ||
| path: /spec/template/spec/containers/1/args/- | ||
| value: '--additional_config={"quantization": {"qwix": {"rules": [{"module_path": ".*", "weight_qtype": "float8_e4m3fn", "act_qtype": "float8_e4m3fn"}]}}}' | ||
| - op: add | ||
| path: /spec/template/spec/containers/1/args/- | ||
| value: "--load-format=runai_streamer" |
9 changes: 9 additions & 0 deletions
9
...f-arch/kubernetes-manifests/online-inference-tpu/vllm/v6e-gemma-4-31b-it-qwix/runtime.env
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| APP_LABEL=vllm-v6e-gemma-4-31b-it-qwix | ||
| GPU_MEMORY_UTILIZATION=0.90 | ||
| MAX_MODEL_LEN=16384 | ||
| MODEL_ID=google/gemma-4-31b-it | ||
| MODEL_NAME=gemma-4-31b-it-qwix | ||
| TENSOR_PARALLEL_SIZE=4 | ||
| MODEL_IMPL_TYPE=flax_nnx | ||
| USE_BATCHED_RPA_KERNEL=1 | ||
| DATA_PARALLEL_SIZE=2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.