From 4c70a569e48903901849f1b49aef14de5d4b930c Mon Sep 17 00:00:00 2001 From: Aleksandr Oleinikov <10602045+tannisroot@users.noreply.github.com> Date: Sun, 14 Apr 2024 03:18:55 +0300 Subject: [PATCH] feat(wyoming-whisper): Update whisper config (#20623) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** This updates the chart to match config options modified upstream in https://github.com/home-assistant/addons/pull/3507 **โš™๏ธ Type of change** - [x] โš™๏ธ Feature/App addition - [ ] ๐Ÿช› Bugfix - [ ] โš ๏ธ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] ๐Ÿ”ƒ Refactor of current code **๐Ÿงช How Has This Been Tested?** Tests in my own repo for this particular chart were succesful. **๐Ÿ“ƒ Notes:** **โœ”๏ธ Checklist:** - [x] โš–๏ธ My code follows the style guidelines of this project - [x] ๐Ÿ‘€ I have performed a self-review of my own code - [ ] #๏ธโƒฃ I have commented my code, particularly in hard-to-understand areas - [ ] ๐Ÿ“„ I have made corresponding changes to the documentation - [x] โš ๏ธ My changes generate no new warnings - [ ] ๐Ÿงช I have added tests to this description that prove my fix is effective or that my feature works - [x] โฌ†๏ธ I increased versions for any altered app according to semantic versioning - [x] I made sure the title starts with `feat(chart-name):`, `fix(chart-name):` or `chore(chart-name):` **โž• App addition** If this PR is an app addition please make sure you have done the following. - [ ] ๐Ÿ–ผ๏ธ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --------- Signed-off-by: Aleksandr Oleinikov <10602045+tannisroot@users.noreply.github.com> Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> --- charts/stable/wyoming-whisper/Chart.yaml | 2 +- charts/stable/wyoming-whisper/questions.yaml | 65 +++++++++++++++---- .../wyoming-whisper/templates/_args.tpl | 12 ++++ .../wyoming-whisper/templates/common.yaml | 9 ++- charts/stable/wyoming-whisper/values.yaml | 28 ++++---- 5 files changed, 88 insertions(+), 28 deletions(-) create mode 100644 charts/stable/wyoming-whisper/templates/_args.tpl diff --git a/charts/stable/wyoming-whisper/Chart.yaml b/charts/stable/wyoming-whisper/Chart.yaml index 7cc1ede19e7..e806efcfff0 100644 --- a/charts/stable/wyoming-whisper/Chart.yaml +++ b/charts/stable/wyoming-whisper/Chart.yaml @@ -33,4 +33,4 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/stable/wyoming-whisper - https://hub.docker.com/r/rhasspy/wyoming-whisper type: application -version: 5.1.4 +version: 5.2.0 diff --git a/charts/stable/wyoming-whisper/questions.yaml b/charts/stable/wyoming-whisper/questions.yaml index 2e09bd404be..6a2a441ccd9 100644 --- a/charts/stable/wyoming-whisper/questions.yaml +++ b/charts/stable/wyoming-whisper/questions.yaml @@ -222,6 +222,8 @@ questions: description: yi - value: yo description: yo + - value: yue + description: yue - value: zh description: zh - variable: model @@ -232,20 +234,53 @@ questions: required: true default: tiny-int8 enum: - - value: base - description: base - - value: base-int8 - description: base-int8 - - value: medium-int8 - description: medium-int8 - - value: small - description: small - - value: small-int8 - description: small-int8 - - value: tiny - description: tiny + - value: custom + description: custom - value: tiny-int8 description: tiny-int8 + - value: tiny + description: tiny + - value: tiny.en + description: tiny.en + - value: base-int8 + description: base-int8 + - value: base + description: base + - value: base.en + description: base.en + - value: small-int8 + description: small-int8 + - value: distil-small.en + description: distil-small.en + - value: small + description: small + - value: small.en + description: small.en + - value: medium-int8 + description: medium-int8 + - value: distil-medium.en + description: distil-medium.en + - value: medium + description: medium + - value: medium.en + description: medium.en + - value: large + description: large + - value: large-v1 + description: large-v1 + - value: distil-large-v2 + description: distil-large-v2 + - value: large-v2 + description: large-v2 + - value: large-v3 + description: large-v3 + - variable: custom_model + label: Custom Model + description: 'Path to a converted model directory, or a CTranslate2-converted Whisper model ID from the HuggingFace Hub like "Systran/faster-distil-whisper-small.en".' + schema: + type: string + default: "" + show_if: [[model, "=", "custom"]] - variable: beam_size label: Beam Size description: Number of candidates to consider simultaneously during transcription. @@ -253,6 +288,12 @@ questions: type: int required: true default: 1 + - variable: initial_prompt + label: Initial prompt + description: Description of audio that can help Whisper transcribe unusual words better. + schema: + type: string + default: "" # Include{containerConfig} # Include{serviceRoot} # Include{serviceMain} diff --git a/charts/stable/wyoming-whisper/templates/_args.tpl b/charts/stable/wyoming-whisper/templates/_args.tpl new file mode 100644 index 00000000000..6ee566c06e8 --- /dev/null +++ b/charts/stable/wyoming-whisper/templates/_args.tpl @@ -0,0 +1,12 @@ +{{- define "wyoming-whisper.args" -}} +{{- $whisper := .Values.wyoming_whisper -}} +args: + - --language + - {{ $whisper.language | quote }} + - --model + - {{ ternary $whisper.custom_model $whisper.model (eq $whisper.model "custom") | quote }} + - --beam-size + - {{ $whisper.beam_size | quote }} + - --initial-prompt + - {{ $whisper.initial_prompt | quote }} +{{- end -}} diff --git a/charts/stable/wyoming-whisper/templates/common.yaml b/charts/stable/wyoming-whisper/templates/common.yaml index b51394e00a4..00100b04da2 100644 --- a/charts/stable/wyoming-whisper/templates/common.yaml +++ b/charts/stable/wyoming-whisper/templates/common.yaml @@ -1 +1,8 @@ -{{ include "tc.v1.common.loader.all" . }} +{{/* Make sure all variables are set properly */}} +{{- include "tc.v1.common.loader.init" . }} + +{{- $newArgs := (include "wyoming-whisper.args" . | fromYaml) }} +{{- $_ := set .Values.workload.main.podSpec.containers.main "args" $newArgs.args -}} + +{{/* Render the templates */}} +{{ include "tc.v1.common.loader.apply" . }} diff --git a/charts/stable/wyoming-whisper/values.yaml b/charts/stable/wyoming-whisper/values.yaml index 671dfd67658..5d2b992d817 100644 --- a/charts/stable/wyoming-whisper/values.yaml +++ b/charts/stable/wyoming-whisper/values.yaml @@ -2,10 +2,22 @@ image: repository: rhasspy/wyoming-whisper pullPolicy: IfNotPresent tag: 2.1.0@sha256:ceaa162ec05e53b8fa883182cdbceb72e6a1422740ec35be038c9faa278323b3 + +service: + main: + ports: + main: + port: 10300 + protocol: tcp + targetPort: 10300 + wyoming_whisper: language: en model: tiny-int8 +# custom_model: "" beam_size: 1 + initial_prompt: "" + workload: main: podSpec: @@ -21,20 +33,7 @@ workload: startup: port: 10300 type: tcp - args: - - --language - - "{{ .Values.wyoming_whisper.language }}" - - --model - - "{{ .Values.wyoming_whisper.model }}" - - --beam-size - - "{{ .Values.wyoming_whisper.beam_size }}" -service: - main: - ports: - main: - port: 10300 - protocol: tcp - targetPort: 10300 + persistence: config: enabled: true @@ -42,6 +41,7 @@ persistence: cache: enabled: true mountPath: /.cache/huggingface/hub + portal: open: enabled: false