mirror of
https://github.com/w-okada/voice-changer.git
synced 2025-01-23 21:45:00 +03:00
WIP:multi 3
This commit is contained in:
parent
e2f08a17d4
commit
84ca7974e9
@ -51,17 +51,15 @@ class MMVCv13:
|
||||
self.gpu_num = torch.cuda.device_count()
|
||||
self.text_norm = torch.LongTensor([0, 6, 0])
|
||||
|
||||
def loadModel(self, config: str, pyTorch_model_file: str = None, onnx_model_file: str = None):
|
||||
self.settings.configFile = config
|
||||
self.hps = get_hparams_from_file(config)
|
||||
def loadModel(self, props):
|
||||
self.settings.configFile = props["files"]["configFilename"]
|
||||
self.hps = get_hparams_from_file(self.settings.configFile)
|
||||
|
||||
if pyTorch_model_file != None:
|
||||
self.settings.pyTorchModelFile = pyTorch_model_file
|
||||
if onnx_model_file:
|
||||
self.settings.onnxModelFile = onnx_model_file
|
||||
self.settings.pyTorchModelFile = props["files"]["pyTorchModelFilename"]
|
||||
self.settings.onnxModelFile = props["files"]["onnxModelFilename"]
|
||||
|
||||
# PyTorchモデル生成
|
||||
if pyTorch_model_file != None:
|
||||
if self.settings.pyTorchModelFile != None:
|
||||
self.net_g = SynthesizerTrn(
|
||||
len(symbols),
|
||||
self.hps.data.filter_length // 2 + 1,
|
||||
@ -69,14 +67,14 @@ class MMVCv13:
|
||||
n_speakers=self.hps.data.n_speakers,
|
||||
**self.hps.model)
|
||||
self.net_g.eval()
|
||||
load_checkpoint(pyTorch_model_file, self.net_g, None)
|
||||
load_checkpoint(self.settings.pyTorchModelFile, self.net_g, None)
|
||||
|
||||
# ONNXモデル生成
|
||||
if onnx_model_file != None:
|
||||
if self.settings.onnxModelFile != None:
|
||||
ort_options = onnxruntime.SessionOptions()
|
||||
ort_options.intra_op_num_threads = 8
|
||||
self.onnx_session = onnxruntime.InferenceSession(
|
||||
onnx_model_file,
|
||||
self.settings.onnxModelFile,
|
||||
providers=providers
|
||||
)
|
||||
return self.get_info()
|
||||
|
@ -51,18 +51,13 @@ class MMVCv15:
|
||||
|
||||
self.gpu_num = torch.cuda.device_count()
|
||||
|
||||
def loadModel(self, config: str, pyTorch_model_file: str = None, onnx_model_file: str = None):
|
||||
self.settings.configFile = config
|
||||
self.hps = get_hparams_from_file(config)
|
||||
def loadModel(self, props):
|
||||
|
||||
if pyTorch_model_file != None:
|
||||
self.settings.pyTorchModelFile = pyTorch_model_file
|
||||
else:
|
||||
self.settings.pyTorchModelFile = ""
|
||||
if onnx_model_file:
|
||||
self.settings.onnxModelFile = onnx_model_file
|
||||
else:
|
||||
self.settings.onnxModelFile = ""
|
||||
self.settings.configFile = props["files"]["configFilename"]
|
||||
self.hps = get_hparams_from_file(self.settings.configFile)
|
||||
|
||||
self.settings.pyTorchModelFile = props["files"]["pyTorchModelFilename"]
|
||||
self.settings.onnxModelFile = props["files"]["onnxModelFilename"]
|
||||
|
||||
# PyTorchモデル生成
|
||||
self.net_g = SynthesizerTrn(
|
||||
@ -83,17 +78,17 @@ class MMVCv15:
|
||||
requires_grad_text_enc=self.hps.requires_grad.text_enc,
|
||||
requires_grad_dec=self.hps.requires_grad.dec
|
||||
)
|
||||
if pyTorch_model_file != None:
|
||||
if self.settings.pyTorchModelFile != None:
|
||||
self.net_g.eval()
|
||||
load_checkpoint(pyTorch_model_file, self.net_g, None)
|
||||
load_checkpoint(self.settings.pyTorchModelFile, self.net_g, None)
|
||||
|
||||
# ONNXモデル生成
|
||||
self.onxx_input_length = 8192
|
||||
if onnx_model_file != None:
|
||||
if self.settings.onnxModelFile != None:
|
||||
ort_options = onnxruntime.SessionOptions()
|
||||
ort_options.intra_op_num_threads = 8
|
||||
self.onnx_session = onnxruntime.InferenceSession(
|
||||
onnx_model_file,
|
||||
self.settings.onnxModelFile,
|
||||
providers=providers
|
||||
)
|
||||
inputs_info = self.onnx_session.get_inputs()
|
||||
|
@ -69,12 +69,16 @@ class SoVitsSvc40:
|
||||
self.params = params
|
||||
print("so-vits-svc40 initialization:", params)
|
||||
|
||||
def loadModel(self, config: str, pyTorch_model_file: str = None, onnx_model_file: str = None, clusterTorchModel: str = None):
|
||||
|
||||
self.settings.configFile = config
|
||||
self.hps = utils.get_hparams_from_file(config)
|
||||
# def loadModel(self, config: str, pyTorch_model_file: str = None, onnx_model_file: str = None, clusterTorchModel: str = None):
|
||||
def loadModel(self, props):
|
||||
self.settings.configFile = props["files"]["configFilename"]
|
||||
self.hps = utils.get_hparams_from_file(self.settings.configFile)
|
||||
self.settings.speakers = self.hps.spk
|
||||
|
||||
self.settings.pyTorchModelFile = props["files"]["pyTorchModelFilename"]
|
||||
self.settings.onnxModelFile = props["files"]["onnxModelFilename"]
|
||||
clusterTorchModel = props["files"]["clusterTorchModelFilename"]
|
||||
|
||||
# hubert model
|
||||
try:
|
||||
hubert_path = self.params["hubert"]
|
||||
@ -108,27 +112,22 @@ class SoVitsSvc40:
|
||||
except Exception as e:
|
||||
print("EXCEPTION during loading cluster model ", e)
|
||||
|
||||
if pyTorch_model_file != None:
|
||||
self.settings.pyTorchModelFile = pyTorch_model_file
|
||||
if onnx_model_file:
|
||||
self.settings.onnxModelFile = onnx_model_file
|
||||
|
||||
# PyTorchモデル生成
|
||||
if pyTorch_model_file != None:
|
||||
if self.settings.pyTorchModelFile != None:
|
||||
self.net_g = SynthesizerTrn(
|
||||
self.hps.data.filter_length // 2 + 1,
|
||||
self.hps.train.segment_size // self.hps.data.hop_length,
|
||||
**self.hps.model
|
||||
)
|
||||
self.net_g.eval()
|
||||
utils.load_checkpoint(pyTorch_model_file, self.net_g, None)
|
||||
utils.load_checkpoint(self.settings.pyTorchModelFile, self.net_g, None)
|
||||
|
||||
# ONNXモデル生成
|
||||
if onnx_model_file != None:
|
||||
if self.settings.onnxModelFile != None:
|
||||
ort_options = onnxruntime.SessionOptions()
|
||||
ort_options.intra_op_num_threads = 8
|
||||
self.onnx_session = onnxruntime.InferenceSession(
|
||||
onnx_model_file,
|
||||
self.settings.onnxModelFile,
|
||||
providers=providers
|
||||
)
|
||||
# input_info = self.onnx_session.get_inputs()
|
||||
|
@ -66,12 +66,15 @@ class SoVitsSvc40v2:
|
||||
self.params = params
|
||||
print("so-vits-svc 40v2 initialization:", params)
|
||||
|
||||
def loadModel(self, config: str, pyTorch_model_file: str = None, onnx_model_file: str = None, clusterTorchModel: str = None):
|
||||
|
||||
self.settings.configFile = config
|
||||
self.hps = utils.get_hparams_from_file(config)
|
||||
def loadModel(self, props):
|
||||
self.settings.configFile = props["files"]["configFilename"]
|
||||
self.hps = utils.get_hparams_from_file(self.settings.configFile)
|
||||
self.settings.speakers = self.hps.spk
|
||||
|
||||
self.settings.pyTorchModelFile = props["files"]["pyTorchModelFilename"]
|
||||
self.settings.onnxModelFile = props["files"]["onnxModelFilename"]
|
||||
clusterTorchModel = props["files"]["clusterTorchModelFilename"]
|
||||
|
||||
# hubert model
|
||||
try:
|
||||
# if sys.platform.startswith('darwin'):
|
||||
@ -99,25 +102,20 @@ class SoVitsSvc40v2:
|
||||
except Exception as e:
|
||||
print("EXCEPTION during loading cluster model ", e)
|
||||
|
||||
if pyTorch_model_file != None:
|
||||
self.settings.pyTorchModelFile = pyTorch_model_file
|
||||
if onnx_model_file:
|
||||
self.settings.onnxModelFile = onnx_model_file
|
||||
|
||||
# PyTorchモデル生成
|
||||
if pyTorch_model_file != None:
|
||||
if self.settings.pyTorchModelFile != None:
|
||||
self.net_g = SynthesizerTrn(
|
||||
self.hps
|
||||
)
|
||||
self.net_g.eval()
|
||||
utils.load_checkpoint(pyTorch_model_file, self.net_g, None)
|
||||
utils.load_checkpoint(self.settings.pyTorchModelFile, self.net_g, None)
|
||||
|
||||
# ONNXモデル生成
|
||||
if onnx_model_file != None:
|
||||
if self.settings.onnxModelFile != None:
|
||||
ort_options = onnxruntime.SessionOptions()
|
||||
ort_options.intra_op_num_threads = 8
|
||||
self.onnx_session = onnxruntime.InferenceSession(
|
||||
onnx_model_file,
|
||||
self.settings.onnxModelFile,
|
||||
providers=providers
|
||||
)
|
||||
input_info = self.onnx_session.get_inputs()
|
||||
|
Loading…
Reference in New Issue
Block a user