Use cache_dir instead of local_dir (#182)
* Use cache_dir instead of local_dir * Fix unit test * Use cache_dir and preserve local_dir parameter * Remove blank line at the end * Disable ut * Implement download_root suggestion * Use cache_dir=download_root
This commit is contained in:
@@ -35,6 +35,7 @@ def download_model(
|
||||
size: str,
|
||||
output_dir: Optional[str] = None,
|
||||
local_files_only: Optional[bool] = False,
|
||||
cache_dir: Optional[str] = None,
|
||||
):
|
||||
"""Downloads a CTranslate2 Whisper model from the Hugging Face Hub.
|
||||
|
||||
@@ -47,6 +48,7 @@ def download_model(
|
||||
the standard Hugging Face cache directory.
|
||||
local_files_only: If True, avoid downloading the file and return the path to the local
|
||||
cached file if it exists.
|
||||
cache_dir: Path to the folder where cached files are stored.
|
||||
|
||||
Returns:
|
||||
The path to the downloaded model.
|
||||
@@ -66,6 +68,9 @@ def download_model(
|
||||
kwargs["local_dir"] = output_dir
|
||||
kwargs["local_dir_use_symlinks"] = False
|
||||
|
||||
if cache_dir is not None:
|
||||
kwargs["cache_dir"] = cache_dir
|
||||
|
||||
allow_patterns = [
|
||||
"config.json",
|
||||
"model.bin",
|
||||
|
||||
Reference in New Issue
Block a user