Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Helm Chart for VideoQnA Application #497

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
131861f
Optimize path and link validity check. (#462)
ZePan110 Oct 9, 2024
7cd488a
🚨 linter and pre-commit check fixes
krish918 Oct 16, 2024
1f121e9
✅ Added helm tests for all services | linting fixes
krish918 Oct 16, 2024
418edb7
✏ typo fix
krish918 Oct 17, 2024
24b4e3f
🛂 running vdms as root to fix errors
krish918 Oct 22, 2024
880e406
✅ updated tests for vdms-vector-db | typo fix
krish918 Oct 22, 2024
0110b85
⚡Updated and fixed several tests, values during integration
krish918 Oct 24, 2024
56afc63
🔥 removed hardcoded extraArgs for some comps
krish918 Oct 24, 2024
1a5f762
🔥 removed hardcoded extraArgs for some comps
krish918 Oct 24, 2024
5fbfe85
Merge branch 'main' into helm/videoqna
krish918 Oct 24, 2024
3bb015d
🩹 fixes for request going to nginx instead of videoqna
krish918 Oct 27, 2024
a29691b
🔨 passed nginx proxy endpoints to UI using templates
krish918 Oct 28, 2024
e8f58bb
🔨 passed nginx proxy endpoints to UI using templates
krish918 Oct 28, 2024
a8cbdbf
💚 added symbolic links to values files for CI
krish918 Oct 28, 2024
63bf7f6
💚 added symbolic links to values files for CI
krish918 Oct 28, 2024
cf4360f
📝 Added readme files for videoqna charts and subcharts
krish918 Oct 28, 2024
2d02cf9
💚 Added missing symbolic links for some values files
krish918 Oct 28, 2024
d03a52f
Merge branch 'main' into helm/videoqna
krish918 Oct 29, 2024
1e5eea1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 29, 2024
6e832ea
💚 added variant prefix to all videoqna values file
krish918 Oct 29, 2024
fc17e30
💚 Added several CI fixes
krish918 Oct 30, 2024
5ee3dc0
updated videoqna-ui vars and configmap
krish918 Oct 30, 2024
ea180a5
Merge branch 'main' into helm/videoqna
krish918 Oct 30, 2024
ef695c8
🩹 Fixes in reranking values for enabling data-prep
krish918 Oct 31, 2024
7be67a1
🩹 fixes in chart.yaml | updates in UI configmap
krish918 Nov 1, 2024
3cf4f29
updated videoqna-ui values filename
krish918 Nov 1, 2024
0e37189
Merge branch 'main' into helm/videoqna
krish918 Nov 1, 2024
d13bdcb
🔥 Updates based on lvm-uservice from visualqna
krish918 Nov 4, 2024
c932c31
Merge branch 'main' into helm/videoqna
krish918 Nov 4, 2024
a993f1a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 4, 2024
773922e
🩹 fix videoqna new dependency values for lvm-uservice
krish918 Nov 4, 2024
4bd8b04
lvm-serving rename | replaced cachedir with modeldir
krish918 Nov 6, 2024
91f96ec
reverted to INDEX_NAME key
krish918 Nov 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"spellright.language": ["en"],
"spellright.documentTypes": ["markdown", "latex", "plaintext", "yaml"]
}
4 changes: 4 additions & 0 deletions helm-charts/common/data-prep/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ dependencies:
version: 1.0.0
repository: file://../redis-vector-db
condition: redis-vector-db.enabled
- name: vdms-vector-db
version: 1.0.0
repository: file://../vdms-vector-db
condition: vdms-vector-db.enabled
- name: milvus
version: 4.2.12
repository: https://zilliztech.github.io/milvus-helm/
Expand Down
95 changes: 82 additions & 13 deletions helm-charts/common/data-prep/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# data-prep
# Data-Prep Microservice

