Merge pull request #52 from makaveli10/vad_warnings
Add `force_onnx_cpu` arg, thanks Shubh for reporting the issue and providing a fix.
This commit is contained in:
+6
-2
@@ -9,7 +9,7 @@ import onnxruntime
|
|||||||
|
|
||||||
class VoiceActivityDetection():
|
class VoiceActivityDetection():
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, force_onnx_cpu=True):
|
||||||
path = self.download()
|
path = self.download()
|
||||||
opts = onnxruntime.SessionOptions()
|
opts = onnxruntime.SessionOptions()
|
||||||
opts.log_severity_level = 3
|
opts.log_severity_level = 3
|
||||||
@@ -17,7 +17,11 @@ class VoiceActivityDetection():
|
|||||||
opts.inter_op_num_threads = 1
|
opts.inter_op_num_threads = 1
|
||||||
opts.intra_op_num_threads = 1
|
opts.intra_op_num_threads = 1
|
||||||
|
|
||||||
self.session = onnxruntime.InferenceSession(path, providers=['CPUExecutionProvider'], sess_options=opts)
|
if force_onnx_cpu and 'CPUExecutionProvider' in onnxruntime.get_available_providers():
|
||||||
|
self.session = onnxruntime.InferenceSession(path, providers=['CPUExecutionProvider'], sess_options=opts)
|
||||||
|
else:
|
||||||
|
self.session = onnxruntime.InferenceSession(path, providers=['CUDAExecutionProvider'], sess_options=opts)
|
||||||
|
|
||||||
|
|
||||||
self.reset_states()
|
self.reset_states()
|
||||||
self.sample_rates = [8000, 16000]
|
self.sample_rates = [8000, 16000]
|
||||||
|
|||||||
Reference in New Issue
Block a user