Skip to content

Commit

Permalink
Add helm test for chart tei
Browse files Browse the repository at this point in the history
- Added helm test for chart tei

- Update the chart README

Signed-off-by: Lianhao Lu <[email protected]>
  • Loading branch information
lianhao authored and yongfengdu committed Jul 17, 2024
1 parent 9b5def0 commit f5c7faf
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 30 deletions.
34 changes: 23 additions & 11 deletions helm-charts/common/tei/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,37 @@ Helm chart for deploying Hugging Face Text Generation Inference service.
To install the chart, run the following:

```console
$ cd ${GenAIInfro_repo}/helm-charts/common
$ export MODELDIR=/mnt/model
$ export MODELNAME="BAAI/bge-base-en-v1.5"
$ helm install tei tei --set global.modelUseHostPath=${MODELDIR} --set EMBEDDING_MODEL_ID=${MODELNAME}
cd ${GenAIInfro_repo}/helm-charts/common
export MODELDIR=/mnt/opea-models
export MODELNAME="BAAI/bge-base-en-v1.5"
helm install tei tei --set global.modelUseHostPath=${MODELDIR} --set EMBEDDING_MODEL_ID=${MODELNAME}
```

By default, the tei service will downloading the "BAAI/bge-base-en-v1.5" which is about 1.1GB.

If you already cached the model locally, you can pass it to container like this example:

MODELDIR=/mnt/model
MODELDIR=/mnt/opea-models

MODELNAME="/data/BAAI/bge-base-en-v1.5"

## Verify

To verify the installation, run the command `kubectl get pod` to make sure all pods are runinng.

Then run the command `kubectl port-forward svc/tei 2081:80` to expose the tei service for access.

Open another terminal and run the following command to verify the service if working:

```console
curl http://localhost:2081/embed -X POST -d '{"inputs":"What is Deep Learning?"}' -H 'Content-Type: application/json'
```

## Values

| Key | Type | Default | Description |
| ----------------------- | ------ | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| EMBEDDING_MODEL_ID | string | `"BAAI/bge-base-en-v1.5"` | Models id from https://huggingface.co/, or predownloaded model directory |
| global.modelUseHostPath | string | `"/mnt"` | Cached models directory, tei will not download if the model is cached here. The host path "modelUseHostPath" will be mounted to container as /data directory |
| image.repository | string | `"ghcr.io/huggingface/text-embeddings-inference"` | |
| image.tag | string | `"cpu-1.2"` | |
| Key | Type | Default | Description |
| ----------------------- | ------ | ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| EMBEDDING_MODEL_ID | string | `"BAAI/bge-base-en-v1.5"` | Models id from https://huggingface.co/, or predownloaded model directory |
| global.modelUseHostPath | string | `"/mnt/opea-models"` | Cached models directory, tei will not download if the model is cached here. The host path "modelUseHostPath" will be mounted to container as /data directory. Set this to null/empty will force it to download model. |
| image.repository | string | `"ghcr.io/huggingface/text-embeddings-inference"` | |
| image.tag | string | `"cpu-1.2"` | |
19 changes: 0 additions & 19 deletions helm-charts/common/tei/templates/NOTES.txt

This file was deleted.

25 changes: 25 additions & 0 deletions helm-charts/common/tei/templates/tests/test-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: Pod
metadata:
name: "{{ include "tei.fullname" . }}-testpod"
labels:
{{- include "tei.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
#"helm.sh/hook-delete-policy": "hook-succeeded, hook-failure"
spec:
containers:
- name: curl
image: alpine/curl
#image: python:3.10.14
command: ['sh', '-c']
args:
- |
curl http://{{ include "tei.fullname" . }}/embed -sS --fail-with-body \
-X POST \
-d '{"inputs":"What is Deep Learning?"}' \
-H 'Content-Type: application/json'
restartPolicy: Never

0 comments on commit f5c7faf

Please sign in to comment.