mirror of
https://github.com/w-okada/voice-changer.git
synced 2025-01-23 13:35:12 +03:00
bugfix: mmvcv15 load only pytorch
This commit is contained in:
parent
d84e9a776b
commit
e5ad4b9504
@ -101,7 +101,7 @@ class MMVCv15:
|
|||||||
return self.get_info()
|
return self.get_info()
|
||||||
|
|
||||||
def update_settings(self, key: str, val: any):
|
def update_settings(self, key: str, val: any):
|
||||||
if key == "onnxExecutionProvider" and self.settings.onnxModelFile != "": # self.onnx_session != None:
|
if key == "onnxExecutionProvider" and self.settings.onnxModelFile != "" and self.settings.onnxModelFile != None:
|
||||||
if val == "CUDAExecutionProvider":
|
if val == "CUDAExecutionProvider":
|
||||||
if self.settings.gpu < 0 or self.settings.gpu >= self.gpu_num:
|
if self.settings.gpu < 0 or self.settings.gpu >= self.gpu_num:
|
||||||
self.settings.gpu = 0
|
self.settings.gpu = 0
|
||||||
@ -111,7 +111,7 @@ class MMVCv15:
|
|||||||
self.onnx_session.set_providers(providers=[val])
|
self.onnx_session.set_providers(providers=[val])
|
||||||
elif key in self.settings.intData:
|
elif key in self.settings.intData:
|
||||||
setattr(self.settings, key, int(val))
|
setattr(self.settings, key, int(val))
|
||||||
if key == "gpu" and val >= 0 and val < self.gpu_num and self.settings.onnxModelFile != "": # self.onnx_session != None:
|
if key == "gpu" and val >= 0 and val < self.gpu_num and self.settings.onnxModelFile != "" and self.settings.onnxModelFile != None:
|
||||||
providers = self.onnx_session.get_providers()
|
providers = self.onnx_session.get_providers()
|
||||||
print("Providers:", providers)
|
print("Providers:", providers)
|
||||||
if "CUDAExecutionProvider" in providers:
|
if "CUDAExecutionProvider" in providers:
|
||||||
@ -129,7 +129,8 @@ class MMVCv15:
|
|||||||
def get_info(self):
|
def get_info(self):
|
||||||
data = asdict(self.settings)
|
data = asdict(self.settings)
|
||||||
|
|
||||||
data["onnxExecutionProviders"] = self.onnx_session.get_providers() if self.settings.onnxModelFile != "" else []
|
data["onnxExecutionProviders"] = self.onnx_session.get_providers(
|
||||||
|
) if self.settings.onnxModelFile != "" and self.settings.onnxModelFile != None else []
|
||||||
files = ["configFile", "pyTorchModelFile", "onnxModelFile"]
|
files = ["configFile", "pyTorchModelFile", "onnxModelFile"]
|
||||||
for f in files:
|
for f in files:
|
||||||
if data[f] != None and os.path.exists(data[f]):
|
if data[f] != None and os.path.exists(data[f]):
|
||||||
@ -193,7 +194,7 @@ class MMVCv15:
|
|||||||
return [spec, f0, sid]
|
return [spec, f0, sid]
|
||||||
|
|
||||||
def _onnx_inference(self, data):
|
def _onnx_inference(self, data):
|
||||||
if self.settings.onnxModelFile == "" or self.settings.onnxModelFile == None:
|
if self.settings.onnxModelFile == "" and self.settings.onnxModelFile == None:
|
||||||
print("[Voice Changer] No ONNX session.")
|
print("[Voice Changer] No ONNX session.")
|
||||||
raise NoModeLoadedException("ONNX")
|
raise NoModeLoadedException("ONNX")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user