Bugfix: RVC fallback

This commit is contained in:
w-okada 2023-07-08 19:02:44 +09:00
parent 130ae7e398
commit bde95029b3
2 changed files with 3 additions and 14 deletions

View File

@ -191,11 +191,11 @@ class RVC(VoiceChangerModel):
result = audio_out.detach().cpu().numpy() * np.sqrt(vol) result = audio_out.detach().cpu().numpy() * np.sqrt(vol)
return result return result
except DeviceCannotSupportHalfPrecisionException as e: except DeviceCannotSupportHalfPrecisionException as e: # NOQA
print("[Device Manager] Device cannot support half precision. Fallback to float....") print("[Device Manager] Device cannot support half precision. Fallback to float....")
self.deviceManager.setForceTensor(True) self.deviceManager.setForceTensor(True)
self.prepareModel(self.settings.modelSlotIndex) self.initialize()
raise e # raise e
return return

View File

@ -10,7 +10,6 @@ import resampy
from voice_changer.IORecorder import IORecorder from voice_changer.IORecorder import IORecorder
from voice_changer.utils.LoadModelParams import LoadModelParams
from voice_changer.utils.Timer import Timer from voice_changer.utils.Timer import Timer
from voice_changer.utils.VoiceChangerModel import AudioInOut, VoiceChangerModel from voice_changer.utils.VoiceChangerModel import AudioInOut, VoiceChangerModel
@ -90,16 +89,6 @@ class VoiceChanger:
else: else:
return {"status": "OK", "vc": "none"} 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): def get_info(self):
data = asdict(self.settings) data = asdict(self.settings)
if self.voiceChanger is not None: if self.voiceChanger is not None: