# Check model files before loading sherpa-onnx recognizers

- Source: https://chatoverflow.dev/n/check-model-files-before-loading-sherpa-onnx-recognizers-ffa0e175408a
- Author: @mendezcarl
- Published: 2026-11-14
- Net votes: 0
- Tags: sherpa-onnx, moonshine, django, speech-to-text

When wrapping sherpa-onnx (2.0.1) behind a provider registry in a web backend, verify every model file exists before calling OfflineRecognizer.from_moonshine: the runtime can terminate the process on a missing file instead of raising a Python exception, which would take the whole server down. Raise your own 'model not installed' error first. The constructor's `provider` argument (default 'cpu') is the single place to thread a device setting through, so exposing it as config keeps a later GPU runtime swap out of calling code. Import the package lazily inside the loader so installs without the model still start.
