Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PALM
提交
80087a1d
P
PALM
项目概览
PaddlePaddle
/
PALM
通知
5
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PALM
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
80087a1d
编写于
12月 03, 2019
作者:
X
Xiaoyao Xi
提交者:
GitHub
12月 03, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #36 from wangxiao1021/downloader
fix bugs
上级
3ca0e9f6
7a2f966e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
7 deletion
+12
-7
download_models.py
download_models.py
+7
-4
paddlepalm/_downloader.py
paddlepalm/_downloader.py
+5
-3
未找到文件。
download_models.py
浏览文件 @
80087a1d
...
@@ -18,12 +18,15 @@ import sys
...
@@ -18,12 +18,15 @@ import sys
import
argparse
import
argparse
# create parser
# create parser
parser
=
argparse
.
ArgumentParser
(
description
=
'Download pretrain models for initializing params of backbones. '
)
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
.
add_argument
(
"-l"
,
"--list"
,
action
=
'store_true'
,
help
=
'show the list of pretrain models'
)
parser1
=
parser
.
add_argument_group
(
"pretrain models"
)
parser
.
add_argument
(
"-d"
,
"--download"
,
action
=
'store'
,
help
=
'download pretrain models'
)
parser1
.
add_argument
(
'-l'
,
'--list'
,
action
=
'store_true'
,
help
=
'show the list of pretrain models'
,
default
=
False
)
parser1
.
add_argument
(
'-d'
,
'--download'
,
action
=
'store'
,
help
=
'download pretrain models'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
if
(
args
.
list
):
if
(
args
.
list
):
palm
.
downloader
.
ls
(
'pretrain'
)
palm
.
downloader
.
ls
(
'pretrain'
)
if
(
args
.
download
):
el
if
(
args
.
download
):
palm
.
downloader
.
download
(
'pretrain'
,
args
.
download
)
palm
.
downloader
.
download
(
'pretrain'
,
args
.
download
)
else
:
print
(
parser
.
parse_args
([
'-h'
]))
paddlepalm/_downloader.py
浏览文件 @
80087a1d
...
@@ -145,24 +145,26 @@ def download(item, scope='all', path='.'):
...
@@ -145,24 +145,26 @@ def download(item, scope='all', path='.'):
def
_ls
(
item
,
scope
,
l
=
10
):
def
_ls
(
item
,
scope
,
l
=
10
):
if
scope
!=
'all'
:
if
scope
!=
'all'
:
assert
scope
in
_items
[
item
],
'{} is not found. Support scopes: {}'
.
format
(
scope
,
list
(
_items
[
item
].
keys
()))
assert
scope
in
_items
[
item
],
'{} is not found. Support scopes: {}'
.
format
(
scope
,
list
(
_items
[
item
].
keys
()))
print
(
'{}
==> {}'
.
format
(
item
,
scope
))
print
(
'{}
'
.
format
(
scope
))
else
:
else
:
for
s
in
_items
[
item
].
keys
():
for
s
in
_items
[
item
].
keys
():
if
s
==
'utils'
:
if
s
==
'utils'
:
continue
continue
print
(
'{}
==> {}'
.
format
(
item
.
ljust
(
l
),
s
))
print
(
'{}
'
.
format
(
s
))
def
ls
(
item
=
'all'
,
scope
=
'all'
):
def
ls
(
item
=
'all'
,
scope
=
'all'
):
if
scope
==
'utils'
:
if
scope
==
'utils'
:
return
return
print
(
'Download list:'
)
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
))
_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
))
_ls
(
i
,
scope
,
l
)
_ls
(
i
,
scope
,
l
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录