From bde95029b3f3ccdb56b9b17e4d731c0044cdbcb0 Mon Sep 17 00:00:00 2001 From: w-okada Date: Sat, 8 Jul 2023 19:02:44 +0900 Subject: [PATCH] Bugfix: RVC fallback --- server/voice_changer/RVC/RVC.py | 6 +++--- server/voice_changer/VoiceChanger.py | 11 ----------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/server/voice_changer/RVC/RVC.py b/server/voice_changer/RVC/RVC.py index e6d571e8..ae5a0898 100644 --- a/server/voice_changer/RVC/RVC.py +++ b/server/voice_changer/RVC/RVC.py @@ -191,11 +191,11 @@ class RVC(VoiceChangerModel): result = audio_out.detach().cpu().numpy() * np.sqrt(vol) return result - except DeviceCannotSupportHalfPrecisionException as e: + except DeviceCannotSupportHalfPrecisionException as e: # NOQA print("[Device Manager] Device cannot support half precision. Fallback to float....") self.deviceManager.setForceTensor(True) - self.prepareModel(self.settings.modelSlotIndex) - raise e + self.initialize() + # raise e return diff --git a/server/voice_changer/VoiceChanger.py b/server/voice_changer/VoiceChanger.py index 41255a6c..9f73e0f8 100755 --- a/server/voice_changer/VoiceChanger.py +++ b/server/voice_changer/VoiceChanger.py @@ -10,7 +10,6 @@ import resampy from voice_changer.IORecorder import IORecorder -from voice_changer.utils.LoadModelParams import LoadModelParams from voice_changer.utils.Timer import Timer from voice_changer.utils.VoiceChangerModel import AudioInOut, VoiceChangerModel @@ -90,16 +89,6 @@ class VoiceChanger: else: return {"status": "OK", "vc": "none"} - def loadModel(self, props: LoadModelParams): - try: - if self.voiceChanger is None: - raise VoiceChangerIsNotSelectedException("Voice Changer is not selected.") - return self.voiceChanger.loadModel(props) - except Exception as e: - print(traceback.format_exc()) - print("[Voice Changer] Model Load Error! Check your model is valid.", e) - return {"status": "NG"} - def get_info(self): data = asdict(self.settings) if self.voiceChanger is not None: