[Update] Rename and add methods for CTranslate2 compute type management in Controller
This commit is contained in:
@@ -1456,11 +1456,15 @@ class Controller:
|
||||
return {"status":200, "result":config.CTRANSLATE2_WEIGHT_TYPE}
|
||||
|
||||
@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}
|
||||
|
||||
@staticmethod
|
||||
def setCtranslateComputeType(data, *args, **kwargs) -> dict:
|
||||
def setCtranslate2ComputeType(data, *args, **kwargs) -> dict:
|
||||
config.CTRANSLATE2_COMPUTE_TYPE = str(data)
|
||||
if model.checkTranslatorCTranslate2ModelWeight(config.CTRANSLATE2_WEIGHT_TYPE):
|
||||
def callback():
|
||||
|
||||
@@ -162,8 +162,10 @@ mapping = {
|
||||
"/get/data/ctranslate2_weight_type": {"status": True, "variable":controller.getCtranslate2WeightType},
|
||||
"/set/data/ctranslate2_weight_type": {"status": True, "variable":controller.setCtranslate2WeightType},
|
||||
|
||||
"/get/data/ctranslate2_compute_type": {"status": True, "variable":controller.getCtranslateComputeType},
|
||||
"/set/data/ctranslate2_compute_type": {"status": True, "variable":controller.setCtranslateComputeType},
|
||||
"/get/data/ctranslate2_compute_type_list": {"status": True, "variable":controller.getCtranslate2ComputeTypeList},
|
||||
|
||||
"/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},
|
||||
|
||||
@@ -268,6 +270,8 @@ mapping = {
|
||||
"/get/data/whisper_weight_type": {"status": True, "variable":controller.getWhisperWeightType},
|
||||
"/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},
|
||||
"/set/data/whisper_compute_type": {"status": True, "variable":controller.setWhisperComputeType},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user