forked from skeskinen/resemble-denoise-onnx-inference
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
29 lines (23 loc) · 702 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import time
import numpy as np
from denoiser import run
import onnxruntime
import librosa
import scipy
path = './test_audio.wav'
wav, sr = librosa.load(path, mono=True)
opts = onnxruntime.SessionOptions()
opts.inter_op_num_threads = 4
opts.intra_op_num_threads = 4
opts.log_severity_level = 4
session = onnxruntime.InferenceSession(
'denoiser.onnx',
providers=["CPUExecutionProvider"],
#providers=["ROCMExecutionProvider"],
#providers=["DnnlExecutionProvider"],
sess_options=opts,
)
start = time.time()
wav_onnx, new_sr = run(session, wav, sr, batch_process_chunks=False)
print(f'Ran in {time.time() - start}s')
scipy.io.wavfile.write('denoiser_output.wav', new_sr, wav_onnx)