[Update] Rename and add methods for CTranslate2 compute type management in Controller

This commit is contained in:
misyaguziya
2025-09-17 10:52:56 +09:00
parent 245855d0ca
commit 5f0f918642
2 changed files with 12 additions and 4 deletions

View File

@@ -1456,11 +1456,15 @@ class Controller:
return {"status":200, "result":config.CTRANSLATE2_WEIGHT_TYPE} return {"status":200, "result":config.CTRANSLATE2_WEIGHT_TYPE}
@staticmethod @staticmethod
def getCtranslateComputeType(*args, **kwargs) -> dict: def getCtranslate2ComputeTypeList(*args, **kwargs) -> dict:
return {"status":200, "result":config.SELECTABLE_CTRANSLATE2_COMPUTE_TYPE_LIST}
@staticmethod
def getCtranslate2ComputeType(*args, **kwargs) -> dict:
return {"status":200, "result":config.CTRANSLATE2_COMPUTE_TYPE} return {"status":200, "result":config.CTRANSLATE2_COMPUTE_TYPE}
@staticmethod @staticmethod
def setCtranslateComputeType(data, *args, **kwargs) -> dict: def setCtranslate2ComputeType(data, *args, **kwargs) -> dict:
config.CTRANSLATE2_COMPUTE_TYPE = str(data) config.CTRANSLATE2_COMPUTE_TYPE = str(data)
if model.checkTranslatorCTranslate2ModelWeight(config.CTRANSLATE2_WEIGHT_TYPE): if model.checkTranslatorCTranslate2ModelWeight(config.CTRANSLATE2_WEIGHT_TYPE):
def callback(): def callback():

View File

@@ -162,8 +162,10 @@ 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/ctranslate2_compute_type": {"status": True, "variable":controller.getCtranslateComputeType}, "/get/data/ctranslate2_compute_type_list": {"status": True, "variable":controller.getCtranslate2ComputeTypeList},
"/set/data/ctranslate2_compute_type": {"status": True, "variable":controller.setCtranslateComputeType},
"/get/data/ctranslate2_compute_type": {"status": True, "variable":controller.getCtranslate2ComputeType},
"/set/data/ctranslate2_compute_type": {"status": True, "variable":controller.setCtranslate2ComputeType},
"/run/download_ctranslate2_weight": {"status": True, "variable":controller.downloadCtranslate2Weight}, "/run/download_ctranslate2_weight": {"status": True, "variable":controller.downloadCtranslate2Weight},
@@ -268,6 +270,8 @@ mapping = {
"/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/whisper_compute_type_list": {"status": True, "variable":controller.getWhisperComputeTypeList},
"/get/data/whisper_compute_type": {"status": True, "variable":controller.getWhisperComputeType}, "/get/data/whisper_compute_type": {"status": True, "variable":controller.getWhisperComputeType},
"/set/data/whisper_compute_type": {"status": True, "variable":controller.setWhisperComputeType}, "/set/data/whisper_compute_type": {"status": True, "variable":controller.setWhisperComputeType},