diff --git a/server/restapi/MMVC_Rest_Fileuploader.py b/server/restapi/MMVC_Rest_Fileuploader.py index 8318e971..af3b57a5 100644 --- a/server/restapi/MMVC_Rest_Fileuploader.py +++ b/server/restapi/MMVC_Rest_Fileuploader.py @@ -104,6 +104,8 @@ class MMVC_Rest_Fileuploader: return JSONResponse(content=json_compatible_item_data) except Exception as e: print("[Voice Changer] get_onnx ex:", e) + import traceback + traceback.print_exc() def post_merge_models(self, request: str = Form(...)): try: diff --git a/server/voice_changer/RVC/inferencer/rvc_models/infer_pack/models.py b/server/voice_changer/RVC/inferencer/rvc_models/infer_pack/models.py index abd2dbb8..8010681d 100644 --- a/server/voice_changer/RVC/inferencer/rvc_models/infer_pack/models.py +++ b/server/voice_changer/RVC/inferencer/rvc_models/infer_pack/models.py @@ -537,6 +537,7 @@ class GeneratorNSF(torch.nn.Module): x = F.leaky_relu(x, LRELU_SLOPE) x = self.ups[i](x) x_source = self.noise_convs[i](har_source) + x = x[:, :, : x_source.shape[2]] x = x + x_source xs = None for j in range(self.num_kernels): diff --git a/server/voice_changer/RVC/onnxExporter/export2onnx.py b/server/voice_changer/RVC/onnxExporter/export2onnx.py index eb1405c6..fc1353bf 100644 --- a/server/voice_changer/RVC/onnxExporter/export2onnx.py +++ b/server/voice_changer/RVC/onnxExporter/export2onnx.py @@ -88,17 +88,19 @@ def _export2onnx(input_model, output_model, output_model_simple, is_half, metada net_g_onnx.load_state_dict(cpt["weight"], strict=False) if is_half: net_g_onnx = net_g_onnx.half() + + featsLength = 64 if is_half: - feats = torch.HalfTensor(1, 2192, metadata["embChannels"]).to(dev) + feats = torch.HalfTensor(1, featsLength, metadata["embChannels"]).to(dev) else: - feats = torch.FloatTensor(1, 2192, metadata["embChannels"]).to(dev) - p_len = torch.LongTensor([2192]).to(dev) + feats = torch.FloatTensor(1, featsLength, metadata["embChannels"]).to(dev) + p_len = torch.LongTensor([featsLength]).to(dev) sid = torch.LongTensor([0]).to(dev) if metadata["f0"] is True: - pitch = torch.zeros(1, 2192, dtype=torch.int64).to(dev) - pitchf = torch.FloatTensor(1, 2192).to(dev) + pitch = torch.zeros(1, featsLength, dtype=torch.int64).to(dev) + pitchf = torch.FloatTensor(1, featsLength).to(dev) input_names = ["feats", "p_len", "pitch", "pitchf", "sid"] inputs = ( feats, diff --git a/server/voice_changer/RVC/pitchExtractor/RMVPOnnxEPitchExtractor.py b/server/voice_changer/RVC/pitchExtractor/RMVPEOnnxPitchExtractor.py similarity index 98% rename from server/voice_changer/RVC/pitchExtractor/RMVPOnnxEPitchExtractor.py rename to server/voice_changer/RVC/pitchExtractor/RMVPEOnnxPitchExtractor.py index 72d6f5e5..b87253b3 100644 --- a/server/voice_changer/RVC/pitchExtractor/RMVPOnnxEPitchExtractor.py +++ b/server/voice_changer/RVC/pitchExtractor/RMVPEOnnxPitchExtractor.py @@ -5,7 +5,7 @@ from voice_changer.RVC.deviceManager.DeviceManager import DeviceManager import onnxruntime -class RMVPOnnxEPitchExtractor(PitchExtractor): +class RMVPEOnnxPitchExtractor(PitchExtractor): def __init__(self, file: str, gpu: int): super().__init__()