提交 b3f8bb03 编写于 作者: X xixiaoyao

fix download script

上级 80087a1d
...@@ -18,15 +18,17 @@ import sys ...@@ -18,15 +18,17 @@ import sys
import argparse import argparse
# create parser # create parser
parser = argparse.ArgumentParser(prog='download_models.py', usage='%(prog)s < -l | -d <model_name> > [-h] ',description = 'Download pretrain models for initializing params of backbones. ') parser = argparse.ArgumentParser(prog='download_models.py', usage='python %(prog)s -l | -d <model_name> [-h]\n\nFor example,\n\tpython %(prog)s -d bert-en-uncased-large ',description = 'Download pretrain models for initializing params of backbones. ')
parser1= parser.add_argument_group("pretrain models") parser1= parser.add_argument_group("required arguments")
parser1.add_argument('-l','--list', action = 'store_true', help = 'show the list of pretrain models', default = False) parser1.add_argument('-l','--list', action = 'store_true', help = 'show the list of available pretrain models', default = False)
parser1.add_argument('-d','--download', action = 'store', help = 'download pretrain models') parser1.add_argument('-d','--download', action = 'store', help = 'download pretrain models. The available pretrain models can be listed by run "python download_models.py -l"')
args = parser.parse_args() args = parser.parse_args()
if(args.list): if(args.list):
palm.downloader.ls('pretrain') palm.downloader.ls('pretrain')
elif(args.download): elif(args.download):
print('download~~~')
print(args.download)
palm.downloader.download('pretrain', args.download) palm.downloader.download('pretrain', args.download)
else: else:
print (parser.parse_args(['-h'])) print (parser.parse_args(['-h']))
此差异已折叠。
README.md
setup.cfg
setup.py
./paddlepalm/__init__.py
./paddlepalm/_downloader.py
./paddlepalm/default_settings.py
./paddlepalm/downloader.py
./paddlepalm/interface.py
./paddlepalm/mtl_controller.py
./paddlepalm/task_instance.py
./paddlepalm/backbone/__init__.py
./paddlepalm/backbone/bert.py
./paddlepalm/backbone/ernie.py
./paddlepalm/backbone/utils/__init__.py
./paddlepalm/backbone/utils/transformer.py
./paddlepalm/optimizer/__init__.py
./paddlepalm/optimizer/adam.py
./paddlepalm/reader/__init__.py
./paddlepalm/reader/cls.py
./paddlepalm/reader/match.py
./paddlepalm/reader/mlm.py
./paddlepalm/reader/mrc.py
./paddlepalm/reader/utils/__init__.py
./paddlepalm/reader/utils/batching4bert.py
./paddlepalm/reader/utils/batching4ernie.py
./paddlepalm/reader/utils/mlm_batching.py
./paddlepalm/reader/utils/mrqa_helper.py
./paddlepalm/reader/utils/reader4ernie.py
./paddlepalm/task_paradigm/__init__.py
./paddlepalm/task_paradigm/cls.py
./paddlepalm/task_paradigm/match.py
./paddlepalm/task_paradigm/mlm.py
./paddlepalm/task_paradigm/mrc.py
./paddlepalm/tokenizer/__init__.py
./paddlepalm/tokenizer/bert_tokenizer.py
./paddlepalm/tokenizer/ernie_tokenizer.py
./paddlepalm/utils/__init__.py
./paddlepalm/utils/config_helper.py
./paddlepalm/utils/plot_helper.py
./paddlepalm/utils/print_helper.py
./paddlepalm/utils/reader_helper.py
./paddlepalm/utils/saver.py
./paddlepalm/utils/textprocess_helper.py
paddlepalm.egg-info/PKG-INFO
paddlepalm.egg-info/SOURCES.txt
paddlepalm.egg-info/dependency_links.txt
paddlepalm.egg-info/not-zip-safe
paddlepalm.egg-info/requires.txt
paddlepalm.egg-info/top_level.txt
\ No newline at end of file
...@@ -150,7 +150,7 @@ def _ls(item, scope, l = 10): ...@@ -150,7 +150,7 @@ def _ls(item, scope, l = 10):
for s in _items[item].keys(): for s in _items[item].keys():
if s == 'utils': if s == 'utils':
continue continue
print ('{}'.format(s)) print (' => '+s)
def ls(item='all', scope='all'): def ls(item='all', scope='all'):
...@@ -158,13 +158,12 @@ def ls(item='all', scope='all'): ...@@ -158,13 +158,12 @@ def ls(item='all', scope='all'):
return return
if item != 'all': if item != 'all':
assert item in _items, '{} is not found. Support scopes: {}'.format(item, list(_items.keys())) assert item in _items, '{} is not found. Support scopes: {}'.format(item, list(_items.keys()))
print ('Download list of \'{}\':'.format(item)) print ('Available {} items:'.format(item))
_ls(item, scope) _ls(item, scope)
else: else:
l = max(map(len, _items.keys())) l = max(map(len, _items.keys()))
print ('Download list: ')
for i in _items.keys(): for i in _items.keys():
print ('\'{}\':'.format(i)) print ('Available {} items: '.format(i))
_ls(i, scope, l) _ls(i, scope, l)
......
...@@ -21,17 +21,18 @@ Authors: zhouxiangyang(zhouxiangyang@baidu.com) ...@@ -21,17 +21,18 @@ Authors: zhouxiangyang(zhouxiangyang@baidu.com)
Date: 2019/09/29 21:00:01 Date: 2019/09/29 21:00:01
""" """
import setuptools import setuptools
from io import open
with open("README.md", "r", encoding='utf-8') as fh: with open("README.md", "r", encoding='utf-8') as fh:
long_description = fh.read() long_description = fh.read()
setuptools.setup( setuptools.setup(
name="paddlepalm", name="paddlepalm",
version="1.0.0", version="0.2.1",
author="PaddlePaddle", author="PaddlePaddle",
author_email="zhangyiming04@baidu.com", author_email="zhangyiming04@baidu.com",
description="A Multi-task Learning Lib for PaddlePaddle Users.", description="A Multi-task Learning Lib for PaddlePaddle Users.",
long_description=long_description, long_description=long_description,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
url="https://github.com/PaddlePadd", url="https://github.com/PaddlePaddle/PALM",
# packages=setuptools.find_packages(), # packages=setuptools.find_packages(),
packages = ['paddlepalm', packages = ['paddlepalm',
'paddlepalm.backbone', 'paddlepalm.backbone',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册