Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def find_version(*file_paths):
'pillow >= 4.1.1',
'six',
'torch',
'tqdm'
]

setup(
Expand Down
11 changes: 10 additions & 1 deletion torchvision/datasets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
import os.path
import hashlib
import errno
from tqdm import tqdm


def gen_bar_updator(pbar):
def bar_update(count, block_size, total_size):
pbar.total = total_size / block_size
pbar.update(count)

return bar_update


def check_integrity(fpath, md5):
Expand Down Expand Up @@ -38,7 +47,7 @@ def download_url(url, root, filename, md5):
else:
try:
print('Downloading ' + url + ' to ' + fpath)
urllib.request.urlretrieve(url, fpath)
urllib.request.urlretrieve(url, fpath, reporthook=gen_bar_updator(tqdm()))
except:
if url[:5] == 'https':
url = url.replace('https:', 'http:')
Expand Down