livekit-plugins-silero 0.6.0.dev1__tar.gz → 0.6.0.dev7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (19) hide show
  1. {livekit_plugins_silero-0.6.0.dev1 → livekit_plugins_silero-0.6.0.dev7}/PKG-INFO +2 -2
  2. livekit_plugins_silero-0.6.0.dev7/livekit/plugins/silero/resources/silero_vad.onnx +0 -0
  3. {livekit_plugins_silero-0.6.0.dev1 → livekit_plugins_silero-0.6.0.dev7}/livekit/plugins/silero/vad.py +25 -8
  4. {livekit_plugins_silero-0.6.0.dev1 → livekit_plugins_silero-0.6.0.dev7}/livekit/plugins/silero/version.py +1 -1
  5. {livekit_plugins_silero-0.6.0.dev1 → livekit_plugins_silero-0.6.0.dev7}/livekit_plugins_silero.egg-info/PKG-INFO +2 -2
  6. {livekit_plugins_silero-0.6.0.dev1 → livekit_plugins_silero-0.6.0.dev7}/livekit_plugins_silero.egg-info/requires.txt +1 -1
  7. {livekit_plugins_silero-0.6.0.dev1 → livekit_plugins_silero-0.6.0.dev7}/setup.py +1 -1
  8. livekit_plugins_silero-0.6.0.dev1/livekit/plugins/silero/resources/silero_vad.onnx +0 -3
  9. {livekit_plugins_silero-0.6.0.dev1 → livekit_plugins_silero-0.6.0.dev7}/README.md +0 -0
  10. {livekit_plugins_silero-0.6.0.dev1 → livekit_plugins_silero-0.6.0.dev7}/livekit/plugins/silero/__init__.py +0 -0
  11. {livekit_plugins_silero-0.6.0.dev1 → livekit_plugins_silero-0.6.0.dev7}/livekit/plugins/silero/log.py +0 -0
  12. {livekit_plugins_silero-0.6.0.dev1 → livekit_plugins_silero-0.6.0.dev7}/livekit/plugins/silero/onnx_model.py +0 -0
  13. {livekit_plugins_silero-0.6.0.dev1 → livekit_plugins_silero-0.6.0.dev7}/livekit/plugins/silero/py.typed +0 -0
  14. {livekit_plugins_silero-0.6.0.dev1 → livekit_plugins_silero-0.6.0.dev7}/livekit/plugins/silero/resources/__init__.py +0 -0
  15. {livekit_plugins_silero-0.6.0.dev1 → livekit_plugins_silero-0.6.0.dev7}/livekit_plugins_silero.egg-info/SOURCES.txt +0 -0
  16. {livekit_plugins_silero-0.6.0.dev1 → livekit_plugins_silero-0.6.0.dev7}/livekit_plugins_silero.egg-info/dependency_links.txt +0 -0
  17. {livekit_plugins_silero-0.6.0.dev1 → livekit_plugins_silero-0.6.0.dev7}/livekit_plugins_silero.egg-info/top_level.txt +0 -0
  18. {livekit_plugins_silero-0.6.0.dev1 → livekit_plugins_silero-0.6.0.dev7}/pyproject.toml +0 -0
  19. {livekit_plugins_silero-0.6.0.dev1 → livekit_plugins_silero-0.6.0.dev7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: livekit-plugins-silero
3
- Version: 0.6.0.dev1
3
+ Version: 0.6.0.dev7
4
4
  Summary: Agent Framework Plugin for Silero
5
5
  Home-page: https://github.com/livekit/agents
6
6
  License: Apache-2.0
@@ -19,7 +19,7 @@ Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Programming Language :: Python :: 3 :: Only
20
20
  Requires-Python: >=3.9.0
21
21
  Description-Content-Type: text/markdown
22
- Requires-Dist: livekit-agents~=0.7
22
+ Requires-Dist: livekit-agents>=0.8.0.dev0
23
23
  Requires-Dist: onnxruntime>=1.18
24
24
  Requires-Dist: numpy>=1.26
25
25
 
@@ -19,6 +19,7 @@ import time
19
19
  from dataclasses import dataclass
20
20
 
21
21
  import numpy as np
22
+ import onnxruntime # type: ignore
22
23
  from livekit import agents, rtc
23
24
  from livekit.agents import utils
24
25
 
@@ -37,8 +38,9 @@ class _VADOptions:
37
38
 
38
39
 
39
40
  class VAD(agents.vad.VAD):
40
- def __init__(
41
- self,
41
+ @classmethod
42
+ def load(
43
+ cls,
42
44
  *,
43
45
  min_speech_duration: float = 0.05,
44
46
  min_silence_duration: float = 0.1,
@@ -47,7 +49,7 @@ class VAD(agents.vad.VAD):
47
49
  activation_threshold: float = 0.25,
48
50
  sample_rate: int = 16000,
49
51
  force_cpu: bool = True,
50
- ) -> None:
52
+ ) -> "VAD":
51
53
  """
52
54
  Initialize the Silero VAD with the given options.
53
55
  The options are already set to strong defaults.
@@ -61,12 +63,11 @@ class VAD(agents.vad.VAD):
61
63
  sample_rate: sample rate for the inference (only 8KHz and 16KHz are supported)
62
64
  force_cpu: force to use CPU for inference
63
65
  """
64
-
65
66
  if sample_rate not in onnx_model.SUPPORTED_SAMPLE_RATES:
66
67
  raise ValueError("Silero VAD only supports 8KHz and 16KHz sample rates")
67
68
 
68
- self._onnx_session = onnx_model.new_inference_session(force_cpu)
69
- self._opts = _VADOptions(
69
+ session = onnx_model.new_inference_session(force_cpu)
70
+ opts = _VADOptions(
70
71
  min_speech_duration=min_speech_duration,
71
72
  min_silence_duration=min_silence_duration,
72
73
  padding_duration=padding_duration,
@@ -74,6 +75,17 @@ class VAD(agents.vad.VAD):
74
75
  activation_threshold=activation_threshold,
75
76
  sample_rate=sample_rate,
76
77
  )
78
+ return cls(session=session, opts=opts)
79
+
80
+ def __init__(
81
+ self,
82
+ *,
83
+ session: onnxruntime.InferenceSession,
84
+ opts: _VADOptions,
85
+ ) -> None:
86
+ super().__init__(capabilities=agents.vad.VADCapabilities(update_interval=0.032))
87
+ self._onnx_session = session
88
+ self._opts = opts
77
89
 
78
90
  def stream(self) -> "VADStream":
79
91
  return VADStream(
@@ -177,8 +189,12 @@ class VADStream(agents.vad.VADStream):
177
189
  may_start_at_sample = -1
178
190
  may_end_at_sample = -1
179
191
 
180
- min_speech_samples = self._opts.min_speech_duration * self._opts.sample_rate
181
- min_silence_samples = self._opts.min_silence_duration * self._opts.sample_rate
192
+ min_speech_samples = int(
193
+ self._opts.min_speech_duration * self._opts.sample_rate
194
+ )
195
+ min_silence_samples = int(
196
+ self._opts.min_silence_duration * self._opts.sample_rate
197
+ )
182
198
 
183
199
  current_sample = 0
184
200
 
@@ -204,6 +220,7 @@ class VADStream(agents.vad.VADStream):
204
220
  else:
205
221
  max_data_s += self._opts.max_buffered_speech
206
222
 
223
+ assert self._original_sample_rate is not None
207
224
  cl = int(max_data_s) * self._original_sample_rate
208
225
  if len(pub_speech_buf) > cl:
209
226
  pub_speech_buf = pub_speech_buf[-cl:]
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = "0.6.0-dev.1"
15
+ __version__ = "0.6.0-dev.7"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: livekit-plugins-silero
3
- Version: 0.6.0.dev1
3
+ Version: 0.6.0.dev7
4
4
  Summary: Agent Framework Plugin for Silero
5
5
  Home-page: https://github.com/livekit/agents
6
6
  License: Apache-2.0
@@ -19,7 +19,7 @@ Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Programming Language :: Python :: 3 :: Only
20
20
  Requires-Python: >=3.9.0
21
21
  Description-Content-Type: text/markdown
22
- Requires-Dist: livekit-agents~=0.7
22
+ Requires-Dist: livekit-agents>=0.8.0.dev0
23
23
  Requires-Dist: onnxruntime>=1.18
24
24
  Requires-Dist: numpy>=1.26
25
25
 
@@ -1,3 +1,3 @@
1
- livekit-agents~=0.7
1
+ livekit-agents>=0.8.0.dev0
2
2
  onnxruntime>=1.18
3
3
  numpy>=1.26
@@ -47,7 +47,7 @@ setuptools.setup(
47
47
  license="Apache-2.0",
48
48
  packages=setuptools.find_namespace_packages(include=["livekit.*"]),
49
49
  python_requires=">=3.9.0",
50
- install_requires=["livekit-agents~=0.7", "onnxruntime>=1.18", "numpy>=1.26"],
50
+ install_requires=["livekit-agents>=0.8.0.dev0", "onnxruntime>=1.18", "numpy>=1.26"],
51
51
  package_data={
52
52
  "livekit.plugins.silero.resources": ["silero_vad.onnx"],
53
53
  "livekit.plugins.silero": ["py.typed"],
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:6b99cbfd39246b6706f98ec13c7c50c6b299181f2474fa05cbc8046acc274396
3
- size 2313101