Skip to content

Commit

Permalink
Handle XDG_CACHE_HOME properly for download_root (#864)
Browse files Browse the repository at this point in the history
Co-authored-by: Jong Wook Kim <[email protected]>
  • Loading branch information
zefr0x and jongwook authored Jan 21, 2023
1 parent 12e1089 commit 9f7aba6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions whisper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,14 @@ def load_model(name: str, device: Optional[Union[str, torch.device]] = None, dow
if device is None:
device = "cuda" if torch.cuda.is_available() else "cpu"
if download_root is None:
download_root = os.getenv(
"XDG_CACHE_HOME",
os.path.join(os.path.expanduser("~"), ".cache", "whisper")
download_root = os.path.join(
os.getenv(
"XDG_CACHE_HOME",
os.path.join(
os.path.expanduser("~"), ".cache"
)
),
"whisper"
)

if name in _MODELS:
Expand Down

0 comments on commit 9f7aba6

Please sign in to comment.