From e85b06d73eee49d4fb5a4b7b1b8ec2bcfd94ae33 Mon Sep 17 00:00:00 2001 From: Liora Milbaum Date: Thu, 28 Mar 2024 21:17:12 +0200 Subject: [PATCH] model_servers workflow renamed Signed-off-by: Liora Milbaum --- .github/workflows/chatbot.yaml | 2 +- .github/workflows/model_servers.yaml | 57 +++++++++++++++++++ .../llamacpp_python/{base => }/Makefile | 6 +- .../base/tests/requirements-test.txt | 1 - .../{base => }/tests/__init__.py | 0 .../{base => }/tests/conftest.py | 0 .../tests/requirements-test.txt | 1 + .../{base => }/tests/test_alive.py | 0 8 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/model_servers.yaml rename model_servers/llamacpp_python/{base => }/Makefile (81%) delete mode 120000 model_servers/llamacpp_python/base/tests/requirements-test.txt rename model_servers/llamacpp_python/{base => }/tests/__init__.py (100%) rename model_servers/llamacpp_python/{base => }/tests/conftest.py (100%) create mode 120000 model_servers/llamacpp_python/tests/requirements-test.txt rename model_servers/llamacpp_python/{base => }/tests/test_alive.py (100%) diff --git a/.github/workflows/chatbot.yaml b/.github/workflows/chatbot.yaml index 38155c15..8a2865b3 100644 --- a/.github/workflows/chatbot.yaml +++ b/.github/workflows/chatbot.yaml @@ -46,7 +46,7 @@ jobs: - name: Install python dependencies working-directory: ./recipes/natural_language_processing/chatbot - run: make install + run: make install - name: Run tests working-directory: ./recipes/natural_language_processing/chatbot diff --git a/.github/workflows/model_servers.yaml b/.github/workflows/model_servers.yaml new file mode 100644 index 00000000..d8603bdd --- /dev/null +++ b/.github/workflows/model_servers.yaml @@ -0,0 +1,57 @@ +name: model_servers + +on: + pull_request: + branches: + - main + push: + branches: + - main + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository_owner }}/model_servers + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + services: + registry: + image: registry:2.8.3 + ports: + - 5000:5000 + steps: + - uses: actions/checkout@v4.1.1 + + - name: Login to ghcr + uses: docker/login-action@v3.1.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Buildah Action + uses: redhat-actions/buildah-build@v2.13 + with: + image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: latest + containerfiles: ./model_servers/llamacpp_python/base/Containerfile + context: model_servers/llamacpp_python/ + + - name: Download model + working-directory: ./model_servers/llamacpp_python/ + run: make models/llama-2-7b-chat.Q5_K_S.gguf + + - name: Set up Python + uses: actions/setup-python@v5.0.0 + + - name: Install python dependencies + working-directory: ./model_servers/llamacpp_python/ + run: make install + + - name: Run tests + working-directory: ./model_servers/llamacpp_python/ + run: make test diff --git a/model_servers/llamacpp_python/base/Makefile b/model_servers/llamacpp_python/Makefile similarity index 81% rename from model_servers/llamacpp_python/base/Makefile rename to model_servers/llamacpp_python/Makefile index e515d3f4..76748bb8 100644 --- a/model_servers/llamacpp_python/base/Makefile +++ b/model_servers/llamacpp_python/Makefile @@ -10,9 +10,9 @@ install: pip install -r tests/requirements-test.txt .PHONY: run -run: models/llama-2-7b-chat.Q5_K_S.gguf install +run: podman run -it -d -p 8001:8001 -v ./models:/locallm/models:ro,Z -e MODEL_PATH=models/llama-2-7b-chat.Q5_K_S.gguf -e HOST=0.0.0.0 -e PORT=8001 --net=host ghcr.io/redhat-et/model_servers .PHONY: test -test: models/llama-2-7b-chat.Q5_K_S.gguf install - pytest --log-cli-level NOTSET +test: + pytest --collect-only tests --log-cli-level NOTSET diff --git a/model_servers/llamacpp_python/base/tests/requirements-test.txt b/model_servers/llamacpp_python/base/tests/requirements-test.txt deleted file mode 120000 index 0348837e..00000000 --- a/model_servers/llamacpp_python/base/tests/requirements-test.txt +++ /dev/null @@ -1 +0,0 @@ -../../../../requirements-test.txt \ No newline at end of file diff --git a/model_servers/llamacpp_python/base/tests/__init__.py b/model_servers/llamacpp_python/tests/__init__.py similarity index 100% rename from model_servers/llamacpp_python/base/tests/__init__.py rename to model_servers/llamacpp_python/tests/__init__.py diff --git a/model_servers/llamacpp_python/base/tests/conftest.py b/model_servers/llamacpp_python/tests/conftest.py similarity index 100% rename from model_servers/llamacpp_python/base/tests/conftest.py rename to model_servers/llamacpp_python/tests/conftest.py diff --git a/model_servers/llamacpp_python/tests/requirements-test.txt b/model_servers/llamacpp_python/tests/requirements-test.txt new file mode 120000 index 00000000..f70349b9 --- /dev/null +++ b/model_servers/llamacpp_python/tests/requirements-test.txt @@ -0,0 +1 @@ +../../../requirements-test.txt \ No newline at end of file diff --git a/model_servers/llamacpp_python/base/tests/test_alive.py b/model_servers/llamacpp_python/tests/test_alive.py similarity index 100% rename from model_servers/llamacpp_python/base/tests/test_alive.py rename to model_servers/llamacpp_python/tests/test_alive.py