MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / load_silero_vad_model

Function load_silero_vad_model

src/models/silero_vad/session.cpp:217–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215
216const runtime::CapabilitySet & SileroVADLoadedModel::capabilities() const noexcept {
217 return capabilities_;
218}
219
220std::unique_ptr<runtime::IVoiceTaskSession> SileroVADLoadedModel::create_task_session(
221 const runtime::TaskSpec & task,
222 const runtime::SessionOptions & options) const {
223 return std::make_unique<SileroVADSession>(task, options, weights_);
224}
225
226std::unique_ptr<SileroVADLoadedModel> load_silero_vad_model(const runtime::ModelLoadRequest & request) {
227 if (request.config_id.has_value()) {
228 throw std::runtime_error("Silero VAD does not expose selectable config assets");
229 }
230 const auto weights = discover_weight_assets(request);
231 const auto * selected_weight = runtime::select_named_asset(weights, request.weight_id, "weight");
232 const auto weight_path = selected_weight != nullptr ? selected_weight->path : resolve_weight_path(request.model_path);
233 const auto assets = resolve_silero_assets(weight_path);
234 runtime::ModelMetadata metadata;
235 metadata.family = "silero_vad";
236 metadata.variant = "16k";
237 metadata.description = "Silero VAD loaded from safetensors weights.";
238 metadata.weight_candidates = {"silero_vad_16k.safetensors"};
239 runtime::CapabilitySet capabilities;
240 capabilities.supported_tasks = {
241 {runtime::VoiceTaskKind::Vad, {runtime::RunMode::Offline, runtime::RunMode::Streaming}},
242 };

Callers 2

loadMethod · 0.85
session.cppFile · 0.85

Calls 5

select_named_assetFunction · 0.85
resolve_silero_assetsFunction · 0.85
discover_weight_assetsFunction · 0.70
resolve_weight_pathFunction · 0.70

Tested by

no test coverage detected