Skip to content

Commit

Permalink
Unit test target
Browse files Browse the repository at this point in the history
Added piplock refresh
  • Loading branch information
Xaenalt committed Aug 2, 2023
1 parent b76fc8c commit 6a9d02e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ USER root
WORKDIR /caikit
COPY caikit /caikit

RUN yum -y install git && yum clean all && \
RUN yum -y install git git-lfs && yum clean all && \
git lfs install && \
curl -sL https://github.com/fullstorydev/grpcurl/releases/download/v1.8.7/grpcurl_1.8.7_linux_x86_64.tar.gz | tar zxvf - -C /bin grpcurl && \
pip install pipenv && \
pipenv install --system && \
rm -rf ~/.cache && \
Expand Down
33 changes: 32 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
TGIS_IMAGE=quay.io/opendatahub/text-generation-inference:fast-ec05689

.PHONY: default

default:
Expand All @@ -7,4 +9,33 @@ default:
.PHONY: refresh-piplock-files

refresh-piplock-files:
cd caikit && pipenv lock
podman run --user root -it \
--rm -v $$(pwd)/caikit:/app/caikit:z \
$(TGIS_IMAGE) \
/bin/bash -c " \
cd caikit && \
yum -y install git && pip install pipenv && \
pipenv lock --pre \
"


.PHONY: docker-test

docker-test: default
podman run -it --rm \
-e DTYPE_STR=float32 \
--name caikit-tgis-serving-test-$$(git rev-parse --short HEAD) \
--volume $$(pwd)/test:/tmp/test:z --volume $$(pwd)/utils:/tmp/utils:z \
caikit-tgis-serving:$$(git rev-parse --short HEAD) \
/tmp/test/smoke-test.sh


.PHONY: shell

shell: default
podman run -it --rm \
-e DTYPE_STR=float32 \
--name caikit-tgis-serving-test-$$(git rev-parse --short HEAD) \
--volume $$(pwd)/test:/tmp/test:z --volume $$(pwd)/utils:/tmp/utils:z \
caikit-tgis-serving:$$(git rev-parse --short HEAD) \
/bin/bash
24 changes: 24 additions & 0 deletions test/smoke-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

cd $(mktemp -d)

git clone https://huggingface.co/google/flan-t5-small

/tmp/utils/convert.py --model-path flan-t5-small --model-save-path flan-t5-small-caikit

mv flan-t5-small-caikit /opt/models/

CAIKIT_LOG_FILE=$(mktemp)
cd /caikit
./start-serving.sh &>$CAIKIT_LOG_FILE &
# timeout --signal=SIGINT 30 bash -c "tail -f -n0 $CAIKIT_LOG_FILE | grep 'Caikit Runtime is serving on port'"
timeout --signal=SIGINT 30 bash -c "grep -m1 'Caikit Runtime is serving on port' <(tail -f $CAIKIT_LOG_FILE)"

cat $CAIKIT_LOG_FILE

grpcurl -plaintext -d '{"text": "At what temperature does liquid Nitrogen boil?"}' -H "mm-model-id: flan-t5-small-caikit" localhost:8085 caikit.runtime.Nlp.NlpService/TextGenerationTaskPredict
rc=$?

kill %1

exit $rc

0 comments on commit 6a9d02e

Please sign in to comment.