提交 991e9071 编写于 作者: W wangxiao

fix the bug when scope equals all & remove download.py

上级 5c706ef4
from __future__ import print_function
import os
items = {
'pretrain': {'ernie-en-uncased-large': 'http://xxxxx',
'xxx': 'xxx',
'utils': None}
'reader': {'cls': 'xxx',
'xxx': 'xxx',
'utils': 'xxx'}
'backbone': {xxx}
'tasktype': {xxx}
}
def download(item, scope='all', path='.'):
item = item.lower()
scope = scope.lower()
assert item in items, '{} is not found. Support list: {}'.format(item, list(items.keys()))
if not os.path.exists(path, item):
os.makedirs(os.path.join(path, item))
def _download(item, scope, silent=False):
if not silent:
print('downloading {}: {} from {}...'.format(item, scope, items[item][scope]), end='')
urllib.downloadxxx(items[item][scope])
if not silent:
print('done!')
if items['utils'] is not None:
_download(item, 'utils', silent=True)
if scope != 'all':
assert scope in items[item], '{} is not found. Support scopes: {}'.format(item, list(items[item].keys()))
_download(item, scope)
else:
for s in items[item].keys():
_download(item, s)
def ls(item=None, scope='all'):
pass
......@@ -36,9 +36,11 @@ _items = {
}
def _download(item, scope, path, silent=False):
if not silent:
print('Downloading {}: {} from {}...'.format(item, scope, _items[item][scope]))
data_url = _items[item][scope]
if data_url == None:
return
if not silent:
print('Downloading {}: {} from {}...'.format(item, scope, data_url))
data_dir = path + '/' + item + '/' + scope
if not os.path.exists(data_dir):
os.makedirs(os.path.join(data_dir))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册