Problem Statement
Currently silero vad tries to load onnx file and create a new onnxruntime InferenceSession each time it is created. When there are multiple clients and pipeline tasks, a new onnxruntime session is created for each of these tasks.
|
model_name = "silero_vad.onnx" |
|
package_path = "pipecat.audio.vad.data" |
|
|
|
try: |
|
import importlib_resources as impresources |
|
|
|
model_file_path = str(impresources.files(package_path).joinpath(model_name)) |
|
except BaseException: |
|
from importlib import resources as impresources |
|
|
|
try: |
|
with impresources.path(package_path, model_name) as f: |
|
model_file_path = f |
|
except BaseException: |
|
model_file_path = str(impresources.files(package_path).joinpath(model_name)) |
|
|
|
self._model = SileroOnnxModel(model_file_path, force_onnx_cpu=True) |
Proposed Solution
I think all silero vad analyzers could use a single onnxruntime session across different tasks. As far as I can see, there is no problem using a single onnxruntime session in silero vad(but I guess each silero vad analyzer should be specific to pipeline since it has a state inside)
Alternative Solutions
No response
Additional Context
No response
Would you be willing to help implement this feature?
Problem Statement
Currently silero vad tries to load onnx file and create a new onnxruntime InferenceSession each time it is created. When there are multiple clients and pipeline tasks, a new onnxruntime session is created for each of these tasks.
pipecat/src/pipecat/audio/vad/silero.py
Lines 113 to 129 in aee3011
Proposed Solution
I think all silero vad analyzers could use a single onnxruntime session across different tasks. As far as I can see, there is no problem using a single onnxruntime session in silero vad(but I guess each silero vad analyzer should be specific to pipeline since it has a state inside)
Alternative Solutions
No response
Additional Context
No response
Would you be willing to help implement this feature?