Helm chart for deploying data-prep microservice.
Helm chart for deploying data-prep microservice. Data-Prep is consumed by several reference applications present in [GenAIExample](https://github.com/opea-project/GenAIExamples/tree/main).

data-prep will use redis and tei service, please specify the endpoints.
There are 2 versions of Data-Prep microservice. First version is unimodal based on redis-vector-db and TEI. It performs data preparation for textual data. An alternative multimodal version based on `videoqna-values.yaml` file, performs data preparation for visual data input. Follow along to select and install the version which suites your use case.

## (Option1): Installing the chart separately
Data-Prep uses redis-vector-db and tei. The multimodal version uses vdms-vector-db service. Endpoints for these dependencies should be set properly before installing the chart.

## Install the chart for data preparation using Redis Vector DB

### (Option1): Installing the chart separately

First, you need to install the tei and redis-vector-db chart, please refer to the [tei](../tei/README.md) and [redis-vector-db](../redis-vector-db/README.md) for more information.

After you've deployted the tei and redis-vector-db chart successfully, please run `kubectl get svc` to get the service endpoint and URL respectively, i.e. `http://tei`, `redis://redis-vector-db:6379`.
After you've deployed the tei and redis-vector-db chart successfully, please run `kubectl get svc` to get the service endpoint and URL respectively, i.e. `http://tei`, `redis://redis-vector-db:6379`.

To install data-prep chart, run the following:

Expand All @@ -20,7 +24,7 @@ helm dependency update
helm install data-prep . --set REDIS_URL=${REDIS_URL} --set TEI_EMBEDDING_ENDPOINT=${TEI_EMBEDDING_ENDPOINT}
```

## (Option2): Installing the chart with dependencies automatically
### (Option2): Installing the chart with dependencies automatically

```console
cd GenAIInfra/helm-charts/common/data-prep
Expand All @@ -29,6 +33,52 @@ helm install data-prep . --set redis-vector-db.enabled=true --set tei.enabled=tr

```

## Install the chart for multimodal data preparation using VDMS Vector DB

### (Option1): Installing the chart separately

First, you need to install the `vdms-vector-db` chart. Please refer to the [vdms-vector-db](../vdms-vector-db/README.md) for more information.

After you've deployed the `vdms-vector-db` chart successfully, please run `kubectl get svc` to get the service host and port respectively, for example: `http://vdms-vector-db:8001`.

Next, Run the following commands to install data-prep chart:

```bash
cd GenAIInfra/helm-charts/common/data-prep

# Use the host and port received in previous step as VDMS_HOST and VDMS_PORT.
export VDMS_HOST="vdms-vector-db"
export VDMS_PORT="8001"
export INDEX_NAME="mega-videoqna"
export HFTOKEN=<your huggingface token>
# Set a directory to cache emdedding models
export MODELDIR=/mnt/opea-models

# Export the proxy variables. Assign empty string if no proxy setup required.
export https_proxy="your_http_proxy"
export http_proxy="your_https_proxy"

helm dependency update
helm install data-prep . -f ../variant_videoqna-values.yaml --set global.HUGGINGFACEHUB_API_TOKEN=${HFTOKEN} --set INDEX_NAME=${INDEX_NAME} --set global.modelUseHostPath=${MODELDIR} --set vdmsHost=${VDMS_HOST} --set vdmsPort=${VDMS_PORT} --set global.https_proxy=${https_proxy} --set global.http_proxy=${http_proxy}
```

### (Option2): Installing the chart with dependencies automatically

```bash
cd GenAIInfra/helm-charts/common/data-prep
export INDEX_NAME="mega-videoqna"
export HFTOKEN=<your huggingface token>
# Set a directory to cache emdedding models
export MODELDIR=/mnt/opea-models

# Export the proxy variables. Assign empty string if no proxy setup required.
export https_proxy="your_http_proxy"
export http_proxy="your_https_proxy"

helm dependency update
helm install data-prep . -f ./variant_videoqna-values.yaml --set vdms-vector-db.enabled=true --set global.HUGGINGFACEHUB_API_TOKEN=${HFTOKEN} --set INDEX_NAME=${INDEX_NAME} --set global.modelUseHostPath=${MODELDIR} --set global.https_proxy=${https_proxy} --set global.http_proxy=${http_proxy}
```

## Verify

To verify the installation, run the command `kubectl get pod` to make sure all pods are running.
Expand All @@ -37,21 +87,40 @@ Then run the command `kubectl port-forward svc/data-prep 6007:6007` to expose th

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

```console
### 1. For Data-prep service using redis-vector-db:

```bash

curl http://localhost:6007/v1/dataprep \
-X POST \
-H "Content-Type: multipart/form-data" \
-F "files=@./README.md"
```

### 2. For multimodal data prep service using vdms-vector-db:

```bash
# 1) Download a sample video in current dir:
curl -svLO "https://github.com/opea-project/GenAIExamples/raw/refs/heads/main/VideoQnA/docker_compose/intel/cpu/xeon/data/op_1_0320241830.mp4"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it not be better for this sample video to live in some common VidoQnA directory versus in docker_compose/intel/cpu/xeon/data

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose requested change needs a PR in GenAIExamples rather than here.

# 2) Verify using above video
curl -X POST http://localhost:6007/v1/dataprep \
-H "Content-Type: multipart/form-data" \
-F "files=@./op_1_0320241830.mp4"
```

## Values

| Key | Type | Default | Description |
| ---------------------- | ------ | ----------------------- | ----------- |
| image.repository | string | `"opea/dataprep-redis"` | |
| service.port | string | `"6007"` | |
| REDIS_URL | string | `""` | |
| TEI_EMBEDDING_ENDPOINT | string | `""` | |
| Key | Type | Default | Description |
| -------------------------------- | ------ | --------------------------------- | ----------- |
| image.repository | string | `"opea/dataprep-redis"` | |
| service.port | string | `"6007"` | |
| REDIS_URL | string | `""` | |
| TEI_EMBEDDING_ENDPOINT | string | `""` | |
| videoqna-values:image.repository | string | `"opea/dataprep-multimodal-vdms"` | |
| videoqna-values:vdmsHost | string | `""` | |
| videoqna-values:vdmsPort | string | `"8001"` | |
| videoqna-values:INDEX_NAME | string | `"mega-videoqna"` | |

## Milvus support

Expand Down
21 changes: 21 additions & 0 deletions helm-charts/common/data-prep/ci-videoqna-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

vdms-vector-db:
enabled: true

image:
repository: opea/dataprep-multimodal-vdms
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "latest"

INDEX_NAME: "mega-videoqna"
vdmsHost: ""
vdmsPort: "8001"
entryCommand: ["/bin/sh"]
extraArgs: ["-c", "sleep 15 && python ingest_videos.py"]
yongfengdu marked this conversation as resolved.
Show resolved Hide resolved

# Set cacheUseHostPath to for caching encoding/embedding models and other related data
global:
cacheUseHostPath: ""
10 changes: 9 additions & 1 deletion helm-charts/common/data-prep/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ metadata:
labels:
{{- include "data-prep.labels" . | nindent 4 }}
data:
{{- if .Values.vdmsHost }}
VDMS_HOST: {{ .Values.vdmsHost | quote }}
{{- else }}
VDMS_HOST: "{{ .Release.Name }}-vdms-vector-db"
{{- end }}
{{- if .Values.vdmsPort }}
VDMS_PORT: {{ .Values.vdmsPort | quote }}
{{- end }}
{{- if .Values.MOSEC_EMBEDDING_ENDPOINT }}
MOSEC_EMBEDDING_ENDPOINT: {{ .Values.MOSEC_EMBEDDING_ENDPOINT | quote}}
MOSEC_EMBEDDING_MODEL: {{ .Values.MOSEC_EMBEDDING_MODEL | quote}}
Expand Down Expand Up @@ -47,7 +55,7 @@ data:
http_proxy: {{ .Values.global.http_proxy | quote }}
https_proxy: {{ .Values.global.https_proxy | quote }}
{{- if and (not .Values.REDIS_URL) (and (not .Values.TEI_EMBEDDING_ENDPOINT) (or .Values.global.http_proxy .Values.global.https_proxy)) }}
no_proxy: "{{ .Release.Name }}-tei,{{ .Release.Name }}-redis-vector-db,{{ .Values.global.no_proxy }}"
no_proxy: "{{ .Release.Name }}-tei,{{ .Release.Name }}-redis-vector-db,{{ .Release.Name }}-vdms-vector-db,{{ .Values.global.no_proxy }}"
{{- else }}
no_proxy: {{ .Values.global.no_proxy | quote }}
{{- end }}
Expand Down
29 changes: 28 additions & 1 deletion helm-charts/common/data-prep/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,28 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.entryCommand }}
command: {{ .Values.entryCommand }}
{{- end }}
{{- if .Values.extraArgs }}
args:
{{- range .Values.extraArgs }}
- {{ . | quote }}
{{- end }}
{{- end }}
ports:
- name: data-prep
containerPort: {{ .Values.port }}
containerPort: {{ .Values.service.containerPort }}
protocol: TCP
volumeMounts:
{{- if .Values.global.modelUseHostPath }}
- mountPath: /home/user/.cache/clip
yongfengdu marked this conversation as resolved.
Show resolved Hide resolved
name: model-volume
subPath: clip
- mountPath: /home/user/.cache/huggingface/hub
yongfengdu marked this conversation as resolved.
Show resolved Hide resolved
name: model-volume
subPath: huggingface/hub
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using model-volume, the subPath is not necessary.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, not necessary. But I suppose, as same volume is being re-used to mount different paths from different pod/containers, having a subPath helps to have a proper directory hierarchy inside model-volume and helps with what is coming from which container path instead of dumping everything in the root of model-volume.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The model-volume was used to save the models downloaded from huggingface hub, which is the HUGGINGFACE_HUB_CACHE here https://huggingface.co/docs/text-generation-inference/en/reference/launcher#huggingfacehubcache

{{- end }}
- mountPath: /tmp
name: tmp
{{- if .Values.livenessProbe }}
Expand All @@ -63,6 +80,16 @@ spec:
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
{{- if .Values.global.modelUseHostPath }}
- name: model-volume
hostPath:
path: {{ .Values.global.modelUseHostPath }}
type: Directory
{{- else if .Values.global.modelUsePVC }}
- name: model-volume
persistentVolumeClaim:
claimName: {{ .Values.global.modelUsePVC }}
{{- end }}
- name: tmp
emptyDir: {}
{{- with .Values.nodeSelector }}
Expand Down
2 changes: 1 addition & 1 deletion helm-charts/common/data-prep/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.port }}
targetPort: {{ .Values.service.containerPort }}
protocol: TCP
name: data-prep
selector:
Expand Down
16 changes: 16 additions & 0 deletions helm-charts/common/data-prep/templates/tests/test-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,21 @@ spec:
- name: curl
image: python:3.10.14
command: ['bash', '-c']
{{- if contains "dataprep-multimodal-vdms" .Values.image.repository }}
args:
- |
https_proxy={{ .Values.global.https_proxy }} curl -svLO "https://github.com/opea-project/GenAIExamples/raw/refs/heads/main/VideoQnA/docker_compose/intel/cpu/xeon/data/op_1_0320241830.mp4"
max_retry=5
for ((i=1; i<=max_retry; i++)); do
curl http://{{ include "data-prep.fullname" . }}:{{ .Values.service.port }}/v1/dataprep -sS --fail-with-body \
-X POST \
-H "Content-Type: multipart/form-data" \
-F "files=@./op_1_0320241830.mp4" && break;
curlcode=$?
if [[ $curlcode -eq 7 ]]; then sleep 10; else echo "curl failed with code $curlcode"; exit 1; fi;
done;
if [ $i -gt $max_retry ]; then echo "test failed with maximum retry"; exit 1; fi
{{- else }}
args:
- |
echo "test file" > /tmp/file1.txt;
Expand All @@ -32,4 +47,5 @@ spec:
-H "Content-Type: application/json" \
-d '{"file_path": "file1.txt"}';
if [ $i -gt $max_retry ]; then echo "test failed with maximum retry"; exit 1; fi
{{- end }}
restartPolicy: Never
3 changes: 3 additions & 0 deletions helm-charts/common/data-prep/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ milvus:
enabled: false
redis-vector-db:
enabled: false
vdms-vector-db:
enabled: false

replicaCount: 1

Expand Down Expand Up @@ -44,6 +46,7 @@ port: 6007
service:
type: ClusterIP
port: 6007
containerPort: 6007

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
Expand Down
19 changes: 19 additions & 0 deletions helm-charts/common/data-prep/variant_videoqna-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

image:
repository: opea/dataprep-multimodal-vdms
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "latest"

INDEX_NAME: "mega-videoqna"
vdmsHost: ""
vdmsPort: "8001"
entryCommand: ["/bin/sh"]
extraArgs: ["-c", "sleep 15 && python ingest_videos.py"]

# Set cacheUseHostPath to for caching encoding/embedding models and other related data
global:
modelUseHostPath: ""
modelUsePVC: ""
49 changes: 37 additions & 12 deletions helm-charts/common/embedding-usvc/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# embedding-usvc
# Embedding Microservice (embedding-usvc)

Helm chart for deploying embedding microservice.
**Helm chart for deploying Embedding Microservice.**

embedding-usvc depends on TEI, set TEI_EMBEDDING_ENDPOINT.
Embedding microservice is consumed by several reference applications present in [GenAIExample](https://github.com/opea-project/GenAIExamples/tree/main).

## (Option1): Installing the chart separately
There are 2 versions of embedding microservice. First version is unimodal based on TEI creating embeddings for textual data. An alternative version based on `vdms-values.yaml` file, uses multimodal embedding models for creating embedding for visual data. Follow along to select and install the version which suites your use case.

embedding-usvc depends on TEI, and TEI_EMBEDDING_ENDPOINT should be set properly. Multimodal version has no dependencies.

## Install Embedding microservice chart based on TEI

### (Option1): Installing the chart separately

First, you need to install the tei chart, please refer to the [tei](../tei) chart for more information.

Expand All @@ -19,14 +25,32 @@ helm dependency update
helm install embedding-usvc . --set TEI_EMBEDDING_ENDPOINT=${TEI_EMBEDDING_ENDPOINT}
```

## (Option2): Installing the chart with dependencies automatically
### (Option2): Installing the chart with dependencies automatically

```console
cd GenAIInfra/helm-charts/common/embedding-usvc
helm dependency update
helm install embedding-usvc . --set tei.enabled=true
```

## Install Multimodal Embedding Microservice chart

To install the multimodal embedding-usvc chart, run the following:

```bash
cd GenAIInfra/helm-charts/common/embedding-usvc

# Set a directory to cache emdedding models
export MODELDIR=/mnt/opea-models

# Export the proxy variables. Assign empty string if no proxy setup required.
export https_proxy="your_http_proxy"
export http_proxy="your_https_proxy"

helm dependency update
helm install embedding-usvc . -f ./variant_videoqna-values.yaml --set global.modelUseHostPath=${MODELDIR} --set global.https_proxy=${https_proxy} --set global.http_proxy=${http_proxy}
```

## Verify

To verify the installation, run the command `kubectl get pod` to make sure all pods are running.
Expand All @@ -35,7 +59,7 @@ Then run the command `kubectl port-forward svc/embedding-usvc 6000:6000` to expo

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

```console
```bash
curl http://localhost:6000/v1/embeddings \
-X POST \
-d '{"text":"hello"}' \
Expand All @@ -44,9 +68,10 @@ curl http://localhost:6000/v1/embeddings \

## Values

| Key | Type | Default | Description |
| ---------------------- | ------ | ---------------------- | ----------- |
| image.repository | string | `"opea/embedding-tei"` | |
| service.port | string | `"6000"` | |
| TEI_EMBEDDING_ENDPOINT | string | `""` | |
| global.monitoring | bop; | false | |
| Key | Type | Default | Description |
| ---------------------------- | ------ | ---------------------------------- | ----------- |
| image.repository | string | `"opea/embedding-tei"` | |
| service.port | string | `"6000"` | |
| TEI_EMBEDDING_ENDPOINT | string | `""` | |
| global.monitoring | bop; | `false` | |
| vdms-values:image.repository | string | `"opea/embedding-multimodal-clip"` | |
Loading
Loading