Upload 356 files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +11 -0
- chatbot/.devcontainer/Containerfile +9 -0
- chatbot/.devcontainer/devcontainer.json +12 -0
- chatbot/.gitattributes +1 -0
- chatbot/.github/workflows/README.md +33 -0
- chatbot/.github/workflows/chatbot.yaml +149 -0
- chatbot/.github/workflows/codegen.yaml +88 -0
- chatbot/.github/workflows/instructlab.yaml +79 -0
- chatbot/.github/workflows/manual_build_trigger.yaml +343 -0
- chatbot/.github/workflows/mirror_repository.yaml +40 -0
- chatbot/.github/workflows/model_converter.yaml +73 -0
- chatbot/.github/workflows/model_servers.yaml +133 -0
- chatbot/.github/workflows/models.yaml +94 -0
- chatbot/.github/workflows/object_detection.yaml +89 -0
- chatbot/.github/workflows/rag.yaml +93 -0
- chatbot/.github/workflows/summarizer.yaml +88 -0
- chatbot/.github/workflows/test-trace-steps.yaml +94 -0
- chatbot/.github/workflows/testing_framework.yaml +195 -0
- chatbot/.github/workflows/training-e2e.yaml +154 -0
- chatbot/.github/workflows/training_bootc.yaml +247 -0
- chatbot/.gitignore +16 -0
- chatbot/CODEOWNERS +1 -0
- chatbot/CONTRIBUTING.md +170 -0
- chatbot/LICENSE +201 -0
- chatbot/README.md +70 -0
- chatbot/ailab-images.md +34 -0
- chatbot/assets/ai_lab_recipes_logo.png +3 -0
- chatbot/assets/chatbot_nodejs_ui.png +0 -0
- chatbot/assets/chatbot_ui.png +3 -0
- chatbot/assets/codegen_ui.png +3 -0
- chatbot/assets/image_analysis.png +3 -0
- chatbot/assets/install_continue_extension.png +3 -0
- chatbot/assets/model_converter.png +0 -0
- chatbot/assets/object_detection.png +3 -0
- chatbot/assets/rag_ui.png +3 -0
- chatbot/assets/summarizer_ui.png +3 -0
- chatbot/assets/whisper.png +3 -0
- chatbot/ci/trace-steps.py +47 -0
- chatbot/convert_models/Containerfile +10 -0
- chatbot/convert_models/README.md +44 -0
- chatbot/convert_models/download_huggingface.py +13 -0
- chatbot/convert_models/requirements.txt +1 -0
- chatbot/convert_models/run.sh +32 -0
- chatbot/convert_models/ui.py +55 -0
- chatbot/data/fake_meeting.pdf +0 -0
- chatbot/data/fake_meeting.txt +29 -0
- chatbot/data/jfk.wav +3 -0
- chatbot/eval/embeddings/custom_eval_set.py +98 -0
- chatbot/eval/promptfoo/README.md +15 -0
- chatbot/eval/promptfoo/base/Containerfile +8 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,14 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
chatbot/assets/ai_lab_recipes_logo.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
chatbot/assets/chatbot_ui.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
chatbot/assets/codegen_ui.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
chatbot/assets/image_analysis.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
chatbot/assets/install_continue_extension.png filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
chatbot/assets/object_detection.png filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
chatbot/assets/rag_ui.png filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
chatbot/assets/summarizer_ui.png filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
chatbot/assets/whisper.png filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
chatbot/data/jfk.wav filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
chatbot/recipes/natural_language_processing/chatbot-java-quarkus/app/src/main/resources/META-INF/resources/images/chatbot-architecture.png filter=lfs diff=lfs merge=lfs -text
|
chatbot/.devcontainer/Containerfile
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM quay.io/containers/podman:v5.0.2
|
| 2 |
+
|
| 3 |
+
USER root
|
| 4 |
+
|
| 5 |
+
COPY requirements-test.txt .
|
| 6 |
+
|
| 7 |
+
RUN dnf install -y python3.11 python3-pip buildah git make && \
|
| 8 |
+
dnf clean all && \
|
| 9 |
+
pip3 install -r requirements-test.txt
|
chatbot/.devcontainer/devcontainer.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "recipes",
|
| 3 |
+
"build": {
|
| 4 |
+
"dockerfile": "Containerfile",
|
| 5 |
+
"context": ".."
|
| 6 |
+
},
|
| 7 |
+
"privileged": true,
|
| 8 |
+
"containerEnv": {
|
| 9 |
+
"REGISTRY": "ghcr.io",
|
| 10 |
+
"IMAGE_NAME": "ai-lab-recipes/playground"
|
| 11 |
+
}
|
| 12 |
+
}
|
chatbot/.gitattributes
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
* text=auto eol=lf
|
chatbot/.github/workflows/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AI-Lab Recipes Infrastructure Documentation
|
| 2 |
+
|
| 3 |
+
## Standard Wofklows
|
| 4 |
+
|
| 5 |
+
Our standard workflows deal with building components and pushing their images to `quay.io/ai-lab`. These components include:
|
| 6 |
+
- recipe applications:
|
| 7 |
+
- Chatbot
|
| 8 |
+
- Codegen
|
| 9 |
+
- Summarizer
|
| 10 |
+
- RAG
|
| 11 |
+
- model_servers
|
| 12 |
+
- models
|
| 13 |
+
- instructlab workflows
|
| 14 |
+
- training bootc workflows
|
| 15 |
+
|
| 16 |
+
For a full list of the images we build check out or [quay organization](https://quay.io/organization/ai-lab). These standard workflows should all be run against our standard repo `containers/ai-labs-recipes` rather than the mirror repo.
|
| 17 |
+
|
| 18 |
+
## Testing frameworks
|
| 19 |
+
|
| 20 |
+
Our testing frameworks are a bit different from our standard workflows. In terms of compute, some of these jobs run either AWS machines provisioned via terraform using secrets in the github repository, or customized github hosted action runners, as well as the standard ubuntu-24.04 github runners for jobs not requiring additional resources.
|
| 21 |
+
|
| 22 |
+
These workflows start by checking out the [terraform-test-environment-module](https://github.com/containers/terraform-test-environment-module) repo, as well as the code in `containers/ai-lab-recipes` at the `main` branch. Then it will provision the terraform instance, install the correct ansible playbook requirements, and runs a coressponding playbook. Aditional actions may also be taken depending on the testing framework in question.
|
| 23 |
+
|
| 24 |
+
Finally all of our testing framework workflows will call `terraform destroy` to remove the aws instance we have provisioned and publish the results of the workflow to slack.
|
| 25 |
+
|
| 26 |
+
IMPORTATNT: If you are doing development and testing, please make sure that instances in AWS are spun down before leaving if you have access to the AWS account.
|
| 27 |
+
|
| 28 |
+
### training-e2e
|
| 29 |
+
|
| 30 |
+
The test environment is initially based off of `Fedroa 40`.
|
| 31 |
+
It bootstraps a `g5.8xlarge` AWS EC2 instance with Terraform.
|
| 32 |
+
Provisioning is executed with ansible. The ansible playbook is invoking bootc install and
|
| 33 |
+
reboots the instance.
|
chatbot/.github/workflows/chatbot.yaml
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: chatbot
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request:
|
| 5 |
+
branches:
|
| 6 |
+
- main
|
| 7 |
+
paths:
|
| 8 |
+
- ./recipes/common/Makefile.common
|
| 9 |
+
- ./recipes/natural_language_processing/chatbot/**
|
| 10 |
+
- .github/workflows/chatbot.yaml
|
| 11 |
+
- ./recipes/natural_language_processing/chatbot/app/**
|
| 12 |
+
- ./renovate.json
|
| 13 |
+
push:
|
| 14 |
+
branches:
|
| 15 |
+
- main
|
| 16 |
+
paths:
|
| 17 |
+
- ./recipes/common/Makefile.common
|
| 18 |
+
- ./recipes/natural_language_processing/chatbot/**
|
| 19 |
+
- .github/workflows/chatbot.yaml
|
| 20 |
+
|
| 21 |
+
workflow_dispatch:
|
| 22 |
+
|
| 23 |
+
env:
|
| 24 |
+
REGISTRY: ghcr.io
|
| 25 |
+
IMAGE_NAME: chatbot
|
| 26 |
+
|
| 27 |
+
jobs:
|
| 28 |
+
chatbot-build-and-push:
|
| 29 |
+
if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests')"
|
| 30 |
+
runs-on: ubuntu-24.04
|
| 31 |
+
permissions:
|
| 32 |
+
contents: read
|
| 33 |
+
packages: write
|
| 34 |
+
services:
|
| 35 |
+
registry:
|
| 36 |
+
image: registry:2.8.3
|
| 37 |
+
ports:
|
| 38 |
+
- 5000:5000
|
| 39 |
+
steps:
|
| 40 |
+
- uses: actions/checkout@v4.1.7
|
| 41 |
+
|
| 42 |
+
- name: Set up Python
|
| 43 |
+
uses: actions/setup-python@v5.1.1
|
| 44 |
+
with:
|
| 45 |
+
python-version: '3.11'
|
| 46 |
+
|
| 47 |
+
- name: Install opentelemetry dependencies
|
| 48 |
+
run: |
|
| 49 |
+
pip install --no-cache-dir opentelemetry-sdk opentelemetry-exporter-otlp opentelemetry-instrumentation
|
| 50 |
+
|
| 51 |
+
- name: Download OpenTelemetry Collector Contrib
|
| 52 |
+
run: |
|
| 53 |
+
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.103.0/otelcol-contrib_0.103.0_linux_amd64.tar.gz
|
| 54 |
+
tar -xvf otelcol-contrib_0.103.0_linux_amd64.tar.gz
|
| 55 |
+
|
| 56 |
+
- name: Write secrets to files
|
| 57 |
+
run: |
|
| 58 |
+
echo "${{ secrets.ROSA_OTEL_CACERT }}" > /tmp/ca.crt
|
| 59 |
+
echo "${{ secrets.ROSA_OTEL_SERVER_CRT }}" > /tmp/server.crt
|
| 60 |
+
echo "${{ secrets.ROSA_OTEL_SERVER_KEY }}" > /tmp/server.key
|
| 61 |
+
|
| 62 |
+
- name: Configure OpenTelemetry Collector
|
| 63 |
+
run: |
|
| 64 |
+
echo '
|
| 65 |
+
receivers:
|
| 66 |
+
otlp:
|
| 67 |
+
protocols:
|
| 68 |
+
grpc:
|
| 69 |
+
http:
|
| 70 |
+
exporters:
|
| 71 |
+
otlphttp:
|
| 72 |
+
endpoint: "${{ secrets.ROSA_OTEL_ENDPOINT }}"
|
| 73 |
+
tls:
|
| 74 |
+
insecure: false
|
| 75 |
+
cert_file: /tmp/server.crt
|
| 76 |
+
key_file: /tmp/server.key
|
| 77 |
+
ca_file: /tmp/ca.crt
|
| 78 |
+
debug:
|
| 79 |
+
verbosity: detailed
|
| 80 |
+
service:
|
| 81 |
+
pipelines:
|
| 82 |
+
traces:
|
| 83 |
+
receivers: [otlp]
|
| 84 |
+
exporters: [debug, otlphttp]
|
| 85 |
+
' > otel-collector-config.yaml
|
| 86 |
+
|
| 87 |
+
- name: Run OpenTelemetry Collector
|
| 88 |
+
run: |
|
| 89 |
+
./otelcol-contrib --config otel-collector-config.yaml > otel-collector.log 2>&1 &
|
| 90 |
+
|
| 91 |
+
- name: Install qemu dependency
|
| 92 |
+
run: |
|
| 93 |
+
sudo apt-get update
|
| 94 |
+
sudo apt-get install -y qemu-user-static
|
| 95 |
+
|
| 96 |
+
- name: Start job trace
|
| 97 |
+
run: |
|
| 98 |
+
export WORKFLOW_NAME="chatbot"
|
| 99 |
+
export JOB_NAME="chatbot-build-and-push"
|
| 100 |
+
export TRACE_ACTION="start"
|
| 101 |
+
python ci/trace-steps.py
|
| 102 |
+
|
| 103 |
+
- name: Build Image
|
| 104 |
+
id: build_image
|
| 105 |
+
uses: redhat-actions/buildah-build@v2.13
|
| 106 |
+
with:
|
| 107 |
+
image: ${{ env.REGISTRY }}/containers/${{ env.IMAGE_NAME }}
|
| 108 |
+
tags: latest
|
| 109 |
+
platforms: linux/amd64, linux/arm64
|
| 110 |
+
containerfiles: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}/app/Containerfile
|
| 111 |
+
context: recipes/natural_language_processing/${{ env.IMAGE_NAME }}/app
|
| 112 |
+
|
| 113 |
+
- name: Install Dependencies
|
| 114 |
+
working-directory: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}
|
| 115 |
+
run: make install
|
| 116 |
+
|
| 117 |
+
- name: Download model
|
| 118 |
+
working-directory: ./models
|
| 119 |
+
run: make download-model-granite
|
| 120 |
+
|
| 121 |
+
- name: Run Functional Tests
|
| 122 |
+
shell: bash
|
| 123 |
+
run: make functional-tests
|
| 124 |
+
working-directory: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}
|
| 125 |
+
|
| 126 |
+
- name: Login to Registry
|
| 127 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 128 |
+
uses: redhat-actions/podman-login@v1.7
|
| 129 |
+
with:
|
| 130 |
+
registry: ${{ env.REGISTRY }}
|
| 131 |
+
username: ${{ github.actor }}
|
| 132 |
+
password: ${{ secrets.GITHUB_TOKEN }}
|
| 133 |
+
|
| 134 |
+
- name: Push Image
|
| 135 |
+
id: push_image
|
| 136 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 137 |
+
uses: redhat-actions/push-to-registry@v2.8
|
| 138 |
+
with:
|
| 139 |
+
image: ${{ steps.build_image.outputs.image }}
|
| 140 |
+
tags: ${{ steps.build_image.outputs.tags }}
|
| 141 |
+
registry: ${{ env.REGISTRY }}
|
| 142 |
+
|
| 143 |
+
- name: End job trace
|
| 144 |
+
run: |
|
| 145 |
+
export WORKFLOW_NAME="chatbot"
|
| 146 |
+
export JOB_NAME="chatbot-build-and-push"
|
| 147 |
+
export TRACE_ACTION="end"
|
| 148 |
+
python ci/trace-steps.py
|
| 149 |
+
|
chatbot/.github/workflows/codegen.yaml
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: codegen
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request:
|
| 5 |
+
branches:
|
| 6 |
+
- main
|
| 7 |
+
paths:
|
| 8 |
+
- ./recipes/common/Makefile.common
|
| 9 |
+
- ./recipes/natural_language_processing/codegen/**
|
| 10 |
+
- .github/workflows/codegen.yaml
|
| 11 |
+
push:
|
| 12 |
+
branches:
|
| 13 |
+
- main
|
| 14 |
+
paths:
|
| 15 |
+
- ./recipes/common/Makefile.common
|
| 16 |
+
- ./recipes/natural_language_processing/codegen/**
|
| 17 |
+
- .github/workflows/codegen.yaml
|
| 18 |
+
|
| 19 |
+
workflow_dispatch:
|
| 20 |
+
|
| 21 |
+
env:
|
| 22 |
+
REGISTRY: ghcr.io
|
| 23 |
+
IMAGE_NAME: codegen
|
| 24 |
+
|
| 25 |
+
jobs:
|
| 26 |
+
codegen-build-and-push:
|
| 27 |
+
if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests')"
|
| 28 |
+
runs-on: ubuntu-24.04
|
| 29 |
+
permissions:
|
| 30 |
+
contents: read
|
| 31 |
+
packages: write
|
| 32 |
+
services:
|
| 33 |
+
registry:
|
| 34 |
+
image: registry:2.8.3
|
| 35 |
+
ports:
|
| 36 |
+
- 5000:5000
|
| 37 |
+
steps:
|
| 38 |
+
- uses: actions/checkout@v4.1.7
|
| 39 |
+
|
| 40 |
+
- name: Install qemu dependency
|
| 41 |
+
run: |
|
| 42 |
+
sudo apt-get update
|
| 43 |
+
sudo apt-get install -y qemu-user-static
|
| 44 |
+
|
| 45 |
+
- name: Build Image
|
| 46 |
+
id: build_image
|
| 47 |
+
uses: redhat-actions/buildah-build@v2.13
|
| 48 |
+
with:
|
| 49 |
+
image: ${{ env.REGISTRY }}/containers/${{ env.IMAGE_NAME }}
|
| 50 |
+
tags: latest
|
| 51 |
+
platforms: linux/amd64, linux/arm64
|
| 52 |
+
containerfiles: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}/app/Containerfile
|
| 53 |
+
context: recipes/natural_language_processing/${{ env.IMAGE_NAME }}/app
|
| 54 |
+
|
| 55 |
+
- name: Set up Python
|
| 56 |
+
uses: actions/setup-python@v5.1.1
|
| 57 |
+
with:
|
| 58 |
+
python-version: '3.11'
|
| 59 |
+
|
| 60 |
+
- name: Install Dependencies
|
| 61 |
+
working-directory: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}
|
| 62 |
+
run: make install
|
| 63 |
+
|
| 64 |
+
- name: Download model
|
| 65 |
+
working-directory: ./models
|
| 66 |
+
run: make download-model-mistral-code
|
| 67 |
+
|
| 68 |
+
- name: Run Functional Tests
|
| 69 |
+
shell: bash
|
| 70 |
+
run: make functional-tests
|
| 71 |
+
working-directory: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}
|
| 72 |
+
|
| 73 |
+
- name: Login to Registry
|
| 74 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 75 |
+
uses: redhat-actions/podman-login@v1.7
|
| 76 |
+
with:
|
| 77 |
+
registry: ${{ env.REGISTRY }}
|
| 78 |
+
username: ${{ github.actor }}
|
| 79 |
+
password: ${{ secrets.GITHUB_TOKEN }}
|
| 80 |
+
|
| 81 |
+
- name: Push Image
|
| 82 |
+
id: push_image
|
| 83 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 84 |
+
uses: redhat-actions/push-to-registry@v2.8
|
| 85 |
+
with:
|
| 86 |
+
image: ${{ steps.build_image.outputs.image }}
|
| 87 |
+
tags: ${{ steps.build_image.outputs.tags }}
|
| 88 |
+
registry: ${{ env.REGISTRY }}
|
chatbot/.github/workflows/instructlab.yaml
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Instructlab image builds
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
schedule: # schedule the job to run at 12 AM daily
|
| 5 |
+
- cron: '0 0 * * *'
|
| 6 |
+
|
| 7 |
+
# pull_request:
|
| 8 |
+
# branches:
|
| 9 |
+
# - main
|
| 10 |
+
# paths:
|
| 11 |
+
# - .github/workflows/instructlab_baseimages_build_push.yaml
|
| 12 |
+
# - training/nvidia
|
| 13 |
+
# push:
|
| 14 |
+
# branches:
|
| 15 |
+
# - main
|
| 16 |
+
# paths:
|
| 17 |
+
# - .github/workflows/instructlab_baseimages_build_push.yaml
|
| 18 |
+
# - training/nvidia
|
| 19 |
+
|
| 20 |
+
workflow_dispatch:
|
| 21 |
+
|
| 22 |
+
concurrency:
|
| 23 |
+
group: ${{ github.workflow }}
|
| 24 |
+
cancel-in-progress: false
|
| 25 |
+
|
| 26 |
+
env:
|
| 27 |
+
REGISTRY: ghcr.io
|
| 28 |
+
REGISTRY_ORG: containers
|
| 29 |
+
|
| 30 |
+
jobs:
|
| 31 |
+
instructlab-nvidia:
|
| 32 |
+
if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests') && github.repository == 'containers-mirror/ai-lab-recipes'"
|
| 33 |
+
strategy:
|
| 34 |
+
matrix:
|
| 35 |
+
include:
|
| 36 |
+
- make_target: nvidia
|
| 37 |
+
- make_target: amd
|
| 38 |
+
runs-on: ubuntu-latest
|
| 39 |
+
# runs-on: ubuntu-22.04-2core # starting with minimal option
|
| 40 |
+
steps:
|
| 41 |
+
- name: Remove unnecessary files
|
| 42 |
+
run: |
|
| 43 |
+
sudo rm -rf /usr/share/dotnet
|
| 44 |
+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
| 45 |
+
|
| 46 |
+
- uses: actions/checkout@v4.1.7
|
| 47 |
+
|
| 48 |
+
- name: Build Image
|
| 49 |
+
id: build_image
|
| 50 |
+
run: make ${{ matrix.make_target}}
|
| 51 |
+
working-directory: ./training/instructlab
|
| 52 |
+
|
| 53 |
+
- name: Login to Container Registry
|
| 54 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 55 |
+
uses: redhat-actions/podman-login@v1.7
|
| 56 |
+
with:
|
| 57 |
+
registry: ${{ env.REGISTRY }}
|
| 58 |
+
username: ${{ secrets.REGISTRY_USER }}
|
| 59 |
+
password: ${{ secrets.REGISTRY_PASSWORD }}
|
| 60 |
+
|
| 61 |
+
- name: Push image
|
| 62 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 63 |
+
uses: redhat-actions/push-to-registry@v2.8
|
| 64 |
+
with:
|
| 65 |
+
image: ${{ steps.build_image.outputs.image }}
|
| 66 |
+
tags: ${{ steps.build_image.outputs.tags }}
|
| 67 |
+
registry: ${{ env.REGISTRY }}
|
| 68 |
+
|
| 69 |
+
- name: Publish Job Results to Slack
|
| 70 |
+
id: slack
|
| 71 |
+
if: always()
|
| 72 |
+
uses: slackapi/slack-github-action@v1.26.0
|
| 73 |
+
with:
|
| 74 |
+
payload: |
|
| 75 |
+
{
|
| 76 |
+
"text": "${{ github.workflow }} workflow status: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
| 77 |
+
}
|
| 78 |
+
env:
|
| 79 |
+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
chatbot/.github/workflows/manual_build_trigger.yaml
ADDED
|
@@ -0,0 +1,343 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Update quay.io/ai-lab images with manual trigger
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
workflow_dispatch:
|
| 5 |
+
|
| 6 |
+
env:
|
| 7 |
+
REGISTRY: quay.io/ai-lab
|
| 8 |
+
CHATBOT_IMAGE_NAME: chatbot
|
| 9 |
+
CODEGEN_IMAGE_NAME: codegen
|
| 10 |
+
SUMMARIZER_IMAGE_NAME: summarizer
|
| 11 |
+
LLAMACPP_PYTHON_IMAGE_NAME: llamacpp_python
|
| 12 |
+
LLAMACPP_PYTHON_VULKAN_IMAGE_NAME: llamacpp_python_vulkan
|
| 13 |
+
LLAMACPP_PYTHON_CUDA_IMAGE_NAME: llamacpp_python_cuda
|
| 14 |
+
CHROMADB_IMAGE_NAME: chromadb
|
| 15 |
+
RAG_IMAGE_NAME: rag
|
| 16 |
+
|
| 17 |
+
jobs:
|
| 18 |
+
build-and-push-llamacpp-python-cuda-image:
|
| 19 |
+
runs-on: ubuntu-24.04
|
| 20 |
+
permissions:
|
| 21 |
+
contents: read
|
| 22 |
+
packages: write
|
| 23 |
+
|
| 24 |
+
steps:
|
| 25 |
+
- name: Remove unnecessary files
|
| 26 |
+
run: |
|
| 27 |
+
sudo rm -rf /usr/share/dotnet
|
| 28 |
+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
| 29 |
+
- uses: actions/checkout@v4.1.7
|
| 30 |
+
|
| 31 |
+
- name: Build llamacpp_python cuda
|
| 32 |
+
id: build_llamacpp_python_cuda
|
| 33 |
+
uses: redhat-actions/buildah-build@v2
|
| 34 |
+
with:
|
| 35 |
+
image: ${{ env.LLAMACPP_PYTHON_CUDA_IMAGE_NAME }}
|
| 36 |
+
tags: latest ${{ github.sha }}
|
| 37 |
+
platforms: linux/amd64
|
| 38 |
+
containerfiles: ./model_servers/llamacpp_python/cuda/Containerfile
|
| 39 |
+
context: model_servers/llamacpp_python
|
| 40 |
+
|
| 41 |
+
- name: Login to quay.io
|
| 42 |
+
uses: redhat-actions/podman-login@v1
|
| 43 |
+
with:
|
| 44 |
+
registry: quay.io
|
| 45 |
+
username: ${{ secrets.REGISTRY_USER }}
|
| 46 |
+
password: ${{ secrets.REGISTRY_PASSWORD }}
|
| 47 |
+
|
| 48 |
+
- name: Push llamacpp_python cuda image
|
| 49 |
+
id: push_llamacpp_python_cuda
|
| 50 |
+
uses: redhat-actions/push-to-registry@v2
|
| 51 |
+
with:
|
| 52 |
+
registry: ${{ env.REGISTRY }}
|
| 53 |
+
image: ${{ steps.build_llamacpp_python_cuda.outputs.image }}
|
| 54 |
+
tags: ${{ steps.build_llamacpp_python_cuda.outputs.tags }}
|
| 55 |
+
|
| 56 |
+
build-and-push-llamacpp-python-vulkan-image:
|
| 57 |
+
runs-on: ubuntu-24.04
|
| 58 |
+
permissions:
|
| 59 |
+
contents: read
|
| 60 |
+
packages: write
|
| 61 |
+
|
| 62 |
+
steps:
|
| 63 |
+
- name: Remove unnecessary files
|
| 64 |
+
run: |
|
| 65 |
+
sudo rm -rf /usr/share/dotnet
|
| 66 |
+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
| 67 |
+
- uses: actions/checkout@v4.1.7
|
| 68 |
+
|
| 69 |
+
# required for multi-arch builds
|
| 70 |
+
- name: Install qemu dependency
|
| 71 |
+
run: |
|
| 72 |
+
sudo apt-get update
|
| 73 |
+
sudo apt-get install -y qemu-user-static
|
| 74 |
+
|
| 75 |
+
- name: Build llamacpp_python vulkan
|
| 76 |
+
id: build_llamacpp_python_vulkan
|
| 77 |
+
uses: redhat-actions/buildah-build@v2
|
| 78 |
+
with:
|
| 79 |
+
image: ${{ env.LLAMACPP_PYTHON_VULKAN_IMAGE_NAME }}
|
| 80 |
+
tags: latest ${{ github.sha }}
|
| 81 |
+
platforms: linux/arm64
|
| 82 |
+
containerfiles: ./model_servers/llamacpp_python/vulkan/Containerfile
|
| 83 |
+
context: model_servers/llamacpp_python
|
| 84 |
+
|
| 85 |
+
- name: Login to quay.io
|
| 86 |
+
uses: redhat-actions/podman-login@v1
|
| 87 |
+
with:
|
| 88 |
+
registry: quay.io
|
| 89 |
+
username: ${{ secrets.REGISTRY_USER }}
|
| 90 |
+
password: ${{ secrets.REGISTRY_PASSWORD }}
|
| 91 |
+
|
| 92 |
+
- name: Push llamacpp_python vulkan image
|
| 93 |
+
id: push_llamacpp_python_vulkan
|
| 94 |
+
uses: redhat-actions/push-to-registry@v2
|
| 95 |
+
with:
|
| 96 |
+
registry: ${{ env.REGISTRY }}
|
| 97 |
+
image: ${{ steps.build_llamacpp_python_vulkan.outputs.image }}
|
| 98 |
+
tags: ${{ steps.build_llamacpp_python_vulkan.outputs.tags }}
|
| 99 |
+
|
| 100 |
+
build-and-push-llamacpp-python-base-image:
|
| 101 |
+
runs-on: ubuntu-24.04
|
| 102 |
+
permissions:
|
| 103 |
+
contents: read
|
| 104 |
+
packages: write
|
| 105 |
+
|
| 106 |
+
steps:
|
| 107 |
+
- name: Remove unnecessary files
|
| 108 |
+
run: |
|
| 109 |
+
sudo rm -rf /usr/share/dotnet
|
| 110 |
+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
| 111 |
+
- uses: actions/checkout@v4.1.7
|
| 112 |
+
# required for multi-arch builds
|
| 113 |
+
- name: Install qemu dependency
|
| 114 |
+
run: |
|
| 115 |
+
sudo apt-get update
|
| 116 |
+
sudo apt-get install -y qemu-user-static
|
| 117 |
+
|
| 118 |
+
- name: Build llamacpp_python base
|
| 119 |
+
id: build_llamacpp_python_base
|
| 120 |
+
uses: redhat-actions/buildah-build@v2
|
| 121 |
+
with:
|
| 122 |
+
image: ${{ env.LLAMACPP_PYTHON_IMAGE_NAME }}
|
| 123 |
+
tags: latest ${{ github.sha }}
|
| 124 |
+
platforms: linux/amd64, linux/arm64
|
| 125 |
+
containerfiles: ./model_servers/llamacpp_python/base/Containerfile
|
| 126 |
+
context: model_servers/llamacpp_python
|
| 127 |
+
|
| 128 |
+
- name: Login to quay.io
|
| 129 |
+
uses: redhat-actions/podman-login@v1
|
| 130 |
+
with:
|
| 131 |
+
registry: quay.io
|
| 132 |
+
username: ${{ secrets.REGISTRY_USER }}
|
| 133 |
+
password: ${{ secrets.REGISTRY_PASSWORD }}
|
| 134 |
+
|
| 135 |
+
- name: Push llamacpp_python image
|
| 136 |
+
id: push_llamacpp_python_base
|
| 137 |
+
uses: redhat-actions/push-to-registry@v2
|
| 138 |
+
with:
|
| 139 |
+
registry: ${{ env.REGISTRY }}
|
| 140 |
+
image: ${{ steps.build_llamacpp_python_base.outputs.image }}
|
| 141 |
+
tags: ${{ steps.build_llamacpp_python_base.outputs.tags }}
|
| 142 |
+
|
| 143 |
+
build-and-push-rag-image:
|
| 144 |
+
runs-on: ubuntu-24.04
|
| 145 |
+
permissions:
|
| 146 |
+
contents: read
|
| 147 |
+
packages: write
|
| 148 |
+
|
| 149 |
+
steps:
|
| 150 |
+
- name: Remove unnecessary files
|
| 151 |
+
run: |
|
| 152 |
+
sudo rm -rf /usr/share/dotnet
|
| 153 |
+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
| 154 |
+
- uses: actions/checkout@v4.1.7
|
| 155 |
+
# required for multi-arch builds
|
| 156 |
+
- name: Install qemu dependency
|
| 157 |
+
run: |
|
| 158 |
+
sudo apt-get update
|
| 159 |
+
sudo apt-get install -y qemu-user-static
|
| 160 |
+
|
| 161 |
+
- name: Build rag
|
| 162 |
+
id: build_rag
|
| 163 |
+
uses: redhat-actions/buildah-build@v2
|
| 164 |
+
with:
|
| 165 |
+
image: ${{ env.RAG_IMAGE_NAME }}
|
| 166 |
+
tags: latest ${{ github.sha }}
|
| 167 |
+
platforms: linux/amd64, linux/arm64
|
| 168 |
+
containerfiles: ./recipes/natural_language_processing/rag/app/Containerfile
|
| 169 |
+
context: recipes/natural_language_processing/rag/app
|
| 170 |
+
|
| 171 |
+
- name: Login to quay.io
|
| 172 |
+
uses: redhat-actions/podman-login@v1
|
| 173 |
+
with:
|
| 174 |
+
registry: quay.io
|
| 175 |
+
username: ${{ secrets.REGISTRY_USER }}
|
| 176 |
+
password: ${{ secrets.REGISTRY_PASSWORD }}
|
| 177 |
+
|
| 178 |
+
- name: Push rag image
|
| 179 |
+
id: push_rag
|
| 180 |
+
uses: redhat-actions/push-to-registry@v2
|
| 181 |
+
with:
|
| 182 |
+
registry: ${{ env.REGISTRY }}
|
| 183 |
+
image: ${{ steps.build_rag.outputs.image }}
|
| 184 |
+
tags: ${{ steps.build_rag.outputs.tags }}
|
| 185 |
+
|
| 186 |
+
build-and-push-chromadb-image:
|
| 187 |
+
runs-on: ubuntu-24.04
|
| 188 |
+
permissions:
|
| 189 |
+
contents: read
|
| 190 |
+
packages: write
|
| 191 |
+
|
| 192 |
+
steps:
|
| 193 |
+
- uses: actions/checkout@v4.1.7
|
| 194 |
+
# required for multi-arch builds
|
| 195 |
+
- name: Install qemu dependency
|
| 196 |
+
run: |
|
| 197 |
+
sudo apt-get update
|
| 198 |
+
sudo apt-get install -y qemu-user-static
|
| 199 |
+
|
| 200 |
+
- name: Build chromadb
|
| 201 |
+
id: build_chromadb
|
| 202 |
+
uses: redhat-actions/buildah-build@v2
|
| 203 |
+
with:
|
| 204 |
+
image: ${{ env.CHROMADB_IMAGE_NAME }}
|
| 205 |
+
tags: latest ${{ github.sha }}
|
| 206 |
+
platforms: linux/amd64, linux/arm64
|
| 207 |
+
context: vector_dbs/chromadb
|
| 208 |
+
containerfiles: ./vector_dbs/chromadb/Containerfile
|
| 209 |
+
|
| 210 |
+
- name: Login to quay.io
|
| 211 |
+
uses: redhat-actions/podman-login@v1
|
| 212 |
+
with:
|
| 213 |
+
registry: quay.io
|
| 214 |
+
username: ${{ secrets.REGISTRY_USER }}
|
| 215 |
+
password: ${{ secrets.REGISTRY_PASSWORD }}
|
| 216 |
+
|
| 217 |
+
- name: Push chromadb image
|
| 218 |
+
id: push_chromadb
|
| 219 |
+
uses: redhat-actions/push-to-registry@v2
|
| 220 |
+
with:
|
| 221 |
+
registry: ${{ env.REGISTRY }}
|
| 222 |
+
image: ${{ steps.build_chromadb.outputs.image }}
|
| 223 |
+
tags: ${{ steps.build_chromadb.outputs.tags }}
|
| 224 |
+
|
| 225 |
+
build-and-push-codegen-image:
|
| 226 |
+
runs-on: ubuntu-24.04
|
| 227 |
+
permissions:
|
| 228 |
+
contents: read
|
| 229 |
+
packages: write
|
| 230 |
+
|
| 231 |
+
steps:
|
| 232 |
+
- uses: actions/checkout@v4.1.7
|
| 233 |
+
|
| 234 |
+
# required for multi-arch builds
|
| 235 |
+
- name: Install qemu dependency
|
| 236 |
+
run: |
|
| 237 |
+
sudo apt-get update
|
| 238 |
+
sudo apt-get install -y qemu-user-static
|
| 239 |
+
|
| 240 |
+
- name: Build codegen image
|
| 241 |
+
id: build_codegen_image
|
| 242 |
+
uses: redhat-actions/buildah-build@v2.13
|
| 243 |
+
with:
|
| 244 |
+
image: ${{ env.CODEGEN_IMAGE_NAME }}
|
| 245 |
+
tags: latest ${{ github.sha }}
|
| 246 |
+
platforms: linux/amd64, linux/arm64
|
| 247 |
+
containerfiles: ./recipes/natural_language_processing/codegen/app/Containerfile
|
| 248 |
+
context: recipes/natural_language_processing/codegen/app
|
| 249 |
+
|
| 250 |
+
- name: Login to quay.io
|
| 251 |
+
uses: redhat-actions/podman-login@v1
|
| 252 |
+
with:
|
| 253 |
+
registry: quay.io
|
| 254 |
+
username: ${{ secrets.REGISTRY_USER }}
|
| 255 |
+
password: ${{ secrets.REGISTRY_PASSWORD }}
|
| 256 |
+
|
| 257 |
+
- name: Push codegen image
|
| 258 |
+
id: push_codegen_image
|
| 259 |
+
uses: redhat-actions/push-to-registry@v2.8
|
| 260 |
+
with:
|
| 261 |
+
registry: ${{ env.REGISTRY }}
|
| 262 |
+
image: ${{ steps.build_codegen_image.outputs.image }}
|
| 263 |
+
tags: ${{ steps.build_codegen_image.outputs.tags }}
|
| 264 |
+
|
| 265 |
+
build-and-push-chatbot-image:
|
| 266 |
+
runs-on: ubuntu-24.04
|
| 267 |
+
permissions:
|
| 268 |
+
contents: read
|
| 269 |
+
packages: write
|
| 270 |
+
|
| 271 |
+
steps:
|
| 272 |
+
- uses: actions/checkout@v4.1.7
|
| 273 |
+
|
| 274 |
+
# required for multi-arch builds
|
| 275 |
+
- name: Install qemu dependency
|
| 276 |
+
run: |
|
| 277 |
+
sudo apt-get update
|
| 278 |
+
sudo apt-get install -y qemu-user-static
|
| 279 |
+
|
| 280 |
+
- name: Build chatbot image
|
| 281 |
+
id: build_chatbot_image
|
| 282 |
+
uses: redhat-actions/buildah-build@v2.13
|
| 283 |
+
with:
|
| 284 |
+
image: ${{ env.CHATBOT_IMAGE_NAME }}
|
| 285 |
+
tags: latest ${{ github.sha }}
|
| 286 |
+
platforms: linux/amd64, linux/arm64
|
| 287 |
+
containerfiles: ./recipes/natural_language_processing/chatbot/app/Containerfile
|
| 288 |
+
context: recipes/natural_language_processing/chatbot/app
|
| 289 |
+
|
| 290 |
+
- name: Login to quay.io
|
| 291 |
+
uses: redhat-actions/podman-login@v1
|
| 292 |
+
with:
|
| 293 |
+
registry: quay.io
|
| 294 |
+
username: ${{ secrets.REGISTRY_USER }}
|
| 295 |
+
password: ${{ secrets.REGISTRY_PASSWORD }}
|
| 296 |
+
|
| 297 |
+
- name: Push chatbot image
|
| 298 |
+
id: push_chatbot_image
|
| 299 |
+
uses: redhat-actions/push-to-registry@v2.8
|
| 300 |
+
with:
|
| 301 |
+
registry: ${{ env.REGISTRY }}
|
| 302 |
+
image: ${{ steps.build_chatbot_image.outputs.image }}
|
| 303 |
+
tags: ${{ steps.build_chatbot_image.outputs.tags }}
|
| 304 |
+
|
| 305 |
+
build-and-push-summarizer-image:
|
| 306 |
+
runs-on: ubuntu-24.04
|
| 307 |
+
permissions:
|
| 308 |
+
contents: read
|
| 309 |
+
packages: write
|
| 310 |
+
|
| 311 |
+
steps:
|
| 312 |
+
- uses: actions/checkout@v4.1.7
|
| 313 |
+
|
| 314 |
+
# required for multi-arch builds
|
| 315 |
+
- name: Install qemu dependency
|
| 316 |
+
run: |
|
| 317 |
+
sudo apt-get update
|
| 318 |
+
sudo apt-get install -y qemu-user-static
|
| 319 |
+
|
| 320 |
+
- name: Build summarizer image
|
| 321 |
+
id: build_summarizer_image
|
| 322 |
+
uses: redhat-actions/buildah-build@v2.13
|
| 323 |
+
with:
|
| 324 |
+
image: ${{ env.SUMMARIZER_IMAGE_NAME }}
|
| 325 |
+
tags: latest ${{ github.sha }}
|
| 326 |
+
platforms: linux/amd64, linux/arm64
|
| 327 |
+
containerfiles: ./recipes/natural_language_processing/summarizer/app/Containerfile
|
| 328 |
+
context: recipes/natural_language_processing/summarizer/app
|
| 329 |
+
|
| 330 |
+
- name: Login to quay.io
|
| 331 |
+
uses: redhat-actions/podman-login@v1
|
| 332 |
+
with:
|
| 333 |
+
registry: quay.io
|
| 334 |
+
username: ${{ secrets.REGISTRY_USER }}
|
| 335 |
+
password: ${{ secrets.REGISTRY_PASSWORD }}
|
| 336 |
+
|
| 337 |
+
- name: Push summarizer image
|
| 338 |
+
id: push_summarizer_image
|
| 339 |
+
uses: redhat-actions/push-to-registry@v2.8
|
| 340 |
+
with:
|
| 341 |
+
registry: ${{ env.REGISTRY }}
|
| 342 |
+
image: ${{ steps.build_summarizer_image.outputs.image }}
|
| 343 |
+
tags: ${{ steps.build_summarizer_image.outputs.tags }}
|
chatbot/.github/workflows/mirror_repository.yaml
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Mirror Repository
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches:
|
| 6 |
+
- main
|
| 7 |
+
|
| 8 |
+
workflow_dispatch:
|
| 9 |
+
|
| 10 |
+
concurrency:
|
| 11 |
+
group: ${{ github.workflow }}
|
| 12 |
+
cancel-in-progress: false
|
| 13 |
+
|
| 14 |
+
jobs:
|
| 15 |
+
mirror-repository:
|
| 16 |
+
if: github.repository == 'containers/ai-lab-recipes'
|
| 17 |
+
runs-on: ubuntu-24.04
|
| 18 |
+
steps:
|
| 19 |
+
- uses: actions/checkout@v4.1.7
|
| 20 |
+
with:
|
| 21 |
+
fetch-depth: 0
|
| 22 |
+
|
| 23 |
+
- uses: pixta-dev/repository-mirroring-action@v1.1.1
|
| 24 |
+
with:
|
| 25 |
+
target_repo_url:
|
| 26 |
+
git@github.com:containers-mirror/ai-lab-recipes.git
|
| 27 |
+
ssh_private_key:
|
| 28 |
+
${{ secrets.SSH_PRIVATE_KEY }}
|
| 29 |
+
|
| 30 |
+
- name: Publish Job Results to Slack
|
| 31 |
+
id: slack
|
| 32 |
+
if: always()
|
| 33 |
+
uses: slackapi/slack-github-action@v1.26.0
|
| 34 |
+
with:
|
| 35 |
+
payload: |
|
| 36 |
+
{
|
| 37 |
+
"text": "${{ github.workflow }} workflow status: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
| 38 |
+
}
|
| 39 |
+
env:
|
| 40 |
+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
chatbot/.github/workflows/model_converter.yaml
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Update quay.io/ai-lab model images
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request:
|
| 5 |
+
branches:
|
| 6 |
+
- main
|
| 7 |
+
paths:
|
| 8 |
+
- 'convert_models/**'
|
| 9 |
+
- '!convert_models/README.md'
|
| 10 |
+
- '.github/workflows/model_converter.yaml'
|
| 11 |
+
push:
|
| 12 |
+
branches:
|
| 13 |
+
- main
|
| 14 |
+
paths:
|
| 15 |
+
- 'convert_models/**'
|
| 16 |
+
- '!convert_models/README.md'
|
| 17 |
+
- '.github/workflows/model_converter.yaml'
|
| 18 |
+
|
| 19 |
+
workflow_dispatch:
|
| 20 |
+
|
| 21 |
+
env:
|
| 22 |
+
REGISTRY: quay.io
|
| 23 |
+
REGISTRY_ORG: ai-lab
|
| 24 |
+
|
| 25 |
+
jobs:
|
| 26 |
+
model-converter-build-and-push:
|
| 27 |
+
if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests')"
|
| 28 |
+
strategy:
|
| 29 |
+
matrix:
|
| 30 |
+
include:
|
| 31 |
+
- platforms: linux/amd64,linux/arm64
|
| 32 |
+
runs-on: ubuntu-24.04
|
| 33 |
+
permissions:
|
| 34 |
+
contents: read
|
| 35 |
+
packages: write
|
| 36 |
+
steps:
|
| 37 |
+
- name: Remove unnecessary files
|
| 38 |
+
run: |
|
| 39 |
+
sudo rm -rf /usr/share/dotnet
|
| 40 |
+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
| 41 |
+
|
| 42 |
+
- uses: actions/checkout@v4.1.7
|
| 43 |
+
|
| 44 |
+
- name: Install qemu dependency
|
| 45 |
+
run: |
|
| 46 |
+
sudo apt-get update
|
| 47 |
+
sudo apt-get install -y qemu-user-static
|
| 48 |
+
|
| 49 |
+
- name: Build Image
|
| 50 |
+
id: build_image
|
| 51 |
+
uses: redhat-actions/buildah-build@v2.13
|
| 52 |
+
with:
|
| 53 |
+
image: ${{ env.REGISTRY_ORG }}/model-converter
|
| 54 |
+
platforms: ${{ matrix.platforms }}
|
| 55 |
+
tags: latest
|
| 56 |
+
containerfiles: convert_models/Containerfile
|
| 57 |
+
context: convert_models
|
| 58 |
+
|
| 59 |
+
- name: Login to Container Registry
|
| 60 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 61 |
+
uses: redhat-actions/podman-login@v1.7
|
| 62 |
+
with:
|
| 63 |
+
registry: ${{ env.REGISTRY }}
|
| 64 |
+
username: ${{ secrets.REGISTRY_USER }}
|
| 65 |
+
password: ${{ secrets.REGISTRY_PASSWORD }}
|
| 66 |
+
|
| 67 |
+
- name: Push image
|
| 68 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 69 |
+
uses: redhat-actions/push-to-registry@v2.8
|
| 70 |
+
with:
|
| 71 |
+
image: ${{ steps.build_image.outputs.image }}
|
| 72 |
+
tags: ${{ steps.build_image.outputs.tags }}
|
| 73 |
+
registry: ${{ env.REGISTRY }}
|
chatbot/.github/workflows/model_servers.yaml
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Model Servers
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request:
|
| 5 |
+
branches:
|
| 6 |
+
- main
|
| 7 |
+
paths:
|
| 8 |
+
- 'model_servers/**'
|
| 9 |
+
- 'models/Makefile'
|
| 10 |
+
- .github/workflows/model_servers.yaml
|
| 11 |
+
push:
|
| 12 |
+
branches:
|
| 13 |
+
- main
|
| 14 |
+
paths:
|
| 15 |
+
- 'model_servers/**'
|
| 16 |
+
- 'models/Makefile'
|
| 17 |
+
- .github/workflows/model_servers.yaml
|
| 18 |
+
tags:
|
| 19 |
+
- '*'
|
| 20 |
+
|
| 21 |
+
workflow_dispatch:
|
| 22 |
+
|
| 23 |
+
env:
|
| 24 |
+
REGISTRY: ghcr.io
|
| 25 |
+
REGISTRY_ORG: containers
|
| 26 |
+
|
| 27 |
+
jobs:
|
| 28 |
+
model-servers-buid-and-push:
|
| 29 |
+
if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests')"
|
| 30 |
+
strategy:
|
| 31 |
+
matrix:
|
| 32 |
+
include:
|
| 33 |
+
- image_name: llamacpp_python
|
| 34 |
+
model: granite
|
| 35 |
+
flavor: base
|
| 36 |
+
directory: llamacpp_python
|
| 37 |
+
platforms: linux/amd64,linux/arm64
|
| 38 |
+
no_gpu: 1
|
| 39 |
+
- image_name: llamacpp-python-cuda
|
| 40 |
+
model: granite
|
| 41 |
+
flavor: cuda
|
| 42 |
+
directory: llamacpp_python
|
| 43 |
+
platforms: linux/amd64,linux/arm64
|
| 44 |
+
no_gpu: 0
|
| 45 |
+
- image_name: llamacpp-python-vulkan-amd
|
| 46 |
+
model: granite
|
| 47 |
+
flavor: vulkan/amd64
|
| 48 |
+
directory: llamacpp_python
|
| 49 |
+
platforms: linux/amd64
|
| 50 |
+
no_gpu: 0
|
| 51 |
+
- image_name: llamacpp-python-vulkan-arm
|
| 52 |
+
model: granite
|
| 53 |
+
flavor: vulkan/arm64
|
| 54 |
+
directory: llamacpp_python
|
| 55 |
+
platforms: linux/arm64
|
| 56 |
+
no_gpu: 0
|
| 57 |
+
- image_name: whispercpp
|
| 58 |
+
model: whisper-small
|
| 59 |
+
flavor: base
|
| 60 |
+
directory: whispercpp
|
| 61 |
+
platforms: linux/amd64,linux/arm64
|
| 62 |
+
no_gpu: 1
|
| 63 |
+
- image_name: object_detection_python
|
| 64 |
+
model: facebook-detr-resnet-101
|
| 65 |
+
flavor: base
|
| 66 |
+
directory: object_detection_python
|
| 67 |
+
platforms: linux/amd64,linux/arm64
|
| 68 |
+
no_gpu: 1
|
| 69 |
+
runs-on: ubuntu-24.04
|
| 70 |
+
permissions:
|
| 71 |
+
contents: read
|
| 72 |
+
packages: write
|
| 73 |
+
services:
|
| 74 |
+
registry:
|
| 75 |
+
image: registry:2.8.3
|
| 76 |
+
ports:
|
| 77 |
+
- 5000:5000
|
| 78 |
+
steps:
|
| 79 |
+
- name: Remove unnecessary files
|
| 80 |
+
run: |
|
| 81 |
+
sudo rm -rf /usr/share/dotnet
|
| 82 |
+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
| 83 |
+
|
| 84 |
+
- uses: actions/checkout@v4.1.7
|
| 85 |
+
|
| 86 |
+
- name: Install qemu dependency
|
| 87 |
+
run: |
|
| 88 |
+
sudo apt-get update
|
| 89 |
+
sudo apt-get install -y qemu-user-static
|
| 90 |
+
|
| 91 |
+
- name: Set up Python
|
| 92 |
+
uses: actions/setup-python@v5.1.1
|
| 93 |
+
with:
|
| 94 |
+
python-version: '3.11'
|
| 95 |
+
|
| 96 |
+
- name: Build Image
|
| 97 |
+
id: build_image
|
| 98 |
+
uses: redhat-actions/buildah-build@v2.13
|
| 99 |
+
with:
|
| 100 |
+
image: ${{ env.REGISTRY }}/${{ github.repository_owner}}/${{ matrix.image_name }}
|
| 101 |
+
platforms: ${{ matrix.platforms }}
|
| 102 |
+
tags: latest ${{ github.ref_type == 'tag' && github.ref_name || '' }}
|
| 103 |
+
containerfiles: ./model_servers/${{ matrix.directory }}/${{ matrix.flavor }}/Containerfile
|
| 104 |
+
context: model_servers/${{ matrix.directory }}/
|
| 105 |
+
|
| 106 |
+
- name: Download model
|
| 107 |
+
working-directory: ./models
|
| 108 |
+
run: make download-model-${{ matrix.model }}
|
| 109 |
+
|
| 110 |
+
- name: Install python dependencies
|
| 111 |
+
working-directory: ./model_servers/${{ matrix.directory }}/
|
| 112 |
+
run: make install
|
| 113 |
+
|
| 114 |
+
- name: Run non-gpu tests
|
| 115 |
+
working-directory: ./model_servers/${{ matrix.directory }}/
|
| 116 |
+
if: ${{ matrix.no_gpu }}
|
| 117 |
+
run: make test REGISTRY=${{ env.REGISTRY }} IMAGE_NAME=${{ env.REGISTRY_ORG }}/${{ matrix.image_name}}:latest
|
| 118 |
+
|
| 119 |
+
- name: Login to Container Registry
|
| 120 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 121 |
+
uses: redhat-actions/podman-login@v1.7
|
| 122 |
+
with:
|
| 123 |
+
registry: ${{ env.REGISTRY }}
|
| 124 |
+
username: ${{ github.actor }}
|
| 125 |
+
password: ${{ secrets.GITHUB_TOKEN }}
|
| 126 |
+
|
| 127 |
+
- name: Push image
|
| 128 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 129 |
+
uses: redhat-actions/push-to-registry@v2.8
|
| 130 |
+
with:
|
| 131 |
+
image: ${{ steps.build_image.outputs.image }}
|
| 132 |
+
tags: ${{ steps.build_image.outputs.tags }}
|
| 133 |
+
registry: ${{ env.REGISTRY }}
|
chatbot/.github/workflows/models.yaml
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Update quay.io/ai-lab model images
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
schedule: # schedule the job to run at 12 AM daily
|
| 5 |
+
- cron: '0 0 * * *'
|
| 6 |
+
|
| 7 |
+
pull_request:
|
| 8 |
+
branches:
|
| 9 |
+
- main
|
| 10 |
+
paths:
|
| 11 |
+
- .github/workflows/model_image_build_push.yaml
|
| 12 |
+
push:
|
| 13 |
+
branches:
|
| 14 |
+
- main
|
| 15 |
+
paths:
|
| 16 |
+
- .github/workflows/model_image_build_push.yaml
|
| 17 |
+
|
| 18 |
+
workflow_dispatch:
|
| 19 |
+
|
| 20 |
+
env:
|
| 21 |
+
REGISTRY: quay.io
|
| 22 |
+
REGISTRY_ORG: ai-lab
|
| 23 |
+
|
| 24 |
+
jobs:
|
| 25 |
+
models-build-and-push:
|
| 26 |
+
if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests')"
|
| 27 |
+
strategy:
|
| 28 |
+
matrix:
|
| 29 |
+
include:
|
| 30 |
+
- image_name: mistral-7b-code-16k-qlora
|
| 31 |
+
label: Q4_K_M
|
| 32 |
+
url: https://huggingface.co/TheBloke/Mistral-7B-Code-16K-qlora-GGUF/resolve/main/mistral-7b-code-16k-qlora.Q4_K_M.gguf
|
| 33 |
+
platforms: linux/amd64,linux/arm64
|
| 34 |
+
- image_name: mistral-7b-instruct
|
| 35 |
+
label: Q4_K_M
|
| 36 |
+
url: https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF/resolve/main/mistral-7b-instruct-v0.2.Q4_K_M.gguf
|
| 37 |
+
platforms: linux/amd64,linux/arm64
|
| 38 |
+
- image_name: merlinite-7b-lab
|
| 39 |
+
label: Q4_K_M
|
| 40 |
+
url: https://huggingface.co/instructlab/merlinite-7b-lab-GGUF/resolve/main/merlinite-7b-lab-Q4_K_M.gguf
|
| 41 |
+
platforms: linux/amd64,linux/arm64
|
| 42 |
+
- image_name: granite-7b-lab
|
| 43 |
+
label: Q4_K_M
|
| 44 |
+
url: https://huggingface.co/instructlab/granite-7b-lab-GGUF/resolve/main/granite-7b-lab-Q4_K_M.gguf
|
| 45 |
+
platforms: linux/amd64,linux/arm64
|
| 46 |
+
- image_name: whisper-small
|
| 47 |
+
url: https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.bin
|
| 48 |
+
platforms: linux/amd64,linux/arm64
|
| 49 |
+
runs-on: ubuntu-24.04
|
| 50 |
+
permissions:
|
| 51 |
+
contents: read
|
| 52 |
+
packages: write
|
| 53 |
+
steps:
|
| 54 |
+
- name: Remove unnecessary files
|
| 55 |
+
run: |
|
| 56 |
+
sudo rm -rf /usr/share/dotnet
|
| 57 |
+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
| 58 |
+
|
| 59 |
+
- uses: actions/checkout@v4.1.7
|
| 60 |
+
|
| 61 |
+
- name: Install qemu dependency
|
| 62 |
+
run: |
|
| 63 |
+
sudo apt-get update
|
| 64 |
+
sudo apt-get install -y qemu-user-static
|
| 65 |
+
|
| 66 |
+
- name: Build Image
|
| 67 |
+
id: build_image
|
| 68 |
+
uses: redhat-actions/buildah-build@v2.13
|
| 69 |
+
with:
|
| 70 |
+
image: ${{ env.REGISTRY_ORG }}/${{ matrix.image_name }}
|
| 71 |
+
platforms: ${{ matrix.platforms }}
|
| 72 |
+
labels: |
|
| 73 |
+
${{ matrix.label }}
|
| 74 |
+
build-args: |
|
| 75 |
+
MODEL_URL=${{ matrix.url }}
|
| 76 |
+
tags: latest
|
| 77 |
+
containerfiles: ./models/Containerfile
|
| 78 |
+
context: models
|
| 79 |
+
|
| 80 |
+
- name: Login to Container Registry
|
| 81 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 82 |
+
uses: redhat-actions/podman-login@v1.7
|
| 83 |
+
with:
|
| 84 |
+
registry: ${{ env.REGISTRY }}
|
| 85 |
+
username: ${{ secrets.REGISTRY_USER }}
|
| 86 |
+
password: ${{ secrets.REGISTRY_PASSWORD }}
|
| 87 |
+
|
| 88 |
+
- name: Push image
|
| 89 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 90 |
+
uses: redhat-actions/push-to-registry@v2.8
|
| 91 |
+
with:
|
| 92 |
+
image: ${{ steps.build_image.outputs.image }}
|
| 93 |
+
tags: ${{ steps.build_image.outputs.tags }}
|
| 94 |
+
registry: ${{ env.REGISTRY }}
|
chatbot/.github/workflows/object_detection.yaml
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Object Detection
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request:
|
| 5 |
+
branches:
|
| 6 |
+
- main
|
| 7 |
+
paths:
|
| 8 |
+
- ./recipes/computer_vision/object_detection/**
|
| 9 |
+
- .github/workflows/object_detection.yaml
|
| 10 |
+
push:
|
| 11 |
+
branches:
|
| 12 |
+
- main
|
| 13 |
+
paths:
|
| 14 |
+
- ./recipes/computer_vision/object_detection/**
|
| 15 |
+
- .github/workflows/object_detection.yaml
|
| 16 |
+
|
| 17 |
+
workflow_dispatch:
|
| 18 |
+
|
| 19 |
+
env:
|
| 20 |
+
REGISTRY: ghcr.io
|
| 21 |
+
REGISTRY_ORG: containers
|
| 22 |
+
RECIPE_NAME: object_detection
|
| 23 |
+
RECIPE_TYPE: computer_vision
|
| 24 |
+
IMAGE_NAME: object_detection_client
|
| 25 |
+
|
| 26 |
+
jobs:
|
| 27 |
+
object-detection-client-build-and-push:
|
| 28 |
+
if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests')"
|
| 29 |
+
runs-on: ubuntu-24.04
|
| 30 |
+
permissions:
|
| 31 |
+
contents: read
|
| 32 |
+
packages: write
|
| 33 |
+
services:
|
| 34 |
+
registry:
|
| 35 |
+
image: registry:2.8.3
|
| 36 |
+
ports:
|
| 37 |
+
- 5000:5000
|
| 38 |
+
steps:
|
| 39 |
+
- uses: actions/checkout@v4.1.7
|
| 40 |
+
|
| 41 |
+
- name: Install qemu dependency
|
| 42 |
+
run: |
|
| 43 |
+
sudo apt-get update
|
| 44 |
+
sudo apt-get install -y qemu-user-static
|
| 45 |
+
|
| 46 |
+
- name: Build Image
|
| 47 |
+
id: build_image
|
| 48 |
+
uses: redhat-actions/buildah-build@v2.13
|
| 49 |
+
with:
|
| 50 |
+
image: ${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}/${{ env.IMAGE_NAME }}
|
| 51 |
+
tags: latest
|
| 52 |
+
platforms: linux/amd64,linux/arm64
|
| 53 |
+
containerfiles: ./recipes/${{ env.RECIPE_TYPE }}/${{ env.RECIPE_NAME }}/app/Containerfile
|
| 54 |
+
context: recipes/${{ env.RECIPE_TYPE }}/${{ env.RECIPE_NAME }}/app
|
| 55 |
+
|
| 56 |
+
- name: Set up Python
|
| 57 |
+
uses: actions/setup-python@v5.1.1
|
| 58 |
+
with:
|
| 59 |
+
python-version: '3.11'
|
| 60 |
+
|
| 61 |
+
- name: Install Dependencies
|
| 62 |
+
working-directory: ./recipes/${{ env.RECIPE_TYPE }}/${{ env.RECIPE_NAME }}
|
| 63 |
+
run: make install
|
| 64 |
+
|
| 65 |
+
- name: Download model
|
| 66 |
+
working-directory: ./models
|
| 67 |
+
run: make download-model-facebook-detr-resnet-101
|
| 68 |
+
|
| 69 |
+
- name: Run Functional Tests
|
| 70 |
+
shell: bash
|
| 71 |
+
run: make functional-tests
|
| 72 |
+
working-directory: ./recipes/${{ env.RECIPE_TYPE }}/${{ env.RECIPE_NAME }}
|
| 73 |
+
|
| 74 |
+
- name: Login to Registry
|
| 75 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 76 |
+
uses: redhat-actions/podman-login@v1.7
|
| 77 |
+
with:
|
| 78 |
+
registry: ${{ env.REGISTRY }}
|
| 79 |
+
username: ${{ github.actor }}
|
| 80 |
+
password: ${{ secrets.GITHUB_TOKEN }}
|
| 81 |
+
|
| 82 |
+
- name: Push Image
|
| 83 |
+
id: push_image
|
| 84 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 85 |
+
uses: redhat-actions/push-to-registry@v2.8
|
| 86 |
+
with:
|
| 87 |
+
image: ${{ steps.build_image.outputs.image }}
|
| 88 |
+
tags: ${{ steps.build_image.outputs.tags }}
|
| 89 |
+
registry: ${{ env.REGISTRY }}
|
chatbot/.github/workflows/rag.yaml
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: rag
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request:
|
| 5 |
+
branches:
|
| 6 |
+
- main
|
| 7 |
+
paths:
|
| 8 |
+
- 'recipes/common/Makefile.common'
|
| 9 |
+
- 'recipes/natural_language_processing/rag/**'
|
| 10 |
+
- '.github/workflows/rag.yaml'
|
| 11 |
+
push:
|
| 12 |
+
branches:
|
| 13 |
+
- main
|
| 14 |
+
paths:
|
| 15 |
+
- 'recipes/common/Makefile.common'
|
| 16 |
+
- 'recipes/natural_language_processing/rag/**'
|
| 17 |
+
- '.github/workflows/rag.yaml'
|
| 18 |
+
|
| 19 |
+
workflow_dispatch:
|
| 20 |
+
|
| 21 |
+
env:
|
| 22 |
+
REGISTRY: ghcr.io
|
| 23 |
+
IMAGE_NAME: rag
|
| 24 |
+
|
| 25 |
+
jobs:
|
| 26 |
+
rag-build-and-push:
|
| 27 |
+
if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests')"
|
| 28 |
+
runs-on: ubuntu-24.04
|
| 29 |
+
permissions:
|
| 30 |
+
contents: read
|
| 31 |
+
packages: write
|
| 32 |
+
services:
|
| 33 |
+
registry:
|
| 34 |
+
image: registry:2.8.3
|
| 35 |
+
ports:
|
| 36 |
+
- 5000:5000
|
| 37 |
+
steps:
|
| 38 |
+
- name: Remove unnecessary files
|
| 39 |
+
run: |
|
| 40 |
+
sudo rm -rf /usr/share/dotnet
|
| 41 |
+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
| 42 |
+
|
| 43 |
+
- uses: actions/checkout@v4.1.7
|
| 44 |
+
|
| 45 |
+
- name: Install qemu dependency
|
| 46 |
+
run: |
|
| 47 |
+
sudo apt-get update
|
| 48 |
+
sudo apt-get install -y qemu-user-static
|
| 49 |
+
|
| 50 |
+
- name: Build Image
|
| 51 |
+
id: build_image
|
| 52 |
+
uses: redhat-actions/buildah-build@v2.13
|
| 53 |
+
with:
|
| 54 |
+
image: ${{ env.REGISTRY }}/containers/${{ env.IMAGE_NAME }}
|
| 55 |
+
tags: latest
|
| 56 |
+
platforms: linux/amd64, linux/arm64
|
| 57 |
+
containerfiles: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}/app/Containerfile
|
| 58 |
+
context: recipes/natural_language_processing/${{ env.IMAGE_NAME }}/app
|
| 59 |
+
|
| 60 |
+
- name: Set up Python
|
| 61 |
+
uses: actions/setup-python@v5.1.1
|
| 62 |
+
with:
|
| 63 |
+
python-version: '3.11'
|
| 64 |
+
|
| 65 |
+
- name: Install Dependencies
|
| 66 |
+
working-directory: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}
|
| 67 |
+
run: make install
|
| 68 |
+
|
| 69 |
+
- name: Download model
|
| 70 |
+
working-directory: ./models
|
| 71 |
+
run: make download-model-granite
|
| 72 |
+
|
| 73 |
+
- name: Run Functional Tests
|
| 74 |
+
shell: bash
|
| 75 |
+
run: make functional-tests
|
| 76 |
+
working-directory: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}
|
| 77 |
+
|
| 78 |
+
- name: Login to Registry
|
| 79 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 80 |
+
uses: redhat-actions/podman-login@v1.7
|
| 81 |
+
with:
|
| 82 |
+
registry: ${{ env.REGISTRY }}
|
| 83 |
+
username: ${{ github.actor }}
|
| 84 |
+
password: ${{ secrets.GITHUB_TOKEN }}
|
| 85 |
+
|
| 86 |
+
- name: Push Image
|
| 87 |
+
id: push_image
|
| 88 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 89 |
+
uses: redhat-actions/push-to-registry@v2.8
|
| 90 |
+
with:
|
| 91 |
+
image: ${{ steps.build_image.outputs.image }}
|
| 92 |
+
tags: ${{ steps.build_image.outputs.tags }}
|
| 93 |
+
registry: ${{ env.REGISTRY }}
|
chatbot/.github/workflows/summarizer.yaml
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: summarizer
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request:
|
| 5 |
+
branches:
|
| 6 |
+
- main
|
| 7 |
+
paths:
|
| 8 |
+
- ./recipes/common/Makefile.common
|
| 9 |
+
- ./recipes/natural_language_processing/summarizer/**
|
| 10 |
+
- .github/workflows/summarizer.yaml
|
| 11 |
+
push:
|
| 12 |
+
branches:
|
| 13 |
+
- main
|
| 14 |
+
paths:
|
| 15 |
+
- ./recipes/common/Makefile.common
|
| 16 |
+
- ./recipes/natural_language_processing/summarizer/**
|
| 17 |
+
- .github/workflows/summarizer.yaml
|
| 18 |
+
|
| 19 |
+
workflow_dispatch:
|
| 20 |
+
|
| 21 |
+
env:
|
| 22 |
+
REGISTRY: ghcr.io
|
| 23 |
+
IMAGE_NAME: summarizer
|
| 24 |
+
|
| 25 |
+
jobs:
|
| 26 |
+
summarizer-build-and-push:
|
| 27 |
+
if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests')"
|
| 28 |
+
runs-on: ubuntu-24.04
|
| 29 |
+
permissions:
|
| 30 |
+
contents: read
|
| 31 |
+
packages: write
|
| 32 |
+
services:
|
| 33 |
+
registry:
|
| 34 |
+
image: registry:2.8.3
|
| 35 |
+
ports:
|
| 36 |
+
- 5000:5000
|
| 37 |
+
steps:
|
| 38 |
+
- uses: actions/checkout@v4.1.7
|
| 39 |
+
|
| 40 |
+
- name: Install qemu dependency
|
| 41 |
+
run: |
|
| 42 |
+
sudo apt-get update
|
| 43 |
+
sudo apt-get install -y qemu-user-static
|
| 44 |
+
|
| 45 |
+
- name: Build Image
|
| 46 |
+
id: build_image
|
| 47 |
+
uses: redhat-actions/buildah-build@v2.13
|
| 48 |
+
with:
|
| 49 |
+
image: ${{ env.REGISTRY }}/containers/${{ env.IMAGE_NAME }}
|
| 50 |
+
tags: latest
|
| 51 |
+
platforms: linux/amd64, linux/arm64
|
| 52 |
+
containerfiles: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}/app/Containerfile
|
| 53 |
+
context: recipes/natural_language_processing/${{ env.IMAGE_NAME }}/app
|
| 54 |
+
|
| 55 |
+
- name: Set up Python
|
| 56 |
+
uses: actions/setup-python@v5.1.1
|
| 57 |
+
with:
|
| 58 |
+
python-version: '3.11'
|
| 59 |
+
|
| 60 |
+
- name: Install Dependencies
|
| 61 |
+
working-directory: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}
|
| 62 |
+
run: make install
|
| 63 |
+
|
| 64 |
+
- name: Download model
|
| 65 |
+
working-directory: ./models
|
| 66 |
+
run: make download-model-granite
|
| 67 |
+
|
| 68 |
+
- name: Run Functional Tests
|
| 69 |
+
shell: bash
|
| 70 |
+
run: make functional-tests
|
| 71 |
+
working-directory: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}
|
| 72 |
+
|
| 73 |
+
- name: Login to Registry
|
| 74 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 75 |
+
uses: redhat-actions/podman-login@v1.7
|
| 76 |
+
with:
|
| 77 |
+
registry: ${{ env.REGISTRY }}
|
| 78 |
+
username: ${{ github.actor }}
|
| 79 |
+
password: ${{ secrets.GITHUB_TOKEN }}
|
| 80 |
+
|
| 81 |
+
- name: Push Image
|
| 82 |
+
id: push_image
|
| 83 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 84 |
+
uses: redhat-actions/push-to-registry@v2.8
|
| 85 |
+
with:
|
| 86 |
+
image: ${{ steps.build_image.outputs.image }}
|
| 87 |
+
tags: ${{ steps.build_image.outputs.tags }}
|
| 88 |
+
registry: ${{ env.REGISTRY }}
|
chatbot/.github/workflows/test-trace-steps.yaml
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# To run locally
|
| 2 |
+
# act -W .github/workflows/test-trace-steps.yaml --container-architecture linux/amd64 -b ci/logs:/logs
|
| 3 |
+
|
| 4 |
+
name: Test Workflow
|
| 5 |
+
|
| 6 |
+
on:
|
| 7 |
+
pull_request:
|
| 8 |
+
branches:
|
| 9 |
+
- main
|
| 10 |
+
paths:
|
| 11 |
+
- .github/workflows/test-trace-steps.yaml
|
| 12 |
+
workflow_dispatch:
|
| 13 |
+
|
| 14 |
+
jobs:
|
| 15 |
+
test-build:
|
| 16 |
+
if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests')"
|
| 17 |
+
runs-on: ubuntu-24.04
|
| 18 |
+
steps:
|
| 19 |
+
- uses: actions/checkout@v4.1.7
|
| 20 |
+
- name: Set up Python
|
| 21 |
+
uses: actions/setup-python@v5.1.1
|
| 22 |
+
with:
|
| 23 |
+
python-version: '3.11'
|
| 24 |
+
|
| 25 |
+
- name: Install Python dependencies
|
| 26 |
+
run: |
|
| 27 |
+
pip install --no-cache-dir opentelemetry-sdk opentelemetry-exporter-otlp opentelemetry-instrumentation
|
| 28 |
+
|
| 29 |
+
- name: Download OpenTelemetry Collector Contrib
|
| 30 |
+
run: |
|
| 31 |
+
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.103.0/otelcol-contrib_0.103.0_linux_amd64.tar.gz
|
| 32 |
+
tar -xvf otelcol-contrib_0.103.0_linux_amd64.tar.gz
|
| 33 |
+
|
| 34 |
+
- name: Write secrets to files
|
| 35 |
+
run: |
|
| 36 |
+
echo "${{ secrets.ROSA_OTEL_CACERT }}" > /tmp/ca.crt
|
| 37 |
+
echo "${{ secrets.ROSA_OTEL_SERVER_CRT }}" > /tmp/server.crt
|
| 38 |
+
echo "${{ secrets.ROSA_OTEL_SERVER_KEY }}" > /tmp/server.key
|
| 39 |
+
|
| 40 |
+
- name: Configure OpenTelemetry Collector
|
| 41 |
+
run: |
|
| 42 |
+
echo '
|
| 43 |
+
receivers:
|
| 44 |
+
otlp:
|
| 45 |
+
protocols:
|
| 46 |
+
grpc:
|
| 47 |
+
http:
|
| 48 |
+
exporters:
|
| 49 |
+
otlphttp:
|
| 50 |
+
endpoint: "${{ secrets.ROSA_OTEL_ENDPOINT }}"
|
| 51 |
+
tls:
|
| 52 |
+
insecure: false
|
| 53 |
+
cert_file: /tmp/server.crt
|
| 54 |
+
key_file: /tmp/server.key
|
| 55 |
+
ca_file: /tmp/ca.crt
|
| 56 |
+
debug:
|
| 57 |
+
verbosity: detailed
|
| 58 |
+
service:
|
| 59 |
+
pipelines:
|
| 60 |
+
traces:
|
| 61 |
+
receivers: [otlp]
|
| 62 |
+
exporters: [debug, otlphttp]
|
| 63 |
+
' > otel-collector-config.yaml
|
| 64 |
+
|
| 65 |
+
- name: Run OpenTelemetry Collector
|
| 66 |
+
run: |
|
| 67 |
+
./otelcol-contrib --config otel-collector-config.yaml > otel-collector.log 2>&1 &
|
| 68 |
+
|
| 69 |
+
- name: Start job trace
|
| 70 |
+
run: |
|
| 71 |
+
export WORKFLOW_NAME="test-trace"
|
| 72 |
+
export JOB_NAME="test-build"
|
| 73 |
+
export TRACE_ACTION="start"
|
| 74 |
+
python ci/trace-steps.py
|
| 75 |
+
|
| 76 |
+
- name: Build
|
| 77 |
+
run: |
|
| 78 |
+
echo "Simulating build step..."
|
| 79 |
+
sleep 2
|
| 80 |
+
|
| 81 |
+
- name: Test
|
| 82 |
+
run: |
|
| 83 |
+
echo "Simulating test step..."
|
| 84 |
+
sleep 2
|
| 85 |
+
|
| 86 |
+
- name: End job trace
|
| 87 |
+
run: |
|
| 88 |
+
export WORKFLOW_NAME="test-trace"
|
| 89 |
+
export JOB_NAME="test-build"
|
| 90 |
+
export TRACE_ACTION="end"
|
| 91 |
+
python ci/trace-steps.py
|
| 92 |
+
|
| 93 |
+
- name: Display OpenTelemetry Collector Logs
|
| 94 |
+
run: cat otel-collector.log
|
chatbot/.github/workflows/testing_framework.yaml
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Testing Framework
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
schedule: # schedule the job to run once a day
|
| 5 |
+
- cron: '0 0 * * *'
|
| 6 |
+
|
| 7 |
+
#workflow_dispatch:
|
| 8 |
+
|
| 9 |
+
# pull_request: ## temporary for debugging development purposes
|
| 10 |
+
# branches:
|
| 11 |
+
# - main
|
| 12 |
+
|
| 13 |
+
env:
|
| 14 |
+
TF_VAR_aws_region: "eu-west-2"
|
| 15 |
+
TF_VAR_aws_ami_owners: '["125523088429"]'
|
| 16 |
+
TF_VAR_aws_ami_name: '["Fedora-Cloud-Base-39*"]'
|
| 17 |
+
TF_VAR_aws_volume_size: 100
|
| 18 |
+
TF_VAR_aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
| 19 |
+
TF_VAR_aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
| 20 |
+
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
| 21 |
+
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
| 22 |
+
# AWS_DEFAULT_REGION: "eu-west-2"
|
| 23 |
+
|
| 24 |
+
concurrency:
|
| 25 |
+
group: ${{ github.workflow }}
|
| 26 |
+
cancel-in-progress: false
|
| 27 |
+
|
| 28 |
+
jobs:
|
| 29 |
+
integration-tests:
|
| 30 |
+
if: github.repository == 'containers/ai-lab-recipes'
|
| 31 |
+
runs-on: ubuntu-24.04
|
| 32 |
+
strategy:
|
| 33 |
+
fail-fast: false
|
| 34 |
+
matrix:
|
| 35 |
+
include:
|
| 36 |
+
- arch: amd64
|
| 37 |
+
aws_image_type: t3a.medium
|
| 38 |
+
aws_ami_architecture: x86_64
|
| 39 |
+
- arch: arm64
|
| 40 |
+
aws_image_type: m7g.medium
|
| 41 |
+
aws_ami_architecture: arm64
|
| 42 |
+
- arch: amd64 # gpu enabled
|
| 43 |
+
aws_image_type: g4dn.xlarge
|
| 44 |
+
aws_ami_architecture: x86_64
|
| 45 |
+
steps:
|
| 46 |
+
- name: Checkout
|
| 47 |
+
uses: actions/checkout@v4.1.7
|
| 48 |
+
with:
|
| 49 |
+
ref: 'main'
|
| 50 |
+
|
| 51 |
+
- name: Set up Python
|
| 52 |
+
uses: actions/setup-python@v5.1.1
|
| 53 |
+
with:
|
| 54 |
+
python-version: '3.11'
|
| 55 |
+
|
| 56 |
+
- name: Checkout terraform module
|
| 57 |
+
id: checkout-module
|
| 58 |
+
uses: actions/checkout@v4.1.7
|
| 59 |
+
with:
|
| 60 |
+
repository: containers/terraform-test-environment-module
|
| 61 |
+
path: terraform-test-environment-module
|
| 62 |
+
ref: 'main'
|
| 63 |
+
|
| 64 |
+
- name: Setup Terraform
|
| 65 |
+
uses: hashicorp/setup-terraform@v3.1.2
|
| 66 |
+
with:
|
| 67 |
+
terraform_version: "1.7.5"
|
| 68 |
+
terraform_wrapper: false
|
| 69 |
+
|
| 70 |
+
- name: Init
|
| 71 |
+
run: terraform init
|
| 72 |
+
working-directory: terraform-test-environment-module
|
| 73 |
+
|
| 74 |
+
- name: Bootstrap
|
| 75 |
+
id: up
|
| 76 |
+
run: terraform apply -auto-approve -lock=false
|
| 77 |
+
working-directory: terraform-test-environment-module
|
| 78 |
+
env:
|
| 79 |
+
TF_VAR_aws_instance_type: ${{ matrix.aws_image_type }}
|
| 80 |
+
TF_VAR_aws_ami_architecture: ${{ matrix.aws_ami_architecture }}
|
| 81 |
+
|
| 82 |
+
- name: Terraform Output
|
| 83 |
+
id: terraform-output
|
| 84 |
+
run: |
|
| 85 |
+
echo "id=$(terraform output id | xargs)" >> $GITHUB_OUTPUT
|
| 86 |
+
echo "url=$(terraform output host | xargs)" >> $GITHUB_OUTPUT
|
| 87 |
+
echo "pem_filename=$(terraform output pem_filename | xargs)" >> $GITHUB_OUTPUT
|
| 88 |
+
working-directory: terraform-test-environment-module
|
| 89 |
+
|
| 90 |
+
- name: Ansible Collections
|
| 91 |
+
run: ansible-galaxy install -r ./provision/requirements.yml
|
| 92 |
+
working-directory: ./recipes/natural_language_processing/chatbot
|
| 93 |
+
|
| 94 |
+
- name: Provision
|
| 95 |
+
run: |
|
| 96 |
+
ansible-playbook ./recipes/natural_language_processing/chatbot/provision/playbook.yml \
|
| 97 |
+
-i terraform-test-environment-module/hosts.ini \
|
| 98 |
+
--private-key=terraform-test-environment-module/${{ steps.terraform-output.outputs.pem_filename }}
|
| 99 |
+
env:
|
| 100 |
+
ANSIBLE_HOST_KEY_CHECKING: false
|
| 101 |
+
|
| 102 |
+
- name: Install Dependencies
|
| 103 |
+
working-directory: ./recipes/natural_language_processing/chatbot
|
| 104 |
+
run: make install
|
| 105 |
+
|
| 106 |
+
- name: Run Integration Tests
|
| 107 |
+
working-directory: ./recipes/natural_language_processing/chatbot
|
| 108 |
+
run: make integration-tests
|
| 109 |
+
env:
|
| 110 |
+
URL: ${{ steps.terraform-output.outputs.url }}
|
| 111 |
+
|
| 112 |
+
- name: Destroy Test Environment
|
| 113 |
+
id: down
|
| 114 |
+
if: always()
|
| 115 |
+
run: terraform destroy -auto-approve -lock=false
|
| 116 |
+
working-directory: terraform-test-environment-module
|
| 117 |
+
env:
|
| 118 |
+
TF_VAR_aws_instance_type: ${{ matrix.aws_image_type }}
|
| 119 |
+
TF_VAR_aws_ami_architecture: ${{ matrix.aws_ami_architecture }}
|
| 120 |
+
|
| 121 |
+
- name: Publish Job Results to Slack
|
| 122 |
+
id: slack
|
| 123 |
+
if: always()
|
| 124 |
+
uses: slackapi/slack-github-action@v1.26.0
|
| 125 |
+
with:
|
| 126 |
+
payload: |
|
| 127 |
+
{
|
| 128 |
+
"text": "${{ github.workflow }} workflow status: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
| 129 |
+
}
|
| 130 |
+
env:
|
| 131 |
+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
| 132 |
+
|
| 133 |
+
release-images:
|
| 134 |
+
runs-on: ubuntu-24.04
|
| 135 |
+
needs: integration-tests
|
| 136 |
+
if: success()
|
| 137 |
+
strategy:
|
| 138 |
+
fail-fast: false
|
| 139 |
+
matrix:
|
| 140 |
+
include:
|
| 141 |
+
- image: llamacpp_python
|
| 142 |
+
- image: whispercpp
|
| 143 |
+
- image: chatbot
|
| 144 |
+
steps:
|
| 145 |
+
- name: Login to registry
|
| 146 |
+
uses: redhat-actions/podman-login@v1.7
|
| 147 |
+
with:
|
| 148 |
+
registry: quay.io
|
| 149 |
+
username: ${{ secrets.REGISTRY_USER }}
|
| 150 |
+
password: ${{ secrets.REGISTRY_PASSWORD }}
|
| 151 |
+
|
| 152 |
+
- name: Copy image from one registry to another one
|
| 153 |
+
run: skopeo copy --all docker://${{ env.SOURCE_REGISTRY }}/${{ matrix.image }} docker://${{ env.TARGET_REGISTRY }}/${{ matrix.image }}
|
| 154 |
+
env:
|
| 155 |
+
SOURCE_REGISTRY: ghcr.io/containers
|
| 156 |
+
TARGET_REGISTRY: quay.io/ai-lab
|
| 157 |
+
|
| 158 |
+
- name: Publish Job Results to Slack
|
| 159 |
+
id: slack
|
| 160 |
+
if: always()
|
| 161 |
+
uses: slackapi/slack-github-action@v1.26.0
|
| 162 |
+
with:
|
| 163 |
+
payload: |
|
| 164 |
+
{
|
| 165 |
+
"text": "${{ github.workflow }} workflow status: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
| 166 |
+
}
|
| 167 |
+
env:
|
| 168 |
+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
| 169 |
+
|
| 170 |
+
test-make-targets:
|
| 171 |
+
if: github.repository == 'containers-mirror/ai-lab-recipes'
|
| 172 |
+
runs-on: ubuntu-22.04-2core
|
| 173 |
+
steps:
|
| 174 |
+
- uses: actions/checkout@v4.1.7
|
| 175 |
+
|
| 176 |
+
- name: Set up Python
|
| 177 |
+
uses: actions/setup-python@v5.1.1
|
| 178 |
+
with:
|
| 179 |
+
python-version: '3.11'
|
| 180 |
+
|
| 181 |
+
- name: chatbot
|
| 182 |
+
working-directory: ./recipes/natural_language_processing/chatbot
|
| 183 |
+
run: make bootc
|
| 184 |
+
|
| 185 |
+
- name: Publish Job Results to Slack
|
| 186 |
+
id: slack
|
| 187 |
+
if: always()
|
| 188 |
+
uses: slackapi/slack-github-action@v1.26.0
|
| 189 |
+
with:
|
| 190 |
+
payload: |
|
| 191 |
+
{
|
| 192 |
+
"text": "${{ github.workflow }} workflow status: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
| 193 |
+
}
|
| 194 |
+
env:
|
| 195 |
+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
chatbot/.github/workflows/training-e2e.yaml
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: traning E2E
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
schedule: # schedule the job to run every day at midnight
|
| 5 |
+
- cron: '0 12 * * *'
|
| 6 |
+
|
| 7 |
+
pull_request:
|
| 8 |
+
branches:
|
| 9 |
+
- main
|
| 10 |
+
paths:
|
| 11 |
+
- .github/workflows/training-e2e.yaml
|
| 12 |
+
- ./training/**
|
| 13 |
+
|
| 14 |
+
workflow_dispatch:
|
| 15 |
+
|
| 16 |
+
env:
|
| 17 |
+
TF_VAR_aws_region: "eu-west-2"
|
| 18 |
+
TF_VAR_aws_ami_owners: '["309956199498"]'
|
| 19 |
+
TF_VAR_aws_ami_name: '["*RHEL-9.4*"]'
|
| 20 |
+
TF_VAR_aws_volume_size: 500
|
| 21 |
+
TF_VAR_aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
| 22 |
+
TF_VAR_aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
| 23 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 24 |
+
|
| 25 |
+
concurrency:
|
| 26 |
+
group: ${{ github.workflow }}
|
| 27 |
+
cancel-in-progress: false
|
| 28 |
+
|
| 29 |
+
jobs:
|
| 30 |
+
e2e:
|
| 31 |
+
if: github.repository == 'containers/ai-lab-recipes' && !contains(github.event.pull_request.labels.*.name, 'hold-tests')
|
| 32 |
+
runs-on: ubuntu-24.04
|
| 33 |
+
strategy:
|
| 34 |
+
fail-fast: false
|
| 35 |
+
max-parallel: 1
|
| 36 |
+
matrix:
|
| 37 |
+
include:
|
| 38 |
+
- arch: amd64
|
| 39 |
+
aws_image_type: g5.8xlarge
|
| 40 |
+
image_name: nvidia-bootc
|
| 41 |
+
aws_ami_architecture: x86_64
|
| 42 |
+
steps:
|
| 43 |
+
- name: Checkout
|
| 44 |
+
uses: actions/checkout@v4.1.7
|
| 45 |
+
with:
|
| 46 |
+
path: main
|
| 47 |
+
|
| 48 |
+
- name: Checkout terraform module
|
| 49 |
+
id: checkout-module
|
| 50 |
+
uses: actions/checkout@v4.1.7
|
| 51 |
+
with:
|
| 52 |
+
repository: containers/terraform-test-environment-module
|
| 53 |
+
path: terraform-test-environment-module
|
| 54 |
+
ref: 'main'
|
| 55 |
+
|
| 56 |
+
- name: Setup Terraform
|
| 57 |
+
uses: hashicorp/setup-terraform@v3.1.2
|
| 58 |
+
with:
|
| 59 |
+
terraform_version: "1.7.5"
|
| 60 |
+
terraform_wrapper: false
|
| 61 |
+
|
| 62 |
+
- name: Init
|
| 63 |
+
run: terraform init
|
| 64 |
+
working-directory: terraform-test-environment-module
|
| 65 |
+
|
| 66 |
+
- name: Bootstrap
|
| 67 |
+
id: up
|
| 68 |
+
run: terraform apply -auto-approve -lock=false
|
| 69 |
+
working-directory: terraform-test-environment-module
|
| 70 |
+
env:
|
| 71 |
+
TF_VAR_aws_instance_type: ${{ matrix.aws_image_type }}
|
| 72 |
+
TF_VAR_aws_ami_architecture: ${{ matrix.aws_ami_architecture }}
|
| 73 |
+
|
| 74 |
+
- name: Terraform Output
|
| 75 |
+
id: terraform-output
|
| 76 |
+
run: |
|
| 77 |
+
echo "id=$(terraform output id | xargs)" >> $GITHUB_OUTPUT
|
| 78 |
+
echo "url=$(terraform output host | xargs)" >> $GITHUB_OUTPUT
|
| 79 |
+
echo "ssh_public_key=$(terraform output ssh_public_key | xargs)" >> $GITHUB_OUTPUT
|
| 80 |
+
echo "pem_filename=$(terraform output pem_filename | xargs)" >> $GITHUB_OUTPUT
|
| 81 |
+
working-directory: terraform-test-environment-module
|
| 82 |
+
|
| 83 |
+
- name: Ansible Collections
|
| 84 |
+
run: ansible-galaxy install -r ./tests/provision/requirements.yml
|
| 85 |
+
working-directory: ./main/training
|
| 86 |
+
|
| 87 |
+
- name: Provision
|
| 88 |
+
run: |
|
| 89 |
+
ansible-playbook ./main/training/tests/provision/playbook.yml \
|
| 90 |
+
-i terraform-test-environment-module/hosts.ini \
|
| 91 |
+
--private-key=terraform-test-environment-module/${{ steps.terraform-output.outputs.pem_filename }} \
|
| 92 |
+
--extra-vars "image_name=${{ matrix.image_name }}" \
|
| 93 |
+
--extra-vars "ssh_public_key='${{ steps.terraform-output.outputs.ssh_public_key }}'" \
|
| 94 |
+
--extra-vars "registry_user=${{ secrets.REGISTRY_USER }}" \
|
| 95 |
+
--extra-vars "registry_password=${{ secrets.REGISTRY_PASSWORD }}"
|
| 96 |
+
env:
|
| 97 |
+
ANSIBLE_CONFIG: ./main/training/tests/ansible.cfg
|
| 98 |
+
|
| 99 |
+
# - name: Setup tmate session
|
| 100 |
+
# uses: mxschmitt/action-tmate@v3.18
|
| 101 |
+
# timeout-minutes: 20
|
| 102 |
+
# with:
|
| 103 |
+
# detached: true
|
| 104 |
+
# limit-access-to-actor: false
|
| 105 |
+
|
| 106 |
+
- name: Setup tmate session
|
| 107 |
+
uses: mxschmitt/action-tmate@v3.18
|
| 108 |
+
timeout-minutes: 60
|
| 109 |
+
with:
|
| 110 |
+
detached: true
|
| 111 |
+
limit-access-to-actor: false
|
| 112 |
+
|
| 113 |
+
- name: Run tests
|
| 114 |
+
run: |
|
| 115 |
+
ansible-playbook ./main/training/tests/e2e-tests/playbook.yml \
|
| 116 |
+
-i terraform-test-environment-module/hosts.ini \
|
| 117 |
+
--private-key=terraform-test-environment-module/${{ steps.terraform-output.outputs.pem_filename }} \
|
| 118 |
+
--extra-vars "HF_TOKEN=${{ secrets.HF_TOKEN }}" \
|
| 119 |
+
--extra-vars "image_name=${{ matrix.image_name }}" \
|
| 120 |
+
--extra-vars "ssh_public_key='${{ steps.terraform-output.outputs.ssh_public_key }}'" \
|
| 121 |
+
--extra-vars "registry_user=${{ secrets.REGISTRY_USER }}" \
|
| 122 |
+
--extra-vars "registry_password=${{ secrets.REGISTRY_PASSWORD }}"
|
| 123 |
+
env:
|
| 124 |
+
ANSIBLE_CONFIG: ./main/training/tests/ansible.cfg
|
| 125 |
+
|
| 126 |
+
# This should exist in the final workflow
|
| 127 |
+
# - name: Setup tmate session
|
| 128 |
+
# if: ${{ failure() }}
|
| 129 |
+
# uses: mxschmitt/action-tmate@v3.18
|
| 130 |
+
# timeout-minutes: 15
|
| 131 |
+
# with:
|
| 132 |
+
# detached: true
|
| 133 |
+
# limit-access-to-actor: false
|
| 134 |
+
|
| 135 |
+
- name: Destroy Test Environment
|
| 136 |
+
id: down
|
| 137 |
+
if: always()
|
| 138 |
+
run: terraform destroy -auto-approve -lock=false
|
| 139 |
+
working-directory: terraform-test-environment-module
|
| 140 |
+
env:
|
| 141 |
+
TF_VAR_aws_instance_type: ${{ matrix.aws_image_type }}
|
| 142 |
+
TF_VAR_aws_ami_architecture: ${{ matrix.aws_ami_architecture }}
|
| 143 |
+
|
| 144 |
+
- name: Publish Job Results to Slack
|
| 145 |
+
id: slack
|
| 146 |
+
if: always()
|
| 147 |
+
uses: slackapi/slack-github-action@v1.26.0
|
| 148 |
+
with:
|
| 149 |
+
payload: |
|
| 150 |
+
{
|
| 151 |
+
"text": "${{ github.workflow }} workflow status: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
| 152 |
+
}
|
| 153 |
+
env:
|
| 154 |
+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
chatbot/.github/workflows/training_bootc.yaml
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Training Bootc image builds
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches: [ main ]
|
| 6 |
+
paths:
|
| 7 |
+
- 'training/**'
|
| 8 |
+
- '.github/workflows/training_bootc.yaml'
|
| 9 |
+
|
| 10 |
+
workflow_dispatch:
|
| 11 |
+
|
| 12 |
+
concurrency:
|
| 13 |
+
group: ${{ github.workflow }}
|
| 14 |
+
cancel-in-progress: false
|
| 15 |
+
|
| 16 |
+
env:
|
| 17 |
+
REGISTRY: quay.io
|
| 18 |
+
REGISTRY_ORG: ai-lab
|
| 19 |
+
REGION: us-east-1
|
| 20 |
+
|
| 21 |
+
jobs:
|
| 22 |
+
start-runner:
|
| 23 |
+
name: Start self-hosted EC2 runner
|
| 24 |
+
if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests')"
|
| 25 |
+
runs-on: ubuntu-latest
|
| 26 |
+
outputs:
|
| 27 |
+
label: ${{ steps.start-ec2-runner.outputs.label }}
|
| 28 |
+
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
|
| 29 |
+
steps:
|
| 30 |
+
- name: Configure AWS credentials
|
| 31 |
+
uses: aws-actions/configure-aws-credentials@v1
|
| 32 |
+
with:
|
| 33 |
+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
| 34 |
+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
| 35 |
+
aws-region: ${{ env.REGION }}
|
| 36 |
+
- name: Start EC2 runner
|
| 37 |
+
id: start-ec2-runner
|
| 38 |
+
uses: machulav/ec2-github-runner@v2
|
| 39 |
+
with:
|
| 40 |
+
mode: start
|
| 41 |
+
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
|
| 42 |
+
ec2-image-id: ami-0154957ba4ce98784
|
| 43 |
+
ec2-instance-type: m7i.12xlarge
|
| 44 |
+
subnet-id: subnet-0b1e1d94240813658
|
| 45 |
+
security-group-id: sg-055105753f5e8bd83
|
| 46 |
+
|
| 47 |
+
nvidia-bootc-builder-image:
|
| 48 |
+
if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests')"
|
| 49 |
+
strategy:
|
| 50 |
+
matrix:
|
| 51 |
+
include:
|
| 52 |
+
- image_name: nvidia-builder
|
| 53 |
+
context: training/nvidia-bootc
|
| 54 |
+
arch: amd64
|
| 55 |
+
runs-on: ${{ needs.start-runner.outputs.label }}
|
| 56 |
+
needs: start-runner
|
| 57 |
+
permissions:
|
| 58 |
+
contents: read
|
| 59 |
+
packages: write
|
| 60 |
+
steps:
|
| 61 |
+
- uses: actions/checkout@v4.1.7
|
| 62 |
+
|
| 63 |
+
- name: mkdir root/.docker directory
|
| 64 |
+
run: |
|
| 65 |
+
mkdir -p ~/.docker
|
| 66 |
+
|
| 67 |
+
- name: Login to Container Registry
|
| 68 |
+
run: podman login -u ${{ secrets.REGISTRY_USER }} -p ${{ secrets.REGISTRY_PASSWORD }} ${{ env.REGISTRY }}
|
| 69 |
+
|
| 70 |
+
- name: generate a ssh key - USER SHOULD INJECT THEIR OWN AND REBUILD IF THEY USE THIS IMAGE
|
| 71 |
+
run: |
|
| 72 |
+
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N ""
|
| 73 |
+
|
| 74 |
+
- name: Build Image
|
| 75 |
+
id: build_image
|
| 76 |
+
run: make driver-toolkit ARCH=${{ matrix.arch }}
|
| 77 |
+
working-directory: ${{ matrix.context }}
|
| 78 |
+
|
| 79 |
+
- name: tag image as nvidia-builder
|
| 80 |
+
run: podman tag ${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}/driver-toolkit:latest ${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}/${{ matrix.image_name}}:latest
|
| 81 |
+
|
| 82 |
+
- name: Push image
|
| 83 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 84 |
+
uses: redhat-actions/push-to-registry@v2.8
|
| 85 |
+
with:
|
| 86 |
+
registry: ${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}
|
| 87 |
+
image: driver-toolkit
|
| 88 |
+
tags: latest
|
| 89 |
+
|
| 90 |
+
- name: push the nvidia-builder image
|
| 91 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 92 |
+
uses: redhat-actions/push-to-registry@v2.8
|
| 93 |
+
with:
|
| 94 |
+
image: ${{ matrix.image_name}}
|
| 95 |
+
tags: latest
|
| 96 |
+
registry: ${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}
|
| 97 |
+
|
| 98 |
+
- name: Publish Job Results to Slack
|
| 99 |
+
id: slack
|
| 100 |
+
if: always()
|
| 101 |
+
uses: slackapi/slack-github-action@v1.26.0
|
| 102 |
+
with:
|
| 103 |
+
payload: |
|
| 104 |
+
{
|
| 105 |
+
"text": "${{ github.workflow }} workflow status: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
| 106 |
+
}
|
| 107 |
+
env:
|
| 108 |
+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
| 109 |
+
|
| 110 |
+
nvidia-bootc-image:
|
| 111 |
+
strategy:
|
| 112 |
+
matrix:
|
| 113 |
+
include:
|
| 114 |
+
- image_name: nvidia-bootc
|
| 115 |
+
driver_version: "550.54.15"
|
| 116 |
+
context: training/nvidia-bootc
|
| 117 |
+
arch: amd64
|
| 118 |
+
runs-on: ${{ needs.start-runner.outputs.label }}
|
| 119 |
+
if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests')"
|
| 120 |
+
needs: [ nvidia-bootc-builder-image, start-runner ]
|
| 121 |
+
steps:
|
| 122 |
+
- uses: actions/checkout@v4.1.7
|
| 123 |
+
|
| 124 |
+
- name: mkdir root/.docker directory
|
| 125 |
+
run: |
|
| 126 |
+
mkdir -p ~/.docker
|
| 127 |
+
|
| 128 |
+
- name: generate a ssh key - USER SHOULD INJECT THEIR OWN AND REBUILD IF THEY USE THIS IMAGE and overwrite the existing one
|
| 129 |
+
run: |
|
| 130 |
+
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N "" <<<y
|
| 131 |
+
|
| 132 |
+
- name: Login to Container Registry
|
| 133 |
+
run: podman login -u ${{ secrets.REGISTRY_USER }} -p ${{ secrets.REGISTRY_PASSWORD }} ${{ env.REGISTRY }}
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
- name: generate the local OCI assets
|
| 137 |
+
run: |
|
| 138 |
+
cd training
|
| 139 |
+
make -j vllm
|
| 140 |
+
make -j deepspeed
|
| 141 |
+
make -j instruct-nvidia
|
| 142 |
+
|
| 143 |
+
- name: Build Image
|
| 144 |
+
id: build_image
|
| 145 |
+
run: make bootc DRIVER_VERSION=${{ matrix.driver_version }} ARCH=${{ matrix.arch }} SSH_PUBKEY=~/.ssh/id_rsa.pub
|
| 146 |
+
working-directory: ${{ matrix.context }}
|
| 147 |
+
|
| 148 |
+
- name: Push image
|
| 149 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 150 |
+
uses: redhat-actions/push-to-registry@v2.8
|
| 151 |
+
with:
|
| 152 |
+
image: ${{ matrix.image_name }}
|
| 153 |
+
tags: latest
|
| 154 |
+
registry: ${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}
|
| 155 |
+
|
| 156 |
+
- name: Publish Job Results to Slack
|
| 157 |
+
id: slack
|
| 158 |
+
if: always()
|
| 159 |
+
uses: slackapi/slack-github-action@v1.26.0
|
| 160 |
+
with:
|
| 161 |
+
payload: |
|
| 162 |
+
{
|
| 163 |
+
"text": "${{ github.workflow }} workflow status: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
| 164 |
+
}
|
| 165 |
+
env:
|
| 166 |
+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
| 167 |
+
|
| 168 |
+
bootc-images:
|
| 169 |
+
strategy:
|
| 170 |
+
matrix:
|
| 171 |
+
include:
|
| 172 |
+
- image_name: intel-bootc
|
| 173 |
+
context: training/intel-bootc
|
| 174 |
+
arch: amd64
|
| 175 |
+
gpu: intel
|
| 176 |
+
- image_name: amd-bootc
|
| 177 |
+
context: training/amd-bootc
|
| 178 |
+
arch: amd64
|
| 179 |
+
gpu: amd
|
| 180 |
+
if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests')"
|
| 181 |
+
runs-on: ${{ needs.start-runner.outputs.label }}
|
| 182 |
+
needs: [ start-runner, nvidia-bootc-builder-image ]
|
| 183 |
+
continue-on-error: true
|
| 184 |
+
steps:
|
| 185 |
+
- uses: actions/checkout@v4.1.7
|
| 186 |
+
|
| 187 |
+
- name: mkdir root/.docker directory
|
| 188 |
+
run: |
|
| 189 |
+
mkdir -p ~/.docker
|
| 190 |
+
|
| 191 |
+
- name: Login to Container Registry
|
| 192 |
+
run: podman login -u ${{ secrets.REGISTRY_USER }} -p ${{ secrets.REGISTRY_PASSWORD }} ${{ env.REGISTRY }}
|
| 193 |
+
|
| 194 |
+
- name: generate the local OCI assets
|
| 195 |
+
run: |
|
| 196 |
+
cd training
|
| 197 |
+
make -j vllm
|
| 198 |
+
make -j deepspeed
|
| 199 |
+
make -j instruct-${{ matrix.gpu}}
|
| 200 |
+
|
| 201 |
+
- name: Build Image
|
| 202 |
+
id: build_image
|
| 203 |
+
run: make bootc ARCH=${{ matrix.arch }} INSTRUCTLAB_IMAGE=${{env.REGISTRY}}/${{env.REGISTRY_ORG}}/instruct-${{ matrix.gpu }}:latest
|
| 204 |
+
working-directory: ${{ matrix.context }}
|
| 205 |
+
|
| 206 |
+
- name: Push image
|
| 207 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 208 |
+
uses: redhat-actions/push-to-registry@v2.8
|
| 209 |
+
with:
|
| 210 |
+
image: ${{ matrix.image_name }}
|
| 211 |
+
tags: latest
|
| 212 |
+
registry: ${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}
|
| 213 |
+
|
| 214 |
+
- name: Publish Job Results to Slack
|
| 215 |
+
id: slack
|
| 216 |
+
if: always()
|
| 217 |
+
uses: slackapi/slack-github-action@v1.26.0
|
| 218 |
+
with:
|
| 219 |
+
payload: |
|
| 220 |
+
{
|
| 221 |
+
"text": "${{ github.workflow }} workflow status: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
| 222 |
+
}
|
| 223 |
+
env:
|
| 224 |
+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
| 225 |
+
|
| 226 |
+
stop-runner:
|
| 227 |
+
name: Stop self-hosted EC2 runner
|
| 228 |
+
needs:
|
| 229 |
+
- start-runner
|
| 230 |
+
- bootc-images
|
| 231 |
+
- nvidia-bootc-image
|
| 232 |
+
runs-on: ubuntu-latest
|
| 233 |
+
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
|
| 234 |
+
steps:
|
| 235 |
+
- name: Configure AWS credentials
|
| 236 |
+
uses: aws-actions/configure-aws-credentials@v1
|
| 237 |
+
with:
|
| 238 |
+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
| 239 |
+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
| 240 |
+
aws-region: ${{ secrets.AWS_REGION }}
|
| 241 |
+
- name: Stop EC2 runner
|
| 242 |
+
uses: machulav/ec2-github-runner@v2
|
| 243 |
+
with:
|
| 244 |
+
mode: stop
|
| 245 |
+
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
|
| 246 |
+
label: ${{ needs.start-runner.outputs.label }}
|
| 247 |
+
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}
|
chatbot/.gitignore
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.gguf
|
| 2 |
+
*.bin
|
| 3 |
+
*_pycache_*
|
| 4 |
+
port_check.lock
|
| 5 |
+
*build
|
| 6 |
+
models/*
|
| 7 |
+
!models/Makefile
|
| 8 |
+
!models/README.md
|
| 9 |
+
!models/download_hf_models.py
|
| 10 |
+
convert_models/converted_models
|
| 11 |
+
recipes/common/bin/*
|
| 12 |
+
*/.venv/
|
| 13 |
+
training/cloud/examples
|
| 14 |
+
training/instructlab/instructlab
|
| 15 |
+
vector_dbs/milvus/volumes/milvus/*
|
| 16 |
+
.idea
|
chatbot/CODEOWNERS
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
* @MichaelClifford @rhatdan @sallyom @lmilbaum @cgwalters @Gregory-Pereira
|
chatbot/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Contributing to AI Lab Recipes
|
| 2 |
+
|
| 3 |
+
Our goal is to provide a central hub of open source best practices and vetted patterns for building AI enabled applications. Below please see how to contribute new components.
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
## Topics
|
| 7 |
+
* [Contributing New Recipes](#contributing-new-recipes)
|
| 8 |
+
* [Contributing New Model Servers](#contributing-new-model-servers)
|
| 9 |
+
* [Contributing New Vector Databases](#contributing-new-vector-databases)
|
| 10 |
+
* [Additional Contributions](#additional-contributions)
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
## Contributing New Recipes
|
| 14 |
+
|
| 15 |
+
A "recipe" is essentially a pre-packaged and deployable demo intended to get developers up and running with AI based applications as fast as possible. All of our recipes are built to run with [AI LAB](https://github.com/containers/podman-desktop-extension-ai-lab). But, they should also contain sufficient code and documentation to be run manually so that developers are able to update and customize them to their own needs.
|
| 16 |
+
|
| 17 |
+
Recipes are not intended to be used "as-is" by developers, but to serve as highly functional templates or starting points that demonstrate known patterns and best practices for building AI enabled apps. Once a recipe has been deployed, developers are encouraged to update and modify it for their own purposes.
|
| 18 |
+
|
| 19 |
+
### Adding a New Recipe
|
| 20 |
+
|
| 21 |
+
Recipes are currently organized by category: `audio/`, `computer_vision/`, `multimodal/`, `natural_language_processing/`. If your recipe does not fall into one of the existing categories, please make a new directory under `recipes/` with the appropriate category name. Once you decide on the correct category, create a new directory for your recipe. For example, `recipes/audio/<NEW_RECIPE>`.
|
| 22 |
+
|
| 23 |
+
Inside of the new directory you should add the following files:
|
| 24 |
+
|
| 25 |
+
* `ai-lab.yaml`
|
| 26 |
+
* `app/Containerfile`
|
| 27 |
+
* `app/requirements.txt`
|
| 28 |
+
* `<NEW_RECIPE>_ui.py`
|
| 29 |
+
* `README.md`
|
| 30 |
+
|
| 31 |
+
### ai-lab.yaml
|
| 32 |
+
|
| 33 |
+
This is the most critical file in our directory as in a sense it _IS_ the recipe. This yaml file dictates which images make up our AI application and where their container files can be found. Below please see the chabot example.
|
| 34 |
+
|
| 35 |
+
```yaml
|
| 36 |
+
version: v1.0
|
| 37 |
+
application:
|
| 38 |
+
type: language
|
| 39 |
+
name: ChatBot_Streamlit
|
| 40 |
+
description: This is a Streamlit chat demo application.
|
| 41 |
+
containers:
|
| 42 |
+
- name: llamacpp-server
|
| 43 |
+
contextdir: ../../../model_servers/llamacpp_python
|
| 44 |
+
containerfile: ./base/Containerfile
|
| 45 |
+
model-service: true
|
| 46 |
+
backend:
|
| 47 |
+
- llama-cpp
|
| 48 |
+
arch:
|
| 49 |
+
- arm64
|
| 50 |
+
- amd64
|
| 51 |
+
ports:
|
| 52 |
+
- 8001
|
| 53 |
+
image: quay.io/ai-lab/llamacpp_python:latest
|
| 54 |
+
- name: streamlit-chat-app
|
| 55 |
+
contextdir: .
|
| 56 |
+
containerfile: app/Containerfile
|
| 57 |
+
arch:
|
| 58 |
+
- arm64
|
| 59 |
+
- amd64
|
| 60 |
+
ports:
|
| 61 |
+
- 8501
|
| 62 |
+
image: quay.io/ai-lab/chatbot:latest
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
You can use this example as your template and change the fields where needed to define your own recipe.
|
| 66 |
+
|
| 67 |
+
### app/Containerfile
|
| 68 |
+
|
| 69 |
+
This will be the Containerfile used to build the client side image of your AI application. Whenever possible, we will use Red Hat's UBI as our base image. Below please see an example from the chatbot recipe.
|
| 70 |
+
|
| 71 |
+
```Dockerfile
|
| 72 |
+
FROM registry.access.redhat.com/ubi9/python-311:1-52
|
| 73 |
+
WORKDIR /chat
|
| 74 |
+
COPY requirements.txt .
|
| 75 |
+
RUN pip install --upgrade pip
|
| 76 |
+
RUN pip install --no-cache-dir --upgrade -r /chat/requirements.txt
|
| 77 |
+
COPY chatbot_ui.py .
|
| 78 |
+
EXPOSE 8501
|
| 79 |
+
ENTRYPOINT [ "streamlit", "run", "chatbot_ui.py" ]
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
You can use this example as your template and change the fields where needed to define your own Containerfile.
|
| 83 |
+
|
| 84 |
+
### app/requirements.txt
|
| 85 |
+
|
| 86 |
+
You need to include a requirements.txt file here as well so that we ensure the correct dependencies get built into our application.
|
| 87 |
+
|
| 88 |
+
### <NEW_RECIPE>_ui.py
|
| 89 |
+
|
| 90 |
+
This is the client code you write to interact with the model service. This is the piece of code that will give your recipe it's unique behavior and interface. Currently, all the recipes are written in python so we've used the `*.py` extension here. But we are happy to include recipes that use other languages as well.
|
| 91 |
+
|
| 92 |
+
### README.MD
|
| 93 |
+
|
| 94 |
+
Every recipe needs a README.md that specifies what the recipe's application does and how to build, deploy and interact with it.
|
| 95 |
+
|
| 96 |
+
### _Where's the model server?_
|
| 97 |
+
After creating your new recipe by adding the files above you might be asking yourself where the model and model servers are? It turns out that there are many more unique AI applications than there are model servers, and many of the AI applications from the same category can all use the same model server. So, instead of replicating this code for every recipe, we maintain a separate directory for our model servers and point to the desired one in the `ai-lab.yaml`.
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
## Contributing New Model Servers
|
| 101 |
+
|
| 102 |
+
There are a number of options out there for model servers and we want to ensure that we provide developers with a variety of vetted options for the model server that will meet their application's needs.
|
| 103 |
+
|
| 104 |
+
Deciding which model server is right for a particular use case primarily comes down to the kind of model you want to use (LLM, Object Detection, Data Classification, etc.) and the resources available (GPU, CPU, Cloud, Local).
|
| 105 |
+
|
| 106 |
+
### Adding a New Model Server
|
| 107 |
+
|
| 108 |
+
All of the documentation, scripts and Containerfiles for our model servers live in `model_servers/`. If you would like to contribute a new model server, please create a new directory called `model_servers/<NEW_MODEL_SERVER>`.
|
| 109 |
+
|
| 110 |
+
Inside of this directory you should at a minimum add the following:
|
| 111 |
+
|
| 112 |
+
* `base/Containerfile`
|
| 113 |
+
* `README.md`
|
| 114 |
+
|
| 115 |
+
Depending on the specific needs of the model server, there may be additional files needed to build it. Please see [model_server/llamacpp_python](model_servers/llamacpp_python/) for a more complex example.
|
| 116 |
+
|
| 117 |
+
### base/Containerfile
|
| 118 |
+
|
| 119 |
+
This will be the Containerfile used to build the model server. Whenever possible, we will use Red Hat's UBI as our base image. Below see an example for the base llamacpp_python model server.
|
| 120 |
+
|
| 121 |
+
```Dockerfile
|
| 122 |
+
FROM registry.access.redhat.com/ubi9/python-311:1-52
|
| 123 |
+
WORKDIR /locallm
|
| 124 |
+
COPY src .
|
| 125 |
+
RUN pip install --no-cache-dir --verbose -r ./requirements.txt
|
| 126 |
+
EXPOSE 8001
|
| 127 |
+
ENTRYPOINT [ "sh", "./run.sh" ]
|
| 128 |
+
```
|
| 129 |
+
You can use this example as your template and change the fields where needed to define your own Containerfile.
|
| 130 |
+
|
| 131 |
+
If a model service requires different build instructions for different hardware environments, they can be added under `model_servers/<NEW_MODEL_SERVER>` as well. For example adding a Containerfile for building CUDA enabled images for Nvidia GPU's would be added as `cuda/Containerfile`.
|
| 132 |
+
|
| 133 |
+
### README.md
|
| 134 |
+
|
| 135 |
+
Every model server needs a README.md that specifies how to build, deploy and interact with it. Include any recipes that use this model server or how a recipe would need to be modified to use it.
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
## Contributing New Vector Databases
|
| 139 |
+
|
| 140 |
+
Although the model server and AI client are the minimum required components for an AI infused application, there are other tools and technologies in the AI ecosystem that users may want to include into their application to enhance the capabilities of their AI. One such tool is a vector database.
|
| 141 |
+
|
| 142 |
+
There are many options out there for vector databases and we would like to provide users with a number of well vetted options along with recipes that indicate how to best utilize them.
|
| 143 |
+
|
| 144 |
+
Once a vector database is added to the repo it can be included as an additional `container` in the `ai-lab.yaml` file of any appropriate recipe.
|
| 145 |
+
|
| 146 |
+
### Adding a New Vector Database
|
| 147 |
+
|
| 148 |
+
All of the documentation, scripts and Containerfiles for our vector databases live in `vector_dbs/`. If you would like to contribute a new vector database, please create a new directory called `vector_dbs/<NEW_VECTOR_DB>`.
|
| 149 |
+
|
| 150 |
+
Inside of this directory you should at a minimum add the following:
|
| 151 |
+
|
| 152 |
+
* `base/Containerfile`
|
| 153 |
+
* `README.md`
|
| 154 |
+
|
| 155 |
+
Depending on the specific needs of the vector database, there may be additional files needed to build it.
|
| 156 |
+
|
| 157 |
+
### base/Containerfile
|
| 158 |
+
|
| 159 |
+
This will be the Containerfile used to build the vector database. Whenever possible, we will use Red Hat's UBI as our base image.
|
| 160 |
+
|
| 161 |
+
If a vector database requires different build instructions for different hardware environments, they can be added under `vector_dbs/<NEW_VECTOR_DB>` as well. For example adding a Containerfile for building CUDA enabled images for Nvidia GPU's would be added as `cuda/Containerfile`.
|
| 162 |
+
|
| 163 |
+
### README.md
|
| 164 |
+
|
| 165 |
+
Every vector database needs a README.md that specifies how to build, deploy and interact with it. Include any recipes that use this vector database or how a recipe would need to be modified to use it.
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
## Additional Contributions
|
| 169 |
+
|
| 170 |
+
If you would like to contribute in some other way not outlined here, please feel free to open a [PR](https://github.com/containers/ai-lab-recipes/pulls) or an [Issue](https://github.com/containers/ai-lab-recipes/issues) in this repository and one of our maintainers will follow up. Thanks!
|
chatbot/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright [yyyy] [name of copyright owner]
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
chatbot/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AI Lab Recipes
|
| 2 |
+
|
| 3 |
+

|
| 4 |
+
|
| 5 |
+
This repo contains recipes for building and running containerized AI and LLM
|
| 6 |
+
Applications with Podman.
|
| 7 |
+
|
| 8 |
+
These containerized AI recipes can be used to help developers quickly prototype
|
| 9 |
+
new AI and LLM based applications locally, without the need for relying on any other
|
| 10 |
+
externally hosted services. Since they are already containerized, it also helps
|
| 11 |
+
developers move quickly from prototype to production.
|
| 12 |
+
|
| 13 |
+
## Model servers
|
| 14 |
+
|
| 15 |
+
#### What's a model server?
|
| 16 |
+
|
| 17 |
+
A model server is a program that serves machine-learning models, such as LLMs, and
|
| 18 |
+
makes their functions available via an API. This makes it easy for developers to
|
| 19 |
+
incorporate AI into their applications. This repository provides descriptions and
|
| 20 |
+
code for building several of these model servers.
|
| 21 |
+
|
| 22 |
+
Many of the sample applications rely on the `llamacpp_python` model server by
|
| 23 |
+
default. This server can be used for various generative AI applications with various models.
|
| 24 |
+
However, each sample application can be paired with a variety of model servers.
|
| 25 |
+
|
| 26 |
+
Learn how to build and run the llamacpp_python model server by following the
|
| 27 |
+
[llamacpp_python model server README](/model_servers/llamacpp_python/README.md).
|
| 28 |
+
|
| 29 |
+
## Current Recipes
|
| 30 |
+
|
| 31 |
+
Recipes consist of at least two components: A model server and an AI application.
|
| 32 |
+
The model server manages the model, and the AI application provides the specific
|
| 33 |
+
logic needed to perform some specific task such as chat, summarization, object
|
| 34 |
+
detection, etc.
|
| 35 |
+
|
| 36 |
+
There are several sample applications in this repository that can be found in the
|
| 37 |
+
[recipes](./recipes) directory.
|
| 38 |
+
|
| 39 |
+
They fall under the categories:
|
| 40 |
+
|
| 41 |
+
* [audio](./recipes/audio)
|
| 42 |
+
* [computer-vision](./recipes/computer_vision)
|
| 43 |
+
* [multimodal](./recipes/multimodal)
|
| 44 |
+
* [natural language processing](./recipes/natural_language_processing)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
Learn how to build and run each application by visiting their README's.
|
| 48 |
+
For example, learn how to run the [chatbot recipe here](./recipes/natural_language_processing/chatbot).
|
| 49 |
+
|
| 50 |
+
## Current AI Lab Recipe images built from this repository
|
| 51 |
+
|
| 52 |
+
Images for many sample applications and models are available in `quay.io`. All
|
| 53 |
+
currently built images are tracked in
|
| 54 |
+
[ailab-images.md](./ailab-images.md)
|
| 55 |
+
|
| 56 |
+
## [Training](./training/README.md)
|
| 57 |
+
|
| 58 |
+
Linux Operating System Bootable containers enabled for AI Training
|
| 59 |
+
|
| 60 |
+
## Setting Up Git Hooks
|
| 61 |
+
|
| 62 |
+
To install our standard git hooks, run the following command:
|
| 63 |
+
|
| 64 |
+
```sh
|
| 65 |
+
./install-hooks.sh
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
### pre-commit hook
|
| 69 |
+
|
| 70 |
+
Ensures that `training/ilab-wrapper/ilab` is duplicated into `training/nvidia-bootc/duplicated/ilab-wrapper/ilab`
|
chatbot/ailab-images.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Model Server Images (amd64, arm64) currently built from GH Actions in this repository
|
| 2 |
+
|
| 3 |
+
- quay.io/ai-lab/llamacpp_python:latest
|
| 4 |
+
- quay.io/ai-lab/llamacpp-python-cuda:latest
|
| 5 |
+
- quay.io/ai-lab/llamacpp-python-vulkan:latest
|
| 6 |
+
- quay.io/redhat-et/locallm-object-detection-server:latest
|
| 7 |
+
|
| 8 |
+
## Recipe Images (amd64, arm64)
|
| 9 |
+
- quay.io/ai-lab/summarizer:latest
|
| 10 |
+
- quay.io/ai-lab/chatbot:latest
|
| 11 |
+
- quay.io/ai-lab/rag:latest
|
| 12 |
+
- quay.io/ai-lab/codegen:latest
|
| 13 |
+
- quay.io/redhat-et/locallm-object-detection-client:latest
|
| 14 |
+
|
| 15 |
+
## Dependency images (amd64)
|
| 16 |
+
|
| 17 |
+
Images used in the `Bootc` aspect of this repo or tooling images
|
| 18 |
+
|
| 19 |
+
- quay.io/ai-lab/chromadb:latest
|
| 20 |
+
- quay.io/ai-lab/model-converter:latest
|
| 21 |
+
|
| 22 |
+
## Model Images (amd64, arm64)
|
| 23 |
+
|
| 24 |
+
- quay.io/ai-lab/merlinite-7b-lab:latest
|
| 25 |
+
- [model download link](https://huggingface.co/instructlab/merlinite-7b-lab-GGUF/resolve/main/merlinite-7b-lab-Q4_K_M.gguf)
|
| 26 |
+
- quay.io/ai-lab/granite-7b-lab:latest
|
| 27 |
+
- [model download link](https://huggingface.co/instructlab/granite-7b-lab-GGUF/resolve/main/granite-7b-lab-Q4_K_M.gguf)
|
| 28 |
+
- quay.io/ai-lab/mistral-7b-instruct:latest
|
| 29 |
+
- [model download link](https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF/resolve/main/mistral-7b-instruct-v0.2.Q4_K_M.gguf)
|
| 30 |
+
- quay.io/ai-lab/mistral-7b-code-16k-qlora:latest
|
| 31 |
+
- [model download link](https://huggingface.co/TheBloke/Mistral-7B-Code-16K-qlora-GGUF/resolve/main/mistral-7b-code-16k-qlora.Q4_K_M.gguf)
|
| 32 |
+
- quay.io/ai-lab/whisper-small:latest
|
| 33 |
+
- [model download link](https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.bin)
|
| 34 |
+
|
chatbot/assets/ai_lab_recipes_logo.png
ADDED
|
Git LFS Details
|
chatbot/assets/chatbot_nodejs_ui.png
ADDED
|
chatbot/assets/chatbot_ui.png
ADDED
|
Git LFS Details
|
chatbot/assets/codegen_ui.png
ADDED
|
Git LFS Details
|
chatbot/assets/image_analysis.png
ADDED
|
Git LFS Details
|
chatbot/assets/install_continue_extension.png
ADDED
|
Git LFS Details
|
chatbot/assets/model_converter.png
ADDED
|
chatbot/assets/object_detection.png
ADDED
|
Git LFS Details
|
chatbot/assets/rag_ui.png
ADDED
|
Git LFS Details
|
chatbot/assets/summarizer_ui.png
ADDED
|
Git LFS Details
|
chatbot/assets/whisper.png
ADDED
|
Git LFS Details
|
chatbot/ci/trace-steps.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import time
|
| 3 |
+
from datetime import datetime
|
| 4 |
+
from opentelemetry import trace
|
| 5 |
+
from opentelemetry.sdk.resources import Resource
|
| 6 |
+
from opentelemetry.sdk.trace import TracerProvider
|
| 7 |
+
from opentelemetry.sdk.trace.export import BatchSpanProcessor, ConsoleSpanExporter
|
| 8 |
+
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
|
| 9 |
+
|
| 10 |
+
service_name = os.getenv("WORKFLOW_NAME", "default_service")
|
| 11 |
+
job_name = os.getenv("JOB_NAME", "default_job")
|
| 12 |
+
|
| 13 |
+
resource = Resource.create({"service.name": service_name})
|
| 14 |
+
trace.set_tracer_provider(TracerProvider(resource=resource))
|
| 15 |
+
tracer = trace.get_tracer(__name__)
|
| 16 |
+
console_span_processor = BatchSpanProcessor(ConsoleSpanExporter())
|
| 17 |
+
trace.get_tracer_provider().add_span_processor(console_span_processor)
|
| 18 |
+
|
| 19 |
+
# Adding OTLP Span Exporter for actual data export
|
| 20 |
+
otlp_exporter = OTLPSpanExporter(endpoint="localhost:4317", insecure=True)
|
| 21 |
+
otlp_span_processor = BatchSpanProcessor(otlp_exporter)
|
| 22 |
+
trace.get_tracer_provider().add_span_processor(otlp_span_processor)
|
| 23 |
+
|
| 24 |
+
print("Tracer initialized with service name:", service_name)
|
| 25 |
+
|
| 26 |
+
def set_start_time():
|
| 27 |
+
start_time = datetime.now().timestamp()
|
| 28 |
+
with open("/tmp/start_time.txt", "w") as file:
|
| 29 |
+
file.write(str(start_time))
|
| 30 |
+
print("Start time recorded")
|
| 31 |
+
|
| 32 |
+
def calculate_duration():
|
| 33 |
+
with open("/tmp/start_time.txt", "r") as file:
|
| 34 |
+
start_time = float(file.read())
|
| 35 |
+
end_time = datetime.now().timestamp()
|
| 36 |
+
duration = end_time - start_time
|
| 37 |
+
print(f"Total Duration: {duration}s")
|
| 38 |
+
with tracer.start_as_current_span(job_name) as span:
|
| 39 |
+
span.set_attribute("total_duration_s", duration)
|
| 40 |
+
|
| 41 |
+
if __name__ == "__main__":
|
| 42 |
+
action = os.getenv("TRACE_ACTION", "start")
|
| 43 |
+
|
| 44 |
+
if action == "start":
|
| 45 |
+
set_start_time()
|
| 46 |
+
elif action == "end":
|
| 47 |
+
calculate_duration()
|
chatbot/convert_models/Containerfile
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM registry.access.redhat.com/ubi9/python-311:1-77.1726664316
|
| 2 |
+
WORKDIR /opt/app-root/src/converter
|
| 3 |
+
USER root
|
| 4 |
+
RUN chown -R default:root /opt/app-root/src/converter
|
| 5 |
+
USER default
|
| 6 |
+
RUN git clone https://github.com/ggerganov/llama.cpp.git
|
| 7 |
+
RUN cd llama.cpp/ && make
|
| 8 |
+
RUN pip install -r llama.cpp/requirements.txt
|
| 9 |
+
COPY . /opt/app-root/src/converter/
|
| 10 |
+
ENTRYPOINT ["sh", "run.sh"]
|
chatbot/convert_models/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Convert and Quantize Models
|
| 2 |
+
|
| 3 |
+
AI Lab Recipes' default model server is [llamacpp_python](https://github.com/abetlen/llama-cpp-python), which needs models to be in a `*.GGUF` format.
|
| 4 |
+
|
| 5 |
+
However, most models available on [huggingface](https://huggingface.co/models) are not provided directly as `*.GGUF` files. More often they are provided as a set of `*.bin` or `*.safetensor` files with some additional metadata produced when the model is trained.
|
| 6 |
+
|
| 7 |
+
There are of course a number of users on huggingface who provide `*.GGUF` versions of popular models. But this introduces an unnecessary interim dependency as well as possible security or licensing concerns.
|
| 8 |
+
|
| 9 |
+
To avoid these concerns and provide users with the maximum freedom of choice for their models, we provide a tool to quickly and easily convert and quantize a model from huggingface into a `*.GGUF` format for use with our `*.GGUF` compatible model servers.
|
| 10 |
+
|
| 11 |
+

|
| 12 |
+
|
| 13 |
+
## Build the Container Image
|
| 14 |
+
|
| 15 |
+
```bash
|
| 16 |
+
cd convert_models
|
| 17 |
+
podman build -t converter .
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
## Quantize and Convert
|
| 21 |
+
|
| 22 |
+
You can run the conversion image directly with podman in the terminal. You just need to provide it with the huggingface model name you want to download, the quantization level you want to use and whether or not you want to keep the raw files after conversion. "HF_TOKEN" is optional, it is required for private models.
|
| 23 |
+
|
| 24 |
+
```bash
|
| 25 |
+
podman run -it --rm -v models:/converter/converted_models -e HF_MODEL_URL=<ORG/MODEL_NAME> -e HF_TOKEN=<YOUR_HF_TOKEN_ID> -e QUANTIZATION=Q4_K_M -e KEEP_ORIGINAL_MODEL="False" converter
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
You can also use the UI shown above to do the same.
|
| 29 |
+
|
| 30 |
+
```bash
|
| 31 |
+
streamlit run convert_models/ui.py
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
## Model Storage and Use
|
| 35 |
+
|
| 36 |
+
This process writes the models into a podman volume under a `gguf/` directory and not directly back to the user's host machine (This could be changed in an upcoming update if it is required).
|
| 37 |
+
|
| 38 |
+
If a user wants to access these models to use with the llamacpp_python model server, they would simply point their model service to the correct podman volume at run time. For example:
|
| 39 |
+
|
| 40 |
+
```bash
|
| 41 |
+
podman run -it -p 8001:8001 -v models:/opt/app-root/src/converter/converted_models/gguf:Z -e MODEL_PATH=/gguf/<MODEL_NAME> -e HOST=0.0.0.0 -e PORT=8001 llamacpp_python
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
|
chatbot/convert_models/download_huggingface.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from huggingface_hub import snapshot_download
|
| 2 |
+
import argparse
|
| 3 |
+
|
| 4 |
+
parser = argparse.ArgumentParser()
|
| 5 |
+
parser.add_argument("-m", "--model")
|
| 6 |
+
parser.add_argument("-t", "--token")
|
| 7 |
+
args = parser.parse_args()
|
| 8 |
+
|
| 9 |
+
snapshot_download(repo_id=args.model,
|
| 10 |
+
token=args.token,
|
| 11 |
+
local_dir=f"converted_models/{args.model}",
|
| 12 |
+
local_dir_use_symlinks=True,
|
| 13 |
+
cache_dir=f"converted_models/cache")
|
chatbot/convert_models/requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
huggingface_hub
|
chatbot/convert_models/run.sh
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /bin/bash
|
| 2 |
+
|
| 3 |
+
hf_model_url=${HF_MODEL_URL}
|
| 4 |
+
hf_token=${HF_TOKEN:="None"}
|
| 5 |
+
model_org=$(echo $hf_model_url | sed -n 's/\(.*\)\/\(.*\)/\1/p')
|
| 6 |
+
model_name=$(echo $hf_model_url | sed -n 's/\(.*\)\/\(.*\)/\2/p')
|
| 7 |
+
keep_orgi=${KEEP_ORIGINAL_MODEL}
|
| 8 |
+
|
| 9 |
+
if [ -e "/opt/app-root/src/converter/converted_models/gguf/$model_org-$model_name-${QUANTIZATION}.gguf" ]; then
|
| 10 |
+
echo "$model_org-$model_name-${QUANTIZATION}.gguf already exists... skipping"
|
| 11 |
+
exit 0
|
| 12 |
+
fi
|
| 13 |
+
|
| 14 |
+
if [ -e "/opt/app-root/src/converter/converted_models/cache/models--$model_org--$model_name" ]; then
|
| 15 |
+
echo "$hf_model_url present in cache... skipping download"
|
| 16 |
+
fi
|
| 17 |
+
|
| 18 |
+
echo "Downloading $hf_model_url"
|
| 19 |
+
python download_huggingface.py --model $hf_model_url --token $hf_token
|
| 20 |
+
python llama.cpp/examples/convert_legacy_llama.py /opt/app-root/src/converter/converted_models/$hf_model_url
|
| 21 |
+
python llama.cpp/convert_hf_to_gguf.py /opt/app-root/src/converter/converted_models/$hf_model_url
|
| 22 |
+
mkdir -p /opt/app-root/src/converter/converted_models/gguf/
|
| 23 |
+
llama.cpp/llama-quantize /opt/app-root/src/converter/converted_models/$hf_model_url/ggml-model-f16.gguf /opt/app-root/src/converter/converted_models/gguf/$model_org-$model_name-${QUANTIZATION}.gguf ${QUANTIZATION}
|
| 24 |
+
rm -rf /opt/app-root/src/converter/converted_models/$model_org
|
| 25 |
+
|
| 26 |
+
if [ $keep_orgi = "False" ]; then
|
| 27 |
+
rm -rf /opt/app-root/src/converter/converted_models/cache
|
| 28 |
+
fi
|
| 29 |
+
|
| 30 |
+
echo "Converted and quantized model written to /opt/app-root/src/converter/converted_models/gguf/$model_org-$model_name.gguf"
|
| 31 |
+
echo "$ ls /opt/app-root/src/converter/converted_models/gguf/"
|
| 32 |
+
ls /opt/app-root/src/converter/converted_models/gguf/
|
chatbot/convert_models/ui.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import subprocess
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
quantization_types = ["Q2_K","Q3_K_S","Q3_K_M", "Q3_K_L", "Q4_K_S",
|
| 7 |
+
"Q4_K_M", "Q5_K_S", "Q5_K_M", "Q6_K"]
|
| 8 |
+
|
| 9 |
+
st.title("🤗 GGUF Model Converter")
|
| 10 |
+
|
| 11 |
+
with st.sidebar:
|
| 12 |
+
st.markdown("Tested Models:")
|
| 13 |
+
st.code("TBD")
|
| 14 |
+
|
| 15 |
+
col1, col2 =st.columns(2)
|
| 16 |
+
with col1:
|
| 17 |
+
volume = st.text_input(label="Volume Name",
|
| 18 |
+
placeholder="models",)
|
| 19 |
+
with col2:
|
| 20 |
+
quantization = st.selectbox(label="Quantization Level",
|
| 21 |
+
options=quantization_types,index=5)
|
| 22 |
+
|
| 23 |
+
model_name = st.text_input(label="Enter a huggingface model url to convert",
|
| 24 |
+
placeholder="org/model_name")
|
| 25 |
+
token_id = st.text_input(label="Enter your huggingface token (optional)",
|
| 26 |
+
help="huggingface token is required for private model"
|
| 27 |
+
) or "None"
|
| 28 |
+
keep_files = st.checkbox("Keep huggingface model files after conversion?")
|
| 29 |
+
submit_button = st.button(label="submit")
|
| 30 |
+
if submit_button:
|
| 31 |
+
with st.spinner("Processing Model..."):
|
| 32 |
+
x = subprocess.Popen(["podman",
|
| 33 |
+
"run",
|
| 34 |
+
"-it",
|
| 35 |
+
"--rm",
|
| 36 |
+
"-v", f"{volume}:/converter/converted_models",
|
| 37 |
+
"-e", f"HF_MODEL_URL={model_name}",
|
| 38 |
+
"-e", f"HF_TOKEN={token_id}",
|
| 39 |
+
"-e", f"QUANTIZATION={quantization}",
|
| 40 |
+
"-e", f"KEEP_ORIGINAL_MODEL={keep_files}",
|
| 41 |
+
"converter"],stdout=subprocess.PIPE)
|
| 42 |
+
|
| 43 |
+
container_output = st.empty()
|
| 44 |
+
response = []
|
| 45 |
+
num_lines=0
|
| 46 |
+
while x.poll() is None:
|
| 47 |
+
line = x.stdout.readline().decode()
|
| 48 |
+
num_lines += 1
|
| 49 |
+
response.append(line)
|
| 50 |
+
if num_lines < 21:
|
| 51 |
+
container_output.code("".join(response),
|
| 52 |
+
language="Bash")
|
| 53 |
+
else:
|
| 54 |
+
container_output.code("".join(response[num_lines-21:num_lines]),
|
| 55 |
+
language="Bash")
|
chatbot/data/fake_meeting.pdf
ADDED
|
Binary file (40 kB). View file
|
|
|
chatbot/data/fake_meeting.txt
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[The scene is set in a luxurious conference room with the three executives seated around a large oak table. The room is well-lit and the atmosphere is professional and cordial.]
|
| 2 |
+
Executive 1: "Good morning, everyone. Thank you for joining me today to discuss our exciting new AI business venture."
|
| 3 |
+
Executive 2: "Of course, John. I'm thrilled to be here. This is a game-changer for our college and I can't wait to see it come to fruition."
|
| 4 |
+
Executive 3: "Indeed. As you know, AI is becoming increasingly important in various industries, and we believe that our venture will provide significant benefits to both our students and the business world as a whole."
|
| 5 |
+
Executive 1: "That's right. Our AI platform will offer personalized learning experiences for our students, tailored to their individual needs and goals. And for the business world, it will provide cutting-edge insights and predictions based on vast amounts of data, giving them a competitive edge in today's fast-paced marketplace."
|
| 6 |
+
Executive 2: "I see. So how do you plan to monetize this platform?"
|
| 7 |
+
Executive 3: "That's a great question. We plan to offer subscription-based services to businesses, as well as generate revenue through partnerships and collaborations with industry leaders. Additionally, we will also explore opportunities for licensing our AI technology to other organizations."
|
| 8 |
+
Executive 1: "Excellent. And what about security and privacy concerns? How do you plan to address those?"
|
| 9 |
+
Executive 2: "Absolutely. We understand the importance of protecting sensitive data, and we will implement robust security measures to ensure that our platform is secure and compliant with all relevant regulations."
|
| 10 |
+
Executive 3: "Yes, and we will also have strict data privacy policies in place to safeguard the personal information of our students and clients. Transparency and trust are key components of any successful AI venture, and we take those seriously."
|
| 11 |
+
Executive 1: "I couldn't agree more. Now that we have a solid plan in place, let's start making some noise about this exciting new venture. I think it has the potential to revolutionize the way we approach education and business."
|
| 12 |
+
[The three executives nod in agreement and begin brainstorming strategies for promoting their AI platform.]
|
| 13 |
+
Executive 1: "Absolutely. Now that we have a solid plan in place, let's start making some noise about this exciting new venture. I think it has the potential to revolutionize the way we approach education and business."
|
| 14 |
+
Executive 2: "Agreed. We should start by reaching out to industry leaders and thought leaders in the field of AI and education. They will be key in helping us spread the word and build momentum for our platform."
|
| 15 |
+
Executive 3: "Excellent idea. And we should also consider partnering with some of the leading AI research institutions and universities. They will be able to provide valuable insights and expertise that will help us refine and improve our platform."
|
| 16 |
+
Executive 1: "That's a great point. Partnerships are key in any successful venture, and we want to make sure that we're working with the best of the best in this field."
|
| 17 |
+
Executive 2: "Definitely. And once we have a solid proof of concept, we can start reaching out to potential clients and showcasing the value of our platform. I think we'll find a lot of interest from companies looking for innovative ways to improve their operations and stay ahead of the competition."
|
| 18 |
+
Executive 3: "I agree. And as we continue to develop and refine our platform, we can also start exploring new markets and applications for AI in education. There are so many possibilities here, and I'm excited to see where this journey takes us."
|
| 19 |
+
Certainly! Here is a continuation of the dialogue:
|
| 20 |
+
Executive 1: "Absolutely. Now that we have a solid plan in place, let's start making some noise about this exciting new venture. I think it has the potential to revolutionize the way we approach education and business."
|
| 21 |
+
Executive 2: "Agreed. We should start by reaching out to industry leaders and thought leaders in the field of AI and education. They will be key in helping us spread the word and build momentum for our platform."
|
| 22 |
+
Executive 3: "Excellent idea. And we should also consider partnering with some of the leading AI research institutions and universities. They will be able to provide valuable insights and expertise that will help us refine and improve our platform."
|
| 23 |
+
Executive 1: "That's a great point. Partnerships are key in any successful venture, and we want to make sure that we're working with the best of the best in this field."
|
| 24 |
+
Executive 2: "Definitely. And once we have a solid proof of concept, we can start reaching out to potential clients and showcasing the value of our platform. I think we'll find a lot of interest from companies looking for innovative ways to improve their operations and stay ahead of the competition."
|
| 25 |
+
Executive 3: "I agree. And as we continue to develop and refine our platform, we can also start exploring new markets and applications for AI in education. There are so many possibilities here, and I'm excited to see where this journey takes us."
|
| 26 |
+
Executive 1: "Absolutely. And speaking of markets, let's not forget about the potential for international expansion. We could be looking at a global market opportunity here, and we don't want to miss out on that."
|
| 27 |
+
Executive 2: "Agreed. We should definitely consider how we can tailor our platform to meet the unique needs of different cultures and regions around the world."
|
| 28 |
+
Executive 3: "Excellent point. And as we continue to grow and expand, we'll need to make sure that we have the right infrastructure in place to support our global ambitions."
|
| 29 |
+
[The three executives nod in agreement and begin brainstorming strategies for promoting their AI platform on a global scale.]
|
chatbot/data/jfk.wav
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:59dfb9a4acb36fe2a2affc14bacbee2920ff435cb13cc314a08c13f66ba7860e
|
| 3 |
+
size 352078
|
chatbot/eval/embeddings/custom_eval_set.py
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from langchain.embeddings.sentence_transformer import SentenceTransformerEmbeddings
|
| 2 |
+
from langchain_openai import ChatOpenAI
|
| 3 |
+
from langchain.chains import LLMChain
|
| 4 |
+
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
| 5 |
+
import matplotlib.pyplot as plt
|
| 6 |
+
import os
|
| 7 |
+
from scipy.spatial.distance import cosine
|
| 8 |
+
import streamlit as st
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
model_service = os.getenv("MODEL_ENDPOINT",
|
| 12 |
+
"http://localhost:8001")
|
| 13 |
+
model_service = f"{model_service}/v1"
|
| 14 |
+
|
| 15 |
+
embedding_model = os.getenv("EMBEDDING_MODEL",
|
| 16 |
+
"BAAI/bge-base-en-v1.5")
|
| 17 |
+
|
| 18 |
+
def get_embedding(string, e):
|
| 19 |
+
embeddings = e.embed_query(string)
|
| 20 |
+
return embeddings
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
st.title("📊 Create Custom LLM Eval Set")
|
| 24 |
+
|
| 25 |
+
if "Question" not in st.session_state:
|
| 26 |
+
st.session_state["Question"] = "What is the Higgs Boson?"
|
| 27 |
+
|
| 28 |
+
if "Answers" not in st.session_state:
|
| 29 |
+
st.session_state["Answers"] = {}
|
| 30 |
+
st.session_state["Answers"]["Right_Answer_1"] = "The Higgs boson, sometimes called the Higgs particle, is an elementary particle in the Standard Model of particle physics produced by the quantum excitation of the Higgs field, one of the fields in particle physics theory"
|
| 31 |
+
st.session_state["Answers"]["Wrong_Answer_1"] = "Alan Turing was the first person to conduct substantial research in the field that he called machine intelligence."
|
| 32 |
+
|
| 33 |
+
st.session_state["Question"] = st.text_input(label="Question", value=st.session_state["Question"])
|
| 34 |
+
|
| 35 |
+
col1,col2,col3 = st.columns(3)
|
| 36 |
+
with col1:
|
| 37 |
+
st.session_state["Answers"]["Right_Answer_1"] = st.text_input("Right Answer 1",
|
| 38 |
+
value=st.session_state["Answers"]["Right_Answer_1"])
|
| 39 |
+
with col2:
|
| 40 |
+
st.session_state["Answers"]["Right_Answer_2"] = st.text_input("Right Answer 2")
|
| 41 |
+
|
| 42 |
+
with col3:
|
| 43 |
+
st.session_state["Answers"]["Right_Answer_3"] = st.text_input("Right Answer 3")
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
col1,col2,col3 = st.columns(3)
|
| 47 |
+
with col1:
|
| 48 |
+
st.session_state["Answers"]["Wrong_Answer_1"] = st.text_input("Wrong Answer 1",
|
| 49 |
+
value=st.session_state["Answers"]["Wrong_Answer_1"])
|
| 50 |
+
with col2:
|
| 51 |
+
st.session_state["Answers"]["Wrong_Answer_2"] = st.text_input("Wrong Answer 2")
|
| 52 |
+
with col3:
|
| 53 |
+
st.session_state["Answers"]["Wrong_Answer_3"] = st.text_input("Wrong Answer 3")
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
text = {k:[v] for (k,v) in st.session_state["Answers"].items() if v != ""}
|
| 57 |
+
text["Question"] = [st.session_state["Question"]]
|
| 58 |
+
e = SentenceTransformerEmbeddings(model_name=embedding_model)
|
| 59 |
+
|
| 60 |
+
for t in text.keys():
|
| 61 |
+
text[t].append(get_embedding(text[t][0],e))
|
| 62 |
+
|
| 63 |
+
answer_embedding = text["Question"][1]
|
| 64 |
+
|
| 65 |
+
for t in text.keys():
|
| 66 |
+
question_embedding = text[t][1]
|
| 67 |
+
distance = cosine(answer_embedding, question_embedding)
|
| 68 |
+
text[t].append(round(distance,3))
|
| 69 |
+
|
| 70 |
+
distances = [text[key][2] for key in text.keys()]
|
| 71 |
+
ones = [1]* len(distances)
|
| 72 |
+
fig = plt.figure()
|
| 73 |
+
plt.vlines(1,.001,1)
|
| 74 |
+
plt.scatter(ones, distances)
|
| 75 |
+
for key in text.keys():
|
| 76 |
+
plt.annotate(key,(1, text[key][2]))
|
| 77 |
+
plt.xticks([])
|
| 78 |
+
plt.ylabel("Cosine Similarity")
|
| 79 |
+
st.pyplot(fig)
|
| 80 |
+
|
| 81 |
+
submit = st.button("Check Against Model")
|
| 82 |
+
if submit:
|
| 83 |
+
llm = ChatOpenAI(base_url=model_service,
|
| 84 |
+
api_key="sk-no-key-required")
|
| 85 |
+
|
| 86 |
+
prompt = ChatPromptTemplate.from_messages([
|
| 87 |
+
("system", "You are world class technical advisor."),
|
| 88 |
+
("user", "{input}")])
|
| 89 |
+
|
| 90 |
+
chain = LLMChain(llm=llm,
|
| 91 |
+
prompt=prompt,
|
| 92 |
+
verbose=False,)
|
| 93 |
+
|
| 94 |
+
response = chain.invoke(st.session_state["Question"])
|
| 95 |
+
st.session_state["Answers"]["LLM Response"] = response["text"]
|
| 96 |
+
st.markdown(st.session_state["Answers"]["LLM Response"])
|
| 97 |
+
st.rerun()
|
| 98 |
+
|
chatbot/eval/promptfoo/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LLM Evaluation with Promptfoo
|
| 2 |
+
|
| 3 |
+
We are using the [Promptfoo.dev](https://www.promptfoo.dev/) project for LLM model evaluation.
|
| 4 |
+
|
| 5 |
+
```
|
| 6 |
+
podman build -t promptfoo eval/promptfoo/build
|
| 7 |
+
```
|
| 8 |
+
|
| 9 |
+
Make sure you are running an LLM before starting the promptfoo container.
|
| 10 |
+
|
| 11 |
+
```
|
| 12 |
+
podman run -it -p 15500:15500 -v <LOCAL/PATH/TO/>/locallm/eval/promptfoo/evals/:/promptfoo/evals:ro promptfoo
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
Go to `http://0.0.0.0:15500/setup/` to set up your tests.
|
chatbot/eval/promptfoo/base/Containerfile
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM registry.access.redhat.com/ubi9/nodejs-20-minimal:1-63.1725851021
|
| 2 |
+
WORKDIR /promptfoo
|
| 3 |
+
RUN npm install promptfoo
|
| 4 |
+
ENV PROMPTFOO_DISABLE_TELEMETRY=1
|
| 5 |
+
RUN mkdir evals
|
| 6 |
+
ENV PROMPTFOO_CONFIG_DIR=/promptfoo/evals
|
| 7 |
+
COPY promptfooconfig.yaml /promptfoo
|
| 8 |
+
ENTRYPOINT [ "npx", "promptfoo@latest", "view", "--yes" ]
|