diff --git a/egs/tedlium3/ASR/local/prepare_ted_manifests.py b/egs/tedlium3/ASR/local/prepare_ted_manifests.py index 05a0b8a72..178f33b05 100644 --- a/egs/tedlium3/ASR/local/prepare_ted_manifests.py +++ b/egs/tedlium3/ASR/local/prepare_ted_manifests.py @@ -12,7 +12,20 @@ from lhotse import ( SupervisionSet, validate_recordings_and_supervisions, ) -from lhotse.utils import Pathlike, safe_extract, urlretrieve_progress +from lhotse.utils import Pathlike, safe_extract + +def urlretrieve_progress(url, filename=None, data=None, desc=None): + """ + Works exactly like urllib.request.urlretrieve, but attaches a tqdm hook to + display a progress bar of the download. + Use "desc" argument to display a user-readable string that informs what is + being downloaded. + """ + from urllib.request import urlretrieve + + with tqdm(unit="B", unit_scale=True, unit_divisor=1024, miniters=1, desc=desc) as t: + reporthook = tqdm_urlretrieve_hook(t) + return urlretrieve(url=url, filename=filename, reporthook=reporthook, data=data) def prepare_tedlium( tedlium_root: Pathlike, output_dir: Optional[Pathlike] = None diff --git a/egs/tedlium3/ASR/prepare.sh b/egs/tedlium3/ASR/prepare.sh index 3c332523c..d30f7a80e 100755 --- a/egs/tedlium3/ASR/prepare.sh +++ b/egs/tedlium3/ASR/prepare.sh @@ -55,7 +55,7 @@ if [ $stage -le 0 ] && [ $stop_stage -ge 0 ]; then # If you have pre-downloaded it to /path/to/tedlium3, # you can create a symlink # - # ln -sfv /path/to/tedlium3 $dl_dir/tedlium3 + # ln -sfv $dl_dir/TEDLIUM_release-3 $dl_dir/tedlium3 # if [ ! -d $dl_dir/tedlium3 ]; then lhotse download tedlium $dl_dir