Update dataset_stats() for HUB (#3536)

* Update `dataset_stats()` for HUB 

Cleanup of b6fdd2e

* autodownload flag

* Update general.py

* cleanup
This commit is contained in:
Glenn Jocher authored and GitHub committed 2021-06-09 10:56:11 +02:00
1 parent b6fdd2e5e5
commit 1b5edb6f8e
2 files changed
+8 -9

No files matched your search

+3 -3
View File
@@ -220,14 +220,14 @@ def check_file(file):
return files[0] # return file
def check_dataset(dict):
def check_dataset(data, autodownload=True):
# Download dataset if not found locally
val, s = dict.get('val'), dict.get('download')
val, s = data.get('val'), data.get('download')
if val and len(val):
val = [Path(x).resolve() for x in (val if isinstance(val, list) else [val])] # val path
if not all(x.exists() for x in val):
print('\nWARNING: Dataset not found, nonexistent paths: %s' % [str(x) for x in val if not x.exists()])
if s and len(s): # download script
if s and len(s) and autodownload: # download script
if s.startswith('http') and s.endswith('.zip'): # URL
f = Path(s).name # filename
print(f'Downloading {s} ...')