1
0
mirror of https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI.git synced 2026-06-06 01:30:24 +08:00

optimize(jit): move hubert & synthesizer into rvc

This commit is contained in:
源文雨
2024-06-12 00:03:26 +09:00
parent 0efe48c49c
commit 54f7ae097d
15 changed files with 30 additions and 27 deletions

View File

@@ -6,7 +6,7 @@ from scipy.fft import fft
from pybase16384 import encode_to_string, decode_from_string
from configs import CPUConfig, singleton_variable
from infer.lib.jit import get_synthesizer_ckpt
from rvc.synthesizer import get_synthesizer
from .pipeline import Pipeline
from .utils import load_hubert
@@ -132,7 +132,7 @@ def model_hash_ckpt(cpt):
config = CPUConfig()
with TorchSeedContext(114514):
net_g, cpt = get_synthesizer_ckpt(cpt, config.device)
net_g, cpt = get_synthesizer(cpt, config.device)
tgt_sr = cpt["config"][-1]
if_f0 = cpt.get("f0", 1)
version = cpt.get("version", "v1")

View File

@@ -10,7 +10,7 @@ import torch
from io import BytesIO
from infer.lib.audio import load_audio, wav2
from infer.lib.jit import get_synthesizer_ckpt, get_synthesizer
from rvc.synthesizer import get_synthesizer, load_synthesizer
from .info import show_model_info
from .pipeline import Pipeline
from .utils import get_index_path_from_model, load_hubert
@@ -62,7 +62,7 @@ class VC:
elif torch.backends.mps.is_available():
torch.mps.empty_cache()
###楼下不这么折腾清理不干净
self.net_g, self.cpt = get_synthesizer_ckpt(
self.net_g, self.cpt = get_synthesizer(
self.cpt, self.config.device
)
self.if_f0 = self.cpt.get("f0", 1)
@@ -88,7 +88,7 @@ class VC:
person = f'{os.getenv("weight_root")}/{sid}'
logger.info(f"Loading: {person}")
self.net_g, self.cpt = get_synthesizer(person, self.config.device)
self.net_g, self.cpt = load_synthesizer(person, self.config.device)
self.tgt_sr = self.cpt["config"][-1]
self.cpt["config"][-3] = self.cpt["weight"]["emb_g.weight"].shape[0] # n_spk
self.if_f0 = self.cpt.get("f0", 1)