Skip to content

Commit 9efacee

Browse files
authored
helm: Add audioQnA e2e helm chart (#510)
Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
1 parent b077d44 commit 9efacee

File tree

12 files changed

+514
-0
lines changed

12 files changed

+514
-0
lines changed

helm-charts/audioqna/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

helm-charts/audioqna/Chart.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
apiVersion: v2
5+
name: audioqna
6+
description: The Helm chart to deploy AudioQnA
7+
type: application
8+
dependencies:
9+
- name: asr
10+
version: 1.0.0
11+
repository: "file://../common/asr"
12+
- name: whisper
13+
version: 1.0.0
14+
repository: "file://../common/whisper"
15+
- name: tts
16+
version: 1.0.0
17+
repository: "file://../common/tts"
18+
- name: speecht5
19+
version: 1.0.0
20+
repository: "file://../common/speecht5"
21+
- name: tgi
22+
version: 1.0.0
23+
repository: "file://../common/tgi"
24+
- name: llm-uservice
25+
version: 1.0.0
26+
repository: "file://../common/llm-uservice"
27+
# Uncomment the following to enable UI when the UI image is ready on DockerHub
28+
# - name: ui
29+
# version: 1.0.0
30+
# repository: "file://../common/ui"
31+
# alias: audioqna-ui
32+
version: 1.1.0
33+
appVersion: "1.1"

helm-charts/audioqna/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# AudioQnA
2+
3+
Helm chart for deploying AudioQnA service.
4+
5+
AudioQnA depends on the following micro services:
6+
7+
- [asr](../common/asr/README.md)
8+
- [whisper](../common/whisper/README.md)
9+
- [llm-uservice](../common/llm-uservice/README.md)
10+
- [tgi](../common/tgi/README.md)
11+
- [tts](../common/tts/README.md)
12+
- [speecht5](../common/speecht5/README.md)
13+
14+
## Installing the Chart
15+
16+
To install the chart, run the following:
17+
18+
```console
19+
cd GenAIInfra/helm-charts/
20+
./update_dependency.sh
21+
helm dependency update audioqna
22+
export HFTOKEN="insert-your-huggingface-token-here"
23+
export MODELDIR="/mnt/opea-models"
24+
export MODELNAME="Intel/neural-chat-7b-v3-3"
25+
# To run on Xeon
26+
helm install audioqna audioqna --set global.HUGGINGFACEHUB_API_TOKEN=${HFTOKEN} --set global.modelUseHostPath=${MODELDIR} --set tgi.LLM_MODEL_ID=${MODELNAME}
27+
# To run on Gaudi
28+
#helm install audioqna audioqna --set global.HUGGINGFACEHUB_API_TOKEN=${HFTOKEN} --set global.modelUseHostPath=${MODELDIR} --set tgi.LLM_MODEL_ID=${MODELNAME} -f audioqna/gaudi-values.yaml
29+
```
30+
31+
### IMPORTANT NOTE
32+
33+
1. Make sure your `MODELDIR` exists on the node where your workload is schedueled so you can cache the downloaded model for next time use. Otherwise, set `global.modelUseHostPath` to 'null' if you don't want to cache the model.
34+
35+
## Verify
36+
37+
To verify the installation, run the command `kubectl get pod` to make sure all pods are running.
38+
39+
Test the AudioQnA megaservice by recording a .wav file, encoding the file into the base64 format, and then sending the base64 string to the megaservice endpoint. The megaservice will return a spoken response as a base64 string. To listen to the response, decode the base64 string and save it as a .wav file.
40+
41+
### Verify the workload through curl command
42+
43+
Then run the command `kubectl port-forward svc/audioqna 3008:3008` to expose the service for access.
44+
45+
Open another terminal and run the following command to verify the service if working:
46+
47+
```console
48+
curl http://localhost:3008/v1/audioqna \
49+
-X POST \
50+
-d '{"audio": "UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA", "max_tokens":64}' \
51+
-H 'Content-Type: application/json' | sed 's/^"//;s/"$//' | base64 -d > output.wav
52+
```
53+
54+
## Values
55+
56+
| Key | Type | Default | Description |
57+
| ---------------- | ------ | --------------------------- | ------------------------------------------------------------------------ |
58+
| image.repository | string | `"opea/audioqna"` | |
59+
| service.port | string | `"3008"` | |
60+
| tgi.LLM_MODEL_ID | string | `Intel/neural-chat-7b-v3-3` | Models id from https://huggingface.co/, or predownloaded model directory |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gaudi-values.yaml

helm-charts/audioqna/ci-values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
values.yaml
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
tgi:
5+
accelDevice: "gaudi"
6+
image:
7+
repository: ghcr.io/huggingface/tgi-gaudi
8+
tag: "2.0.5"
9+
resources:
10+
limits:
11+
habana.ai/gaudi: 1
12+
MAX_INPUT_LENGTH: "1024"
13+
MAX_TOTAL_TOKENS: "2048"
14+
CUDA_GRAPHS: ""
15+
livenessProbe:
16+
initialDelaySeconds: 5
17+
periodSeconds: 5
18+
timeoutSeconds: 1
19+
readinessProbe:
20+
initialDelaySeconds: 5
21+
periodSeconds: 5
22+
timeoutSeconds: 1
23+
startupProbe:
24+
initialDelaySeconds: 5
25+
periodSeconds: 5
26+
timeoutSeconds: 1
27+
failureThreshold: 120
28+
29+
whisper:
30+
image:
31+
repository: opea/whisper-gaudi
32+
tag: "latest"
33+
resources:
34+
limits:
35+
habana.ai/gaudi: 1
36+
37+
speecht5:
38+
image:
39+
repository: opea/speecht5-gaudi
40+
tag: "latest"
41+
resources:
42+
limits:
43+
habana.ai/gaudi: 1
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "audioqna.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "audioqna.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "audioqna.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "audioqna.labels" -}}
37+
helm.sh/chart: {{ include "audioqna.chart" . }}
38+
{{ include "audioqna.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "audioqna.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "audioqna.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "audioqna.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "audioqna.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
apiVersion: apps/v1
5+
kind: Deployment
6+
metadata:
7+
name: {{ include "audioqna.fullname" . }}
8+
labels:
9+
{{- include "audioqna.labels" . | nindent 4 }}
10+
app: {{ include "audioqna.fullname" . }}
11+
spec:
12+
replicas: {{ .Values.replicaCount }}
13+
selector:
14+
matchLabels:
15+
{{- include "audioqna.selectorLabels" . | nindent 6 }}
16+
app: {{ include "audioqna.fullname" . }}
17+
template:
18+
metadata:
19+
{{- with .Values.podAnnotations }}
20+
annotations:
21+
{{- toYaml . | nindent 8 }}
22+
{{- end }}
23+
labels:
24+
{{- include "audioqna.selectorLabels" . | nindent 8 }}
25+
app: {{ include "audioqna.fullname" . }}
26+
spec:
27+
{{- with .Values.imagePullSecrets }}
28+
imagePullSecrets:
29+
{{- toYaml . | nindent 8 }}
30+
{{- end }}
31+
securityContext:
32+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
33+
containers:
34+
- name: {{ .Release.Name }}
35+
env:
36+
- name: LLM_SERVICE_HOST_IP
37+
value: {{ include "llm-uservice.fullname" (index .Subcharts "llm-uservice") }}
38+
- name: LLM_SERVICE_PORT
39+
value: {{ index .Values "llm-uservice" "service" "port" | quote }}
40+
- name: ASR_SERVICE_HOST_IP
41+
value: {{ include "asr.fullname" (index .Subcharts "asr") }}
42+
- name: ASR_SERVICE_PORT
43+
value: {{ index .Values "asr" "service" "port" | quote }}
44+
- name: TTS_SERVICE_HOST_IP
45+
value: {{ include "tts.fullname" (index .Subcharts "tts") }}
46+
- name: TTS_SERVICE_PORT
47+
value: {{ index .Values "tts" "service" "port" | quote }}
48+
securityContext:
49+
{{- toYaml .Values.securityContext | nindent 12 }}
50+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
51+
imagePullPolicy: {{ .Values.image.pullPolicy }}
52+
volumeMounts:
53+
- mountPath: /tmp
54+
name: tmp
55+
ports:
56+
- name: audioqna
57+
containerPort: {{ .Values.port }}
58+
protocol: TCP
59+
resources:
60+
{{- toYaml .Values.resources | nindent 12 }}
61+
volumes:
62+
- name: tmp
63+
emptyDir: {}
64+
{{- with .Values.nodeSelector }}
65+
nodeSelector:
66+
{{- toYaml . | nindent 8 }}
67+
{{- end }}
68+
{{- with .Values.affinity }}
69+
affinity:
70+
{{- toYaml . | nindent 8 }}
71+
{{- end }}
72+
{{- with .Values.tolerations }}
73+
tolerations:
74+
{{- toYaml . | nindent 8 }}
75+
{{- end }}
76+
{{- if .Values.evenly_distributed }}
77+
topologySpreadConstraints:
78+
- maxSkew: 1
79+
topologyKey: kubernetes.io/hostname
80+
whenUnsatisfiable: ScheduleAnyway
81+
labelSelector:
82+
matchLabels:
83+
{{- include "audioqna.selectorLabels" . | nindent 14 }}
84+
app: {{ include "audioqna.fullname" . }}
85+
{{- end }}

0 commit comments

Comments
 (0)