Skip to content

Commit

Permalink
Merge pull request #289 from Tomiinek/patch-1
Browse files Browse the repository at this point in the history
Fixing ONNX init
  • Loading branch information
adamnsandle authored Feb 28, 2023
2 parents 262bcb4 + 085d76f commit 4f57fae
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions utils_vad.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ def __init__(self, path, force_onnx_cpu=False):
import numpy as np
global np
import onnxruntime

opts = onnxruntime.SessionOptions()
opts.inter_op_num_threads = 1
opts.intra_op_num_threads = 1

if force_onnx_cpu and 'CPUExecutionProvider' in onnxruntime.get_available_providers():
self.session = onnxruntime.InferenceSession(path, providers=['CPUExecutionProvider'])
self.session = onnxruntime.InferenceSession(path, providers=['CPUExecutionProvider'], sess_options=opts)
else:
self.session = onnxruntime.InferenceSession(path)
self.session.intra_op_num_threads = 1
self.session.inter_op_num_threads = 1
self.session = onnxruntime.InferenceSession(path, sess_options=opts)

self.reset_states()
self.sample_rates = [8000, 16000]
Expand Down

0 comments on commit 4f57fae

Please sign in to comment.