mirror of
https://github.com/w-okada/voice-changer.git
synced 2025-02-03 00:33:57 +03:00
improve half precision check, and fallback(exp.)
This commit is contained in:
parent
28fa21a6b4
commit
9d6ae2fe2e
@ -377,16 +377,18 @@ class RVC:
|
|||||||
repeat,
|
repeat,
|
||||||
protect,
|
protect,
|
||||||
)
|
)
|
||||||
except DeviceCannotSupportHalfPrecisionException:
|
result = audio_out.detach().cpu().numpy() * np.sqrt(vol)
|
||||||
|
|
||||||
|
return result
|
||||||
|
except DeviceCannotSupportHalfPrecisionException as e:
|
||||||
print(
|
print(
|
||||||
"[Device Manager] Device cannot support half precision. Fallback to float...."
|
"[Device Manager] Device cannot support half precision. Fallback to float...."
|
||||||
)
|
)
|
||||||
self.deviceManager.setForceTensor(True)
|
self.deviceManager.setForceTensor(True)
|
||||||
self.prepareModel(self.settings.modelSlotIndex)
|
self.prepareModel(self.settings.modelSlotIndex)
|
||||||
|
raise e
|
||||||
|
|
||||||
result = audio_out.detach().cpu().numpy() * np.sqrt(vol)
|
return
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
del self.pipeline
|
del self.pipeline
|
||||||
|
@ -17,6 +17,7 @@ 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 VoiceChangerModel, AudioInOut
|
from voice_changer.utils.VoiceChangerModel import VoiceChangerModel, AudioInOut
|
||||||
from Exceptions import (
|
from Exceptions import (
|
||||||
|
DeviceCannotSupportHalfPrecisionException,
|
||||||
DeviceChangingException,
|
DeviceChangingException,
|
||||||
HalfPrecisionChangingException,
|
HalfPrecisionChangingException,
|
||||||
NoModeLoadedException,
|
NoModeLoadedException,
|
||||||
@ -580,6 +581,9 @@ class VoiceChanger:
|
|||||||
"[Voice Changer] Voice Changer is not selected. Wait a bit and if there is no improvement, please re-select vc."
|
"[Voice Changer] Voice Changer is not selected. Wait a bit and if there is no improvement, please re-select vc."
|
||||||
)
|
)
|
||||||
return np.zeros(1).astype(np.int16), [0, 0, 0]
|
return np.zeros(1).astype(np.int16), [0, 0, 0]
|
||||||
|
except DeviceCannotSupportHalfPrecisionException:
|
||||||
|
# RVC.pyでfallback処理をするので、ここはダミーデータ返すだけ。
|
||||||
|
return np.zeros(1).astype(np.int16), [0, 0, 0]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("[Voice Changer] VC PROCESSING EXCEPTION!!!", e)
|
print("[Voice Changer] VC PROCESSING EXCEPTION!!!", e)
|
||||||
print(traceback.format_exc())
|
print(traceback.format_exc())
|
||||||
|
Loading…
Reference in New Issue
Block a user