Skip to content

Commit

Permalink
add cuda-tests
Browse files Browse the repository at this point in the history
Signed-off-by: sallyom <somalley@redhat.com>
  • Loading branch information
sallyom committed Apr 12, 2024
1 parent 3f081e8 commit 9f93d55
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/model_servers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,33 @@ jobs:
matrix:
include:
- image_name: llamacpp_python
cuda_image_name: llamacpp_python_cuda
base_image_name: llamacpp_python
model: mistral
flavor: base
directory: llamacpp_python
platforms: linux/amd64,linux/arm64
test_cmd: test
#- image_name: llamacpp_python_vulkan
# cuda_image_name: llamacpp_python_cuda
# base_image_name: llamacpp_python
# model: mistral
# flavor: vulkan
# directory: llamacpp_python
# platforms: linux/arm64
# test_cmd: test
- image_name: llamacpp_python_cuda
cuda_image_name: llamacpp_python_cuda
base_image_name: llamacpp_python
model: mistral
flavor: cuda
directory: llamacpp_python
platforms: linux/amd64
test_cmd: run-cuda
- image_name: whispercpp
cuda_image_name: llamacpp_python_cuda
base_image_name: llamacpp_python
model: whisper-small
flavor: base
directory: whispercpp
platforms: linux/amd64,linux/arm64
test_cmd: test
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -95,9 +99,11 @@ jobs:

- name: Run tests
working-directory: ./model_servers/${{ matrix.directory }}/
run: make ${{ matrix.test_cmd }}
run: make test
env:
IMAGE_NAME: ${{ matrix.image_name }}
BASE_IMAGE_NAME: ${{ matrix.base_image_name }}
CUDA_IMAGE_NAME: ${{ matrix.cuda_image_name }}

- name: Login to Container Registry
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
Expand Down
3 changes: 1 addition & 2 deletions model_servers/llamacpp_python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,10 @@ run:
cd ../../models && \
podman run -it -d -p $(PORT):$(PORT) -v ./$(SELECTED_MODEL_NAME):$(MODELS_PATH)/model.gguf:$(BIND_MOUNT_OPTIONS) -e MODEL_PATH=$(MODELS_PATH)/model.gguf -e HOST=0.0.0.0 -e PORT=$(PORT) --net=host $(IMAGE)

# TODO: set to fail if container isn't running (set || true to enable tests temporarily)
.PHONY: run-cuda
run-cuda:
cd ../../models && \
podman run -it -d -p $(PORT):$(PORT) -v ./$(SELECTED_MODEL_NAME):$(MODELS_PATH)/model.gguf:$(BIND_MOUNT_OPTIONS) -e MODEL_PATH=$(MODELS_PATH)/model.gguf -e HOST=0.0.0.0 -e PORT=$(PORT) --net=host --device nvidia.com/gpu=all $(IMAGE) || true
podman run -it -d -p $(PORT):$(PORT) -v ./$(SELECTED_MODEL_NAME):$(MODELS_PATH)/model.gguf:$(BIND_MOUNT_OPTIONS) -e MODEL_PATH=$(MODELS_PATH)/model.gguf -e HOST=0.0.0.0 -e PORT=$(PORT) --net=host --device nvidia.com/gpu=all $(IMAGE)

.PHONY: test
test:
Expand Down
4 changes: 2 additions & 2 deletions model_servers/llamacpp_python/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os

CUDA_MS = pytest_container.Container(
url=f"containers-storage:{os.environ['REGISTRY']}/containers/{os.environ['IMAGE_NAME']}",
url=f"containers-storage:{os.environ['REGISTRY']}/containers/{os.environ['CUDA_IMAGE_NAME']}",
volume_mounts=[
pytest_container.container.BindMount(
container_path="/locallm/models/model.gguf",
Expand All @@ -25,7 +25,7 @@
)

MS = pytest_container.Container(
url=f"containers-storage:{os.environ['REGISTRY']}/containers/{os.environ['IMAGE_NAME']}",
url=f"containers-storage:{os.environ['REGISTRY']}/containers/{os.environ['BASE_IMAGE_NAME']}",
volume_mounts=[
pytest_container.container.BindMount(
container_path="/locallm/models/model.gguf",
Expand Down
2 changes: 1 addition & 1 deletion model_servers/llamacpp_python/tests/test_alive.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pytest_container
from .conftest import MS
from .conftest import CUDA_MS
import tenacity

CONTAINER_IMAGES = [MS, CUDA_MS]


def test_etc_os_release_present(auto_container: pytest_container.container.ContainerData):
assert auto_container.connection.file("/etc/os-release").exists

Expand Down

0 comments on commit 9f93d55

Please sign in to comment.