mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-09-19 05:54:20 +00:00
urlretrieve_progress is not in the lhoste, in latest version of icefall and lhoste
This commit is contained in:
parent
71e20b46fc
commit
058c72b7d2
@ -12,7 +12,20 @@ from lhotse import (
|
|||||||
SupervisionSet,
|
SupervisionSet,
|
||||||
validate_recordings_and_supervisions,
|
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(
|
def prepare_tedlium(
|
||||||
tedlium_root: Pathlike, output_dir: Optional[Pathlike] = None
|
tedlium_root: Pathlike, output_dir: Optional[Pathlike] = None
|
||||||
|
@ -55,7 +55,7 @@ if [ $stage -le 0 ] && [ $stop_stage -ge 0 ]; then
|
|||||||
# If you have pre-downloaded it to /path/to/tedlium3,
|
# If you have pre-downloaded it to /path/to/tedlium3,
|
||||||
# you can create a symlink
|
# 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
|
if [ ! -d $dl_dir/tedlium3 ]; then
|
||||||
lhotse download tedlium $dl_dir
|
lhotse download tedlium $dl_dir
|
||||||
|
Loading…
x
Reference in New Issue
Block a user