Skip to content
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

add model workflows #304

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions .github/workflows/model_image_build_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ on:
env:
REGISTRY: quay.io/ai-lab
MODEL_CONVERTER_IMAGE_NAME: model-converter
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
Comment on lines +12 to +20
Copy link
Collaborator

@Gregory-Pereira Gregory-Pereira Apr 22, 2024

Choose a reason for hiding this comment

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

We should do these using our make targets for greater test coverage via a matrix rather than hardcoding values into the ENV, see example in ms workflows

Suggested change
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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

matrix approach works for me! it'll be much better


jobs:
build-and-push-model-converter-image:
Expand Down Expand Up @@ -61,6 +67,108 @@ jobs:
image: ${{ steps.build_convert_models_image.outputs.image }}
tags: ${{ steps.build_convert_models_image.outputs.tags }}

build-and-push-granite-model-image:
if: contains( github.event.pull_request.labels.*.name, 'hold-tests')
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.GRANITE_MODEL_IMAGE_NAME }}
Copy link
Collaborator

@Gregory-Pereira Gregory-Pereira Apr 22, 2024

Choose a reason for hiding this comment

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

Based on my above suggestion this will move to a matrix based approach, ex ms model downloads via matrix

tags: latest
platforms: linux/amd64, linux/arm64
context: models
labels: |
${{ env.GRANITE_LABEL }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another env --> matrix refactor

build-args: |
MODEL_URL=${{ env.GRANITE_MODEL_URL }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another env --> matrix refactor

containerfiles: ./models/Containerfile

- name: Login to quay.io
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
uses: redhat-actions/push-to-registry@v2
with:
registry: ${{ env.REGISTRY }}
image: ${{ steps.build_granite_model_image.outputs.image }}
tags: ${{ steps.build_granite_model_image.outputs.tags }}

build-and-push-merlinite-model-image:
if: contains( github.event.pull_request.labels.*.name, 'hold-tests')
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.MERLINITE_MODEL_IMAGE_NAME }}
tags: latest
platforms: linux/amd64, linux/arm64
context: models
labels: |
${{ env.MERLINITE_LABEL }}
build-args: |
MODEL_URL=${{ env.MERLINITE_MODEL_URL }}
containerfiles: ./models/Containerfile
Comment on lines +147 to +155
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as discussed above


- name: Login to quay.io
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
uses: redhat-actions/push-to-registry@v2
with:
registry: ${{ env.REGISTRY }}
image: ${{ steps.build_merlinite_model_image.outputs.image }}
tags: ${{ steps.build_merlinite_model_image.outputs.tags }}

build-and-push-mistral-model-image:
if: contains( github.event.pull_request.labels.*.name, 'hold-tests')
runs-on: ubuntu-latest
Expand Down