From f33493d1a744ef9c3dc271d866d7853324d6d2fe Mon Sep 17 00:00:00 2001 From: Lianhao Lu Date: Wed, 8 Jan 2025 05:09:09 +0000 Subject: [PATCH] Adapt latest changes in asr/tts related components Adapt the latest changes in helm charts of the following components: - asr - whisper - tts - speecht5 - gpt-sovits Signed-off-by: Lianhao Lu --- helm-charts/common/asr/.helmignore | 2 ++ helm-charts/common/asr/README.md | 7 +++-- .../common/asr/templates/deployment.yaml | 2 +- .../common/asr/templates/tests/test-pod.yaml | 6 ++-- helm-charts/common/asr/values.yaml | 29 ++++++------------- helm-charts/common/gpt-sovits/.helmignore | 2 ++ .../gpt-sovits/templates/deployment.yaml | 6 +--- helm-charts/common/gpt-sovits/values.yaml | 20 +++---------- helm-charts/common/speecht5/.helmignore | 2 ++ .../common/speecht5/templates/deployment.yaml | 2 +- helm-charts/common/speecht5/values.yaml | 19 +++--------- helm-charts/common/tts/.helmignore | 2 ++ helm-charts/common/tts/README.md | 4 +-- .../common/tts/templates/deployment.yaml | 2 +- .../common/tts/templates/tests/test-pod.yaml | 7 +++-- helm-charts/common/tts/values.yaml | 26 +++++------------ helm-charts/common/whisper/.helmignore | 2 ++ .../common/whisper/templates/deployment.yaml | 2 +- helm-charts/common/whisper/values.yaml | 19 +++--------- 19 files changed, 57 insertions(+), 104 deletions(-) diff --git a/helm-charts/common/asr/.helmignore b/helm-charts/common/asr/.helmignore index 0e8a0eb36..d2c43a2ac 100644 --- a/helm-charts/common/asr/.helmignore +++ b/helm-charts/common/asr/.helmignore @@ -21,3 +21,5 @@ .idea/ *.tmproj .vscode/ +# CI values +ci*-values.yaml diff --git a/helm-charts/common/asr/README.md b/helm-charts/common/asr/README.md index a0c131936..3ccecd8d0 100644 --- a/helm-charts/common/asr/README.md +++ b/helm-charts/common/asr/README.md @@ -36,10 +36,11 @@ Then run the command `kubectl port-forward svc/asr 9099:9099` to expose the asr Open another terminal and run the following command to verify the service if working: ```console +wget https://github.com/intel/intel-extension-for-transformers/raw/main/intel_extension_for_transformers/neural_chat/assets/audio/sample.wav curl http://localhost:9099/v1/audio/transcriptions \ - -XPOST \ - -d '{"byte_str": "UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"}' \ - -H 'Content-Type: application/json' + -H "Content-Type: multipart/form-data" \ + -F file="@./sample.wav" \ + -F model="openai/whisper-small" ``` ## Values diff --git a/helm-charts/common/asr/templates/deployment.yaml b/helm-charts/common/asr/templates/deployment.yaml index 0f7f6edfa..e31bb6383 100644 --- a/helm-charts/common/asr/templates/deployment.yaml +++ b/helm-charts/common/asr/templates/deployment.yaml @@ -29,7 +29,7 @@ spec: securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - - name: {{ .Release.Name }} + - name: {{ .Chart.Name }} envFrom: - configMapRef: name: {{ include "asr.fullname" . }}-config diff --git a/helm-charts/common/asr/templates/tests/test-pod.yaml b/helm-charts/common/asr/templates/tests/test-pod.yaml index d71fbf9f7..ae506eda3 100644 --- a/helm-charts/common/asr/templates/tests/test-pod.yaml +++ b/helm-charts/common/asr/templates/tests/test-pod.yaml @@ -18,11 +18,11 @@ spec: args: - | max_retry=20; + wget https://github.com/intel/intel-extension-for-transformers/raw/main/intel_extension_for_transformers/neural_chat/assets/audio/sample.wav; for ((i=1; i<=max_retry; i++)); do curl -sS --fail-with-body http://{{ include "asr.fullname" . }}:{{ .Values.service.port }}/v1/audio/transcriptions \ - -XPOST \ - -d '{"byte_str": "UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"}' \ - -H 'Content-Type: application/json' && break; + -H "Content-Type: multipart/form-data" \ + -F file="@./sample.wav" && break; curlcode=$? if [[ $curlcode -eq 7 ]]; then sleep 10; else echo "curl failed with code $curlcode"; exit 1; fi; done; diff --git a/helm-charts/common/asr/values.yaml b/helm-charts/common/asr/values.yaml index b975a3c1f..f85691876 100644 --- a/helm-charts/common/asr/values.yaml +++ b/helm-charts/common/asr/values.yaml @@ -5,13 +5,9 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. -whisper: - enabled: false - replicaCount: 1 -# Set it as a non-null string, such as true, if you want to enable logging facility, -# otherwise, keep it as "" to disable it. +# Set it as a non-null string, such as true, if you want to enable logging facility. LOGFLAG: "" ASR_ENDPOINT: "" @@ -59,25 +55,14 @@ service: # The default port for asr service is 9099 port: 9099 -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. +resources: # limits: # cpu: 100m # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi + requests: + cpu: 100m + memory: 128Mi -livenessProbe: - httpGet: - path: v1/health_check - port: asr - initialDelaySeconds: 5 - periodSeconds: 5 - failureThreshold: 24 readinessProbe: httpGet: path: v1/health_check @@ -106,3 +91,7 @@ global: # If set, it will overwrite serviceAccount.name. # If set, and serviceAccount.create is false, it will assume this service account is already created by others. sharedSAName: "" + +# Only for CI tests +whisper: + enabled: false diff --git a/helm-charts/common/gpt-sovits/.helmignore b/helm-charts/common/gpt-sovits/.helmignore index 0e8a0eb36..d2c43a2ac 100644 --- a/helm-charts/common/gpt-sovits/.helmignore +++ b/helm-charts/common/gpt-sovits/.helmignore @@ -21,3 +21,5 @@ .idea/ *.tmproj .vscode/ +# CI values +ci*-values.yaml diff --git a/helm-charts/common/gpt-sovits/templates/deployment.yaml b/helm-charts/common/gpt-sovits/templates/deployment.yaml index 36da72b47..629719fce 100644 --- a/helm-charts/common/gpt-sovits/templates/deployment.yaml +++ b/helm-charts/common/gpt-sovits/templates/deployment.yaml @@ -29,7 +29,7 @@ spec: securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - - name: {{ .Release.Name }} + - name: {{ .Chart.Name }} envFrom: - configMapRef: name: {{ include "gpt-sovits.fullname" . }}-config @@ -39,11 +39,7 @@ spec: optional: true {{- end }} securityContext: - {{- if .Values.global.modelUseHostPath }} - {} - {{- else }} {{- toYaml .Values.securityContext | nindent 12 }} - {{- end }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" {{- if .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }} diff --git a/helm-charts/common/gpt-sovits/values.yaml b/helm-charts/common/gpt-sovits/values.yaml index 52fbf83cc..fb7689c41 100644 --- a/helm-charts/common/gpt-sovits/values.yaml +++ b/helm-charts/common/gpt-sovits/values.yaml @@ -36,7 +36,6 @@ podSecurityContext: {} securityContext: allowPrivilegeEscalation: false - readOnlyRootFilesystem: true runAsNonRoot: true runAsUser: 1000 capabilities: @@ -49,25 +48,14 @@ service: type: ClusterIP port: 9880 -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. +resources: # limits: # cpu: 100m # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi + requests: + cpu: 100m + memory: 128Mi -livenessProbe: - tcpSocket: - port: gpt-sovits - initialDelaySeconds: 5 - periodSeconds: 5 - timeoutSeconds: 4 - failureThreshold: 24 readinessProbe: tcpSocket: port: gpt-sovits diff --git a/helm-charts/common/speecht5/.helmignore b/helm-charts/common/speecht5/.helmignore index 0e8a0eb36..d2c43a2ac 100644 --- a/helm-charts/common/speecht5/.helmignore +++ b/helm-charts/common/speecht5/.helmignore @@ -21,3 +21,5 @@ .idea/ *.tmproj .vscode/ +# CI values +ci*-values.yaml diff --git a/helm-charts/common/speecht5/templates/deployment.yaml b/helm-charts/common/speecht5/templates/deployment.yaml index 1a926000a..e0f77118d 100644 --- a/helm-charts/common/speecht5/templates/deployment.yaml +++ b/helm-charts/common/speecht5/templates/deployment.yaml @@ -71,7 +71,7 @@ spec: name: tmp {{- end }} containers: - - name: {{ .Release.Name }} + - name: {{ .Chart.Name }} envFrom: - configMapRef: name: {{ include "speecht5.fullname" . }}-config diff --git a/helm-charts/common/speecht5/values.yaml b/helm-charts/common/speecht5/values.yaml index 386b385a9..46861ca64 100644 --- a/helm-charts/common/speecht5/values.yaml +++ b/helm-charts/common/speecht5/values.yaml @@ -56,25 +56,14 @@ service: # The default port for speecht5 service is 7055 port: 7055 -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. +resources: # limits: # cpu: 100m # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi + requests: + cpu: 100m + memory: 128Mi -livenessProbe: - httpGet: - path: /health - port: speecht5 - initialDelaySeconds: 5 - periodSeconds: 5 - failureThreshold: 24 readinessProbe: httpGet: path: /health diff --git a/helm-charts/common/tts/.helmignore b/helm-charts/common/tts/.helmignore index 0e8a0eb36..d2c43a2ac 100644 --- a/helm-charts/common/tts/.helmignore +++ b/helm-charts/common/tts/.helmignore @@ -21,3 +21,5 @@ .idea/ *.tmproj .vscode/ +# CI values +ci*-values.yaml diff --git a/helm-charts/common/tts/README.md b/helm-charts/common/tts/README.md index 24f3c6cfd..d9ff9bd81 100644 --- a/helm-charts/common/tts/README.md +++ b/helm-charts/common/tts/README.md @@ -38,8 +38,8 @@ Open another terminal and run the following command to verify the service if wor ```console curl http://localhost:9088/v1/audio/speech \ -XPOST \ - -d '{"text": "Who are you?"}' \ - -H 'Content-Type: application/json' + -d '{"input":"Who are you?", "voice": "male"}' \ + -H 'Content-Type: application/json' --output speech.wav ``` ## Values diff --git a/helm-charts/common/tts/templates/deployment.yaml b/helm-charts/common/tts/templates/deployment.yaml index b00631955..9a8828422 100644 --- a/helm-charts/common/tts/templates/deployment.yaml +++ b/helm-charts/common/tts/templates/deployment.yaml @@ -29,7 +29,7 @@ spec: securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - - name: {{ .Release.Name }} + - name: {{ .Chart.Name }} envFrom: - configMapRef: name: {{ include "tts.fullname" . }}-config diff --git a/helm-charts/common/tts/templates/tests/test-pod.yaml b/helm-charts/common/tts/templates/tests/test-pod.yaml index 26fcbcca3..b69b91900 100644 --- a/helm-charts/common/tts/templates/tests/test-pod.yaml +++ b/helm-charts/common/tts/templates/tests/test-pod.yaml @@ -21,10 +21,11 @@ spec: for ((i=1; i<=max_retry; i++)); do curl -sS --fail-with-body http://{{ include "tts.fullname" . }}:{{ .Values.service.port }}/v1/audio/speech \ -XPOST \ - -d '{"text": "Who are you?"}' \ - -H 'Content-Type: application/json' && break; + -d '{"input":"Who are you?", "voice": "male"}' \ + -H 'Content-Type: application/json' --output speech.wav && 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 + if [ $i -gt $max_retry ]; then echo "test failed with maximum retry"; exit 1; fi; + file speech.wav restartPolicy: Never diff --git a/helm-charts/common/tts/values.yaml b/helm-charts/common/tts/values.yaml index ca465dfcb..752627540 100644 --- a/helm-charts/common/tts/values.yaml +++ b/helm-charts/common/tts/values.yaml @@ -5,9 +5,6 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. -speecht5: - enabled: false - replicaCount: 1 # Set it as a non-null string, such as true, if you want to enable logging facility, @@ -59,25 +56,14 @@ service: # The default port for tts service is 9088 port: 9088 -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. +resources: # limits: # cpu: 100m # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi + requests: + cpu: 100m + memory: 128Mi -livenessProbe: - httpGet: - path: v1/health_check - port: tts - initialDelaySeconds: 5 - periodSeconds: 5 - failureThreshold: 24 readinessProbe: httpGet: path: v1/health_check @@ -106,3 +92,7 @@ global: # If set, it will overwrite serviceAccount.name. # If set, and serviceAccount.create is false, it will assume this service account is already created by others. sharedSAName: "" + +# For CI tests only +speecht5: + enabled: false diff --git a/helm-charts/common/whisper/.helmignore b/helm-charts/common/whisper/.helmignore index 0e8a0eb36..d2c43a2ac 100644 --- a/helm-charts/common/whisper/.helmignore +++ b/helm-charts/common/whisper/.helmignore @@ -21,3 +21,5 @@ .idea/ *.tmproj .vscode/ +# CI values +ci*-values.yaml diff --git a/helm-charts/common/whisper/templates/deployment.yaml b/helm-charts/common/whisper/templates/deployment.yaml index 2b965f395..f8dafbb27 100644 --- a/helm-charts/common/whisper/templates/deployment.yaml +++ b/helm-charts/common/whisper/templates/deployment.yaml @@ -69,7 +69,7 @@ spec: name: tmp {{- end }} containers: - - name: {{ .Release.Name }} + - name: {{ .Chart.Name }} envFrom: - configMapRef: name: {{ include "whisper.fullname" . }}-config diff --git a/helm-charts/common/whisper/values.yaml b/helm-charts/common/whisper/values.yaml index 5e3cf92b2..b1f3e247b 100644 --- a/helm-charts/common/whisper/values.yaml +++ b/helm-charts/common/whisper/values.yaml @@ -55,25 +55,14 @@ service: # The default port for whisper service is 7066 port: 7066 -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. +resources: # limits: # cpu: 100m # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi + requests: + cpu: 100m + memory: 128Mi -livenessProbe: - httpGet: - path: /health - port: whisper - initialDelaySeconds: 5 - periodSeconds: 5 - failureThreshold: 24 readinessProbe: httpGet: path: /health