From d39d5a198e51a624a2361723fd6d2e9aba89697a Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Tue, 13 Jan 2026 11:15:31 +0900 Subject: [PATCH] =?UTF-8?q?[Update]=20=E4=BA=92=E6=8F=9B=E6=80=A7=E3=81=AE?= =?UTF-8?q?=E3=81=9F=E3=82=81=E3=81=AB=E5=8F=A4=E3=81=84=E3=83=A2=E3=83=87?= =?UTF-8?q?=E3=83=AB=E3=81=AE=E3=83=87=E3=82=A3=E3=83=AC=E3=82=AF=E3=83=88?= =?UTF-8?q?=E3=83=AA=E5=90=8D=E3=82=92=E5=A4=89=E6=9B=B4=E3=81=99=E3=82=8B?= =?UTF-8?q?=E6=A9=9F=E8=83=BD=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-python/models/translation/translation_utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src-python/models/translation/translation_utils.py b/src-python/models/translation/translation_utils.py index 23f24b15..f647c828 100644 --- a/src-python/models/translation/translation_utils.py +++ b/src-python/models/translation/translation_utils.py @@ -1,5 +1,6 @@ from os import path as os_path from os import makedirs as os_makedirs +from os import rename as os_rename from requests import get as requests_get from typing import Callable import transformers @@ -50,6 +51,19 @@ ctranslate2_weights = { def checkCTranslate2Weight(root: str, weight_type: str = "m2m100_418M-ct2-int8"): weight_directory_name = ctranslate2_weights[weight_type]["directory_name"] path = os_path.join(root, "weights", "ctranslate2", weight_directory_name) + + # 後方互換のためファイル名を変更する + legacy_dirs = { + "m2m100_418M-ct2-int8": "m2m100_418M", + "m2m100_1.2B-ct2-int8": "m2m100_12b", + } + + legacy_dir = legacy_dirs.get(weight_type, None) + if legacy_dir: + old_path = os_path.join(root, "weights", "ctranslate2", legacy_dir) + if os_path.isdir(old_path): + os_rename(old_path, path) + try: # モデルロード可能かどうかで判定 compute_type = getBestComputeType("cpu", 0)