Skip to content

Commit

Permalink
add tags copyright and github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
moficodes committed May 21, 2024
1 parent 40799c9 commit 53047af
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 16 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ai-ml-gke-finetuning-gemma.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: ai-ml-finetune-gemma
on:
push:
branches:
- main
paths:
- '.github/workflows/ai-ml-gke-finetuning-gemma.yml'
- 'ai-ml/llm-finetuning-gemma/**'
pull_request:
paths:
- '.github/workflows/ai-ml-gke-finetuning-gemma.yml'
- 'ai-ml/llm-finetuning-gemma/**'
jobs:
gke-a100-jax:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: build container for llm-finetuning-gemma tutorial
run: |
cd ai-ml/llm-fineturning-gemma/transformers
docker build --tag finetune .
29 changes: 29 additions & 0 deletions ai-ml/llm-finetuning-gemma/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2024 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.

# [START gke_aiml_llm_finetune_gemma_single_node_docker]
FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04

RUN apt-get update && \
apt-get -y --no-install-recommends install python3-dev gcc python3-pip git && \
rm -rf /var/lib/apt/lists/*

RUN pip3 install --no-cache-dir accelerate bitsandbytes datasets transformers peft trl torch

COPY finetune.py /finetune.py

ENV PYTHONUNBUFFERED 1

CMD python3 /finetune.py --device cuda
# [END gke_aiml_llm_finetune_gemma_single_node_docker]
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Copyright 2024 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.

# [START gke_aiml_llm_finetune_gemma_single_node_py]
import os
import torch
from datasets import load_dataset, Dataset
Expand Down Expand Up @@ -232,4 +247,5 @@ def transform(data):

model.push_to_hub(new_model, check_pr=True)

tokenizer.push_to_hub(new_model, check_pr=True)
tokenizer.push_to_hub(new_model, check_pr=True)
# [END gke_aiml_llm_finetune_gemma_single_node_py]
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_aiml_llm_finetune_gemma_single_node_yaml]
apiVersion: batch/v1
kind: Job
metadata:
Expand All @@ -35,7 +36,7 @@ spec:
- name: MODEL_NAME
value: "google/gemma-2b"
- name: NEW_MODEL
value: "gemma-2b-sql-kubecon-eu-2024"
value: "gemma-2b-sql-finetuned"
- name: LORA_R
value: "8"
- name: LORA_ALPHA
Expand Down Expand Up @@ -66,4 +67,5 @@ spec:
medium: Memory
nodeSelector:
cloud.google.com/gke-accelerator: nvidia-l4
restartPolicy: OnFailure
restartPolicy: OnFailure
# [END gke_aiml_llm_finetune_gemma_single_node_yaml]
13 changes: 0 additions & 13 deletions ai-ml/llm-finetuning-gemma/transformers/Dockerfile

This file was deleted.

0 comments on commit 53047af

Please sign in to comment.