allow only CPU Execution

This commit is contained in:
makaveli10
2023-09-27 16:17:20 +08:00
parent 0444cea0ba
commit 5fb6be41bb
+2 -5
View File
@@ -9,7 +9,7 @@ import onnxruntime
class VoiceActivityDetection():
def __init__(self, force_onnx_cpu=True):
def __init__(self):
path = self.download()
opts = onnxruntime.SessionOptions()
opts.log_severity_level = 3
@@ -17,10 +17,7 @@ class VoiceActivityDetection():
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'], sess_options=opts)
else:
self.session = onnxruntime.InferenceSession(path, providers=['CUDAExecutionProvider'], sess_options=opts)
self.session = onnxruntime.InferenceSession(path, providers=['CPUExecutionProvider'], sess_options=opts)
self.reset_states()
self.sample_rates = [8000, 16000]