Merge branch 'bugfix_compute_type' into develop

This commit is contained in:
Sakamoto Shiina
2025-09-28 02:10:23 +09:00
24 changed files with 861 additions and 192 deletions

View File

@@ -73,8 +73,17 @@ update_modal:
is_current_compute_device: "The version currently in use" is_current_compute_device: "The version currently in use"
config_page: config_page:
version: "Version {{version}}" common:
model_download_button_label: "Download" version: "Version {{version}}"
model_download_button_label: "Download"
compute_device:
desc: "The accuracy and speed of each processing type may vary depending on your machine specs, and the compatibility with calculation methods may differ from the displayed order. Please use this as a general guideline."
label_device: "Processing Device"
label_type: "Processing Type"
type_template_auto: "Automatic"
type_template_low: "{{type_name}} (Lower accuracy, faster processing)"
type_template_high: "{{type_name}} (Higher accuracy, slower processing)"
side_menu_labels: side_menu_labels:
device: "Device" device: "Device"
appearance: "Appearance" appearance: "Appearance"
@@ -133,8 +142,8 @@ config_page:
desc: "You can choose the translation model when using the {{ctranslate2}} translation engine." desc: "You can choose the translation model when using the {{ctranslate2}} translation engine."
small: "Basic Model ({{capacity}})" small: "Basic Model ({{capacity}})"
large: "High Accuracy Model ({{capacity}})" large: "High Accuracy Model ({{capacity}})"
ctranslate2_compute_device: translation_compute_device:
label: "Processing device for AI translation {{ctranslate2}}" label: "Processing device for AI translation"
deepl_auth_key: deepl_auth_key:
label: "DeepL Auth Key" label: "DeepL Auth Key"
desc: "When using it, please change {{translator}} on the main screen to DeepL_API. ※Some languages may not be supported." desc: "When using it, please change {{translator}} on the main screen to DeepL_API. ※Some languages may not be supported."
@@ -177,8 +186,8 @@ config_page:
desc: "Larger models have higher accuracy, but they also consume more CPU or GPU resources.\nEspecially for models larger than medium, it may be difficult or even impossible to use them depending on the performance of your CPU/GPU." desc: "Larger models have higher accuracy, but they also consume more CPU or GPU resources.\nEspecially for models larger than medium, it may be difficult or even impossible to use them depending on the performance of your CPU/GPU."
model_template: "{{model_name}} model ({{capacity}})" model_template: "{{model_name}} model ({{capacity}})"
recommended_model_template: "{{model_name}} model ({{capacity}}) (Recommended)" recommended_model_template: "{{model_name}} model ({{capacity}}) (Recommended)"
whisper_compute_device: transcription_compute_device:
label: "Processing Device Used For Whisper" label: "Processing Device Used For AI transcription"
vr: vr:
single_line: "Single line" single_line: "Single line"

View File

@@ -73,8 +73,17 @@ update_modal:
is_current_compute_device: "現在使用中のバージョン" is_current_compute_device: "現在使用中のバージョン"
config_page: config_page:
version: "バージョン {{version}}" common:
model_download_button_label: "ダウンロード" version: "バージョン {{version}}"
model_download_button_label: "ダウンロード"
compute_device:
desc: "各処理タイプの精度・速度は、マシンスペックによって計算方法に相性があり、表示順とは異なる事があるため、大まかな目安としてください。"
label_device: "処理デバイス"
label_type: "処理タイプ"
type_template_auto: "自動"
type_template_low: "{{type_name}} (精度が悪く、処理は早い)"
type_template_high: "{{type_name}} (精度が良く、処理は遅い)"
side_menu_labels: side_menu_labels:
device: "デバイス" device: "デバイス"
appearance: "デザイン" appearance: "デザイン"
@@ -133,8 +142,8 @@ config_page:
desc: "翻訳エンジン「{{ctranslate2}}」で翻訳する際に、使用する翻訳モデルを選択できます。" desc: "翻訳エンジン「{{ctranslate2}}」で翻訳する際に、使用する翻訳モデルを選択できます。"
small: "通常モデル {{capacity}}" small: "通常モデル {{capacity}}"
large: "高精度モデル {{capacity}}" large: "高精度モデル {{capacity}}"
ctranslate2_compute_device: translation_compute_device:
label: "AI翻訳 {{ctranslate2}} の処理デバイス" label: "AI翻訳の処理デバイス"
deepl_auth_key: deepl_auth_key:
label: "DeepL APIキーの登録" label: "DeepL APIキーの登録"
desc: "使用の際は、メイン画面にある {{translator}} をDeepL_APIに変更してください。\n※対応していない言語もあります。" desc: "使用の際は、メイン画面にある {{translator}} をDeepL_APIに変更してください。\n※対応していない言語もあります。"
@@ -177,8 +186,8 @@ config_page:
desc: "容量が大きいモデルほど精度は高いですが、その分CPUやGPUを占有します。\n※特にmediumより容量の大きいモデルは、CPU/GPUの性能によっては使用すらも困難です。" desc: "容量が大きいモデルほど精度は高いですが、その分CPUやGPUを占有します。\n※特にmediumより容量の大きいモデルは、CPU/GPUの性能によっては使用すらも困難です。"
model_template: "{{model_name}} モデル {{capacity}}" model_template: "{{model_name}} モデル {{capacity}}"
recommended_model_template: "{{model_name}} モデル {{capacity}} [推奨]" recommended_model_template: "{{model_name}} モデル {{capacity}} [推奨]"
whisper_compute_device: transcription_compute_device:
label: "Whisperで使用する処理デバイス" label: "AI音声認識で使用する処理デバイス"
vr: vr:
single_line: "一行" single_line: "一行"

View File

@@ -73,8 +73,17 @@ update_modal:
is_current_compute_device: "현재 사용 중인 버전" is_current_compute_device: "현재 사용 중인 버전"
config_page: config_page:
version: "버전 {{version}}" common:
model_download_button_label: "다운로드" version: "버전 {{version}}"
model_download_button_label: "다운로드"
compute_device:
desc:
label_device:
label_type:
type_template_auto:
type_template_low:
type_template_high:
side_menu_labels: side_menu_labels:
device: "장치" device: "장치"
appearance: "모양" appearance: "모양"
@@ -133,8 +142,8 @@ config_page:
desc: "오프라인 번역 시의 번역 모델을 변경합니다." desc: "오프라인 번역 시의 번역 모델을 변경합니다."
small: "일반 모델 ({{capacity}})" small: "일반 모델 ({{capacity}})"
large: "정밀 모델 ({{capacity}})" large: "정밀 모델 ({{capacity}})"
ctranslate2_compute_device: translation_compute_device:
label: "AI 번역 {{ctranslate2}} 처리 장치" label: "AI 번역 처리 장치"
deepl_auth_key: deepl_auth_key:
label: "DeepL 인증키" label: "DeepL 인증키"
desc: "사용시 메인화면에 있는 {{translator}}를 DeepL_API로 변경해 주세요.\n지원하지 않는 언어도 있습니다." desc: "사용시 메인화면에 있는 {{translator}}를 DeepL_API로 변경해 주세요.\n지원하지 않는 언어도 있습니다."
@@ -177,8 +186,8 @@ config_page:
desc: "용량이 큰 모델일수록 정확도는 높지만, 그만큼 CPU나 GPU를 많이 차지합니다. * 특히 medium보다 용량이 큰 모델은 CPU/GPU 성능에 따라 사용 자체가 어려울 수 있습니다." desc: "용량이 큰 모델일수록 정확도는 높지만, 그만큼 CPU나 GPU를 많이 차지합니다. * 특히 medium보다 용량이 큰 모델은 CPU/GPU 성능에 따라 사용 자체가 어려울 수 있습니다."
model_template: "{{model_name}} 모델 ({{capacity}})" model_template: "{{model_name}} 모델 ({{capacity}})"
recommended_model_template: "{{model_name}} 모델 ({{capacity}}) (권장)" recommended_model_template: "{{model_name}} 모델 ({{capacity}}) (권장)"
whisper_compute_device: transcription_compute_device:
label: "Whisper에서 사용할 처리 장치" label:
vr: vr:
single_line: "한 줄" single_line: "한 줄"

View File

@@ -73,8 +73,17 @@ update_modal:
is_current_compute_device: is_current_compute_device:
config_page: config_page:
version: "版本 {{version}}" common:
model_download_button_label: version: "版本 {{version}}"
model_download_button_label:
compute_device:
desc:
label_device:
label_type:
type_template_auto:
type_template_low:
type_template_high:
side_menu_labels: side_menu_labels:
device: device:
appearance: "外观" appearance: "外观"
@@ -133,7 +142,7 @@ config_page:
desc: "可以选择用于离线翻译的翻译模型" desc: "可以选择用于离线翻译的翻译模型"
small: "普通模型 ({{capacity}})" small: "普通模型 ({{capacity}})"
large: "高精度模型 ({{capacity}})" large: "高精度模型 ({{capacity}})"
ctranslate2_compute_device: translation_compute_device:
label: label:
deepl_auth_key: deepl_auth_key:
label: "DeepL 授权密匙" label: "DeepL 授权密匙"
@@ -177,7 +186,7 @@ config_page:
desc: desc:
model_template: "{{model_name}} 模型 ({{capacity}})" model_template: "{{model_name}} 模型 ({{capacity}})"
recommended_model_template: "{{model_name}} 模型 ({{capacity}}) (推荐)" recommended_model_template: "{{model_name}} 模型 ({{capacity}}) (推荐)"
whisper_compute_device: transcription_compute_device:
label: label:
vr: vr:

View File

@@ -73,8 +73,17 @@ update_modal:
is_current_compute_device: is_current_compute_device:
config_page: config_page:
version: "版本 {{version}}" common:
model_download_button_label: version: "版本 {{version}}"
model_download_button_label:
compute_device:
desc:
label_device:
label_type:
type_template_auto:
type_template_low:
type_template_high:
side_menu_labels: side_menu_labels:
device: device:
appearance: "外觀" appearance: "外觀"
@@ -133,7 +142,7 @@ config_page:
desc: "你可以選擇用於離線翻譯引擎的翻譯模型。" desc: "你可以選擇用於離線翻譯引擎的翻譯模型。"
small: "基本模型({{capacity}}" small: "基本模型({{capacity}}"
large: "高準確率模型({{capacity}}" large: "高準確率模型({{capacity}}"
ctranslate2_compute_device: translation_compute_device:
label: label:
deepl_auth_key: deepl_auth_key:
label: "DeepL 授權金鑰" label: "DeepL 授權金鑰"
@@ -177,7 +186,7 @@ config_page:
desc: desc:
model_template: "{{model_name}}模型({{capacity}}" model_template: "{{model_name}}模型({{capacity}}"
recommended_model_template: "{{model_name}}模型({{capacity}})(推薦)" recommended_model_template: "{{model_name}}模型({{capacity}})(推薦)"
whisper_compute_device: transcription_compute_device:
label: label:
vr: vr:

