@@ -1119,12 +1119,12 @@ def change_info_(ckpt_path):
1119
1119
from infer_pack .models_onnx import SynthesizerTrnMsNSFsidM
1120
1120
1121
1121
1122
- def export_onnx (ModelPath , ExportedPath , MoeVS = True ):
1122
+ def export_onnx (ModelPath , ExportedPath ):
1123
1123
cpt = torch .load (ModelPath , map_location = "cpu" )
1124
- cpt ["config" ][- 3 ] = cpt ["weight" ]["emb_g.weight" ].shape [0 ] # n_spk
1125
- hidden_channels = 256 if cpt .get ("version" ,"v1" )== "v1" else 768 #cpt["config"][-2] # hidden_channels,为768Vec做准备
1124
+ cpt ["config" ][- 3 ] = cpt ["weight" ]["emb_g.weight" ].shape [0 ]
1125
+ vec_channels = 256 if cpt .get ("version" ,"v1" )== "v1" else 768
1126
1126
1127
- test_phone = torch .rand (1 , 200 , hidden_channels ) # hidden unit
1127
+ test_phone = torch .rand (1 , 200 , vec_channels ) # hidden unit
1128
1128
test_phone_lengths = torch .tensor ([200 ]).long () # hidden unit 长度(貌似没啥用)
1129
1129
test_pitch = torch .randint (size = (1 , 200 ), low = 5 , high = 255 ) # 基频(单位赫兹)
1130
1130
test_pitchf = torch .rand (1 , 200 ) # nsf基频
@@ -1160,7 +1160,7 @@ def export_onnx(ModelPath, ExportedPath, MoeVS=True):
1160
1160
"rnd" : [2 ],
1161
1161
},
1162
1162
do_constant_folding = False ,
1163
- opset_version = 16 ,
1163
+ opset_version = 13 ,
1164
1164
verbose = False ,
1165
1165
input_names = input_names ,
1166
1166
output_names = output_names ,
@@ -1835,11 +1835,10 @@ def export_onnx(ModelPath, ExportedPath, MoeVS=True):
1835
1835
label = i18n ("Onnx输出路径" ), value = "" , interactive = True
1836
1836
)
1837
1837
with gr .Row ():
1838
- moevs = gr .Checkbox (label = i18n ("MoeVS模型" ), value = False ,visible = False )
1839
1838
infoOnnx = gr .Label (label = "info" )
1840
1839
with gr .Row ():
1841
1840
butOnnx = gr .Button (i18n ("导出Onnx模型" ), variant = "primary" )
1842
- butOnnx .click (export_onnx , [ckpt_dir , onnx_dir , moevs ], infoOnnx )
1841
+ butOnnx .click (export_onnx , [ckpt_dir , onnx_dir ], infoOnnx )
1843
1842
1844
1843
tab_faq = i18n ("常见问题解答" )
1845
1844
with gr .TabItem (tab_faq ):
0 commit comments