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