@@ -1119,12 +1119,12 @@ def change_info_(ckpt_path):
11191119from infer_pack .models_onnx import SynthesizerTrnMsNSFsidM
11201120
11211121
1122- def export_onnx (ModelPath , ExportedPath , MoeVS = True ):
1122+ def export_onnx (ModelPath , ExportedPath ):
11231123 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
11261126
1127- test_phone = torch .rand (1 , 200 , hidden_channels ) # hidden unit
1127+ test_phone = torch .rand (1 , 200 , vec_channels ) # hidden unit
11281128 test_phone_lengths = torch .tensor ([200 ]).long () # hidden unit 长度(貌似没啥用)
11291129 test_pitch = torch .randint (size = (1 , 200 ), low = 5 , high = 255 ) # 基频(单位赫兹)
11301130 test_pitchf = torch .rand (1 , 200 ) # nsf基频
@@ -1160,7 +1160,7 @@ def export_onnx(ModelPath, ExportedPath, MoeVS=True):
11601160 "rnd" : [2 ],
11611161 },
11621162 do_constant_folding = False ,
1163- opset_version = 16 ,
1163+ opset_version = 13 ,
11641164 verbose = False ,
11651165 input_names = input_names ,
11661166 output_names = output_names ,
@@ -1835,11 +1835,10 @@ def export_onnx(ModelPath, ExportedPath, MoeVS=True):
18351835 label = i18n ("Onnx输出路径" ), value = "" , interactive = True
18361836 )
18371837 with gr .Row ():
1838- moevs = gr .Checkbox (label = i18n ("MoeVS模型" ), value = False ,visible = False )
18391838 infoOnnx = gr .Label (label = "info" )
18401839 with gr .Row ():
18411840 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 )
18431842
18441843 tab_faq = i18n ("常见问题解答" )
18451844 with gr .TabItem (tab_faq ):
0 commit comments