👍️[Update] Controller : CUDAが使用できない場合にデバイス設定をcudaからcpuに変更する処理を追加
This commit is contained in:
@@ -398,10 +398,6 @@ class Controller:
|
||||
def getTransparencyRange(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.TRANSPARENCY_RANGE}
|
||||
|
||||
@staticmethod
|
||||
def getAppearanceThemesList(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.APPEARANCE_THEME_LIST}
|
||||
|
||||
@staticmethod
|
||||
def getUiScalingRange(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.UI_SCALING_RANGE}
|
||||
@@ -416,8 +412,11 @@ class Controller:
|
||||
|
||||
@staticmethod
|
||||
def getComputeDeviceList(*args, **kwargs) -> dict:
|
||||
device_list = [{"type":"cuda", "device_index": i, "name": torch.cuda.get_device_name(i)} for i in range(torch.cuda.device_count())]
|
||||
device_list.append({"type":"cpu", "device_index": 0, "name": "cpu"})
|
||||
device_list = []
|
||||
if torch.cuda.is_available():
|
||||
for i in range(torch.cuda.device_count()):
|
||||
device_list.append({"device":"cuda", "device_index": i, "name": torch.cuda.get_device_name(i)})
|
||||
device_list.append({"device":"cpu", "device_index": 0, "name": "cpu"})
|
||||
return {"status":200, "result":device_list}
|
||||
|
||||
@staticmethod
|
||||
@@ -615,15 +614,6 @@ class Controller:
|
||||
config.TRANSPARENCY = int(data)
|
||||
return {"status":200, "result":config.TRANSPARENCY}
|
||||
|
||||
@staticmethod
|
||||
def getAppearanceTheme(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.APPEARANCE_THEME}
|
||||
|
||||
@staticmethod
|
||||
def setAppearanceTheme(data, *args, **kwargs) -> dict:
|
||||
config.APPEARANCE_THEME = data
|
||||
return {"status":200, "result":config.APPEARANCE_THEME}
|
||||
|
||||
@staticmethod
|
||||
def getUiScaling(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.UI_SCALING}
|
||||
@@ -1639,6 +1629,14 @@ class Controller:
|
||||
th_download.daemon = True
|
||||
th_download.start()
|
||||
|
||||
@staticmethod
|
||||
def updateComputeDeviceSettings() -> None:
|
||||
if torch.cuda.is_available() is False:
|
||||
if config.SELECTED_TRANSLATION_COMPUTE_DEVICE["device"] != "cpu":
|
||||
config.SELECTED_TRANSLATION_COMPUTE_DEVICE = {"device":"cpu", "device_id":0, "device_name":"cpu"}
|
||||
if config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE["device"] != "cpu":
|
||||
config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE = {"device":"cpu", "device_id":0, "device_name":"cpu"}
|
||||
|
||||
@staticmethod
|
||||
def startWatchdog(*args, **kwargs) -> dict:
|
||||
model.startWatchdog()
|
||||
@@ -1689,6 +1687,10 @@ class Controller:
|
||||
self.updateDownloadedWhisperModelWeight()
|
||||
self.updateTranscriptionEngine()
|
||||
|
||||
# set Compute CPU or CUDA
|
||||
printLog("Set Compute CPU or CUDA")
|
||||
self.updateComputeDeviceSettings()
|
||||
|
||||
# set word filter
|
||||
printLog("Set Word Filter")
|
||||
model.addKeywords()
|
||||
|
||||
Reference in New Issue
Block a user