View File

@@ -11,7 +11,7 @@ from models.translation.translation_languages import translation_lang
from models.translation.translation_utils import ctranslate2_weights from models.translation.translation_utils import ctranslate2_weights
from models.transcription.transcription_languages import transcription_lang from models.transcription.transcription_languages import transcription_lang
from models.transcription.transcription_whisper import _MODELS as whisper_models from models.transcription.transcription_whisper import _MODELS as whisper_models
from utils import errorLogging, validateDictStructure from utils import errorLogging, validateDictStructure, getComputeDeviceList
json_serializable_vars = {} json_serializable_vars = {}
def json_serializable(var_name): def json_serializable(var_name):
@@ -818,6 +818,18 @@ class Config:
self._CTRANSLATE2_WEIGHT_TYPE = value self._CTRANSLATE2_WEIGHT_TYPE = value
self.saveConfig(inspect.currentframe().f_code.co_name, value) self.saveConfig(inspect.currentframe().f_code.co_name, value)
@property
@json_serializable('SELECTED_TRANSLATION_COMPUTE_TYPE')
def SELECTED_TRANSLATION_COMPUTE_TYPE(self):
return self._SELECTED_TRANSLATION_COMPUTE_TYPE
@SELECTED_TRANSLATION_COMPUTE_TYPE.setter
def SELECTED_TRANSLATION_COMPUTE_TYPE(self, value):
if isinstance(value, str):
if value in self.SELECTED_TRANSLATION_COMPUTE_DEVICE["compute_types"]:
self._SELECTED_TRANSLATION_COMPUTE_TYPE = value
self.saveConfig(inspect.currentframe().f_code.co_name, value)
@property @property
@json_serializable('WHISPER_WEIGHT_TYPE') @json_serializable('WHISPER_WEIGHT_TYPE')
def WHISPER_WEIGHT_TYPE(self): def WHISPER_WEIGHT_TYPE(self):
@@ -830,6 +842,18 @@ class Config:
self._WHISPER_WEIGHT_TYPE = value self._WHISPER_WEIGHT_TYPE = value
self.saveConfig(inspect.currentframe().f_code.co_name, value) self.saveConfig(inspect.currentframe().f_code.co_name, value)
@property
@json_serializable('SELECTED_TRANSCRIPTION_COMPUTE_TYPE')
def SELECTED_TRANSCRIPTION_COMPUTE_TYPE(self):
return self._SELECTED_TRANSCRIPTION_COMPUTE_TYPE
@SELECTED_TRANSCRIPTION_COMPUTE_TYPE.setter
def SELECTED_TRANSCRIPTION_COMPUTE_TYPE(self, value):
if isinstance(value, str):
if value in self.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE["compute_types"]:
self._SELECTED_TRANSCRIPTION_COMPUTE_TYPE = value
self.saveConfig(inspect.currentframe().f_code.co_name, value)
@property @property
@json_serializable('AUTO_CLEAR_MESSAGE_BOX') @json_serializable('AUTO_CLEAR_MESSAGE_BOX')
def AUTO_CLEAR_MESSAGE_BOX(self): def AUTO_CLEAR_MESSAGE_BOX(self):
@@ -1050,11 +1074,7 @@ class Config:
self._SELECTABLE_TRANSCRIPTION_ENGINE_LIST = list(transcription_lang[list(transcription_lang.keys())[0]].values())[0].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._SELECTABLE_UI_LANGUAGE_LIST = ["en", "ja", "ko", "zh-Hant", "zh-Hans"]
self._COMPUTE_MODE = "cuda" if torch.cuda.is_available() else "cpu" self._COMPUTE_MODE = "cuda" if torch.cuda.is_available() else "cpu"
self._SELECTABLE_COMPUTE_DEVICE_LIST = [] self._SELECTABLE_COMPUTE_DEVICE_LIST = getComputeDeviceList()
if torch.cuda.is_available():
for i in range(torch.cuda.device_count()):
self._SELECTABLE_COMPUTE_DEVICE_LIST.append({"device":"cuda", "device_index": i, "device_name": torch.cuda.get_device_name(i)})
self._SELECTABLE_COMPUTE_DEVICE_LIST.append({"device":"cpu", "device_index": 0, "device_name": "cpu"})
self._SEND_MESSAGE_BUTTON_TYPE_LIST = ["show", "hide", "show_and_disable_enter_key"] self._SEND_MESSAGE_BUTTON_TYPE_LIST = ["show", "hide", "show_and_disable_enter_key"]
self._SEND_MESSAGE_FORMAT_PARTS = { self._SEND_MESSAGE_FORMAT_PARTS = {
"message": { "message": {
@@ -1186,7 +1206,9 @@ class Config:
self._SELECTED_TRANSLATION_COMPUTE_DEVICE = copy.deepcopy(self.SELECTABLE_COMPUTE_DEVICE_LIST[0]) self._SELECTED_TRANSLATION_COMPUTE_DEVICE = copy.deepcopy(self.SELECTABLE_COMPUTE_DEVICE_LIST[0])
self._SELECTED_TRANSCRIPTION_COMPUTE_DEVICE = copy.deepcopy(self.SELECTABLE_COMPUTE_DEVICE_LIST[0]) self._SELECTED_TRANSCRIPTION_COMPUTE_DEVICE = copy.deepcopy(self.SELECTABLE_COMPUTE_DEVICE_LIST[0])
self._CTRANSLATE2_WEIGHT_TYPE = "small" self._CTRANSLATE2_WEIGHT_TYPE = "small"
self._SELECTED_TRANSLATION_COMPUTE_TYPE = "auto"
self._WHISPER_WEIGHT_TYPE = "base" self._WHISPER_WEIGHT_TYPE = "base"
self._SELECTED_TRANSCRIPTION_COMPUTE_TYPE = "auto"
self._AUTO_CLEAR_MESSAGE_BOX = True self._AUTO_CLEAR_MESSAGE_BOX = True
self._SEND_ONLY_TRANSLATED_MESSAGES = False self._SEND_ONLY_TRANSLATED_MESSAGES = False
self._OVERLAY_SMALL_LOG = False self._OVERLAY_SMALL_LOG = False

View File

@@ -747,13 +747,15 @@ class Controller:
def getSelectedTranslationComputeDevice(*args, **kwargs) -> dict: def getSelectedTranslationComputeDevice(*args, **kwargs) -> dict:
return {"status":200, "result":config.SELECTED_TRANSLATION_COMPUTE_DEVICE} return {"status":200, "result":config.SELECTED_TRANSLATION_COMPUTE_DEVICE}
@staticmethod def setSelectedTranslationComputeDevice(self, device:str, *args, **kwargs) -> dict:
def setSelectedTranslationComputeDevice(device:str, *args, **kwargs) -> dict:
printLog("setSelectedTranslationComputeDevice", device) printLog("setSelectedTranslationComputeDevice", device)
pre_device = config.SELECTED_TRANSLATION_COMPUTE_DEVICE pre_device = config.SELECTED_TRANSLATION_COMPUTE_DEVICE
pre_compute_type = config.SELECTED_TRANSLATION_COMPUTE_TYPE
config.SELECTED_TRANSLATION_COMPUTE_DEVICE = device config.SELECTED_TRANSLATION_COMPUTE_DEVICE = device
config.SELECTED_TRANSLATION_COMPUTE_TYPE = "auto"
try: try:
model.changeTranslatorCTranslate2Model() model.changeTranslatorCTranslate2Model()
self.run(200, self.run_mapping["selected_translation_compute_type"], config.SELECTED_TRANSLATION_COMPUTE_TYPE)
except Exception as e: except Exception as e:
# VRAM不足エラーの検出デバイス切り替え時 # VRAM不足エラーの検出デバイス切り替え時
is_vram_error, error_message = model.detectVRAMError(e) is_vram_error, error_message = model.detectVRAMError(e)
@@ -761,6 +763,7 @@ class Controller:
# 前のデバイス設定に戻す # 前のデバイス設定に戻す
printLog("VRAM error detected, reverting device setting") printLog("VRAM error detected, reverting device setting")
config.SELECTED_TRANSLATION_COMPUTE_DEVICE = pre_device config.SELECTED_TRANSLATION_COMPUTE_DEVICE = pre_device
config.SELECTED_TRANSLATION_COMPUTE_TYPE = pre_compute_type
model.changeTranslatorCTranslate2Model() model.changeTranslatorCTranslate2Model()
else: else:
# その他のエラーは通常通り処理 # その他のエラーは通常通り処理
@@ -775,10 +778,11 @@ class Controller:
def getSelectedTranscriptionComputeDevice(*args, **kwargs) -> dict: def getSelectedTranscriptionComputeDevice(*args, **kwargs) -> dict:
return {"status":200, "result":config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE} return {"status":200, "result":config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE}
@staticmethod def setSelectedTranscriptionComputeDevice(self, device:str, *args, **kwargs) -> dict:
def setSelectedTranscriptionComputeDevice(device:str, *args, **kwargs) -> dict:
printLog("setSelectedTranscriptionComputeDevice", device) printLog("setSelectedTranscriptionComputeDevice", device)
config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE = device config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE = device
config.SELECTED_TRANSCRIPTION_COMPUTE_TYPE = "auto"
self.run(200, self.run_mapping["selected_transcription_compute_type"], config.SELECTED_TRANSCRIPTION_COMPUTE_TYPE)
return {"status":200,"result":config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE} return {"status":200,"result":config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE}
@staticmethod @staticmethod
@@ -1549,6 +1553,7 @@ class Controller:
@staticmethod @staticmethod
def setCtranslate2WeightType(data, *args, **kwargs) -> dict: def setCtranslate2WeightType(data, *args, **kwargs) -> dict:
pre_weight_type = config.CTRANSLATE2_WEIGHT_TYPE
config.CTRANSLATE2_WEIGHT_TYPE = str(data) config.CTRANSLATE2_WEIGHT_TYPE = str(data)
if model.checkTranslatorCTranslate2ModelWeight(config.CTRANSLATE2_WEIGHT_TYPE): if model.checkTranslatorCTranslate2ModelWeight(config.CTRANSLATE2_WEIGHT_TYPE):
def callback(): def callback():
@@ -1557,8 +1562,29 @@ class Controller:
th_callback.daemon = True th_callback.daemon = True
th_callback.start() th_callback.start()
th_callback.join() th_callback.join()
else:
config.CTRANSLATE2_WEIGHT_TYPE = pre_weight_type
return {"status":200, "result":config.CTRANSLATE2_WEIGHT_TYPE} return {"status":200, "result":config.CTRANSLATE2_WEIGHT_TYPE}
@staticmethod
def getSelectedTranslationComputeType(*args, **kwargs) -> dict:
return {"status":200, "result":config.SELECTED_TRANSLATION_COMPUTE_TYPE}
@staticmethod
def setSelectedTranslationComputeType(data, *args, **kwargs) -> dict:
pre_compute_type = config.SELECTED_TRANSLATION_COMPUTE_TYPE
config.SELECTED_TRANSLATION_COMPUTE_TYPE = str(data)
if model.checkTranslatorCTranslate2ModelWeight(config.CTRANSLATE2_WEIGHT_TYPE):
def callback():
model.changeTranslatorCTranslate2Model()
th_callback = Thread(target=callback)
th_callback.daemon = True
th_callback.start()
th_callback.join()
else:
config.SELECTED_TRANSLATION_COMPUTE_TYPE = pre_compute_type
return {"status":200, "result":config.SELECTED_TRANSLATION_COMPUTE_TYPE}
@staticmethod @staticmethod
def getWhisperWeightType(*args, **kwargs) -> dict: def getWhisperWeightType(*args, **kwargs) -> dict:
return {"status":200, "result":config.WHISPER_WEIGHT_TYPE} return {"status":200, "result":config.WHISPER_WEIGHT_TYPE}
@@ -1568,6 +1594,15 @@ class Controller:
config.WHISPER_WEIGHT_TYPE = str(data) config.WHISPER_WEIGHT_TYPE = str(data)
return {"status":200, "result": config.WHISPER_WEIGHT_TYPE} return {"status":200, "result": config.WHISPER_WEIGHT_TYPE}
@staticmethod
def getSelectedTranscriptionComputeType(*args, **kwargs) -> dict:
return {"status":200, "result":config.SELECTED_TRANSCRIPTION_COMPUTE_TYPE}
@staticmethod
def setSelectedTranscriptionComputeType(data, *args, **kwargs) -> dict:
config.SELECTED_TRANSCRIPTION_COMPUTE_TYPE = str(data)
return {"status":200, "result":config.SELECTED_TRANSCRIPTION_COMPUTE_TYPE}
@staticmethod @staticmethod
def getSendMessageFormatParts(*args, **kwargs) -> dict: def getSendMessageFormatParts(*args, **kwargs) -> dict:
return {"status":200, "result":config.SEND_MESSAGE_FORMAT_PARTS} return {"status":200, "result":config.SEND_MESSAGE_FORMAT_PARTS}

View File

@@ -48,6 +48,9 @@ run_mapping = {
"selected_translation_engines":"/run/selected_translation_engines", "selected_translation_engines":"/run/selected_translation_engines",
"translation_engines":"/run/translation_engines", "translation_engines":"/run/translation_engines",
"selected_translation_compute_type":"/run/selected_translation_compute_type",
"selected_transcription_compute_type":"/run/selected_transcription_compute_type",
"mic_host_list":"/run/mic_host_list", "mic_host_list":"/run/mic_host_list",
"mic_device_list":"/run/mic_device_list", "mic_device_list":"/run/mic_device_list",
"speaker_device_list":"/run/speaker_device_list", "speaker_device_list":"/run/speaker_device_list",
@@ -162,6 +165,9 @@ mapping = {
"/get/data/ctranslate2_weight_type": {"status": True, "variable":controller.getCtranslate2WeightType}, "/get/data/ctranslate2_weight_type": {"status": True, "variable":controller.getCtranslate2WeightType},
"/set/data/ctranslate2_weight_type": {"status": True, "variable":controller.setCtranslate2WeightType}, "/set/data/ctranslate2_weight_type": {"status": True, "variable":controller.setCtranslate2WeightType},
"/get/data/selected_translation_compute_type": {"status": True, "variable":controller.getSelectedTranslationComputeType},
"/set/data/selected_translation_compute_type": {"status": True, "variable":controller.setSelectedTranslationComputeType},
"/run/download_ctranslate2_weight": {"status": True, "variable":controller.downloadCtranslate2Weight}, "/run/download_ctranslate2_weight": {"status": True, "variable":controller.downloadCtranslate2Weight},
"/get/data/deepl_auth_key": {"status": False, "variable":controller.getDeepLAuthKey}, "/get/data/deepl_auth_key": {"status": False, "variable":controller.getDeepLAuthKey},
@@ -261,8 +267,13 @@ mapping = {
"/set/disable/check_speaker_threshold": {"status": True, "variable":controller.setDisableCheckSpeakerThreshold}, "/set/disable/check_speaker_threshold": {"status": True, "variable":controller.setDisableCheckSpeakerThreshold},
"/get/data/selectable_whisper_weight_type_dict": {"status": True, "variable":controller.getSelectableWhisperWeightTypeDict}, "/get/data/selectable_whisper_weight_type_dict": {"status": True, "variable":controller.getSelectableWhisperWeightTypeDict},
"/get/data/whisper_weight_type": {"status": True, "variable":controller.getWhisperWeightType}, "/get/data/whisper_weight_type": {"status": True, "variable":controller.getWhisperWeightType},
"/set/data/whisper_weight_type": {"status": True, "variable":controller.setWhisperWeightType}, "/set/data/whisper_weight_type": {"status": True, "variable":controller.setWhisperWeightType},
"/get/data/selected_transcription_compute_type": {"status": True, "variable":controller.getSelectedTranscriptionComputeType},
"/set/data/selected_transcription_compute_type": {"status": True, "variable":controller.setSelectedTranscriptionComputeType},
"/run/download_whisper_weight": {"status": True, "variable":controller.downloadWhisperWeight}, "/run/download_whisper_weight": {"status": True, "variable":controller.downloadWhisperWeight},
# VR # VR

View File

@@ -112,10 +112,12 @@ class Model:
def changeTranslatorCTranslate2Model(self): def changeTranslatorCTranslate2Model(self):
self.translator.changeCTranslate2Model( self.translator.changeCTranslate2Model(
config.PATH_LOCAL, path=config.PATH_LOCAL,
config.CTRANSLATE2_WEIGHT_TYPE, model_type=config.CTRANSLATE2_WEIGHT_TYPE,
config.SELECTED_TRANSLATION_COMPUTE_DEVICE["device"], device=config.SELECTED_TRANSLATION_COMPUTE_DEVICE["device"],
config.SELECTED_TRANSLATION_COMPUTE_DEVICE["device_index"]) device_index=config.SELECTED_TRANSLATION_COMPUTE_DEVICE["device_index"],
compute_type=config.SELECTED_TRANSLATION_COMPUTE_TYPE
)
def downloadCTranslate2ModelWeight(self, weight_type, callback=None, end_callback=None): def downloadCTranslate2ModelWeight(self, weight_type, callback=None, end_callback=None):
return downloadCTranslate2Weight(config.PATH_LOCAL, weight_type, callback, end_callback) return downloadCTranslate2Weight(config.PATH_LOCAL, weight_type, callback, end_callback)
@@ -446,6 +448,7 @@ class Model:
whisper_weight_type=config.WHISPER_WEIGHT_TYPE, whisper_weight_type=config.WHISPER_WEIGHT_TYPE,
device=config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE["device"], device=config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE["device"],
device_index=config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE["device_index"], device_index=config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE["device_index"],
compute_type=config.SELECTED_TRANSCRIPTION_COMPUTE_TYPE,
) )
def sendMicTranscript(): def sendMicTranscript():
try: try:
@@ -629,6 +632,7 @@ class Model:
whisper_weight_type=config.WHISPER_WEIGHT_TYPE, whisper_weight_type=config.WHISPER_WEIGHT_TYPE,
device=config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE["device"], device=config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE["device"],
device_index=config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE["device_index"], device_index=config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE["device_index"],
compute_type=config.SELECTED_TRANSCRIPTION_COMPUTE_TYPE,
) )
def sendSpeakerTranscript(): def sendSpeakerTranscript():
try: try:

View File

@@ -21,7 +21,7 @@ PHRASE_TIMEOUT = 3
MAX_PHRASES = 10 MAX_PHRASES = 10
class AudioTranscriber: class AudioTranscriber:
def __init__(self, speaker, source, phrase_timeout, max_phrases, transcription_engine, root=None, whisper_weight_type=None, device="cpu", device_index=0): def __init__(self, speaker, source, phrase_timeout, max_phrases, transcription_engine, root=None, whisper_weight_type=None, device="cpu", device_index=0, compute_type="auto"):
self.speaker = speaker self.speaker = speaker
self.phrase_timeout = phrase_timeout self.phrase_timeout = phrase_timeout
self.max_phrases = max_phrases self.max_phrases = max_phrases
@@ -41,7 +41,7 @@ class AudioTranscriber:
} }
if transcription_engine == "Whisper" and checkWhisperWeight(root, whisper_weight_type) is True: if transcription_engine == "Whisper" and checkWhisperWeight(root, whisper_weight_type) is True:
self.whisper_model = getWhisperModel(root, whisper_weight_type, device=device, device_index=device_index) self.whisper_model = getWhisperModel(root, whisper_weight_type, device=device, device_index=device_index, compute_type=compute_type)
self.transcription_engine = "Whisper" self.transcription_engine = "Whisper"
def transcribeAudioQueue(self, audio_queue, languages, countries, avg_logprob=-0.8, no_speech_prob=0.6): def transcribeAudioQueue(self, audio_queue, languages, countries, avg_logprob=-0.8, no_speech_prob=0.6):

View File

@@ -74,9 +74,10 @@ def downloadWhisperWeight(root, weight_type, callback=None, end_callback=None):
if isinstance(end_callback, Callable): if isinstance(end_callback, Callable):
end_callback() end_callback()
def getWhisperModel(root, weight_type, device="cpu", device_index=0): def getWhisperModel(root, weight_type, device="cpu", device_index=0, compute_type="auto"):
path = os_path.join(root, "weights", "whisper", weight_type) path = os_path.join(root, "weights", "whisper", weight_type)
compute_type = getBestComputeType(device, device_index) if compute_type == "auto":
compute_type = getBestComputeType(device, device_index)
try: try:
model = WhisperModel( model = WhisperModel(
path, path,

View File

@@ -36,14 +36,15 @@ class Translator():
result = False result = False
return result return result
def changeCTranslate2Model(self, path, model_type, device="cpu", device_index=0): def changeCTranslate2Model(self, path, model_type, device="cpu", device_index=0, compute_type="auto"):
self.is_loaded_ctranslate2_model = False self.is_loaded_ctranslate2_model = False
directory_name = ctranslate2_weights[model_type]["directory_name"] directory_name = ctranslate2_weights[model_type]["directory_name"]
tokenizer = ctranslate2_weights[model_type]["tokenizer"] tokenizer = ctranslate2_weights[model_type]["tokenizer"]
weight_path = os_path.join(path, "weights", "ctranslate2", directory_name) weight_path = os_path.join(path, "weights", "ctranslate2", directory_name)
tokenizer_path = os_path.join(path, "weights", "ctranslate2", directory_name, "tokenizer") tokenizer_path = os_path.join(path, "weights", "ctranslate2", directory_name, "tokenizer")
compute_type = getBestComputeType(device, device_index) if compute_type == "auto":
compute_type = getBestComputeType(device, device_index)
self.ctranslate2_translator = ctranslate2.Translator( self.ctranslate2_translator = ctranslate2.Translator(
weight_path, weight_path,
device=device, device=device,

View File

@@ -5,6 +5,7 @@ import traceback
import logging import logging
from logging.handlers import RotatingFileHandler from logging.handlers import RotatingFileHandler
import torch
from ctranslate2 import get_supported_compute_types from ctranslate2 import get_supported_compute_types
import requests import requests
import ipaddress import ipaddress
@@ -78,14 +79,67 @@ def isValidIpAddress(ip_address: str) -> bool:
except ValueError: except ValueError:
return False return False
def getBestComputeType(device, device_index) -> str: def getComputeDeviceList() -> dict:
compute_types = get_supported_compute_types(device, device_index) compute_types = [
compute_types = set(compute_types) {
preferred_types = ["int8_bfloat16", "int8_float16", "int8", "bfloat16", "float16", "int8_float32", "float32"] "device": "cpu",
"device_index": 0,
"device_name": "cpu",
"compute_types": ["auto"] + list(get_supported_compute_types("cpu", 0)),
}
]
for preferred_type in preferred_types: if torch.cuda.is_available():
if preferred_type in compute_types: for device_index in range(torch.cuda.device_count()):
return preferred_type gpu_device_name = torch.cuda.get_device_name(device_index)
gpu_compute_types = ["auto"] + list(get_supported_compute_types("cuda", device_index))
# デバイスごとの計算タイプの制限
if "GTX" in gpu_device_name:
unsupported_types = {"int8_bfloat16", "bfloat16", "float16", "int8"}
gpu_compute_types = [t for t in gpu_compute_types if t not in unsupported_types]
elif not any(keyword in gpu_device_name for keyword in ["RTX", "Tesla", "A100", "Quadro"]):
gpu_compute_types = ["float32"]
compute_types.append(
{
"device": "cuda",
"device_index": device_index,
"device_name": gpu_device_name,
"compute_types": gpu_compute_types,
}
)
return compute_types
def getBestComputeType(device: str, device_index: int) -> str:
compute_types = set(get_supported_compute_types(device, device_index))
device_name = "cpu" if device == "cpu" else torch.cuda.get_device_name(device_index)
# デバイスごとの優先計算タイプ
preferred_types = {
"default": ["int8_bfloat16", "int8_float16", "int8", "bfloat16", "float16", "int8_float32", "float32"],
"GTX": ["float32"],
"RTX": ["int8_bfloat16", "int8_float16", "int8", "bfloat16", "float16", "int8_float32", "float32"],
"Tesla": ["int8_bfloat16", "int8_float16", "int8", "bfloat16", "float16", "int8_float32", "float32"],
"A100": ["int8_bfloat16", "int8_float16", "int8", "bfloat16", "float16", "int8_float32", "float32"],
"Quadro": ["int8_bfloat16", "int8_float16", "int8", "bfloat16", "float16", "int8_float32", "float32"],
}
# デバイス名に基づいて優先タイプを選択
for key in preferred_types:
if key in device_name:
selected_types = preferred_types[key]
break
else:
selected_types = preferred_types["default"]
# 利用可能な計算タイプを返す
for compute_type in selected_types:
if compute_type in compute_types:
return compute_type
return "float32"
def encodeBase64(data:str) -> dict: def encodeBase64(data:str) -> dict:
return json.loads(base64.b64decode(data).decode('utf-8')) return json.loads(base64.b64decode(data).decode('utf-8'))
@@ -176,3 +230,6 @@ def errorLogging() -> None:
error_logger = setupLogger("error", "error.log", logging.ERROR) error_logger = setupLogger("error", "error.log", logging.ERROR)
error_logger.error(traceback.format_exc()) error_logger.error(traceback.format_exc())
if __name__ == "__main__":
print(getComputeDeviceList())

View File

@@ -29,7 +29,7 @@ export const _DownloadButton = ({option, ...props}) => {
className={styles.download_button} className={styles.download_button}
onClick={() => props.downloadStartFunction(option.id)} onClick={() => props.downloadStartFunction(option.id)}
> >
<p className={styles.download_button_label}>{t("config_page.model_download_button_label")}</p> <p className={styles.download_button_label}>{t("config_page.common.model_download_button_label")}</p>
</button> </button>
); );
case option.update_button: case option.update_button:

View File

@@ -53,6 +53,7 @@ const Mic_Container = () => {
setSelectedMicDevice(selected_data.selected_id); setSelectedMicDevice(selected_data.selected_id);
}; };
// [Fix me] currentEnableAutoMicSelect.data === "pending"; ? not currentEnableAutoMicSelect.state === "pending"; ??(.state)
const is_disabled_selector = currentEnableAutoMicSelect.data === true || currentEnableAutoMicSelect.data === "pending"; const is_disabled_selector = currentEnableAutoMicSelect.data === true || currentEnableAutoMicSelect.data === "pending";
const getLabels = () => { const getLabels = () => {

View File

@@ -1,7 +1,8 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useI18n } from "@useI18n"; import { useI18n } from "@useI18n";
import styles from "./Transcription.module.scss"; import styles from "./Transcription.module.scss";
import { updateLabelsById, genNumObjArray } from "@utils"; import { updateLabelsById, genNumObjArray, arrayToObject } from "@utils";
import { useStore_IsBreakPoint } from "@store";
import { import {
useTranscription, useTranscription,
@@ -12,11 +13,14 @@ import {
DownloadModelsContainer, DownloadModelsContainer,
RadioButtonContainer, RadioButtonContainer,
DropdownMenuContainer, DropdownMenuContainer,
ComputeDeviceContainer,
SliderContainer, SliderContainer,
useOnMouseLeaveDropdownMenu,
} from "../_templates/Templates"; } from "../_templates/Templates";
import { import {
DropdownMenu,
LabelComponent,
SectionLabelComponent, SectionLabelComponent,
} from "../_components/"; } from "../_components/";
@@ -201,7 +205,7 @@ const TranscriptionEngine_Container = () => {
<SectionLabelComponent label={t("config_page.transcription.section_label_transcription_engines")} /> <SectionLabelComponent label={t("config_page.transcription.section_label_transcription_engines")} />
<TranscriptionEngine_Box /> <TranscriptionEngine_Box />
<WhisperWeightType_Box /> <WhisperWeightType_Box />
<WhisperComputeDevice_Box /> <TranscriptionComputeDevice_Box />
</div> </div>
); );
}; };
@@ -274,47 +278,143 @@ const WhisperWeightType_Box = () => {
); );
}; };
// Duplicate // Duplicate
import { useComputeMode } from "@logics_common"; const TranscriptionComputeDevice_Box = () => {
const WhisperComputeDevice_Box = () => {
const { t } = useI18n(); const { t } = useI18n();
const { currentSelectedWhisperComputeDevice, setSelectedWhisperComputeDevice } = useTranscription(); const {
const { currentSelectableWhisperComputeDeviceList } = useTranscription(); currentSelectableTranscriptionComputeDeviceList,
currentSelectedTranscriptionComputeDevice,
setSelectedTranscriptionComputeDevice,
currentSelectedTranscriptionComputeType,
setSelectedTranscriptionComputeType,
} = useTranscription();
const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu();
const { currentIsBreakPoint } = useStore_IsBreakPoint();
const selectFunction = (selected_data) => { const list_for_ui = transformDeviceArray(currentSelectableTranscriptionComputeDeviceList.data);
const target_obj = currentSelectableWhisperComputeDeviceList.data[selected_data.selected_id];
setSelectedWhisperComputeDevice(target_obj); const target_index = findKeyByDeviceValue(currentSelectableTranscriptionComputeDeviceList.data, currentSelectedTranscriptionComputeDevice.data);
const DEFAULT_ORDER = [
"auto",
"int8",
"int8_bfloat16",
"int8_float16",
"int8_float32",
"bfloat16",
"float16",
"int16",
"float32"
];
const sortComputeTypesArray = (compute_types_array = [], order) => {
const src_set = new Set(compute_types_array);
const from_order = order.filter((id) => src_set.has(id));
const invalid_ids = compute_types_array.filter((id) => !order.includes(id));
if (invalid_ids.length > 0) {
console.error("[sortComputeTypesArray] Unsupported compute types ignored:", invalid_ids);
}
return from_order;
}; };
const list_for_ui = transformDeviceArray(currentSelectableWhisperComputeDeviceList.data);
const target_index = findKeyByDeviceValue(currentSelectableWhisperComputeDeviceList.data, currentSelectedWhisperComputeDevice.data); const buildSimpleLabels = (ordered_array = []) => {
const n = ordered_array.length;
if (n === 0) return {};
const labels = {};
ordered_array.forEach((id, idx) => {
if (idx === 0 && id === "auto") {
labels[id] = t("config_page.common.compute_device.type_template_auto");
return;
}
if (idx === 1) {
labels[id] = t(
"config_page.common.compute_device.type_template_low",
{ type_name: id }
);
return;
}
if (idx === n - 1) {
labels[id] = t(
"config_page.common.compute_device.type_template_high",
{ type_name: id }
);
return;
}
labels[id] = id;
});
return labels;
};
const { currentComputeMode } = useComputeMode(); const computeTypesArray = currentSelectableTranscriptionComputeDeviceList.data[target_index].compute_types;
if (currentComputeMode.data === "cpu") {
return ( const ordered_array = sortComputeTypesArray(computeTypesArray, DEFAULT_ORDER);
<ComputeDeviceContainer
label={t("config_page.transcription.whisper_compute_device.label")} const new_compute_types_labels = buildSimpleLabels(ordered_array);
selected_id={target_index}
list={list_for_ui} const selectFunction_ComputeDevice = (selected_data) => {
selectFunction={selectFunction} const target_obj = currentSelectableTranscriptionComputeDeviceList.data[selected_data.selected_id];
state={currentSelectedWhisperComputeDevice.state} setSelectedTranscriptionComputeDevice(target_obj);
/> };
)
} const selectFunction_ComputeType = (selected_data) => {
setSelectedTranscriptionComputeType(selected_data.selected_id);
};
const device_container_class = clsx(styles.device_container, {
[styles.is_break_point]: currentIsBreakPoint.data,
});
const is_disabled_selector = currentSelectedTranscriptionComputeDevice.state === "pending" || currentSelectedTranscriptionComputeType.state === "pending";
return ( return (
<DropdownMenuContainer <div className={styles.mic_container}>
dropdown_id="whisper_compute_device" <div className={device_container_class} onMouseLeave={onMouseLeaveFunction}>
label={t("config_page.transcription.whisper_compute_device.label")} <LabelComponent
// desc={t("config_page.transcription.whisper_compute_device.label")} label={t("config_page.transcription.transcription_compute_device.label")}
selected_id={target_index} desc={t("config_page.common.compute_device.desc")}
list={list_for_ui} />
selectFunction={selectFunction} <div className={styles.device_contents}>
state={currentSelectedWhisperComputeDevice.state}
/> <div className={styles.device_dropdown_wrapper}>
<div className={styles.device_dropdown}>
<p className={styles.device_secondary_label}>{t("config_page.common.compute_device.label_device")}</p>
<DropdownMenu
dropdown_id="transcription_compute_device"
selected_id={target_index}
list={list_for_ui}
selectFunction={selectFunction_ComputeDevice}
state={currentSelectedTranscriptionComputeDevice.state}
style={{ maxWidth: "20rem", minWidth: "10rem" }}
is_disabled={is_disabled_selector}
/>
</div>
<div className={styles.device_dropdown}>
<p className={styles.device_secondary_label}>{t("config_page.common.compute_device.label_type")}</p>
<DropdownMenu
dropdown_id="transcription_compute_type"
selected_id={currentSelectedTranscriptionComputeType.data}
list={new_compute_types_labels}
selectFunction={selectFunction_ComputeType}
state={currentSelectedTranscriptionComputeType.state}
is_disabled={is_disabled_selector}
/>
</div>
</div>
</div>
</div>
</div>
); );
}; };
@@ -374,8 +474,6 @@ const Advanced_Container = () => {
<SpeakerNoSpeechProbContainer /> <SpeakerNoSpeechProbContainer />
</div> </div>
); );
}; };
export const MicAvgLogprobContainer = () => { export const MicAvgLogprobContainer = () => {

View File

@@ -3,3 +3,119 @@
flex-direction: column; flex-direction: column;
gap: 6.4rem; gap: 6.4rem;
} }
// [Fix me] Need refactor.
.mic_container {
display: flex;
flex-direction: column;
border-bottom: solid 0.1rem var(--dark_800_color);
padding-bottom: 1rem;
}
.speaker_container {
padding-top: 0rem;
}
.device_container {
display: flex;
width: 100%;
justify-content: space-between;
align-items: center;
padding: 2rem;
margin-bottom: 0rem;
&.is_break_point {
flex-direction: column;
gap: 2rem;
align-items: start;
& .device_contents {
display: flex;
width: 100%;
justify-content: space-between;
padding-left: 0rem;
}
}
}
.threshold_container {
padding: 2rem;
}
.threshold_container {
display: flex;
width: 100%;
flex-direction: column;
justify-content: space-between;
align-items: center;
gap: 2rem;
}
.threshold_switch_section {
display: flex;
width: 100%;
justify-content: space-between;
align-items: center;
flex-shrink: 0;
}
.threshold_section {
width: 100%;
}
.device_label {
font-size: 1.8rem;
}
.device_contents {
display: flex;
width: 100%;
justify-content: end;
padding-left: 2rem;
gap: 2rem;
}
.device_auto_select_wrapper {
display: flex;
flex-direction: column;
gap: 1.2rem;
justify-content: center;
align-items: center;
}
.device_dropdown_wrapper {
display: flex;
flex-direction: row;
gap: 2.8rem;
}
.device_dropdown {
display: flex;
flex-direction: column;
gap: 0.6rem;
white-space: nowrap;
max-width: 24rem;
&.is_disabled {
pointer-events: none;
}
}
.device_secondary_label {
padding-left: 0.2rem;
padding-right: 0.4rem;
font-size: 1.4rem;
color: var(--dark_500_color);
white-space: nowrap;
}

