mirror of
https://github.com/Mangio621/Mangio-RVC-Fork.git
synced 2026-02-24 03:49:51 +01:00
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
10
infer-web.py
10
infer-web.py
@@ -1130,7 +1130,7 @@ from infer_pack.models_onnx import SynthesizerTrnMsNSFsidM
|
||||
def export_onnx(ModelPath, ExportedPath, MoeVS=True):
|
||||
cpt = torch.load(ModelPath, map_location="cpu")
|
||||
cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] # n_spk
|
||||
hidden_channels = cpt["config"][-2] # hidden_channels,为768Vec做准备
|
||||
hidden_channels = 256 if cpt.get("version","v1")=="v1"else 768#cpt["config"][-2] # hidden_channels,为768Vec做准备
|
||||
|
||||
test_phone = torch.rand(1, 200, hidden_channels) # hidden unit
|
||||
test_phone_lengths = torch.tensor([200]).long() # hidden unit 长度(貌似没啥用)
|
||||
@@ -1143,7 +1143,7 @@ def export_onnx(ModelPath, ExportedPath, MoeVS=True):
|
||||
|
||||
|
||||
net_g = SynthesizerTrnMsNSFsidM(
|
||||
*cpt["config"], is_half=False
|
||||
*cpt["config"], is_half=False,version=cpt.get("version","v1")
|
||||
) # fp32导出(C++要支持fp16必须手动将内存重新排列所以暂时不用fp16)
|
||||
net_g.load_state_dict(cpt["weight"], strict=False)
|
||||
input_names = ["phone", "phone_lengths", "pitch", "pitchf", "ds", "rnd"]
|
||||
@@ -2174,7 +2174,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
||||
[ckpt_path2, save_name, sr__, if_f0__, info___, version_1],
|
||||
info7,
|
||||
)
|
||||
|
||||
|
||||
with gr.TabItem(i18n("Onnx导出")):
|
||||
with gr.Row():
|
||||
ckpt_dir = gr.Textbox(label=i18n("RVC模型路径"), value="", interactive=True)
|
||||
@@ -2183,8 +2183,8 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
||||
label=i18n("Onnx输出路径"), value="", interactive=True
|
||||
)
|
||||
with gr.Row():
|
||||
moevs = gr.Checkbox(label=i18n("MoeVS模型"), value=True)
|
||||
infoOnnx = gr.Label(label="Null")
|
||||
moevs = gr.Checkbox(label=i18n("MoeVS模型"), value=False,visible=False)
|
||||
infoOnnx = gr.Label(label="info")
|
||||
with gr.Row():
|
||||
butOnnx = gr.Button(i18n("导出Onnx模型"), variant="primary")
|
||||
butOnnx.click(export_onnx, [ckpt_dir, onnx_dir, moevs], infoOnnx)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user