Skip to content

Commit

Permalink
stopped being dumb and updated model-image-workflow the right way
Browse files Browse the repository at this point in the history
Signed-off-by: sallyom <somalley@redhat.com>
  • Loading branch information
sallyom committed Apr 23, 2024
1 parent 43f9257 commit d69dc60
Showing 1 changed file with 38 additions and 187 deletions.
225 changes: 38 additions & 187 deletions .github/workflows/model_image_build_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,221 +18,72 @@ on:
workflow_dispatch:

env:
REGISTRY: quay.io/ai-lab
MISTRAL_CODE_IMAGE_NAME: mistral-7b-code-16k-qlora
MISTRAL_CODE_LABEL: Q4_K_M
MISTRAL_CODE_MODEL_URL: https://huggingface.co/TheBloke/Mistral-7B-Code-16K-qlora-GGUF/resolve/main/mistral-7b-code-16k-qlora.Q4_K_M.gguf
MERLINITE_MODEL_IMAGE_NAME: merlinite-7b-lab
MERLINITE_LABEL: Q4_K_M
MERLINITE_MODEL_URL: https://huggingface.co/instructlab/merlinite-7b-lab-GGUF/resolve/main/merlinite-7b-lab-Q4_K_M.gguf
MISTRAL_MODEL_IMAGE_NAME: mistral-7b-instruct
MISTRAL_LABEL: v0.1.Q4_K_M.gguf
MISTRAL_MODEL_URL: https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GGUF/resolve/main/mistral-7b-instruct-v0.1.Q4_K_M.gguf
GRANITE_MODEL_IMAGE_NAME: granite-7b-lab
GRANITE_LABEL: Q4_K_M
GRANITE_MODEL_URL: https://huggingface.co/instructlab/granite-7b-lab-GGUF/resolve/main/granite-7b-lab-Q4_K_M.gguf
REGISTRY: quay.io
REGISTRY_ORG: ai-lab

jobs:
build-and-push-mistral-code-model-image:
build-and-push-model-image:
if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests')"
strategy:
matrix:
include:
- image_name: mistral-7b-code-16k-qlora
label: Q4_K_M
url: https://huggingface.co/TheBloke/Mistral-7B-Code-16K-qlora-GGUF/resolve/main/mistral-7b-code-16k-qlora.Q4_K_M.gguf
platforms: linux/amd64,linux/arm64
- image_name: mistral-7b-instruct
label: Q4_K_M
url: https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GGUF/resolve/main/mistral-7b-instruct-v0.1.Q4_K_M.gguf
platforms: linux/amd64,linux/arm64
- image_name: merlinite-7b-lab
label: Q4_K_M
url: https://huggingface.co/instructlab/merlinite-7b-lab-GGUF/resolve/main/merlinite-7b-lab-Q4_K_M.gguf
platforms: linux/amd64,linux/arm64
- image_name: granite-7b-lab
label: Q4_K_M
url: https://huggingface.co/instructlab/granite-7b-lab-GGUF/resolve/main/granite-7b-lab-Q4_K_M.gguf
platforms: linux/amd64,linux/arm64
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
# need enough disk space to download model
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v4.1.1

# required for multi-arch builds
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build mistral code model image
id: build_mistral_code_model_image
uses: redhat-actions/buildah-build@v2
- name: Build Image
id: build_image
uses: redhat-actions/buildah-build@v2.13
with:
image: ${{ env.REGISTRY }}/${{ env.MISTRAL_CODE_IMAGE_NAME }}
tags: latest
platforms: linux/amd64, linux/arm64
context: models
labels: |
${{ env.MISTRAL_CODE_LABEL }}
image: ${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}/${{ matrix.image_name }}
platforms: ${{ matrix.platforms }}
build-args: |
MODEL_URL=${{ env.MISTRAL_CODE_MODEL_URL }}
containerfiles: ./models/Containerfile

- name: Login to quay.io
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: redhat-actions/podman-login@v1
with:
registry: quay.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Push mistral code model image
id: push_mistral_code_model_image
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_mistral_code_model_image.outputs.image }}
tags: ${{ steps.build_mistral_code_model_image.outputs.tags }}

build-and-push-granite-model-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
# need enough disk space to download model
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v4.1.1

# required for multi-arch builds
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build granite model image
id: build_granite_model_image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.REGISTRY }}/${{ env.GRANITE_MODEL_IMAGE_NAME }}
tags: latest
platforms: linux/amd64, linux/arm64
context: models
labels: |
${{ env.GRANITE_LABEL }}
build-args: |
MODEL_URL=${{ env.GRANITE_MODEL_URL }}
containerfiles: ./models/Containerfile

- name: Login to quay.io
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: redhat-actions/podman-login@v1
with:
registry: quay.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Push granite model image
id: push_granite_model_image
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_granite_model_image.outputs.image }}
tags: ${{ steps.build_granite_model_image.outputs.tags }}

build-and-push-merlinite-model-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
# need enough disk space to download model
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v4.1.1

# required for multi-arch builds
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build merlinite model image
id: build_merlinite_model_image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.REGISTRY }}/${{ env.MERLINITE_MODEL_IMAGE_NAME }}
MODEL_URL=${{ matrix.url }}
tags: latest
platforms: linux/amd64, linux/arm64
context: models
labels: |
${{ env.MERLINITE_LABEL }}
build-args: |
MODEL_URL=${{ env.MERLINITE_MODEL_URL }}
containerfiles: ./models/Containerfile

- name: Login to quay.io
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: redhat-actions/podman-login@v1
with:
registry: quay.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Push merlinite model image
id: push_merlinite_model_image
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_merlinite_model_image.outputs.image }}
tags: ${{ steps.build_merlinite_model_image.outputs.tags }}

build-and-push-mistral-model-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
# need enough disk space to download model
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v4.1.1

# required for multi-arch builds
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build mistral model image
id: build_mistral_model_image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.REGISTRY }}/${{ env.MISTRAL_MODEL_IMAGE_NAME }}
tags: latest
platforms: linux/amd64, linux/arm64
context: models
labels: |
${{ env.MISTRAL_LABEL }}
build-args: |
MODEL_URL=${{ env.MISTRAL_MODEL_URL }}
containerfiles: ./models/Containerfile

- name: Login to quay.io
- name: Login to Container Registry
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: redhat-actions/podman-login@v1
uses: redhat-actions/podman-login@v1.7
with:
registry: quay.io
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Push mistral model image
id: push_mistral_model_image
- name: Push image
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: redhat-actions/push-to-registry@v2
uses: redhat-actions/push-to-registry@v2.8
with:
image: ${{ steps.build_mistral_model_image.outputs.image }}
tags: ${{ steps.build_mistral_model_image.outputs.tags }}
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ${{ env.REGISTRY }}

0 comments on commit d69dc60

Please sign in to comment.