From 7aafce6e2e78187086db7602f9de3f48e270847b Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Sun, 4 Feb 2024 01:03:38 +0900 Subject: [PATCH] =?UTF-8?q?[WIP/TEST]=20distil-wisper=E3=81=AE=E5=87=A6?= =?UTF-8?q?=E7=90=86=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 3 +++ controller.py | 6 ++++++ locales/en.yml | 3 +++ main.py | 2 +- models/transcription/transcription_whisper.py | 3 +++ view.py | 17 ++++++++++------- 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/config.py b/config.py index 6ce32035..ff1f7263 100644 --- a/config.py +++ b/config.py @@ -812,6 +812,9 @@ class Config: "large-v1": "large-v1", "large-v2": "large-v2", "large-v3": "large-v3", + "distil-small": "distil-small", + "distil-medium": "distil-medium", + "distil-large-v2": "distil-large-v2", } self._MAX_MIC_ENERGY_THRESHOLD = 2000 diff --git a/controller.py b/controller.py index e63101b2..e5b747d4 100644 --- a/controller.py +++ b/controller.py @@ -925,6 +925,12 @@ def createMainWindow(splash): # set Translation Engine updateTranslationEngineAndEngineList() + # set Transcription Engine + if config.USE_WHISPER_FEATURE is True: + config.SELECTED_TRANSCRIPTION_ENGINE = "Whisper" + else: + config.SELECTED_TRANSCRIPTION_ENGINE = "Google" + # set word filter model.addKeywords() diff --git a/locales/en.yml b/locales/en.yml index f68aa32c..c799c9d0 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -140,6 +140,9 @@ config_window: large_v1: "large_v1 model (%{capacity})" large_v2: "large_v2 model (%{capacity})" large_v3: "large_v3 model (%{capacity})" + distil_small: "distil-small model (%{capacity})" + distil_medium: "distil-medium model (%{capacity})" + distil_large_v2: "distil-large-v2 model (%{capacity})" deepl_auth_key: label: DeepL Auth Key diff --git a/main.py b/main.py index 0df15326..6b6c0e3e 100644 --- a/main.py +++ b/main.py @@ -13,9 +13,9 @@ if __name__ == "__main__": downloadCTranslate2Weight(config.PATH_LOCAL, config.CTRANSLATE2_WEIGHT_TYPE, splash.updateDownloadProgress) from models.transcription.transcription_whisper import downloadWhisperWeight - # whisperのダウンロードの説明に変更する必要あり if config.USE_WHISPER_FEATURE is True: downloadWhisperWeight(config.PATH_LOCAL, config.WHISPER_WEIGHT_TYPE, splash.updateDownloadProgress) + splash.toProgress(0) import controller diff --git a/models/transcription/transcription_whisper.py b/models/transcription/transcription_whisper.py index c6412d35..148b2edb 100644 --- a/models/transcription/transcription_whisper.py +++ b/models/transcription/transcription_whisper.py @@ -15,6 +15,9 @@ _MODELS = { "large-v1": "Systran/faster-whisper-large-v1", "large-v2": "Systran/faster-whisper-large-v2", "large-v3": "Systran/faster-whisper-large-v3", + "distil-small": "Systran/faster-distil-whisper-small.en", + "distil-medium": "Systran/faster-distil-whisper-medium.en", + "distil-large-v2": "Systran/faster-distil-whisper-large-v2" } _FILENAMES = [ diff --git a/view.py b/view.py index 84ebd550..1efb3f22 100644 --- a/view.py +++ b/view.py @@ -947,13 +947,16 @@ class View(): @staticmethod def getSelectableWhisperWeightTypeDict(): return { - config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["tiny"]: i18n.t("config_window.whisper_weight_type.tiny", capacity="t"), - config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["base"]: i18n.t("config_window.whisper_weight_type.base", capacity="b"), - config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["small"]: i18n.t("config_window.whisper_weight_type.small", capacity="s"), - config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["medium"]: i18n.t("config_window.whisper_weight_type.medium", capacity="m"), - config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["large-v1"]: i18n.t("config_window.whisper_weight_type.large_v1", capacity="l_v1"), - config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["large-v2"]: i18n.t("config_window.whisper_weight_type.large_v2", capacity="l_v2"), - config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["large-v3"]: i18n.t("config_window.whisper_weight_type.large_v3", capacity="l_v3"), + config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["tiny"]: i18n.t("config_window.whisper_weight_type.tiny", capacity="74.5MB"), + config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["base"]: i18n.t("config_window.whisper_weight_type.base", capacity="141MB"), + config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["small"]: i18n.t("config_window.whisper_weight_type.small", capacity="463MB"), + config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["medium"]: i18n.t("config_window.whisper_weight_type.medium", capacity="1.42GB"), + config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["large-v1"]: i18n.t("config_window.whisper_weight_type.large_v1", capacity="2.87GB"), + config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["large-v2"]: i18n.t("config_window.whisper_weight_type.large_v2", capacity="2.87GB"), + config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["large-v3"]: i18n.t("config_window.whisper_weight_type.large_v3", capacity="2.87GB"), + config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["distil-small"]: i18n.t("config_window.whisper_weight_type.distil_small", capacity="319MB"), + config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["distil-medium"]: i18n.t("config_window.whisper_weight_type.distil_medium", capacity="755MB"), + config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT["distil-large-v2"]: i18n.t("config_window.whisper_weight_type.distil_large_v2", capacity="1.41GB"), } # Open Webpage Functions