Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to fix windows MDX ONNX loading tempfile bug in onnx2torch #63

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion audio_separator/separator/architectures/mdx_separator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""Module for separating audio sources using MDX architecture models."""

import os
import platform
import torch
import onnx
import onnxruntime as ort
import numpy as np
import onnx2torch
Expand Down Expand Up @@ -121,7 +123,12 @@ def load_model(self):
self.model_run = lambda spek: ort_inference_session.run(None, {"input": spek.cpu().numpy()})[0]
self.logger.debug("Model loaded successfully using ONNXruntime inferencing session.")
else:
self.model_run = onnx2torch.convert(self.model_path)
if platform.system() == 'Windows':
onnx_model = onnx.load(self.model_path)
self.model_run = onnx2torch.convert(onnx_model)
else:
self.model_run = onnx2torch.convert(self.model_path)

self.model_run.to(self.torch_device).eval()
self.logger.warning("Model converted from onnx to pytorch due to segment size not matching dim_t, processing may be slower.")

Expand Down
Loading
Loading