improve:onnx export

This commit is contained in:
w-okada 2023-07-23 07:20:48 +09:00
parent 20e7a472be
commit 11756788aa
7 changed files with 19 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -249,7 +249,7 @@ export const CharacterArea = (_props: CharacterAreaProps) => {
</div>
</div>
);
}, [selected, serverSetting.getOnnx, serverSetting.updateModelDefault]);
}, [selected, serverSetting.getOnnx, serverSetting.updateModelDefault, guiState.isConverting]);
const characterArea = useMemo(() => {
return (

View File

@ -211,7 +211,6 @@ class Pipeline(object):
pitch_buffer = None
del pitch, pitchf, feats, sid
torch.cuda.empty_cache()
audio1 = self.resamplerOut(audio1.float())
# print("[Timer::5: ]", t.secs)
return audio1, pitch_buffer, feats_buffer

View File

@ -225,7 +225,15 @@ class RVC(VoiceChangerModel):
print("[Voice Changer] export2onnx, No pyTorch filepath.")
return {"status": "ng", "path": ""}
if self.pipeline is not None:
del self.pipeline
self.pipeline = None
torch.cuda.empty_cache()
self.initialize()
output_file_simple = export2onnx(self.settings.gpu, modelSlot)
return {
"status": "ok",
"path": f"/tmp/{output_file_simple}",

View File

@ -12,7 +12,7 @@ class VoRASInferencer(Inferencer):
super().setProps(EnumInferenceTypes.pyTorchVoRASbeta, file, False, gpu)
dev = DeviceManager.get_instance().getDevice(gpu)
self.isHalf = False # DeviceManager.get_instance().halfPrecisionAvailable(gpu)
self.isHalf = False # DeviceManager.get_instance().halfPrecisionAvailable(gpu)
cpt = torch.load(file, map_location="cpu")
model = Synthesizer(**cpt["params"])

View File

@ -138,7 +138,6 @@ class SynthesizerTrnMsNSFsid(nn.Module):
return o, x_mask, (z, z_p, m_p, logs_p)
class SynthesizerTrnMsNSFsidNono(nn.Module):
def __init__(self, spec_channels, segment_size, inter_channels, hidden_channels, filter_channels, n_heads, n_layers, kernel_size, p_dropout, resblock, resblock_kernel_sizes, resblock_dilation_sizes, upsample_rates, upsample_initial_channel, upsample_kernel_sizes, spk_embed_dim, gin_channels, emb_channels, sr=None, **kwargs):
super().__init__()

View File

@ -243,7 +243,7 @@ class Pipeline(object):
pitchf_buffer = None
del p_len, pitch, pitchf, feats
torch.cuda.empty_cache()
# torch.cuda.empty_cache()
# inferで出力されるサンプリングレートはモデルのサンプリングレートになる。
# pipelineに入力されるときはhubertように16k
@ -253,5 +253,11 @@ class Pipeline(object):
audio1 = audio1[offset:end]
del sid
torch.cuda.empty_cache()
# torch.cuda.empty_cache()
return audio1, pitchf_buffer, feats_buffer
def __del__(self):
del self.embedder
del self.inferencer
del self.pitchExtractor
print('Pipeline has been deleted')