mirror of
https://github.com/snakers4/silero-vad.git
synced 2026-02-05 18:09:22 +08:00
11
utils_vad.py
11
utils_vad.py
@@ -13,12 +13,15 @@ class OnnxWrapper():
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
global np
|
global np
|
||||||
import onnxruntime
|
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():
|
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:
|
else:
|
||||||
self.session = onnxruntime.InferenceSession(path)
|
self.session = onnxruntime.InferenceSession(path, sess_options=opts)
|
||||||
self.session.intra_op_num_threads = 1
|
|
||||||
self.session.inter_op_num_threads = 1
|
|
||||||
|
|
||||||
self.reset_states()
|
self.reset_states()
|
||||||
self.sample_rates = [8000, 16000]
|
self.sample_rates = [8000, 16000]
|
||||||
|
|||||||
Reference in New Issue
Block a user