From 2da19efb1944c86c606310d35695832cc99027ab Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Wed, 30 Oct 2024 10:30:31 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8D=EF=B8=8F[Update]=20Model=20:=20?= =?UTF-8?q?=E3=83=96=E3=83=AD=E3=82=B0=E3=83=AC=E3=82=B9=E3=81=AE=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=82=92model.bin=E3=81=AE=E3=83=80=E3=82=A6=E3=83=B3?= =?UTF-8?q?=E3=83=AD=E3=83=BC=E3=83=89=E3=81=AE=E3=81=BF=E3=81=AB=E5=A4=89?= =?UTF-8?q?=E6=9B=B4/wisper=E3=81=AEweight=E3=81=AE=E8=A1=A8=E8=A8=98?= =?UTF-8?q?=E3=81=AB=E5=90=88=E3=82=8F=E3=81=9B=E3=81=A6ctanslate2?= =?UTF-8?q?=E3=81=AEweight=E3=82=82=E5=B0=8F=E6=96=87=E5=AD=97=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-python/config.py | 6 +++--- src-python/models/transcription/transcription_whisper.py | 2 +- src-python/models/translation/translation_utils.py | 8 ++++---- src-python/webui_mainloop.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src-python/config.py b/src-python/config.py index a7a8e747..52fa5f07 100644 --- a/src-python/config.py +++ b/src-python/config.py @@ -923,8 +923,8 @@ class Config: self._TEXTBOX_UI_SCALING_RANGE = (40, 200) self._MESSAGE_BOX_RATIO_RANGE = (1, 99) self._SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_DICT = { - "Small": False, - "Large": False, + "small": False, + "large": False, } self._SELECTABLE_WHISPER_WEIGHT_TYPE_DICT = { @@ -1071,7 +1071,7 @@ class Config: self._USE_EXCLUDE_WORDS = True self._SELECTED_TRANSLATION_COMPUTE_DEVICE = {"device": "cpu", "device_index": 0, "device_name":"cpu"} self._SELECTED_TRANSCRIPTION_COMPUTE_DEVICE = {"device": "cpu", "device_index": 0, "device_name":"cpu"} - self._CTRANSLATE2_WEIGHT_TYPE = "Small" + self._CTRANSLATE2_WEIGHT_TYPE = "small" self._WHISPER_WEIGHT_TYPE = "base" self._SEND_MESSAGE_FORMAT = "[message]" self._SEND_MESSAGE_FORMAT_WITH_T = "[message]([translation])" diff --git a/src-python/models/transcription/transcription_whisper.py b/src-python/models/transcription/transcription_whisper.py index d21df91a..049af84a 100644 --- a/src-python/models/transcription/transcription_whisper.py +++ b/src-python/models/transcription/transcription_whisper.py @@ -70,7 +70,7 @@ def downloadWhisperWeight(root, weight_type, callback=None, end_callback=None): for filename in _FILENAMES: file_path = os_path.join(path, filename) url = huggingface_hub.hf_hub_url(_MODELS[weight_type], filename) - downloadFile(url, file_path, func=callback) + downloadFile(url, file_path, func=callback if filename == "model.bin" else None) if isinstance(end_callback, Callable): end_callback() diff --git a/src-python/models/translation/translation_utils.py b/src-python/models/translation/translation_utils.py index dbe06e76..f6312884 100644 --- a/src-python/models/translation/translation_utils.py +++ b/src-python/models/translation/translation_utils.py @@ -8,7 +8,7 @@ import hashlib from utils import printLog ctranslate2_weights = { - "Small": { # M2M-100 418M-parameter model + "small": { # M2M-100 418M-parameter model "url": "https://github.com/misyaguziya/VRCT-weights/releases/download/v1.0/m2m100_418m.zip", "directory_name": "m2m100_418m", "tokenizer": "facebook/m2m100_418M", @@ -18,7 +18,7 @@ ctranslate2_weights = { "shared_vocabulary.txt": "bd440aa21b8ca3453fc792a0018a1f3fe68b3464aadddd4d16a4b72f73c86d8c", } }, - "Large": { # M2M-100 1.2B-parameter model + "large": { # M2M-100 1.2B-parameter model "url": "https://github.com/misyaguziya/VRCT-weights/releases/download/v1.0/m2m100_12b.zip", "directory_name": "m2m100_12b", "tokenizer": "facebook/m2m100_1.2b", @@ -39,7 +39,7 @@ def calculate_file_hash(file_path, block_size=65536): return hash_object.hexdigest() -def checkCTranslate2Weight(root, weight_type="Small"): +def checkCTranslate2Weight(root, weight_type="small"): weight_directory_name = ctranslate2_weights[weight_type]["directory_name"] hash_data = ctranslate2_weights[weight_type]["hash"] files = [ @@ -61,7 +61,7 @@ def checkCTranslate2Weight(root, weight_type="Small"): already_downloaded = True return already_downloaded -def downloadCTranslate2Weight(root, weight_type="Small", callback=None, end_callback=None): +def downloadCTranslate2Weight(root, weight_type="small", callback=None, end_callback=None): url = ctranslate2_weights[weight_type]["url"] filename = "weight.zip" path = os_path.join(root, "weights", "ctranslate2") diff --git a/src-python/webui_mainloop.py b/src-python/webui_mainloop.py index baddba4c..a3deffcd 100644 --- a/src-python/webui_mainloop.py +++ b/src-python/webui_mainloop.py @@ -512,7 +512,7 @@ if __name__ == "__main__": case "/set/data/ui_language": data = "ja" case "/set/data/ctranslate2_weight_type": - data = "Small" + data = "small" case "/set/data/deepl_auth_key": data = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:fx" case "/set/data/selected_mic_host":