mirror of
https://github.com/w-okada/voice-changer.git
synced 2025-01-09 04:17:58 +08:00
improve onnx
This commit is contained in:
parent
8e822c16e3
commit
6f8710fd50
@ -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:
|
||||
|
@ -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):
|
||||
|
@ -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,
|
||||
|
@ -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__()
|
Loading…
Reference in New Issue
Block a user