re-support onnx export for cpu
This commit is contained in:
parent
4171baa6de
commit
1c8d891a7d
@ -340,5 +340,10 @@ class RVC:
|
|||||||
output_path = os.path.join(TMP_DIR, output_file)
|
output_path = os.path.join(TMP_DIR, output_file)
|
||||||
output_path_simple = os.path.join(TMP_DIR, output_file_simple)
|
output_path_simple = os.path.join(TMP_DIR, output_file_simple)
|
||||||
|
|
||||||
onnxExporter.export2onnx(self.settings.pyTorchModelFile, output_path, output_path_simple, True)
|
if torch.cuda.device_count() > 0:
|
||||||
|
onnxExporter.export2onnx(self.settings.pyTorchModelFile, output_path, output_path_simple, True)
|
||||||
|
else:
|
||||||
|
print("[Voice Changer] Warning!!! onnx export with float32. maybe size is doubled.")
|
||||||
|
onnxExporter.export2onnx(self.settings.pyTorchModelFile, output_path, output_path_simple, False)
|
||||||
|
|
||||||
return {"status": "ok", "path": f"/tmp/{output_file_simple}", "filename": output_file_simple}
|
return {"status": "ok", "path": f"/tmp/{output_file_simple}", "filename": output_file_simple}
|
||||||
|
@ -99,7 +99,6 @@ class SynthesizerTrnMs256NSFsid_ONNX(nn.Module):
|
|||||||
|
|
||||||
|
|
||||||
def export2onnx(input_model, output_model, output_model_simple, is_half):
|
def export2onnx(input_model, output_model, output_model_simple, is_half):
|
||||||
is_half = False
|
|
||||||
cpt = torch.load(input_model, map_location="cpu")
|
cpt = torch.load(input_model, map_location="cpu")
|
||||||
if is_half:
|
if is_half:
|
||||||
dev = torch.device("cuda", index=0)
|
dev = torch.device("cuda", index=0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user