From ddf7fadc910b3f618d2ad6893693390dc49fc86f Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Tue, 3 Dec 2024 08:21:43 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B[bugfix]=20Config=20:=20compute=20d?= =?UTF-8?q?evice=20"name"=20->=20"device=5Fname"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-python/config.py | 10 ++++++---- src-python/webui_controller.py | 12 ------------ 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src-python/config.py b/src-python/config.py index 73f6dc1a..68c5a96a 100644 --- a/src-python/config.py +++ b/src-python/config.py @@ -930,8 +930,8 @@ class Config: self._SELECTABLE_COMPUTE_DEVICE_LIST = [] if torch.cuda.is_available(): for i in range(torch.cuda.device_count()): - self._SELECTABLE_COMPUTE_DEVICE_LIST.append({"device":"cuda", "device_index": i, "name": torch.cuda.get_device_name(i)}) - self._SELECTABLE_COMPUTE_DEVICE_LIST.append({"device":"cpu", "device_index": 0, "name": "cpu"}) + self._SELECTABLE_COMPUTE_DEVICE_LIST.append({"device":"cuda", "device_index": i, "device_name": torch.cuda.get_device_name(i)}) + self._SELECTABLE_COMPUTE_DEVICE_LIST.append({"device":"cpu", "device_index": 0, "device_name": "cpu"}) self._SEND_MESSAGE_BUTTON_TYPE_LIST = ["show", "hide", "show_and_disable_enter_key"] self._SEND_MESSAGE_FORMAT = "[message]" self._SEND_MESSAGE_FORMAT_WITH_T = "[message]([translation])" @@ -1078,8 +1078,10 @@ class Config: for key, value in self._config_data.items(): try: setattr(self, key, value) - except: - pass + except Exception: + import traceback + with open('error.log', 'a') as f: + traceback.print_exc(file=f) with open(self.PATH_CONFIG, 'w', encoding="utf-8") as fp: for var_name, var_func in json_serializable_vars.items(): diff --git a/src-python/webui_controller.py b/src-python/webui_controller.py index 110d0086..50b3b37d 100644 --- a/src-python/webui_controller.py +++ b/src-python/webui_controller.py @@ -1606,14 +1606,6 @@ class Controller: th_download.daemon = True th_download.start() - @staticmethod - def updateComputeDeviceSettings() -> None: - if config.COMPUTE_MODE == "cpu": - if config.SELECTED_TRANSLATION_COMPUTE_DEVICE["device"] != "cpu": - config.SELECTED_TRANSLATION_COMPUTE_DEVICE = {"device":"cpu", "device_index":0, "device_name":"cpu"} - if config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE["device"] != "cpu": - config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE = {"device":"cpu", "device_index":0, "device_name":"cpu"} - @staticmethod def startWatchdog(*args, **kwargs) -> dict: model.startWatchdog() @@ -1687,10 +1679,6 @@ class Controller: self.initializationProgress(3) - # set Compute CPU or CUDA - printLog("Set Compute CPU or CUDA") - self.updateComputeDeviceSettings() - # set word filter printLog("Set Word Filter") model.addKeywords()