Skip to content

Commit 9f56f08

Browse files
authored
Update rvc.py
1 parent f6043f1 commit 9f56f08

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/rvc.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@
88

99
now_dir = Path(os.getcwd())
1010

11-
from src.infer_pack.models import (
12-
SynthesizerTrnMs256NSFsid,
13-
SynthesizerTrnMs256NSFsid_nono,
14-
SynthesizerTrnMs768NSFsid,
15-
SynthesizerTrnMs768NSFsid_nono,
16-
)
11+
from src.infer_pack.models import Synthesizer, Synthesizer_nono
1712
from src.my_utils import load_audio
1813
from src.vc_infer_pipeline import VC
1914

@@ -97,10 +92,12 @@ def get_vc(device, is_half, config, model_path):
9792
pitch_guidance = cpt.get("f0", 1)
9893
version = cpt.get("version", "v1")
9994

95+
input_dim = 256 if version == "v1" else 768
96+
10097
if version == "v1":
101-
net_g = SynthesizerTrnMs256NSFsid(*cpt["config"], is_half=is_half) if pitch_guidance == 1 else SynthesizerTrnMs256NSFsid_nono(*cpt["config"])
102-
elif version == "v2":
103-
net_g = SynthesizerTrnMs768NSFsid(*cpt["config"], is_half=is_half) if pitch_guidance == 1 else SynthesizerTrnMs768NSFsid_nono(*cpt["config"])
98+
net_g = Synthesizer(input_dim, *cpt["config"], is_half=is_half, f0=pitch_guidance == 1) if pitch_guidance == 1 else Synthesizer_nono(input_dim, *cpt["config"])
99+
else:
100+
net_g = Synthesizer(input_dim, *cpt["config"], is_half=is_half, f0=pitch_guidance == 1) if pitch_guidance == 1 else Synthesizer_nono(input_dim, *cpt["config"])
104101

105102
del net_g.enc_q
106103
logger.info(net_g.load_state_dict(cpt["weight"], strict=False))

0 commit comments

Comments
 (0)