mudler/LocalAI · critical

error: Failed to init model as VAD\n

Error message

error: Failed to init model as VAD\n

What it means

load_model_vad() failed because whisper_vad_init_from_file_with_params() returned NULL for the given model path — the file could not be initialized as a Whisper VAD model. Note the shim explicitly leaves use_gpu at its default (the upstream override is commented out), so both file-level and init-level causes surface here. Returns 1.

Source

Thrown at backend/go/crispasr/cpp/crispasr_shim.cpp:190

// success or when the active backend needs no companion, negative on failure,
// and -1 when no session is open.
int set_codec_path(const char *path) {
  return g_session ? crispasr_session_set_codec_path(g_session, path) : -1;
}

int load_model_vad(const char *const model_path) {
  whisper_log_set(ggml_log_cb, nullptr);
  ggml_backend_load_all();

  struct whisper_vad_context_params vcparams =
      whisper_vad_default_context_params();

  // XXX: Overridden to false in upstream due to performance?
  // vcparams.use_gpu = true;

  vctx = whisper_vad_init_from_file_with_params(model_path, vcparams);
  if (vctx == nullptr) {
    fprintf(stderr, "error: Failed to init model as VAD\n");
    return 1;
  }

  return 0;
}

int vad(float pcmf32[], size_t pcmf32_len, float **segs_out,
        size_t *segs_out_len) {
  if (!whisper_vad_detect_speech(vctx, pcmf32, pcmf32_len)) {
    fprintf(stderr, "error: failed to detect speech\n");
    return 1;
  }

  struct whisper_vad_params params = whisper_vad_default_params();
  struct whisper_vad_segments *segs =
      whisper_vad_segments_from_probs(vctx, params);
  size_t segn = whisper_vad_segments_n_segments(segs);

View on GitHub (pinned to 44413a9d06)

Solutions

  1. Confirm the path points to the dedicated Whisper VAD model, not a transcription model.
  2. Verify file integrity (size/hash against the gallery entry).
  3. Check ggml logs above the error for the concrete init failure.
  4. Ensure the bundled whisper.cpp has VAD support compiled in.
Defensive patterns

Strategy: validation

Validate before calling

if _, err := os.Stat(vadModelPath); err != nil {
    return fmt.Errorf("VAD model missing: %w", err)
}
if rc := C.load_model_vad(C.CString(vadModelPath)); rc != 0 {
    return errors.New("VAD init failed; is this the dedicated VAD checkpoint?")
}

Prevention

When it happens

Trigger: load_model_vad(path) where path is missing, not a valid VAD checkpoint (e.g., a regular ASR model without VAD head), or whisper VAD init fails on the current backend.

Common situations: Passing a standard whisper ASR GGUF where the dedicated VAD model (silero-style vad checkpoint) is required; wrong path in config; truncated download; whisper.cpp version bundled does not support the VAD model format.

Related errors


AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15). Data as JSON: /api/errors/323ba5d7bf531611. Report an issue: GitHub.