Skip to content

Commit 797d103

Browse files
zefr0xjongwook
authored andcommitted
Handle XDG_CACHE_HOME properly for download_root (openai#864)
Co-authored-by: Jong Wook Kim <jongwook@openai.com>
1 parent 34e956a commit 797d103

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

whisper/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,14 @@ def load_model(name: str, device: Optional[Union[str, torch.device]] = None, dow
9494
if device is None:
9595
device = "cuda" if torch.cuda.is_available() else "cpu"
9696
if download_root is None:
97-
download_root = os.getenv(
98-
"XDG_CACHE_HOME",
99-
os.path.join(os.path.expanduser("~"), ".cache", "whisper")
97+
download_root = os.path.join(
98+
os.getenv(
99+
"XDG_CACHE_HOME",
100+
os.path.join(
101+
os.path.expanduser("~"), ".cache"
102+
)
103+
),
104+
"whisper"
100105
)
101106

102107
if name in _MODELS:

0 commit comments

Comments
 (0)