Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 29 additions & 0 deletions helm-charts/common/speecht5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,35 @@ export MODELDIR=/mnt/opea-models
helm install speecht5 speecht5 --set global.modelUseHostPath=${MODELDIR}
```

### Install the microservice in air gapped (offline) mode

To run `speecht5` microservice in an air gapped environment, users are required to pre-download the models `microsoft/speecht5_tts` and `microsoft/speecht5_hifigan` to a shared storage.

Below is an example for using node level local directory to download the model data:

Assuming the model data is shared using node-local directory `/mnt/opea-models`.

```
# On every K8s node, run the following command:
export MODEL_DIR=/mnt/opea-models
# Download model, assumes Python huggingface_hub[cli] module is already installed
huggingface-cli download --cache-dir "${MODEL_DIR}" microsoft/speecht5_tts
huggingface-cli download --cache-dir "${MODEL_DIR}" microsoft/speecht5_hifigan
# On K8s master node, run the following command:
# Install using Helm with the following additional parameters:
helm install ... ... --set global.offline=true,global.modelUseHostPath=${MODEL_DIR}
```

Assuming we share the offline data on cluster level using a persistent volume (PV), first we need to create the persistent volume claim (PVC) with name `opea-model-pvc` to store the model data.

```
# Download model openai/whisper-small at the root directory of the corresponding PV
# ... ...
# Install using Helm with the following additional parameters:
# export MODEL_PVC=opea-model-pvc
# helm install ... ... --set global.offline=true,global.modelUsePVC=${MODEL_PVC}
```

## Verify

Use port-forward to access it from localhost.
Expand Down
5 changes: 4 additions & 1 deletion helm-charts/common/speecht5/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ data:
HF_ENDPOINT: {{ .Values.global.HF_ENDPOINT | quote}}
{{- end }}
HUGGINGFACE_HUB_CACHE: "/data"
HF_TOKEN: {{ .Values.global.HUGGINGFACEHUB_API_TOKEN | default .Values.global.HF_TOKEN | quote }}
HF_TOKEN: {{ .Values.global.HUGGINGFACEHUB_API_TOKEN | quote}}
{{- if .Values.global.offline }}
HF_HUB_OFFLINE: "1"
{{- end }}
6 changes: 4 additions & 2 deletions helm-charts/common/speecht5/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
serviceAccountName: {{ include "speecht5.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if not (hasPrefix "/data/" .Values.TTS_MODEL_PATH) }}
{{- if and (not .Values.global.offline) (not (hasPrefix "/data/" .Values.TTS_MODEL_PATH)) }}
initContainers:
- name: model-downloader
envFrom:
Expand Down Expand Up @@ -118,8 +118,10 @@ spec:
hostPath:
path: {{ .Values.global.modelUseHostPath }}
type: Directory
{{- else }}
{{- else if not .Values.global.offline }}
emptyDir: {}
{{- else }}
{{- fail "'global.modelUsePVC' or 'global.modelUseHostPath' must be set in offline mode" }}
{{- end }}
- name: tmp
emptyDir: {}
Expand Down
3 changes: 3 additions & 0 deletions helm-charts/common/speecht5/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ global:
# If set, and serviceAccount.create is false, it will assume this service account is already created by others.
sharedSAName: ""

# Running microservice in air gapped (offline) mode
# If offline is enabled, user must set either modelUseHostPath or modelUsePVC and download models `microsoft/speecht5_tts` and `microsoft/speecht5_hifigan`.
offline: false
# Choose where to save your downloaded models
# Set modelUseHostPath for local directory, this is good for one node test. Example:
# modelUseHostPath: /mnt/opea-models
Expand Down
Loading