Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleHub
提交
a61b5c3d
P
PaddleHub
项目概览
PaddlePaddle
/
PaddleHub
1 年多 前同步成功
通知
283
Star
12117
Fork
2091
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
200
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleHub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
200
Issue
200
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a61b5c3d
编写于
4月 17, 2019
作者:
W
wuzewu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix python2 compatibility issues
上级
048a9ec6
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
23 addition
and
24 deletion
+23
-24
paddlehub/commands/base_command.py
paddlehub/commands/base_command.py
+1
-1
paddlehub/commands/clear.py
paddlehub/commands/clear.py
+1
-1
paddlehub/commands/download.py
paddlehub/commands/download.py
+1
-1
paddlehub/commands/help.py
paddlehub/commands/help.py
+1
-1
paddlehub/commands/hub.py
paddlehub/commands/hub.py
+6
-6
paddlehub/commands/install.py
paddlehub/commands/install.py
+1
-1
paddlehub/commands/list.py
paddlehub/commands/list.py
+1
-1
paddlehub/commands/run.py
paddlehub/commands/run.py
+1
-1
paddlehub/commands/search.py
paddlehub/commands/search.py
+1
-1
paddlehub/commands/show.py
paddlehub/commands/show.py
+1
-1
paddlehub/commands/uninstall.py
paddlehub/commands/uninstall.py
+1
-1
paddlehub/commands/version.py
paddlehub/commands/version.py
+1
-1
paddlehub/module/module.py
paddlehub/module/module.py
+4
-5
paddlehub/version.py
paddlehub/version.py
+2
-2
未找到文件。
paddlehub/commands/base_command.py
浏览文件 @
a61b5c3d
...
...
@@ -62,5 +62,5 @@ class BaseCommand(object):
def
print_args
(
self
):
print_arguments
(
self
.
args
)
def
exec
(
self
,
argv
):
def
exec
ute
(
self
,
argv
):
raise
NotImplementedError
(
"Base Command should not be execute!"
)
paddlehub/commands/clear.py
浏览文件 @
a61b5c3d
...
...
@@ -54,7 +54,7 @@ class ClearCommand(BaseCommand):
def
cache_dir
(
self
):
return
CACHE_HOME
def
exec
(
self
,
argv
):
def
exec
ute
(
self
,
argv
):
result
=
True
total_file_size
=
0
total_file_count
=
0
...
...
paddlehub/commands/download.py
浏览文件 @
a61b5c3d
...
...
@@ -43,7 +43,7 @@ class DownloadCommand(BaseCommand):
self
.
add_arg
(
'--uncompress'
,
bool
,
False
,
"uncompress the download package or not"
)
# yapf: enable
def
exec
(
self
,
argv
):
def
exec
ute
(
self
,
argv
):
if
not
argv
:
print
(
"ERROR: Please provide the model/module name
\n
"
)
self
.
help
()
...
...
paddlehub/commands/help.py
浏览文件 @
a61b5c3d
...
...
@@ -30,7 +30,7 @@ class HelpCommand(BaseCommand):
def
get_all_commands
(
self
):
return
BaseCommand
.
command_dict
def
exec
(
self
,
argv
):
def
exec
ute
(
self
,
argv
):
hub_command
=
BaseCommand
.
command_dict
[
"hub"
]
help_text
=
"
\n
"
help_text
+=
"Usage:
\n
"
...
...
paddlehub/commands/hub.py
浏览文件 @
a61b5c3d
...
...
@@ -34,30 +34,30 @@ class HubCommand(BaseCommand):
super
(
HubCommand
,
self
).
__init__
(
name
)
self
.
show_in_help
=
False
def
exec
(
self
,
argv
):
def
exec
ute
(
self
,
argv
):
logger
.
setLevel
(
"NOLOG"
)
if
not
argv
:
help
.
command
.
exec
(
argv
)
help
.
command
.
exec
ute
(
argv
)
exit
(
1
)
return
False
sub_command
=
argv
[
0
]
if
not
sub_command
in
BaseCommand
.
command_dict
:
print
(
"ERROR: unknown command '%s'"
%
sub_command
)
help
.
command
.
exec
(
argv
)
help
.
command
.
exec
ute
(
argv
)
exit
(
1
)
return
False
command
=
BaseCommand
.
command_dict
[
sub_command
]
return
command
.
exec
(
argv
[
1
:])
return
command
.
exec
ute
(
argv
[
1
:])
command
=
HubCommand
.
instance
()
def
main
():
command
.
exec
(
sys
.
argv
[
1
:])
command
.
exec
ute
(
sys
.
argv
[
1
:])
if
__name__
==
"__main__"
:
command
.
exec
(
sys
.
argv
[
1
:])
command
.
exec
ute
(
sys
.
argv
[
1
:])
paddlehub/commands/install.py
浏览文件 @
a61b5c3d
...
...
@@ -37,7 +37,7 @@ class InstallCommand(BaseCommand):
add_help
=
False
)
#TODO(wuzewu): add --upgrade option
def
exec
(
self
,
argv
):
def
exec
ute
(
self
,
argv
):
if
not
argv
:
print
(
"ERROR: Please specify a module name.
\n
"
)
self
.
help
()
...
...
paddlehub/commands/list.py
浏览文件 @
a61b5c3d
...
...
@@ -31,7 +31,7 @@ class ListCommand(BaseCommand):
self
.
show_in_help
=
True
self
.
description
=
"List all installed PaddleHub modules."
def
exec
(
self
,
argv
):
def
exec
ute
(
self
,
argv
):
all_modules
=
default_module_manager
.
all_modules
()
if
utils
.
is_windows
():
placeholders
=
[
20
,
40
]
...
...
paddlehub/commands/run.py
浏览文件 @
a61b5c3d
...
...
@@ -75,7 +75,7 @@ class RunCommand(BaseCommand):
demo
=
"%s %s %s"
%
(
entry
,
self
.
name
,
module
.
name
)
return
demo
def
exec
(
self
,
argv
):
def
exec
ute
(
self
,
argv
):
if
not
argv
:
print
(
"ERROR: Please specify a module name.
\n
"
)
self
.
help
()
...
...
paddlehub/commands/search.py
浏览文件 @
a61b5c3d
...
...
@@ -37,7 +37,7 @@ class SearchCommand(BaseCommand):
usage
=
'%(prog)s'
,
add_help
=
False
)
def
exec
(
self
,
argv
):
def
exec
ute
(
self
,
argv
):
if
not
argv
:
argv
=
[
'.*'
]
...
...
paddlehub/commands/show.py
浏览文件 @
a61b5c3d
...
...
@@ -108,7 +108,7 @@ class ShowCommand(BaseCommand):
print
(
tp
.
get_text
())
return
True
def
exec
(
self
,
argv
):
def
exec
ute
(
self
,
argv
):
if
not
argv
:
print
(
"ERROR: Please specify a module or a model
\n
"
)
self
.
help
()
...
...
paddlehub/commands/uninstall.py
浏览文件 @
a61b5c3d
...
...
@@ -36,7 +36,7 @@ class UninstallCommand(BaseCommand):
usage
=
'%(prog)s'
,
add_help
=
False
)
def
exec
(
self
,
argv
):
def
exec
ute
(
self
,
argv
):
if
not
argv
:
print
(
"ERROR: Please specify a module
\n
"
)
self
.
help
()
...
...
paddlehub/commands/version.py
浏览文件 @
a61b5c3d
...
...
@@ -28,7 +28,7 @@ class VersionCommand(BaseCommand):
self
.
show_in_help
=
True
self
.
description
=
"Show PaddleHub's version."
def
exec
(
self
,
argv
):
def
exec
ute
(
self
,
argv
):
print
(
"hub %s"
%
version
.
hub_version
)
return
True
...
...
paddlehub/module/module.py
浏览文件 @
a61b5c3d
...
...
@@ -239,14 +239,14 @@ class Module(object):
continue
var
=
global_block
.
var
(
param
[
'name'
])
global_block
.
create_parameter
(
**
param
,
shape
=
var
.
shape
,
dtype
=
var
.
dtype
,
type
=
var
.
type
,
lod_level
=
var
.
lod_level
,
error_clip
=
var
.
error_clip
,
stop_gradient
=
var
.
stop_gradient
,
is_data
=
var
.
is_data
)
is_data
=
var
.
is_data
,
**
param
)
def
_recover_variable_info
(
self
,
program
):
var_infos
=
self
.
desc
.
attr
.
map
.
data
[
'var_infos'
]
...
...
@@ -422,8 +422,7 @@ class Module(object):
self
.
check_processor
()
def
_get_reader_and_feeder
(
data_format
,
data
,
place
):
def
_reader
():
nonlocal
process_data
def
_reader
(
process_data
):
for
item
in
zip
(
*
process_data
):
yield
item
...
...
@@ -433,7 +432,7 @@ class Module(object):
process_data
.
append
([
value
[
'processed'
]
for
value
in
data
[
key
]])
feed_name_list
.
append
(
data_format
[
key
][
'feed_key'
])
feeder
=
fluid
.
DataFeeder
(
feed_list
=
feed_name_list
,
place
=
place
)
return
_reader
,
feeder
return
functools
.
partial
(
_reader
,
process_data
=
process_data
)
,
feeder
feed_dict
,
fetch_dict
,
program
=
self
.
context
(
sign_name
,
for_test
=
True
)
#TODO(wuzewu): more option
...
...
paddlehub/version.py
浏览文件 @
a61b5c3d
...
...
@@ -12,5 +12,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
""" PaddleHub version string """
hub_version
=
"0.4.
0
.alpha"
module_proto_version
=
"
0.1
.0"
hub_version
=
"0.4.
2
.alpha"
module_proto_version
=
"
1.0
.0"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录