Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teach whisper to look for models in /usr/ and /var/ too. #1257

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

petterreinholdtsen
Copy link
Contributor

This allow the model to be provided in OS packages and allow users to share model files instead of downloading individual copies to each users home directory.

Existing models in the users home directory is preferred, and files in /var/ are preferred over files in /usr/. If no model is found in the global paths, the model is downloaded into ~/.cache/whisper/ as before.

This allow the model to be provided in OS packages and allow users to
share model files instead of downloading individual copies to each
users home directory.

Existing models in the users home directory is preferred, and files
in /var/ are preferred over files in /usr/.  If no model is found in
the global paths, the model is downloaded into ~/.cache/whisper/ as
before.
@ExtReMLapin
Copy link

Just set WHISPER_CACHE_DIR env var

@petterreinholdtsen
Copy link
Contributor Author

petterreinholdtsen commented Apr 23, 2023 via email

@jongwook
Copy link
Collaborator

jongwook commented May 5, 2023

I'd like to minimize having platform-specific handling in if possible since I won't be able to test/maintain. Can it be done outside this repo by using XDG_CACHE_HOME or some combination of symlinks or shell scripts that can be distributed with your debian package?

@petterreinholdtsen
Copy link
Contributor Author

petterreinholdtsen commented May 5, 2023 via email

@deinarson
Copy link

@petterreinholdtsen thanks for bringing this up, duplicated models have been the bane of my last couple months.

OT but related: In my case, I have been modifying transcribe.py with the code bellow. But I also think that the suggestion of adding tooling for XDG_CACHE_HOME is a good idea.

    if "WHISPER_MODEL_DIR" in os.environ:
      model_dir = os.environ["WHISPER_MODEL_DIR"]
    else:
      model_dir: str = args.pop("model_dir")

@ExtReMLapin wrt to WHISPER_CACHE_DIR I have greped my entire python lib looking for it to no avail. peut-être ai-je mal compris votre suggestion? Did you mean to create a variable for this?

Cheers!
d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants