Skip to content

Commit a071f1e

Browse files
authored
fix v2 onnx export
1 parent 147d3c8 commit a071f1e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

infer-web.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ def change_info_(ckpt_path):
11221122
def export_onnx(ModelPath, ExportedPath, MoeVS=True):
11231123
cpt = torch.load(ModelPath, map_location="cpu")
11241124
cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] # n_spk
1125-
hidden_channels = cpt["config"][-2] # hidden_channels,为768Vec做准备
1125+
hidden_channels = 256 if cpt.get("version","v1")=="v1"else 768#cpt["config"][-2] # hidden_channels,为768Vec做准备
11261126

11271127
test_phone = torch.rand(1, 200, hidden_channels) # hidden unit
11281128
test_phone_lengths = torch.tensor([200]).long() # hidden unit 长度(貌似没啥用)
@@ -1134,7 +1134,7 @@ def export_onnx(ModelPath, ExportedPath, MoeVS=True):
11341134
device = "cpu" # 导出时设备(不影响使用模型)
11351135

11361136
net_g = SynthesizerTrnMsNSFsidM(
1137-
*cpt["config"], is_half=False
1137+
*cpt["config"], is_half=False,version=cpt.get("version","v1")
11381138
) # fp32导出(C++要支持fp16必须手动将内存重新排列所以暂时不用fp16)
11391139
net_g.load_state_dict(cpt["weight"], strict=False)
11401140
input_names = ["phone", "phone_lengths", "pitch", "pitchf", "ds", "rnd"]

0 commit comments

Comments
 (0)