View File

@@ -1,7 +1,8 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useI18n } from "@useI18n"; import { useI18n } from "@useI18n";
import styles from "./Translation.module.scss"; import styles from "./Translation.module.scss";
import { updateLabelsById } from "@utils"; import { updateLabelsById, arrayToObject } from "@utils";
import { useStore_IsBreakPoint } from "@store";
import { import {
useTranslation, useTranslation,
@@ -10,15 +11,20 @@ import {
import { import {
DownloadModelsContainer, DownloadModelsContainer,
DeeplAuthKeyContainer, DeeplAuthKeyContainer,
DropdownMenuContainer,
ComputeDeviceContainer, useOnMouseLeaveDropdownMenu,
} from "../_templates/Templates"; } from "../_templates/Templates";
import {
DropdownMenu,
LabelComponent,
} from "../_components/";
export const Translation = () => { export const Translation = () => {
return ( return (
<> <>
<CTranslate2WeightType_Box /> <CTranslate2WeightType_Box />
<CTranslation2ComputeDevice_Box /> <TranslationComputeDevice_Box />
<DeeplAuthKey_Box /> <DeeplAuthKey_Box />
</> </>
); );
@@ -62,7 +68,7 @@ const CTranslate2WeightType_Box = () => {
"config_page.translation.ctranslate2_weight_type.desc", "config_page.translation.ctranslate2_weight_type.desc",
{ctranslate2: "CTranslate2"} {ctranslate2: "CTranslate2"}
)} )}
name="ctransalte2_weight_type" name="ctranslate2_weight_type"
options={c_translate2_weight_types} options={c_translate2_weight_types}
checked_variable={currentSelectedCTranslate2WeightType} checked_variable={currentSelectedCTranslate2WeightType}
selectFunction={selectFunction} selectFunction={selectFunction}
@@ -71,49 +77,143 @@ const CTranslate2WeightType_Box = () => {
</> </>
); );
}; };
// Duplicate // Duplicate
import { useComputeMode } from "@logics_common"; const TranslationComputeDevice_Box = () => {
const CTranslation2ComputeDevice_Box = () => {
const { t } = useI18n(); const { t } = useI18n();
const { currentSelectedCTranslate2ComputeDevice, setSelectedCTranslate2ComputeDevice } = useTranslation(); const {
const { currentSelectableCTranslate2ComputeDeviceList } = useTranslation(); currentSelectableTranslationComputeDeviceList,
currentSelectedTranslationComputeDevice,
setSelectedTranslationComputeDevice,
currentSelectedTranslationComputeType,
setSelectedTranslationComputeType,
} = useTranslation();
const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu();
const { currentIsBreakPoint } = useStore_IsBreakPoint();
const selectFunction = (selected_data) => { const list_for_ui = transformDeviceArray(currentSelectableTranslationComputeDeviceList.data);
const target_obj = currentSelectableCTranslate2ComputeDeviceList.data[selected_data.selected_id];
setSelectedCTranslate2ComputeDevice(target_obj); const target_index = findKeyByDeviceValue(currentSelectableTranslationComputeDeviceList.data, currentSelectedTranslationComputeDevice.data);
const DEFAULT_ORDER = [
"auto",
"int8",
"int8_bfloat16",
"int8_float16",
"int8_float32",
"bfloat16",
"float16",
"int16",
"float32"
];
const sortComputeTypesArray = (compute_types_array = [], order) => {
const src_set = new Set(compute_types_array);
const from_order = order.filter((id) => src_set.has(id));
const invalid_ids = compute_types_array.filter((id) => !order.includes(id));
if (invalid_ids.length > 0) {
console.error("[sortComputeTypesArray] Unsupported compute types ignored:", invalid_ids);
}
return from_order;
}; };
const list_for_ui = transformDeviceArray(currentSelectableCTranslate2ComputeDeviceList.data);
const target_index = findKeyByDeviceValue(currentSelectableCTranslate2ComputeDeviceList.data, currentSelectedCTranslate2ComputeDevice.data); const buildSimpleLabels = (ordered_array = []) => {
const n = ordered_array.length;
if (n === 0) return {};
const labels = {};
ordered_array.forEach((id, idx) => {
if (idx === 0 && id === "auto") {
labels[id] = t("config_page.common.compute_device.type_template_auto");
return;
}
if (idx === 1) {
labels[id] = t(
"config_page.common.compute_device.type_template_low",
{ type_name: id }
);
return;
}
if (idx === n - 1) {
labels[id] = t(
"config_page.common.compute_device.type_template_high",
{ type_name: id }
);
return;
}
labels[id] = id;
});
return labels;
};
const { currentComputeMode } = useComputeMode(); const computeTypesArray = currentSelectableTranslationComputeDeviceList.data[target_index].compute_types;
const ctranslate2_compute_device_label = t("config_page.translation.ctranslate2_compute_device.label", {
ctranslate2: "Ctranslate2" const ordered_array = sortComputeTypesArray(computeTypesArray, DEFAULT_ORDER);
const new_compute_types_labels = buildSimpleLabels(ordered_array);
const selectFunction_ComputeDevice = (selected_data) => {
const target_obj = currentSelectableTranslationComputeDeviceList.data[selected_data.selected_id];
setSelectedTranslationComputeDevice(target_obj);
};
const selectFunction_ComputeType = (selected_data) => {
setSelectedTranslationComputeType(selected_data.selected_id);
};
const device_container_class = clsx(styles.device_container, {
[styles.is_break_point]: currentIsBreakPoint.data,
}); });
if (currentComputeMode.data === "cpu") {
return ( const is_disabled_selector = currentSelectedTranslationComputeDevice.state === "pending" || currentSelectedTranslationComputeType.state === "pending";
<ComputeDeviceContainer
label={ctranslate2_compute_device_label}
selected_id={target_index}
list={list_for_ui}
selectFunction={selectFunction}
state={currentSelectedCTranslate2ComputeDevice.state}
/>
)
}
return ( return (
<DropdownMenuContainer <div className={styles.mic_container}>
dropdown_id="ctranslate2_compute_device" <div className={device_container_class} onMouseLeave={onMouseLeaveFunction}>
label={ctranslate2_compute_device_label} <LabelComponent
selected_id={target_index} label={t("config_page.translation.translation_compute_device.label")}
list={list_for_ui} desc={t("config_page.common.compute_device.desc")}
selectFunction={selectFunction} />
state={currentSelectedCTranslate2ComputeDevice.state} <div className={styles.device_contents}>
/>
<div className={styles.device_dropdown_wrapper}>
<div className={styles.device_dropdown}>
<p className={styles.device_secondary_label}>{t("config_page.common.compute_device.label_device")}</p>
<DropdownMenu
dropdown_id="translation_compute_device"
selected_id={target_index}
list={list_for_ui}
selectFunction={selectFunction_ComputeDevice}
state={currentSelectedTranslationComputeDevice.state}
style={{ maxWidth: "20rem", minWidth: "10rem" }}
is_disabled={is_disabled_selector}
/>
</div>
<div className={styles.device_dropdown}>
<p className={styles.device_secondary_label}>{t("config_page.common.compute_device.label_type")}</p>
<DropdownMenu
dropdown_id="translation_compute_type"
selected_id={currentSelectedTranslationComputeType.data}
list={new_compute_types_labels}
selectFunction={selectFunction_ComputeType}
state={currentSelectedTranslationComputeType.state}
is_disabled={is_disabled_selector}
/>
</div>
</div>
</div>
</div>
</div>
); );
}; };

