🗑️ [Remove] Model : Whisperの不要な関数を削除

This commit is contained in:
misyaguziya
2024-10-29 15:58:21 +09:00
parent 192507a605
commit 134ef373af
3 changed files with 2 additions and 60 deletions

View File

@@ -677,17 +677,6 @@ class Config:
self._USE_TRANSLATION_FEATURE = value
self.saveConfig(inspect.currentframe().f_code.co_name, value)
@property
@json_serializable('USE_WHISPER_FEATURE')
def USE_WHISPER_FEATURE(self):
return self._USE_WHISPER_FEATURE
@USE_WHISPER_FEATURE.setter
def USE_WHISPER_FEATURE(self, value):
if isinstance(value, bool):
self._USE_WHISPER_FEATURE = value
self.saveConfig(inspect.currentframe().f_code.co_name, value)
@property
@json_serializable('SELECTED_TRANSLATION_COMPUTE_DEVICE')
def SELECTED_TRANSLATION_COMPUTE_DEVICE(self):
@@ -1083,7 +1072,6 @@ class Config:
}
self._USE_EXCLUDE_WORDS = True
self._USE_TRANSLATION_FEATURE = True
self._USE_WHISPER_FEATURE = False
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"

View File

@@ -1092,35 +1092,6 @@ class Controller:
config.USE_TRANSLATION_FEATURE = False
return {"status":200, "result": config.USE_TRANSLATION_FEATURE}
@staticmethod
def getUseWhisperFeature(*args, **kwargs) -> dict:
return {"status":200, "result":config.USE_WHISPER_FEATURE}
@staticmethod
def setEnableUseWhisperFeature(*args, **kwargs) -> dict:
config.USE_WHISPER_FEATURE = True
if model.checkTranscriptionWhisperModelWeight() is True:
config.SELECTED_TRANSCRIPTION_ENGINE = "Whisper"
else:
config.SELECTED_TRANSCRIPTION_ENGINE = "Google"
return {"status":200,
"result":{
"feature":config.USE_WHISPER_FEATURE,
"transcription_engine":config.SELECTED_TRANSCRIPTION_ENGINE,
},
}
@staticmethod
def setDisableUseWhisperFeature(*args, **kwargs) -> dict:
config.USE_WHISPER_FEATURE = False
config.SELECTED_TRANSCRIPTION_ENGINE = "Google"
return {"status":200,
"result":{
"feature":config.USE_WHISPER_FEATURE,
"transcription_engine":config.SELECTED_TRANSCRIPTION_ENGINE,
},
}
@staticmethod
def getCtranslate2WeightType(*args, **kwargs) -> dict:
return {"status":200, "result":config.CTRANSLATE2_WEIGHT_TYPE}
@@ -1650,22 +1621,9 @@ class Controller:
printLog("Set Translation Engine")
self.updateTranslationEngineAndEngineList()
# check Downloaded CTranslate2 Model Weight
printLog("Check Downloaded CTranslate2 Model Weight")
if config.USE_TRANSLATION_FEATURE is True and model.checkCTranslatorCTranslate2ModelWeight() is False:
self.startThreadingDownloadCtranslate2Weight(self.downloadCTranslate2ProgressBar)
# set Transcription Engine
printLog("Set Transcription Engine")
if config.USE_WHISPER_FEATURE is True:
config.SELECTED_TRANSCRIPTION_ENGINE = "Whisper"
else:
config.SELECTED_TRANSCRIPTION_ENGINE = "Google"
# check Downloaded Whisper Model Weight
printLog("Check Downloaded Whisper Model Weight")
if config.USE_WHISPER_FEATURE is True and model.checkTranscriptionWhisperModelWeight() is False:
self.startThreadingDownloadWhisperWeight(self.downloadWhisperProgressBar)
# printLog("Set Transcription Engine")
# self.updateTranscriptionEngineAndEngineList()
# set word filter
printLog("Set Word Filter")

View File

@@ -246,10 +246,6 @@ mapping = {
"/get/data/whisper_weight_type": {"status": True, "variable":controller.getWhisperWeightType},
"/set/data/whisper_weight_type": {"status": True, "variable":controller.setWhisperWeightType},
"/get/data/use_whisper_feature": {"status": True, "variable":controller.getUseWhisperFeature},
"/set/enable/use_whisper_feature": {"status": True, "variable":controller.setEnableUseWhisperFeature},
"/set/disable/use_whisper_feature": {"status": True, "variable":controller.setDisableUseWhisperFeature},
"/run/download_whisper_weight": {"status": True, "variable":controller.downloadWhisperWeight},
# VR