Skip to content

Commit 83e5deb

Browse files
committed
Fix Phonemizer download (#1897)
If `torch.hub` is never used, the cache directory "~/.cach/torch/hub/checkpoints/" does not exist, and the attempt to download DeepPhonemizer checkpoint there would fail. This commit fixes it by calling `os.makedirs(directory, exit_ok=True)`.
1 parent 57c8b97 commit 83e5deb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

torchaudio/pipelines/_tts/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ def _load_phonemizer(file, dl_kwargs):
169169
logger.setLevel(logging.INFO)
170170
try:
171171
url = f'https://public-asai-dl-models.s3.eu-central-1.amazonaws.com/DeepPhonemizer/{file}'
172-
path = os.path.join(torch.hub.get_dir(), 'checkpoints', file)
172+
directory = os.path.join(torch.hub.get_dir(), 'checkpoints')
173+
os.makedirs(directory, exist_ok=True)
174+
path = os.path.join(directory, file)
173175
if not os.path.exists(path):
174176
dl_kwargs = {} if dl_kwargs is None else dl_kwargs
175177
torch.hub.download_url_to_file(url, path, **dl_kwargs)

0 commit comments

Comments
 (0)