mirror of
https://github.com/pyannote/pyannote-audio.git
synced 2026-11-20 13:07:51 +09:00
feat: add cache_dir option to {Model|Pipeline}.from_pretrained
Co-authored-by: Hervé BREDIN <hbredin@users.noreply.github.com>
This commit is contained in:
1 parent
3c4d0a68a3
commit
20e567359d
2 files changed
+10
-2
No files matched your search
@@ -726,6 +726,7 @@ class Model(pl.LightningModule):
|
||||
strict: bool = True,
|
||||
task: Task = None,
|
||||
use_auth_token: Union[Text, None] = None,
|
||||
cache_dir: Union[Path, Text] = CACHE_DIR,
|
||||
**kwargs,
|
||||
) -> "Model":
|
||||
"""Load pretrained model
|
||||
@@ -757,6 +758,9 @@ class Model(pl.LightningModule):
|
||||
When loading a private huggingface.co model, set `use_auth_token`
|
||||
to True or to a string containing your hugginface.co authentication
|
||||
token that can be obtained by running `huggingface-cli login`
|
||||
cache_dir: Path or str, optional
|
||||
Path to model cache directory. Defaults to content of PYANNOTE_CACHE
|
||||
environment variable, or "~/.cache/torch/pyannote" when unset.
|
||||
kwargs: optional
|
||||
Any extra keyword args needed to init the model.
|
||||
Can also be used to override saved hyperparameter values.
|
||||
@@ -800,7 +804,7 @@ class Model(pl.LightningModule):
|
||||
url=url,
|
||||
library_name="pyannote",
|
||||
library_version=__version__,
|
||||
cache_dir=CACHE_DIR,
|
||||
cache_dir=cache_dir,
|
||||
use_auth_token=use_auth_token,
|
||||
)
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ class Pipeline(_Pipeline):
|
||||
batch_size: int = 32,
|
||||
use_auth_token: Union[Text, None] = None,
|
||||
progress_hook: bool = False,
|
||||
cache_dir: Union[Path, Text] = CACHE_DIR,
|
||||
) -> "Pipeline":
|
||||
"""Load pretrained pipeline
|
||||
|
||||
@@ -68,6 +69,9 @@ class Pipeline(_Pipeline):
|
||||
progress_hook : bool, optional
|
||||
Set to True to display a tqdm progress bar for each `Inference`
|
||||
preprocessor.
|
||||
cache_dir: Path or str, optional
|
||||
Path to model cache directory. Defaults to content of PYANNOTE_CACHE
|
||||
environment variable, or "~/.cache/torch/pyannote" when unset.
|
||||
"""
|
||||
|
||||
if device is not None:
|
||||
@@ -91,7 +95,7 @@ class Pipeline(_Pipeline):
|
||||
url=url,
|
||||
library_name="pyannote",
|
||||
library_version=__version__,
|
||||
cache_dir=CACHE_DIR,
|
||||
cache_dir=cache_dir,
|
||||
use_auth_token=use_auth_token,
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user