Skip to content

Commit 644d5a2

Browse files
fix(silero): keep explicit load on onnx (#1944)
Co-authored-by: rosetta-livekit-bot[bot] <282703043+rosetta-livekit-bot[bot]@users.noreply.github.com>
1 parent 120f06e commit 644d5a2

3 files changed

Lines changed: 5 additions & 34 deletions

File tree

.changeset/silero-onnx-load.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@livekit/agents-plugin-silero': patch
3+
---
4+
5+
Use the ONNX runtime path when explicitly loading `silero.VAD.load()`.

plugins/silero/src/index.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ import { Plugin } from '@livekit/agents';
55

66
export { VAD, VADStream } from './vad.js';
77

8-
console.warn(
9-
'@livekit/agents-plugin-silero is deprecated and will be removed in v2.0. ' +
10-
'AgentSession now defaults to the bundled silero VAD (via @livekit/local-inference); ' +
11-
'drop the explicit `vad=` argument entirely, pass `vad: null` to opt out, or use ' +
12-
"`import { inference } from '@livekit/agents'; new inference.VAD({ model: 'silero', ... })` " +
13-
'to customise options.',
14-
);
15-
168
class SileroPlugin extends Plugin {
179
constructor() {
1810
super({

plugins/silero/src/vad.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
VADEventType,
77
VADStream as baseStream,
88
VAD as baseVAD,
9-
inference,
109
log,
1110
mergeFrames,
1211
} from '@livekit/agents';
@@ -100,31 +99,6 @@ export class VAD extends baseVAD {
10099
*/
101100
static async load(opts: Partial<VADOptions> = {}): Promise<baseVAD> {
102101
const mergedOpts: VADOptions = { ...defaultVADOptions, ...opts };
103-
104-
// When the requested settings are compatible with the bundled native
105-
// implementation in `@livekit/local-inference`, delegate to
106-
// `inference.VAD({ model: 'silero' })` so existing call sites transparently
107-
// get the faster, COW-shared native path as part of the silero deprecation.
108-
// The native lib only ships the 16 kHz model, so any other sample rate
109-
// falls back to the legacy onnxruntime path below.
110-
if (mergedOpts.sampleRate === 16000) {
111-
if (!mergedOpts.forceCPU) {
112-
log().warn(
113-
'forceCPU=false is ignored when using the bundled native VAD; the ' +
114-
'model runs CPU-only. Use a non-16kHz sampleRate to keep the legacy ' +
115-
'onnxruntime path that honors forceCPU.',
116-
);
117-
}
118-
return new inference.VAD({
119-
model: 'silero',
120-
minSpeechDuration: mergedOpts.minSpeechDuration,
121-
minSilenceDuration: mergedOpts.minSilenceDuration,
122-
prefixPaddingDuration: mergedOpts.prefixPaddingDuration,
123-
maxBufferedSpeech: mergedOpts.maxBufferedSpeech,
124-
activationThreshold: mergedOpts.activationThreshold,
125-
});
126-
}
127-
128102
const session = await newInferenceSession(mergedOpts.forceCPU);
129103
return new VAD(session, mergedOpts);
130104
}

0 commit comments

Comments
 (0)