Spaces:
Runtime error
Runtime error
DJQmUKV
commited on
Commit
•
2c97e10
1
Parent(s):
71ed4b2
feat: sync with latest code, added legacy v1 model support
Browse filesfixes #2
- app_multi.py +28 -8
app_multi.py
CHANGED
@@ -19,6 +19,8 @@ import edge_tts
|
|
19 |
import config
|
20 |
import util
|
21 |
from infer_pack.models import (
|
|
|
|
|
22 |
SynthesizerTrnMs768NSFsid,
|
23 |
SynthesizerTrnMs768NSFsid_nono
|
24 |
)
|
@@ -110,15 +112,32 @@ for model_name in multi_cfg.get('models'):
|
|
110 |
tgt_sr = cpt['config'][-1]
|
111 |
cpt['config'][-3] = cpt['weight']['emb_g.weight'].shape[0] # n_spk
|
112 |
|
|
|
|
|
|
|
113 |
if_f0 = cpt.get('f0', 1)
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
115 |
if if_f0 == 1:
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
else:
|
121 |
-
|
|
|
|
|
|
|
122 |
|
123 |
del net_g.enc_q
|
124 |
|
@@ -136,7 +155,8 @@ for model_name in multi_cfg.get('models'):
|
|
136 |
vc=vc,
|
137 |
net_g=net_g,
|
138 |
if_f0=if_f0,
|
139 |
-
target_sr=tgt_sr
|
|
|
140 |
))
|
141 |
|
142 |
print(f'Models loaded: {len(loaded_models)}')
|
@@ -209,7 +229,7 @@ def vc_func(
|
|
209 |
model['target_sr'],
|
210 |
resample,
|
211 |
rms_mix_rate,
|
212 |
-
'
|
213 |
)
|
214 |
|
215 |
out_sr = (
|
|
|
19 |
import config
|
20 |
import util
|
21 |
from infer_pack.models import (
|
22 |
+
SynthesizerTrnMs256NSFsid,
|
23 |
+
SynthesizerTrnMs256NSFsid_nono,
|
24 |
SynthesizerTrnMs768NSFsid,
|
25 |
SynthesizerTrnMs768NSFsid_nono
|
26 |
)
|
|
|
112 |
tgt_sr = cpt['config'][-1]
|
113 |
cpt['config'][-3] = cpt['weight']['emb_g.weight'].shape[0] # n_spk
|
114 |
|
115 |
+
cpt_version = cpt.get('version', 'v1')
|
116 |
+
print(f'Model version: {cpt_version}')
|
117 |
+
|
118 |
if_f0 = cpt.get('f0', 1)
|
119 |
+
|
120 |
+
net_g: Union[
|
121 |
+
SynthesizerTrnMs256NSFsid, SynthesizerTrnMs256NSFsid_nono,
|
122 |
+
SynthesizerTrnMs768NSFsid, SynthesizerTrnMs768NSFsid_nono
|
123 |
+
]
|
124 |
+
|
125 |
if if_f0 == 1:
|
126 |
+
if cpt_version == 'v2':
|
127 |
+
net_g = SynthesizerTrnMs768NSFsid(
|
128 |
+
*cpt['config'],
|
129 |
+
is_half=config.is_half
|
130 |
+
)
|
131 |
+
else:
|
132 |
+
net_g = SynthesizerTrnMs256NSFsid(
|
133 |
+
*cpt['config'],
|
134 |
+
is_half=config.is_half
|
135 |
+
)
|
136 |
else:
|
137 |
+
if cpt_version == 'v2':
|
138 |
+
net_g = SynthesizerTrnMs768NSFsid_nono(*cpt['config'])
|
139 |
+
else:
|
140 |
+
net_g = SynthesizerTrnMs256NSFsid_nono(*cpt['config'])
|
141 |
|
142 |
del net_g.enc_q
|
143 |
|
|
|
155 |
vc=vc,
|
156 |
net_g=net_g,
|
157 |
if_f0=if_f0,
|
158 |
+
target_sr=tgt_sr,
|
159 |
+
version=cpt_version
|
160 |
))
|
161 |
|
162 |
print(f'Models loaded: {len(loaded_models)}')
|
|
|
229 |
model['target_sr'],
|
230 |
resample,
|
231 |
rms_mix_rate,
|
232 |
+
model['version']
|
233 |
)
|
234 |
|
235 |
out_sr = (
|