Open will-ca opened 1 year ago
- What is the canonical place to put models? Do the docs give a recommendation?
nshmyrev commented on Apr 29, 2022 Like I wrote before we need to look for models in 3 places: /usr/share/vosk, /home/user/.cache/vosk, os.env('VOSK_MODEL_PATH').
MODEL_DIRS = [os.getenv("VOSK_MODEL_PATH"), Path("/usr/share/vosk"),
Path.home() / "AppData/Local/vosk", Path.home() / ".cache/vosk"]
def get_model_by_name(self, model_name):
for directory in MODEL_DIRS:
def get_model_by_lang(self, lang):
for directory in MODEL_DIRS:
…Or, actually, since it looks like class vosk.Model()
already includes search path logic anyway, why does vosk-cli
implement its own model_path()
resolution order?
https://github.com/elan-ev/vosk-cli/blob/81b9f1ca27efc9ea3fa316be620b41a69edd6b4c/voskcli/transcribe.py#L249-L252
https://github.com/elan-ev/vosk-cli/blob/81b9f1ca27efc9ea3fa316be620b41a69edd6b4c/voskcli/transcribe.py#L337-L340
Searching in
$XDG_DATA_DIRS
would be nice. (Spec.) You don't always want to install models system-wide.As it's not always set, it should also look through default values of
/usr/share/
(as currently),/usr/local/share/
, and$HOME/.local/share/
.In addition to exposing manually installed models in non-root locations, this would also allow automatic use of models installed via E.G. Flatpak or Nix, which set
$XDG_DATA_DIRS
.Also, from the AUR, the
share
subdirectory seems to bevosk-models
, notvosk/models
:But that may be a packaging issue in the
vosk-api-bin
package, asvosk-api
does usevosk/models
.Just a thought/convenience that might be nice to have.