From 1c4a832afc9c2945c780bbdbcf03d53cd016a3e6 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Tue, 3 Dec 2024 12:59:04 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B[bugfix]=20Controller=20:=20compute?= =?UTF-8?q?=20device=E5=A4=89=E6=9B=B4=E6=99=82=E3=81=AB=E7=BF=BB=E8=A8=B3?= =?UTF-8?q?=E3=82=A8=E3=83=B3=E3=82=B8=E3=83=B3=E3=81=AEAI=E3=83=A2?= =?UTF-8?q?=E3=83=87=E3=83=AB=E3=82=92=E5=A4=89=E6=9B=B4=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-python/config.py | 2 +- src-python/webui_controller.py | 1 + src-python/webui_mainloop.py | 7 +++---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src-python/config.py b/src-python/config.py index 68c5a96a..e8b17bf9 100644 --- a/src-python/config.py +++ b/src-python/config.py @@ -924,7 +924,7 @@ class Config: self._SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_LIST = ctranslate2_weights.keys() self._SELECTABLE_WHISPER_WEIGHT_TYPE_LIST = whisper_models.keys() self._SELECTABLE_TRANSLATION_ENGINE_LIST = translation_lang.keys() - self._SELECTABLE_TRANSCRIPTION_ENGINE_LIST = translation_lang.keys() + self._SELECTABLE_TRANSCRIPTION_ENGINE_LIST = list(transcription_lang[list(transcription_lang.keys())[0]].values())[0].keys() self._SELECTABLE_UI_LANGUAGE_LIST = ["en", "ja", "ko", "zh-Hant", "zh-Hans"] self._COMPUTE_MODE = "cuda" if torch.cuda.is_available() else "cpu" self._SELECTABLE_COMPUTE_DEVICE_LIST = [] diff --git a/src-python/webui_controller.py b/src-python/webui_controller.py index 50b3b37d..fedade0d 100644 --- a/src-python/webui_controller.py +++ b/src-python/webui_controller.py @@ -418,6 +418,7 @@ class Controller: def setSelectedTranslationComputeDevice(device:str, *args, **kwargs) -> dict: printLog("setSelectedTranslationComputeDevice", device) config.SELECTED_TRANSLATION_COMPUTE_DEVICE = device + model.changeTranslatorCTranslate2Model() return {"status":200,"result":config.SELECTED_TRANSLATION_COMPUTE_DEVICE} @staticmethod diff --git a/src-python/webui_mainloop.py b/src-python/webui_mainloop.py index 7495fbce..e81e01e4 100644 --- a/src-python/webui_mainloop.py +++ b/src-python/webui_mainloop.py @@ -125,6 +125,9 @@ mapping = { "/get/data/translation_compute_device_list": {"status": True, "variable":controller.getComputeDeviceList}, "/get/data/selected_translation_compute_device": {"status": True, "variable":controller.getSelectedTranslationComputeDevice}, "/set/data/selected_translation_compute_device": {"status": True, "variable":controller.setSelectedTranslationComputeDevice}, + "/get/data/transcription_compute_device_list": {"status": True, "variable":controller.getComputeDeviceList}, + "/get/data/selected_transcription_compute_device": {"status": True, "variable":controller.getSelectedTranscriptionComputeDevice}, + "/set/data/selected_transcription_compute_device": {"status": True, "variable":controller.setSelectedTranscriptionComputeDevice}, # Translation "/get/data/selectable_ctranslate2_weight_type_dict": {"status": True, "variable":controller.getSelectableCtranslate2WeightTypeDict}, @@ -228,10 +231,6 @@ mapping = { "/set/enable/check_speaker_threshold": {"status": True, "variable":controller.setEnableCheckSpeakerThreshold}, "/set/disable/check_speaker_threshold": {"status": True, "variable":controller.setDisableCheckSpeakerThreshold}, - "/get/data/transcription_compute_device_list": {"status": True, "variable":controller.getComputeDeviceList}, - "/get/data/selected_transcription_compute_device": {"status": True, "variable":controller.getSelectedTranscriptionComputeDevice}, - "/set/data/selected_transcription_compute_device": {"status": True, "variable":controller.setSelectedTranscriptionComputeDevice}, - "/get/data/selectable_whisper_weight_type_dict": {"status": True, "variable":controller.getSelectableWhisperWeightTypeDict}, "/get/data/whisper_weight_type": {"status": True, "variable":controller.getWhisperWeightType}, "/set/data/whisper_weight_type": {"status": True, "variable":controller.setWhisperWeightType},