-
-
Notifications
You must be signed in to change notification settings - Fork 766
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
Passthrough Pipeline cache_dir param to underlying pipelines and get_model() #1722
Open
benniekiss
wants to merge
17
commits into
pyannote:develop
Choose a base branch
from
benniekiss:set_cache_dir
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
benniekiss
force-pushed
the
set_cache_dir
branch
from
June 21, 2024 11:08
7cf2d70
to
6b5f178
Compare
uses default huggingface cache location
previously, cache_dir was not passed through, so models would not download to the expected location passed in Pipeline
allow passing None as an optional parameter to cache_dir
fix docstring
Nemo api does not seem to take a save location parameter, so the cache cannot be changed passthrough cache_dir passthrough cache_dir param passthrough cache_dir param passthrough cache_dir param fix type annotation fix type annotation fix type annotation fix type annotation fix type annotation fix type annotation fix type annotation
fix import for Path typing fix import for Path typing fix import for Path typing fix import for Path typing fix import for Path typing
empty strings should trigger default cache to be set remove whitespace
formatting
formatting
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
Pipeline
class takes acache_dir
param which sets where the pipelineconfig.yaml
is downloaded, but the actual models used in the pipeline are downloaded to different locations, either the default huggingface cache location or the location set in thePYANNOTE_CACHE
env_var, by default~/.cache/torch/pyannote
.This PR makes it so that the
cache_dir
set inPipeline
is passed through to the underlying pipelines,get_model()
, andhf_hub_download()
. This way, whencache_dir
is set, all models are downloaded to this directory. Now, by default, all models are downloaded to thePYANNOTE_CACHE
env_var location,~/.cache/torch/pyannote
.Of note, the
Nemo
framework does not allow setting thecache_dir
dynamically, it can only be set via env_var.This PR will break some functionality for users, specifically for models downloaded using hf_hub_download. Previously, they were downloaded to the default huggingface cache location; now, they will be downloaded to
~/.cache/torch/pyannote
by default. This may require users to re-download models.