mirror of
https://github.com/openai/whisper.git
synced 2025-11-27 15:54:00 +00:00
Handle XDG_CACHE_HOME properly for download_root (#864)
Co-authored-by: Jong Wook Kim <jongwook@openai.com>
This commit is contained in:
parent
12e1089462
commit
9f7aba6099
@ -94,9 +94,14 @@ def load_model(name: str, device: Optional[Union[str, torch.device]] = None, dow
|
|||||||
if device is None:
|
if device is None:
|
||||||
device = "cuda" if torch.cuda.is_available() else "cpu"
|
device = "cuda" if torch.cuda.is_available() else "cpu"
|
||||||
if download_root is None:
|
if download_root is None:
|
||||||
download_root = os.getenv(
|
download_root = os.path.join(
|
||||||
"XDG_CACHE_HOME",
|
os.getenv(
|
||||||
os.path.join(os.path.expanduser("~"), ".cache", "whisper")
|
"XDG_CACHE_HOME",
|
||||||
|
os.path.join(
|
||||||
|
os.path.expanduser("~"), ".cache"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
"whisper"
|
||||||
)
|
)
|
||||||
|
|
||||||
if name in _MODELS:
|
if name in _MODELS:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user