View File

@@ -0,0 +1,106 @@
// [Fix me] Need refactor.
.mic_container {
display: flex;
flex-direction: column;
border-bottom: solid 0.1rem var(--dark_800_color);
padding-bottom: 1rem;
}
.speaker_container {
padding-top: 0rem;
}
.device_container {
display: flex;
width: 100%;
justify-content: space-between;
align-items: center;
padding: 2rem;
margin-bottom: 0rem;
&.is_break_point {
flex-direction: column;
gap: 2rem;
align-items: start;
& .device_contents {
display: flex;
width: 100%;
justify-content: space-between;
padding-left: 0rem;
}
}
}
.threshold_container {
padding: 2rem;
}
.threshold_container {
display: flex;
width: 100%;
flex-direction: column;
justify-content: space-between;
align-items: center;
gap: 2rem;
}
.threshold_switch_section {
display: flex;
width: 100%;
justify-content: space-between;
align-items: center;
flex-shrink: 0;
}
.threshold_section {
width: 100%;
}
.device_label {
font-size: 1.8rem;
}
.device_contents {
display: flex;
width: 100%;
justify-content: end;
padding-left: 2rem;
gap: 2rem;
}
.device_auto_select_wrapper {
display: flex;
flex-direction: column;
gap: 1.2rem;
justify-content: center;
align-items: center;
}
.device_dropdown_wrapper {
display: flex;
flex-direction: row;
gap: 2.8rem;
}
.device_dropdown {
display: flex;
flex-direction: column;
gap: 0.6rem;
white-space: nowrap;
max-width: 24rem;
&.is_disabled {
pointer-events: none;
}
}
.device_secondary_label {
padding-left: 0.2rem;
padding-right: 0.4rem;
font-size: 1.4rem;
color: var(--dark_500_color);
white-space: nowrap;
}

View File

@@ -15,10 +15,10 @@ export const VersionLabel = () => {
const { currentComputeMode } = useComputeMode(); const { currentComputeMode } = useComputeMode();
const version_label = currentComputeMode.data === "cpu" const version_label = currentComputeMode.data === "cpu"
? t("config_page.version", { version: currentSoftwareVersion.data }) ? t("config_page.common.version", { version: currentSoftwareVersion.data })
: currentComputeMode.data === "cuda" : currentComputeMode.data === "cuda"
? t("config_page.version", { version: currentSoftwareVersion.data }) + " CUDA" ? t("config_page.common.version", { version: currentSoftwareVersion.data }) + " CUDA"
: t("config_page.version", { version: currentSoftwareVersion.data }); : t("config_page.common.version", { version: currentSoftwareVersion.data });
const is_cpu = currentComputeMode.data === "cpu"; const is_cpu = currentComputeMode.data === "cpu";

View File

@@ -8,12 +8,13 @@ import {
useStore_SpeakerPhraseTimeout, useStore_SpeakerPhraseTimeout,
useStore_SpeakerRecordTimeout, useStore_SpeakerRecordTimeout,
useStore_SelectableWhisperComputeDeviceList, useStore_SelectableTranscriptionComputeDeviceList,
useStore_SelectedTranscriptionEngine, useStore_SelectedTranscriptionEngine,
useStore_SelectedWhisperComputeDevice, useStore_SelectedTranscriptionComputeDevice,
useStore_SelectedWhisperWeightType,
useStore_WhisperWeightTypeStatus, useStore_WhisperWeightTypeStatus,
useStore_SelectedWhisperWeightType,
useStore_SelectedTranscriptionComputeType,
useStore_MicAvgLogprob, useStore_MicAvgLogprob,
useStore_MicNoSpeechProb, useStore_MicNoSpeechProb,
@@ -21,7 +22,7 @@ import {
useStore_SpeakerNoSpeechProb, useStore_SpeakerNoSpeechProb,
} from "@store"; } from "@store";
import { useStdoutToPython } from "@useStdoutToPython"; import { useStdoutToPython } from "@useStdoutToPython";
import { transformToIndexedArray } from "@utils"; import { transformToIndexedArray, arrayToObject } from "@utils";
import { useNotificationStatus } from "@logics_common"; import { useNotificationStatus } from "@logics_common";
export const useTranscription = () => { export const useTranscription = () => {
@@ -41,10 +42,15 @@ export const useTranscription = () => {
// Transcription Engines // Transcription Engines
const { currentSelectedTranscriptionEngine, updateSelectedTranscriptionEngine, pendingSelectedTranscriptionEngine } = useStore_SelectedTranscriptionEngine(); const { currentSelectedTranscriptionEngine, updateSelectedTranscriptionEngine, pendingSelectedTranscriptionEngine } = useStore_SelectedTranscriptionEngine();
const { currentWhisperWeightTypeStatus, updateWhisperWeightTypeStatus, pendingWhisperWeightTypeStatus } = useStore_WhisperWeightTypeStatus(); const { currentWhisperWeightTypeStatus, updateWhisperWeightTypeStatus, pendingWhisperWeightTypeStatus } = useStore_WhisperWeightTypeStatus();
const { currentSelectedWhisperWeightType, updateSelectedWhisperWeightType, pendingSelectedWhisperWeightType } = useStore_SelectedWhisperWeightType(); const { currentSelectedWhisperWeightType, updateSelectedWhisperWeightType, pendingSelectedWhisperWeightType } = useStore_SelectedWhisperWeightType();
const { currentSelectableWhisperComputeDeviceList, updateSelectableWhisperComputeDeviceList, pendingSelectableWhisperComputeDeviceList } = useStore_SelectableWhisperComputeDeviceList();
const { currentSelectedWhisperComputeDevice, updateSelectedWhisperComputeDevice, pendingSelectedWhisperComputeDevice } = useStore_SelectedWhisperComputeDevice();
const { currentSelectedTranscriptionComputeType, updateSelectedTranscriptionComputeType, pendingSelectedTranscriptionComputeType } = useStore_SelectedTranscriptionComputeType();
const { currentSelectableTranscriptionComputeDeviceList, updateSelectableTranscriptionComputeDeviceList, pendingSelectableTranscriptionComputeDeviceList } = useStore_SelectableTranscriptionComputeDeviceList();
const { currentSelectedTranscriptionComputeDevice, updateSelectedTranscriptionComputeDevice, pendingSelectedTranscriptionComputeDevice } = useStore_SelectedTranscriptionComputeDevice();
// Advanced Settings // Advanced Settings
const { currentMicAvgLogprob, updateMicAvgLogprob, pendingMicAvgLogprob } = useStore_MicAvgLogprob(); const { currentMicAvgLogprob, updateMicAvgLogprob, pendingMicAvgLogprob } = useStore_MicAvgLogprob();
@@ -246,6 +252,24 @@ export const useTranscription = () => {
asyncStdoutToPython("/run/download_whisper_weight", weight_type); asyncStdoutToPython("/run/download_whisper_weight", weight_type);
}; };
const getSelectedTranscriptionComputeType = () => {
pendingSelectedTranscriptionComputeType();
asyncStdoutToPython("/get/data/selected_transcription_compute_type");
};
const setSelectedTranscriptionComputeType = (selected_transcription_compute_type) => {
pendingSelectedTranscriptionComputeType();
asyncStdoutToPython("/set/data/selected_transcription_compute_type", selected_transcription_compute_type);
};
const setSuccessSelectedTranscriptionComputeType = (selected_transcription_compute_type) => {
updateSelectedTranscriptionComputeType(selected_transcription_compute_type);
showNotification_SaveSuccess();
};
// Transcription Engines (Selected Weight Type) // Transcription Engines (Selected Weight Type)
const getSelectedWhisperWeightType = () => { const getSelectedWhisperWeightType = () => {
pendingSelectedWhisperWeightType(); pendingSelectedWhisperWeightType();
@@ -263,28 +287,28 @@ export const useTranscription = () => {
}; };
// Transcription Engines (Compute Device List) // Transcription Engines (Compute Device List)
const getSelectableWhisperComputeDeviceList = () => { const getSelectableTranscriptionComputeDeviceList = () => {
pendingSelectableWhisperComputeDeviceList(); pendingSelectableTranscriptionComputeDeviceList();
asyncStdoutToPython("/get/data/transcription_compute_device_list"); asyncStdoutToPython("/get/data/transcription_compute_device_list");
}; };
const updateSelectableWhisperComputeDeviceList_FromBackend = (payload) => { const updateSelectableTranscriptionComputeDeviceList_FromBackend = (payload) => {
updateSelectableWhisperComputeDeviceList(transformToIndexedArray(payload)); updateSelectableTranscriptionComputeDeviceList(transformToIndexedArray(payload));
}; };
// Transcription Engines (Selected Compute Device) // Transcription Engines (Selected Compute Device)
const getSelectedWhisperComputeDevice = () => { const getSelectedTranscriptionComputeDevice = () => {
pendingSelectedWhisperComputeDevice(); pendingSelectedTranscriptionComputeDevice();
asyncStdoutToPython("/get/data/selected_transcription_compute_device"); asyncStdoutToPython("/get/data/selected_transcription_compute_device");
}; };
const setSelectedWhisperComputeDevice = (selected_transcription_compute_device) => { const setSelectedTranscriptionComputeDevice = (selected_transcription_compute_device) => {
pendingSelectedWhisperComputeDevice(); pendingSelectedTranscriptionComputeDevice();
asyncStdoutToPython("/set/data/selected_transcription_compute_device", selected_transcription_compute_device); asyncStdoutToPython("/set/data/selected_transcription_compute_device", selected_transcription_compute_device);
}; };
const setSuccessSelectedWhisperComputeDevice = (dev) => { const setSuccessSelectedTranscriptionComputeDevice = (dev) => {
updateSelectedWhisperComputeDevice(dev); updateSelectedTranscriptionComputeDevice(dev);
showNotification_SaveSuccess(); showNotification_SaveSuccess();
}; };
@@ -416,16 +440,24 @@ export const useTranscription = () => {
setSelectedWhisperWeightType, setSelectedWhisperWeightType,
setSuccessSelectedWhisperWeightType, setSuccessSelectedWhisperWeightType,
currentSelectableWhisperComputeDeviceList,
getSelectableWhisperComputeDeviceList,
updateSelectableWhisperComputeDeviceList,
updateSelectableWhisperComputeDeviceList_FromBackend,
currentSelectedWhisperComputeDevice, currentSelectedTranscriptionComputeType,
getSelectedWhisperComputeDevice, getSelectedTranscriptionComputeType,
updateSelectedWhisperComputeDevice, updateSelectedTranscriptionComputeType,
setSelectedWhisperComputeDevice, setSelectedTranscriptionComputeType,
setSuccessSelectedWhisperComputeDevice, setSuccessSelectedTranscriptionComputeType,
currentSelectableTranscriptionComputeDeviceList,
getSelectableTranscriptionComputeDeviceList,
updateSelectableTranscriptionComputeDeviceList,
updateSelectableTranscriptionComputeDeviceList_FromBackend,
currentSelectedTranscriptionComputeDevice,
getSelectedTranscriptionComputeDevice,
updateSelectedTranscriptionComputeDevice,
setSelectedTranscriptionComputeDevice,
setSuccessSelectedTranscriptionComputeDevice,
// Advanced // Advanced
// Mic Avg Logprob // Mic Avg Logprob

View File

@@ -1,13 +1,14 @@
import { import {
useStore_CTranslate2WeightTypeStatus, useStore_CTranslate2WeightTypeStatus,
useStore_SelectedCTranslate2WeightType, useStore_SelectedCTranslate2WeightType,
useStore_SelectableCTranslate2ComputeDeviceList, useStore_SelectedTranslationComputeType,
useStore_SelectedCTranslate2ComputeDevice, useStore_SelectableTranslationComputeDeviceList,
useStore_SelectedTranslationComputeDevice,
useStore_DeepLAuthKey, useStore_DeepLAuthKey,
} from "@store"; } from "@store";
import { useStdoutToPython } from "@useStdoutToPython"; import { useStdoutToPython } from "@useStdoutToPython";
import { useI18n } from "@useI18n"; import { useI18n } from "@useI18n";
import { transformToIndexedArray } from "@utils"; import { transformToIndexedArray, arrayToObject } from "@utils";
import { useNotificationStatus } from "@logics_common"; import { useNotificationStatus } from "@logics_common";
export const useTranslation = () => { export const useTranslation = () => {
@@ -17,8 +18,12 @@ export const useTranslation = () => {
const { currentCTranslate2WeightTypeStatus, updateCTranslate2WeightTypeStatus, pendingCTranslate2WeightTypeStatus } = useStore_CTranslate2WeightTypeStatus(); const { currentCTranslate2WeightTypeStatus, updateCTranslate2WeightTypeStatus, pendingCTranslate2WeightTypeStatus } = useStore_CTranslate2WeightTypeStatus();
const { currentSelectedCTranslate2WeightType, updateSelectedCTranslate2WeightType, pendingSelectedCTranslate2WeightType } = useStore_SelectedCTranslate2WeightType(); const { currentSelectedCTranslate2WeightType, updateSelectedCTranslate2WeightType, pendingSelectedCTranslate2WeightType } = useStore_SelectedCTranslate2WeightType();
const { currentSelectableCTranslate2ComputeDeviceList, updateSelectableCTranslate2ComputeDeviceList, pendingSelectableCTranslate2ComputeDeviceList } = useStore_SelectableCTranslate2ComputeDeviceList();
const { currentSelectedCTranslate2ComputeDevice, updateSelectedCTranslate2ComputeDevice, pendingSelectedCTranslate2ComputeDevice } = useStore_SelectedCTranslate2ComputeDevice(); const { currentSelectedTranslationComputeType, updateSelectedTranslationComputeType, pendingSelectedTranslationComputeType } = useStore_SelectedTranslationComputeType();
const { currentSelectableTranslationComputeDeviceList, updateSelectableTranslationComputeDeviceList, pendingSelectableTranslationComputeDeviceList } = useStore_SelectableTranslationComputeDeviceList();
const { currentSelectedTranslationComputeDevice, updateSelectedTranslationComputeDevice, pendingSelectedTranslationComputeDevice } = useStore_SelectedTranslationComputeDevice();
const { currentDeepLAuthKey, updateDeepLAuthKey, pendingDeepLAuthKey } = useStore_DeepLAuthKey(); const { currentDeepLAuthKey, updateDeepLAuthKey, pendingDeepLAuthKey } = useStore_DeepLAuthKey();
@@ -80,28 +85,45 @@ export const useTranslation = () => {
}; };
const getSelectableCTranslate2ComputeDeviceList = () => { const getSelectedTranslationComputeType = () => {
pendingSelectableCTranslate2ComputeDeviceList(); pendingSelectedTranslationComputeType();
asyncStdoutToPython("/get/data/selected_translation_compute_type");
};
const setSelectedTranslationComputeType = (selected_translation_compute_type) => {
pendingSelectedTranslationComputeType();
asyncStdoutToPython("/set/data/selected_translation_compute_type", selected_translation_compute_type);
};
const setSuccessSelectedTranslationComputeType = (selected_translation_compute_type) => {
updateSelectedTranslationComputeType(selected_translation_compute_type);
showNotification_SaveSuccess();
};
const getSelectableTranslationComputeDeviceList = () => {
pendingSelectableTranslationComputeDeviceList();
asyncStdoutToPython("/get/data/translation_compute_device_list"); asyncStdoutToPython("/get/data/translation_compute_device_list");
}; };
const updateSelectableCTranslate2ComputeDeviceList_FromBackend = (payload) => { const updateSelectableTranslationComputeDeviceList_FromBackend = (payload) => {
updateSelectableCTranslate2ComputeDeviceList(transformToIndexedArray(payload)); updateSelectableTranslationComputeDeviceList(transformToIndexedArray(payload));
}; };
const getSelectedCTranslate2ComputeDevice = () => { const getSelectedTranslationComputeDevice = () => {
pendingSelectedCTranslate2ComputeDevice(); pendingSelectedTranslationComputeDevice();
asyncStdoutToPython("/get/data/selected_translation_compute_device"); asyncStdoutToPython("/get/data/selected_translation_compute_device");
}; };
const setSelectedCTranslate2ComputeDevice = (selected_translation_compute_device) => { const setSelectedTranslationComputeDevice = (selected_translation_compute_device) => {
pendingSelectedCTranslate2ComputeDevice(); pendingSelectedTranslationComputeDevice();
asyncStdoutToPython("/set/data/selected_translation_compute_device", selected_translation_compute_device); asyncStdoutToPython("/set/data/selected_translation_compute_device", selected_translation_compute_device);
}; };
const setSuccessSelectedCTranslate2ComputeDevice = (selected_translation_compute_device) => { const setSuccessSelectedTranslationComputeDevice = (selected_translation_compute_device) => {
updateSelectedCTranslate2ComputeDevice(selected_translation_compute_device); updateSelectedTranslationComputeDevice(selected_translation_compute_device);
showNotification_SaveSuccess(); showNotification_SaveSuccess();
}; };
@@ -146,16 +168,24 @@ export const useTranslation = () => {
setSelectedCTranslate2WeightType, setSelectedCTranslate2WeightType,
setSuccessSelectedCTranslate2WeightType, setSuccessSelectedCTranslate2WeightType,
currentSelectableCTranslate2ComputeDeviceList,
getSelectableCTranslate2ComputeDeviceList,
updateSelectableCTranslate2ComputeDeviceList,
updateSelectableCTranslate2ComputeDeviceList_FromBackend,
currentSelectedCTranslate2ComputeDevice, currentSelectedTranslationComputeType,
getSelectedCTranslate2ComputeDevice, getSelectedTranslationComputeType,
updateSelectedCTranslate2ComputeDevice, updateSelectedTranslationComputeType,
setSelectedCTranslate2ComputeDevice, setSelectedTranslationComputeType,
setSuccessSelectedCTranslate2ComputeDevice, setSuccessSelectedTranslationComputeType,
currentSelectableTranslationComputeDeviceList,
getSelectableTranslationComputeDeviceList,
updateSelectableTranslationComputeDeviceList,
updateSelectableTranslationComputeDeviceList_FromBackend,
currentSelectedTranslationComputeDevice,
getSelectedTranslationComputeDevice,
updateSelectedTranslationComputeDevice,
setSelectedTranslationComputeDevice,
setSuccessSelectedTranslationComputeDevice,
currentDeepLAuthKey, currentDeepLAuthKey,
getDeepLAuthKey, getDeepLAuthKey,

View File

@@ -168,19 +168,22 @@ export const ROUTE_META_LIST = [
{ endpoint: "/delete/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "deleteSuccessDeepLAuthKey" }, { endpoint: "/delete/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "deleteSuccessDeepLAuthKey" },
// Translation (AI Models) // Translation (AI Models)
{ endpoint: "/get/data/selectable_ctranslate2_weight_type_dict", ns: configs, hook_name: "useTranslation", method_name: "updateDownloadedCTranslate2WeightTypeStatus" },
{ endpoint: "/get/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2WeightType" }, { endpoint: "/get/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2WeightType" },
{ endpoint: "/set/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedCTranslate2WeightType" }, { endpoint: "/set/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedCTranslate2WeightType" },
{ endpoint: "/get/data/selectable_ctranslate2_weight_type_dict", ns: configs, hook_name: "useTranslation", method_name: "updateDownloadedCTranslate2WeightTypeStatus" }, { endpoint: "/run/selected_translation_compute_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedTranslationComputeType" },
{ endpoint: "/get/data/selected_translation_compute_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedTranslationComputeType" },
{ endpoint: "/set/data/selected_translation_compute_type", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedTranslationComputeType" },
{ endpoint: "/run/downloaded_ctranslate2_weight", ns: configs, hook_name: "useTranslation", method_name: "downloadedCTranslate2WeightType" }, { endpoint: "/run/downloaded_ctranslate2_weight", ns: configs, hook_name: "useTranslation", method_name: "downloadedCTranslate2WeightType" },
{ endpoint: "/run/download_ctranslate2_weight", ns: null, hook_name: null, method_name: null }, { endpoint: "/run/download_ctranslate2_weight", ns: null, hook_name: null, method_name: null },
{ endpoint: "/run/download_progress_ctranslate2_weight", ns: configs, hook_name: "useTranslation", method_name: "updateDownloadProgressCTranslate2WeightTypeStatus" }, { endpoint: "/run/download_progress_ctranslate2_weight", ns: configs, hook_name: "useTranslation", method_name: "updateDownloadProgressCTranslate2WeightTypeStatus" },
{ endpoint: "/get/data/translation_compute_device_list", ns: configs, hook_name: "useTranslation", method_name: "updateSelectableCTranslate2ComputeDeviceList_FromBackend" }, { endpoint: "/get/data/translation_compute_device_list", ns: configs, hook_name: "useTranslation", method_name: "updateSelectableTranslationComputeDeviceList_FromBackend" },
{ endpoint: "/get/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2ComputeDevice" }, { endpoint: "/get/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedTranslationComputeDevice" },
{ endpoint: "/set/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedCTranslate2ComputeDevice" }, { endpoint: "/set/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedTranslationComputeDevice" },
// Transcription // Transcription
@@ -211,18 +214,22 @@ export const ROUTE_META_LIST = [
{ endpoint: "/get/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionEngine" }, { endpoint: "/get/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionEngine" },
{ endpoint: "/set/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedTranscriptionEngine" }, { endpoint: "/set/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedTranscriptionEngine" },
{ endpoint: "/get/data/selectable_whisper_weight_type_dict", ns: configs, hook_name: "useTranscription", method_name: "updateDownloadedWhisperWeightTypeStatus" },
{ endpoint: "/get/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperWeightType" }, { endpoint: "/get/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperWeightType" },
{ endpoint: "/set/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedWhisperWeightType" }, { endpoint: "/set/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedWhisperWeightType" },
{ endpoint: "/get/data/selectable_whisper_weight_type_dict", ns: configs, hook_name: "useTranscription", method_name: "updateDownloadedWhisperWeightTypeStatus" }, { endpoint: "/run/selected_transcription_compute_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionComputeType" },
{ endpoint: "/get/data/selected_transcription_compute_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionComputeType" },
{ endpoint: "/set/data/selected_transcription_compute_type", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedTranscriptionComputeType" },
{ endpoint: "/run/downloaded_whisper_weight", ns: configs, hook_name: "useTranscription", method_name: "downloadedWhisperWeightType" }, { endpoint: "/run/downloaded_whisper_weight", ns: configs, hook_name: "useTranscription", method_name: "downloadedWhisperWeightType" },
{ endpoint: "/run/download_whisper_weight", ns: null, hook_name: null, method_name: null }, { endpoint: "/run/download_whisper_weight", ns: null, hook_name: null, method_name: null },
{ endpoint: "/run/download_progress_whisper_weight", ns: configs, hook_name: "useTranscription", method_name: "updateDownloadProgressWhisperWeightTypeStatus" }, { endpoint: "/run/download_progress_whisper_weight", ns: configs, hook_name: "useTranscription", method_name: "updateDownloadProgressWhisperWeightTypeStatus" },
{ endpoint: "/get/data/transcription_compute_device_list", ns: configs, hook_name: "useTranscription", method_name: "updateSelectableWhisperComputeDeviceList_FromBackend" }, { endpoint: "/get/data/transcription_compute_device_list", ns: configs, hook_name: "useTranscription", method_name: "updateSelectableTranscriptionComputeDeviceList_FromBackend" },
{ endpoint: "/get/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperComputeDevice" }, { endpoint: "/get/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionComputeDevice" },
{ endpoint: "/set/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedWhisperComputeDevice" }, { endpoint: "/set/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedTranscriptionComputeDevice" },
// Transcription (Advanced) // Transcription (Advanced)
{ endpoint: "/get/data/mic_avg_logprob", ns: configs, hook_name: "useTranscription", method_name: "updateMicAvgLogprob" }, { endpoint: "/get/data/mic_avg_logprob", ns: configs, hook_name: "useTranscription", method_name: "updateMicAvgLogprob" },

View File

@@ -218,10 +218,12 @@ export const { atomInstance: Atom_MicWordFilterList, useHook: useStore_MicWordFi
// Translation // Translation
export const { atomInstance: Atom_DeepLAuthKey, useHook: useStore_DeepLAuthKey } = createAtomWithHook(null, "DeepLAuthKey"); export const { atomInstance: Atom_DeepLAuthKey, useHook: useStore_DeepLAuthKey } = createAtomWithHook(null, "DeepLAuthKey");
export const { atomInstance: Atom_SelectedCTranslate2WeightType, useHook: useStore_SelectedCTranslate2WeightType } = createAtomWithHook("", "SelectedCTranslate2WeightType"); export const { atomInstance: Atom_SelectedCTranslate2WeightType, useHook: useStore_SelectedCTranslate2WeightType } = createAtomWithHook("", "SelectedCTranslate2WeightType");
export const { atomInstance: Atom_SelectableCTranslate2ComputeDeviceList, useHook: useStore_SelectableCTranslate2ComputeDeviceList } = createAtomWithHook({}, "SelectableCTranslate2ComputeDeviceList");
export const { atomInstance: Atom_SelectedCTranslate2ComputeDevice, useHook: useStore_SelectedCTranslate2ComputeDevice } = createAtomWithHook("", "SelectedCTranslate2ComputeDevice");
export const { atomInstance: Atom_CTranslate2WeightTypeStatus, useHook: useStore_CTranslate2WeightTypeStatus } = createAtomWithHook(ctranslate2_weight_type_status, "CTranslate2WeightTypeStatus"); export const { atomInstance: Atom_CTranslate2WeightTypeStatus, useHook: useStore_CTranslate2WeightTypeStatus } = createAtomWithHook(ctranslate2_weight_type_status, "CTranslate2WeightTypeStatus");
export const { atomInstance: Atom_SelectableTranslationComputeDeviceList, useHook: useStore_SelectableTranslationComputeDeviceList } = createAtomWithHook({}, "SelectableTranslationComputeDeviceList");
export const { atomInstance: Atom_SelectedTranslationComputeDevice, useHook: useStore_SelectedTranslationComputeDevice } = createAtomWithHook("", "SelectedTranslationComputeDevice");
export const { atomInstance: Atom_SelectedTranslationComputeType, useHook: useStore_SelectedTranslationComputeType } = createAtomWithHook("", "SelectedTranslationComputeType");
// Transcription // Transcription
export const { atomInstance: Atom_MicRecordTimeout, useHook: useStore_MicRecordTimeout } = createAtomWithHook(0, "MicRecordTimeout"); export const { atomInstance: Atom_MicRecordTimeout, useHook: useStore_MicRecordTimeout } = createAtomWithHook(0, "MicRecordTimeout");
export const { atomInstance: Atom_MicPhraseTimeout, useHook: useStore_MicPhraseTimeout } = createAtomWithHook(0, "MicPhraseTimeout"); export const { atomInstance: Atom_MicPhraseTimeout, useHook: useStore_MicPhraseTimeout } = createAtomWithHook(0, "MicPhraseTimeout");
@@ -235,8 +237,9 @@ export const { atomInstance: Atom_SelectedWhisperWeightType, useHook: useStore_S
export const { atomInstance: Atom_WhisperWeightTypeStatus, useHook: useStore_WhisperWeightTypeStatus } = createAtomWithHook(whisper_weight_type_status, "WhisperWeightTypeStatus"); export const { atomInstance: Atom_WhisperWeightTypeStatus, useHook: useStore_WhisperWeightTypeStatus } = createAtomWithHook(whisper_weight_type_status, "WhisperWeightTypeStatus");
export const { atomInstance: Atom_SelectedTranscriptionEngine, useHook: useStore_SelectedTranscriptionEngine } = createAtomWithHook(whisper_weight_type_status, "SelectedTranscriptionEngine"); export const { atomInstance: Atom_SelectedTranscriptionEngine, useHook: useStore_SelectedTranscriptionEngine } = createAtomWithHook(whisper_weight_type_status, "SelectedTranscriptionEngine");
export const { atomInstance: Atom_SelectableWhisperComputeDeviceList, useHook: useStore_SelectableWhisperComputeDeviceList } = createAtomWithHook({}, "SelectableWhisperComputeDeviceList"); export const { atomInstance: Atom_SelectableTranscriptionComputeDeviceList, useHook: useStore_SelectableTranscriptionComputeDeviceList } = createAtomWithHook({}, "SelectableTranscriptionComputeDeviceList");
export const { atomInstance: Atom_SelectedWhisperComputeDevice, useHook: useStore_SelectedWhisperComputeDevice } = createAtomWithHook("", "SelectedWhisperComputeDevice"); export const { atomInstance: Atom_SelectedTranscriptionComputeDevice, useHook: useStore_SelectedTranscriptionComputeDevice } = createAtomWithHook("", "SelectedTranscriptionComputeDevice");
export const { atomInstance: Atom_SelectedTranscriptionComputeType, useHook: useStore_SelectedTranscriptionComputeType } = createAtomWithHook("", "SelectedTranscriptionComputeType");
export const { atomInstance: Atom_MicAvgLogprob, useHook: useStore_MicAvgLogprob } = createAtomWithHook(-0.8, "MicAvgLogprob"); export const { atomInstance: Atom_MicAvgLogprob, useHook: useStore_MicAvgLogprob } = createAtomWithHook(-0.8, "MicAvgLogprob");
export const { atomInstance: Atom_MicNoSpeechProb, useHook: useStore_MicNoSpeechProb } = createAtomWithHook(0.6, "MicNoSpeechProb"); export const { atomInstance: Atom_MicNoSpeechProb, useHook: useStore_MicNoSpeechProb } = createAtomWithHook(0.6, "MicNoSpeechProb");