Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleHub
提交
14535dd4
P
PaddleHub
项目概览
PaddlePaddle
/
PaddleHub
大约 1 年 前同步成功
通知
282
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看板
提交
14535dd4
编写于
4月 02, 2019
作者:
W
wuzewu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update module desc proto
上级
6f41ac4a
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
229 addition
and
304 deletion
+229
-304
paddle_hub/common/paddle_helper.py
paddle_hub/common/paddle_helper.py
+36
-36
paddle_hub/common/utils.py
paddle_hub/common/utils.py
+51
-53
paddle_hub/module/module.py
paddle_hub/module/module.py
+43
-45
paddle_hub/module/module_desc.proto
paddle_hub/module/module_desc.proto
+16
-22
paddle_hub/module/module_desc_pb2.py
paddle_hub/module/module_desc_pb2.py
+83
-148
未找到文件。
paddle_hub/common/paddle_helper.py
浏览文件 @
14535dd4
...
...
@@ -16,7 +16,7 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
print_function
from
..module
import
module_desc_pb2
from
.utils
import
from_pyobj_to_
flexible_data
,
from_flexible_data
_to_pyobj
from
.utils
import
from_pyobj_to_
module_attr
,
from_module_attr
_to_pyobj
from
.logger
import
logger
import
paddle
import
paddle.fluid
as
fluid
...
...
@@ -49,70 +49,70 @@ def get_variable_info(var):
return
var_info
def
from_param_to_
flexible_data
(
param
,
flexible_data
):
def
from_param_to_
module_attr
(
param
,
module_attr
):
def
paddle_obj_filter
(
pyobj
):
return
isinstance
(
pyobj
,
fluid
.
framework
.
Variable
)
or
isinstance
(
pyobj
,
fluid
.
framework
.
Block
)
or
isinstance
(
pyobj
,
fluid
.
framework
.
Program
)
or
isinstance
(
pyobj
,
fluid
.
framework
.
Operator
)
flexible_data
.
type
=
module_desc_pb2
.
MAP
from_pyobj_to_
flexible_data
(
param
.
trainable
,
flexible_data
.
map
.
data
[
'trainable'
])
from_pyobj_to_
flexible_data
(
param
.
do_model_average
,
flexible_data
.
map
.
data
[
'do_model_average'
])
module_attr
.
type
=
module_desc_pb2
.
MAP
from_pyobj_to_
module_attr
(
param
.
trainable
,
module_attr
.
map
.
data
[
'trainable'
])
from_pyobj_to_
module_attr
(
param
.
do_model_average
,
module_attr
.
map
.
data
[
'do_model_average'
])
#TODO(wuzewu): don't save learning rate
from_pyobj_to_
flexible_data
(
param
.
optimize_attr
,
flexible_data
.
map
.
data
[
'optimize_attr'
])
from_pyobj_to_
flexible_data
(
from_pyobj_to_
module_attr
(
param
.
optimize_attr
,
module_attr
.
map
.
data
[
'optimize_attr'
])
from_pyobj_to_
module_attr
(
param
.
regularizer
,
flexible_data
.
map
.
data
[
'regularizer'
],
module_attr
.
map
.
data
[
'regularizer'
],
obj_filter
=
paddle_obj_filter
)
from_pyobj_to_
flexible_data
(
from_pyobj_to_
module_attr
(
param
.
gradient_clip_attr
,
flexible_data
.
map
.
data
[
'gradient_clip_attr'
],
module_attr
.
map
.
data
[
'gradient_clip_attr'
],
obj_filter
=
paddle_obj_filter
)
def
from_
flexible_data_to_param
(
flexible_data
):
def
from_
module_attr_to_param
(
module_attr
):
param
=
{
'gradient_clip_attr'
:
None
,
'regularizer'
:
None
}
param
[
'trainable'
]
=
from_
flexible_data
_to_pyobj
(
flexible_data
.
map
.
data
[
'trainable'
])
param
[
'do_model_average'
]
=
from_
flexible_data
_to_pyobj
(
flexible_data
.
map
.
data
[
'do_model_average'
])
param
[
'trainable'
]
=
from_
module_attr
_to_pyobj
(
module_attr
.
map
.
data
[
'trainable'
])
param
[
'do_model_average'
]
=
from_
module_attr
_to_pyobj
(
module_attr
.
map
.
data
[
'do_model_average'
])
# do not recover learning rate
#param['optimize_attr'] = from_
flexible_data
_to_pyobj(
#
flexible_data
.map.data['optimize_attr'])
if
flexible_data
.
map
.
data
[
'regularizer'
].
type
!=
module_desc_pb2
.
NONE
:
regularizer_type
=
flexible_data
.
map
.
data
[
'regularizer'
].
name
regularization_coeff
=
from_
flexible_data
_to_pyobj
(
flexible_data
.
map
.
data
[
'regularizer'
].
object
.
#param['optimize_attr'] = from_
module_attr
_to_pyobj(
#
module_attr
.map.data['optimize_attr'])
if
module_attr
.
map
.
data
[
'regularizer'
].
type
!=
module_desc_pb2
.
NONE
:
regularizer_type
=
module_attr
.
map
.
data
[
'regularizer'
].
name
regularization_coeff
=
from_
module_attr
_to_pyobj
(
module_attr
.
map
.
data
[
'regularizer'
].
object
.
data
[
'_regularization_coeff'
])
param
[
'regularizer'
]
=
eval
(
"fluid.regularizer.%s(regularization_coeff = %f)"
%
(
regularizer_type
,
regularization_coeff
))
if
flexible_data
.
map
.
data
[
'gradient_clip_attr'
].
type
!=
module_desc_pb2
.
NONE
:
clip_type
=
flexible_data
.
map
.
data
[
'gradient_clip_attr'
].
name
if
module_attr
.
map
.
data
[
'gradient_clip_attr'
].
type
!=
module_desc_pb2
.
NONE
:
clip_type
=
module_attr
.
map
.
data
[
'gradient_clip_attr'
].
name
if
clip_type
==
"ErrorClipByValue"
or
clip_type
==
"GradientClipByValue"
:
max
=
from_
flexible_data
_to_pyobj
(
flexible_data
.
map
.
data
[
'gradient_clip_attr'
].
object
.
data
[
'max'
])
min
=
from_
flexible_data
_to_pyobj
(
flexible_data
.
map
.
data
[
'gradient_clip_attr'
].
object
.
data
[
'min'
])
max
=
from_
module_attr
_to_pyobj
(
module_attr
.
map
.
data
[
'gradient_clip_attr'
].
object
.
data
[
'max'
])
min
=
from_
module_attr
_to_pyobj
(
module_attr
.
map
.
data
[
'gradient_clip_attr'
].
object
.
data
[
'min'
])
param
[
'gradient_clip_attr'
]
=
eval
(
"fluid.clip.%s(max = %f, min = %f)"
%
(
clip_type
,
max
,
min
))
if
clip_type
==
"GradientClipByNorm"
:
clip_norm
=
from_
flexible_data
_to_pyobj
(
flexible_data
.
map
.
data
[
'gradient_clip_attr'
].
object
.
clip_norm
=
from_
module_attr
_to_pyobj
(
module_attr
.
map
.
data
[
'gradient_clip_attr'
].
object
.
data
[
'clip_norm'
])
param
[
'gradient_clip_attr'
]
=
eval
(
"fluid.clip.%s(clip_norm = %f)"
%
(
clip_type
,
clip_norm
))
if
clip_type
==
"GradientClipByGlobalNorm"
:
clip_norm
=
from_
flexible_data
_to_pyobj
(
flexible_data
.
map
.
data
[
'gradient_clip_attr'
].
object
.
clip_norm
=
from_
module_attr
_to_pyobj
(
module_attr
.
map
.
data
[
'gradient_clip_attr'
].
object
.
data
[
'clip_norm'
])
group_name
=
from_
flexible_data
_to_pyobj
(
flexible_data
.
map
.
data
[
'gradient_clip_attr'
].
object
.
group_name
=
from_
module_attr
_to_pyobj
(
module_attr
.
map
.
data
[
'gradient_clip_attr'
].
object
.
data
[
'group_name'
])
param
[
'gradient_clip_attr'
]
=
eval
(
"fluid.clip.%s(clip_norm = %f, group_name =
\"
%s
\"
)"
%
...
...
paddle_hub/common/utils.py
浏览文件 @
14535dd4
...
...
@@ -82,86 +82,84 @@ def get_pykey(key, keyed_type):
#TODO(wuzewu): solving the problem of circular references
def
from_pyobj_to_
flexible_data
(
pyobj
,
flexible_data
,
obj_filter
=
None
):
def
from_pyobj_to_
module_attr
(
pyobj
,
module_attr
,
obj_filter
=
None
):
if
obj_filter
and
obj_filter
(
pyobj
):
return
if
isinstance
(
pyobj
,
bool
):
flexible_data
.
type
=
module_desc_pb2
.
BOOLEAN
flexible_data
.
b
=
pyobj
module_attr
.
type
=
module_desc_pb2
.
BOOLEAN
module_attr
.
b
=
pyobj
elif
isinstance
(
pyobj
,
int
):
flexible_data
.
type
=
module_desc_pb2
.
INT
flexible_data
.
i
=
pyobj
module_attr
.
type
=
module_desc_pb2
.
INT
module_attr
.
i
=
pyobj
elif
isinstance
(
pyobj
,
str
):
flexible_data
.
type
=
module_desc_pb2
.
STRING
flexible_data
.
s
=
pyobj
module_attr
.
type
=
module_desc_pb2
.
STRING
module_attr
.
s
=
pyobj
elif
isinstance
(
pyobj
,
float
):
flexible_data
.
type
=
module_desc_pb2
.
FLOAT
flexible_data
.
f
=
pyobj
module_attr
.
type
=
module_desc_pb2
.
FLOAT
module_attr
.
f
=
pyobj
elif
isinstance
(
pyobj
,
list
)
or
isinstance
(
pyobj
,
tuple
):
flexible_data
.
type
=
module_desc_pb2
.
LIST
module_attr
.
type
=
module_desc_pb2
.
LIST
for
index
,
obj
in
enumerate
(
pyobj
):
from_pyobj_to_
flexible_data
(
obj
,
flexible_data
.
list
.
data
[
str
(
index
)],
obj_filter
)
from_pyobj_to_
module_attr
(
obj
,
module_attr
.
list
.
data
[
str
(
index
)],
obj_filter
)
elif
isinstance
(
pyobj
,
set
):
flexible_data
.
type
=
module_desc_pb2
.
SET
module_attr
.
type
=
module_desc_pb2
.
SET
for
index
,
obj
in
enumerate
(
list
(
pyobj
)):
from_pyobj_to_
flexible_data
(
obj
,
flexible_data
.
set
.
data
[
str
(
index
)],
from_pyobj_to_
module_attr
(
obj
,
module_attr
.
set
.
data
[
str
(
index
)],
obj_filter
)
elif
isinstance
(
pyobj
,
dict
):
flexible_data
.
type
=
module_desc_pb2
.
MAP
module_attr
.
type
=
module_desc_pb2
.
MAP
for
key
,
value
in
pyobj
.
items
():
from_pyobj_to_
flexible_data
(
value
,
flexible_data
.
map
.
data
[
str
(
key
)],
from_pyobj_to_
module_attr
(
value
,
module_attr
.
map
.
data
[
str
(
key
)],
obj_filter
)
flexible_data
.
map
.
keyT
ype
[
str
(
key
)]
=
get_keyed_type_of_pyobj
(
key
)
module_attr
.
map
.
key_t
ype
[
str
(
key
)]
=
get_keyed_type_of_pyobj
(
key
)
elif
isinstance
(
pyobj
,
type
(
None
)):
flexible_data
.
type
=
module_desc_pb2
.
NONE
module_attr
.
type
=
module_desc_pb2
.
NONE
else
:
flexible_data
.
type
=
module_desc_pb2
.
OBJECT
flexible_data
.
name
=
str
(
pyobj
.
__class__
.
__name__
)
module_attr
.
type
=
module_desc_pb2
.
OBJECT
module_attr
.
name
=
str
(
pyobj
.
__class__
.
__name__
)
if
not
hasattr
(
pyobj
,
"__dict__"
):
logger
.
warning
(
"python obj %s has not __dict__ attr"
%
flexible_data
.
name
)
"python obj %s has not __dict__ attr"
%
module_attr
.
name
)
return
for
key
,
value
in
pyobj
.
__dict__
.
items
():
from_pyobj_to_flexible_data
(
value
,
flexible_data
.
object
.
data
[
str
(
key
)],
obj_filter
)
flexible_data
.
object
.
keyType
[
str
(
key
)]
=
get_keyed_type_of_pyobj
(
key
)
def
from_flexible_data_to_pyobj
(
flexible_data
):
if
flexible_data
.
type
==
module_desc_pb2
.
BOOLEAN
:
result
=
flexible_data
.
b
elif
flexible_data
.
type
==
module_desc_pb2
.
INT
:
result
=
flexible_data
.
i
elif
flexible_data
.
type
==
module_desc_pb2
.
STRING
:
result
=
flexible_data
.
s
elif
flexible_data
.
type
==
module_desc_pb2
.
FLOAT
:
result
=
flexible_data
.
f
elif
flexible_data
.
type
==
module_desc_pb2
.
LIST
:
from_pyobj_to_module_attr
(
value
,
module_attr
.
object
.
data
[
str
(
key
)],
obj_filter
)
module_attr
.
object
.
key_type
[
str
(
key
)]
=
get_keyed_type_of_pyobj
(
key
)
def
from_module_attr_to_pyobj
(
module_attr
):
if
module_attr
.
type
==
module_desc_pb2
.
BOOLEAN
:
result
=
module_attr
.
b
elif
module_attr
.
type
==
module_desc_pb2
.
INT
:
result
=
module_attr
.
i
elif
module_attr
.
type
==
module_desc_pb2
.
STRING
:
result
=
module_attr
.
s
elif
module_attr
.
type
==
module_desc_pb2
.
FLOAT
:
result
=
module_attr
.
f
elif
module_attr
.
type
==
module_desc_pb2
.
LIST
:
result
=
[]
for
index
in
range
(
len
(
flexible_data
.
list
.
data
)):
for
index
in
range
(
len
(
module_attr
.
list
.
data
)):
result
.
append
(
from_flexible_data_to_pyobj
(
flexible_data
.
list
.
data
[
str
(
index
)]))
elif
flexible_data
.
type
==
module_desc_pb2
.
SET
:
from_module_attr_to_pyobj
(
module_attr
.
list
.
data
[
str
(
index
)]))
elif
module_attr
.
type
==
module_desc_pb2
.
SET
:
result
=
set
()
for
index
in
range
(
len
(
flexible_data
.
set
.
data
)):
for
index
in
range
(
len
(
module_attr
.
set
.
data
)):
result
.
add
(
from_
flexible_data_to_pyobj
(
flexible_data
.
set
.
data
[
str
(
index
)]))
elif
flexible_data
.
type
==
module_desc_pb2
.
MAP
:
from_
module_attr_to_pyobj
(
module_attr
.
set
.
data
[
str
(
index
)]))
elif
module_attr
.
type
==
module_desc_pb2
.
MAP
:
result
=
{}
for
key
,
value
in
flexible_data
.
map
.
data
.
items
():
key
=
get_pykey
(
key
,
flexible_data
.
map
.
keyT
ype
[
key
])
result
[
key
]
=
from_
flexible_data
_to_pyobj
(
value
)
elif
flexible_data
.
type
==
module_desc_pb2
.
NONE
:
for
key
,
value
in
module_attr
.
map
.
data
.
items
():
key
=
get_pykey
(
key
,
module_attr
.
map
.
key_t
ype
[
key
])
result
[
key
]
=
from_
module_attr
_to_pyobj
(
value
)
elif
module_attr
.
type
==
module_desc_pb2
.
NONE
:
result
=
None
elif
flexible_data
.
type
==
module_desc_pb2
.
OBJECT
:
elif
module_attr
.
type
==
module_desc_pb2
.
OBJECT
:
result
=
None
logger
.
warning
(
"can't tran
flexible_data
to python object"
)
logger
.
warning
(
"can't tran
module attr
to python object"
)
else
:
result
=
None
logger
.
warning
(
"unknown type of
flexible_data
"
)
logger
.
warning
(
"unknown type of
module attr
"
)
return
result
...
...
paddle_hub/module/module.py
浏览文件 @
14535dd4
...
...
@@ -161,15 +161,15 @@ class Module(object):
utils
.
mkdir
(
processor_path
)
with
open
(
output_file
,
"w"
)
as
file
:
file
.
write
(
pycode
)
utils
.
from_pyobj_to_
flexible_data
(
processor_name
,
self
.
desc
.
extra_info
.
map
.
data
[
'processor_info'
])
utils
.
from_pyobj_to_
module_attr
(
processor_name
,
self
.
desc
.
attr
.
map
.
data
[
'processor_info'
])
def
_load_processor
(
self
):
processor_path
=
self
.
helper
.
processor_path
()
if
os
.
path
.
exists
(
processor_path
):
sys
.
path
.
append
(
processor_path
)
processor_name
=
utils
.
from_
flexible_data
_to_pyobj
(
self
.
desc
.
extra_info
.
map
.
data
[
'processor_info'
])
processor_name
=
utils
.
from_
module_attr
_to_pyobj
(
self
.
desc
.
attr
.
map
.
data
[
'processor_info'
])
self
.
processor
=
__import__
(
processor_name
).
Processor
(
module
=
self
)
else
:
self
.
processor
=
None
...
...
@@ -230,9 +230,9 @@ class Module(object):
def
_restore_parameter
(
self
,
program
):
global_block
=
program
.
global_block
()
param_attrs
=
self
.
desc
.
extra_info
.
map
.
data
[
'param_attrs'
]
param_attrs
=
self
.
desc
.
attr
.
map
.
data
[
'param_attrs'
]
for
key
,
param_attr
in
param_attrs
.
map
.
data
.
items
():
param
=
paddle_helper
.
from_
flexible_data
_to_param
(
param_attr
)
param
=
paddle_helper
.
from_
module_attr
_to_param
(
param_attr
)
param
[
'name'
]
=
self
.
get_var_name_with_prefix
(
key
)
if
(
param
[
'name'
]
not
in
global_block
.
vars
):
continue
...
...
@@ -248,11 +248,11 @@ class Module(object):
is_data
=
var
.
is_data
)
def
_recover_variable_info
(
self
,
program
):
var_infos
=
self
.
desc
.
extra_info
.
map
.
data
[
'var_infos'
]
var_infos
=
self
.
desc
.
attr
.
map
.
data
[
'var_infos'
]
for
var_info
in
var_infos
.
map
.
data
:
idx
=
utils
.
from_
flexible_data
_to_pyobj
(
idx
=
utils
.
from_
module_attr
_to_pyobj
(
var_infos
.
map
.
data
[
var_info
].
map
.
data
[
'block_id'
])
stop_gradient
=
utils
.
from_
flexible_data
_to_pyobj
(
stop_gradient
=
utils
.
from_
module_attr
_to_pyobj
(
var_infos
.
map
.
data
[
var_info
].
map
.
data
[
'stop_gradient'
])
block
=
program
.
blocks
[
idx
]
var_name
=
self
.
get_var_name_with_prefix
(
var_info
)
...
...
@@ -311,50 +311,50 @@ class Module(object):
fetch_names
=
fetch_names
)
# recover default signature
default_signature_name
=
utils
.
from_
flexible_data
_to_pyobj
(
self
.
desc
.
extra_info
.
map
.
data
[
'default_signature'
])
default_signature_name
=
utils
.
from_
module_attr
_to_pyobj
(
self
.
desc
.
attr
.
map
.
data
[
'default_signature'
])
self
.
default_signature
=
self
.
signatures
[
default_signature_name
]
if
default_signature_name
else
None
# recover module info
module_info
=
self
.
desc
.
extra_info
.
map
.
data
[
'module_info'
]
self
.
name
=
utils
.
from_
flexible_data
_to_pyobj
(
module_info
=
self
.
desc
.
attr
.
map
.
data
[
'module_info'
]
self
.
name
=
utils
.
from_
module_attr
_to_pyobj
(
module_info
.
map
.
data
[
'name'
])
self
.
author
=
utils
.
from_
flexible_data
_to_pyobj
(
self
.
author
=
utils
.
from_
module_attr
_to_pyobj
(
module_info
.
map
.
data
[
'author'
])
self
.
author_email
=
utils
.
from_
flexible_data
_to_pyobj
(
self
.
author_email
=
utils
.
from_
module_attr
_to_pyobj
(
module_info
.
map
.
data
[
'author_email'
])
self
.
version
=
utils
.
from_
flexible_data
_to_pyobj
(
self
.
version
=
utils
.
from_
module_attr
_to_pyobj
(
module_info
.
map
.
data
[
'version'
])
self
.
type
=
utils
.
from_
flexible_data
_to_pyobj
(
self
.
type
=
utils
.
from_
module_attr
_to_pyobj
(
module_info
.
map
.
data
[
'type'
])
self
.
summary
=
utils
.
from_
flexible_data
_to_pyobj
(
self
.
summary
=
utils
.
from_
module_attr
_to_pyobj
(
module_info
.
map
.
data
[
'summary'
])
# recover name prefix
self
.
name_prefix
=
utils
.
from_
flexible_data
_to_pyobj
(
self
.
desc
.
extra_info
.
map
.
data
[
"name_prefix"
])
self
.
name_prefix
=
utils
.
from_
module_attr
_to_pyobj
(
self
.
desc
.
attr
.
map
.
data
[
"name_prefix"
])
def
_generate_desc
(
self
):
# save fluid Parameter
extra_info
=
self
.
desc
.
extra_info
extra_info
.
type
=
module_desc_pb2
.
MAP
param_attrs
=
extra_info
.
map
.
data
[
'param_attrs'
]
attr
=
self
.
desc
.
attr
attr
.
type
=
module_desc_pb2
.
MAP
param_attrs
=
attr
.
map
.
data
[
'param_attrs'
]
param_attrs
.
type
=
module_desc_pb2
.
MAP
for
param
in
self
.
program
.
global_block
().
iter_parameters
():
param_attr
=
param_attrs
.
map
.
data
[
param
.
name
]
paddle_helper
.
from_param_to_
flexible_data
(
param
,
param_attr
)
paddle_helper
.
from_param_to_
module_attr
(
param
,
param_attr
)
# save Variable Info
var_infos
=
extra_info
.
map
.
data
[
'var_infos'
]
var_infos
=
attr
.
map
.
data
[
'var_infos'
]
var_infos
.
type
=
module_desc_pb2
.
MAP
for
block
in
self
.
program
.
blocks
:
for
var
in
block
.
vars
.
values
():
var_info
=
var_infos
.
map
.
data
[
var
.
name
]
var_info
.
type
=
module_desc_pb2
.
MAP
utils
.
from_pyobj_to_
flexible_data
(
utils
.
from_pyobj_to_
module_attr
(
var
.
stop_gradient
,
var_info
.
map
.
data
[
'stop_gradient'
])
utils
.
from_pyobj_to_
flexible_data
(
block
.
idx
,
utils
.
from_pyobj_to_
module_attr
(
block
.
idx
,
var_info
.
map
.
data
[
'block_id'
])
# save signarture info
...
...
@@ -375,28 +375,26 @@ class Module(object):
fetch_var
.
alias
=
fetch_names
[
index
]
# save default signature
utils
.
from_pyobj_to_
flexible_data
(
utils
.
from_pyobj_to_
module_attr
(
self
.
default_signature
.
name
if
self
.
default_signature
else
None
,
extra_info
.
map
.
data
[
'default_signature'
])
attr
.
map
.
data
[
'default_signature'
])
# save name prefix
utils
.
from_pyobj_to_
flexible_data
(
self
.
name_prefix
,
self
.
desc
.
extra_info
.
map
.
data
[
"name_prefix"
])
utils
.
from_pyobj_to_
module_attr
(
self
.
name_prefix
,
self
.
desc
.
attr
.
map
.
data
[
"name_prefix"
])
# save module info
module_info
=
extra_info
.
map
.
data
[
'module_info'
]
module_info
=
attr
.
map
.
data
[
'module_info'
]
module_info
.
type
=
module_desc_pb2
.
MAP
utils
.
from_pyobj_to_flexible_data
(
self
.
name
,
module_info
.
map
.
data
[
'name'
])
utils
.
from_pyobj_to_flexible_data
(
self
.
version
,
utils
.
from_pyobj_to_module_attr
(
self
.
name
,
module_info
.
map
.
data
[
'name'
])
utils
.
from_pyobj_to_module_attr
(
self
.
version
,
module_info
.
map
.
data
[
'version'
])
utils
.
from_pyobj_to_
flexible_data
(
self
.
author
,
utils
.
from_pyobj_to_
module_attr
(
self
.
author
,
module_info
.
map
.
data
[
'author'
])
utils
.
from_pyobj_to_
flexible_data
(
self
.
author_email
,
utils
.
from_pyobj_to_
module_attr
(
self
.
author_email
,
module_info
.
map
.
data
[
'author_email'
])
utils
.
from_pyobj_to_flexible_data
(
self
.
type
,
module_info
.
map
.
data
[
'type'
])
utils
.
from_pyobj_to_flexible_data
(
self
.
summary
,
utils
.
from_pyobj_to_module_attr
(
self
.
type
,
module_info
.
map
.
data
[
'type'
])
utils
.
from_pyobj_to_module_attr
(
self
.
summary
,
module_info
.
map
.
data
[
'summary'
])
def
__call__
(
self
,
sign_name
,
data
,
**
kwargs
):
...
...
paddle_hub/module/module_desc.proto
浏览文件 @
14535dd4
...
...
@@ -31,22 +31,25 @@ enum DataType {
}
message
KVData
{
map
<
string
,
DataType
>
key
T
ype
=
1
;
map
<
string
,
FlexibleData
>
data
=
2
;
map
<
string
,
DataType
>
key
_t
ype
=
1
;
map
<
string
,
ModuleAttr
>
data
=
2
;
}
message
FlexibleData
{
message
ModuleAttr
{
// Basic type
DataType
type
=
1
;
string
name
=
2
;
int64
i
=
3
;
double
f
=
4
;
bool
b
=
5
;
string
s
=
6
;
KVData
map
=
7
;
KVData
list
=
8
;
KVData
set
=
9
;
KVData
object
=
10
;
int64
i
=
2
;
double
f
=
3
;
bool
b
=
4
;
string
s
=
5
;
KVData
map
=
6
;
KVData
list
=
7
;
KVData
set
=
8
;
KVData
object
=
9
;
//
string
name
=
10
;
string
info
=
11
;
}
// Feed Variable Description
...
...
@@ -76,18 +79,9 @@ message AuthInfo {
// containing a serialized protocol message of this type. The further contents
// of the directory depend on the storage format described by the message.
message
ModuleDesc
{
// PaddleHub module name
string
name
=
1
;
// PaddleHub module name
// signature to module variable
map
<
string
,
ModuleVar
>
sign2var
=
2
;
bool
return_numpy
=
3
;
bool
contain_assets
=
4
;
AuthInfo
auth_info
=
5
;
FlexibleData
extra_info
=
6
;
ModuleAttr
attr
=
3
;
};
paddle_hub/module/module_desc_pb2.py
浏览文件 @
14535dd4
...
...
@@ -18,7 +18,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
package
=
'paddle_hub_module'
,
syntax
=
'proto3'
,
serialized_pb
=
_b
(
'
\n\x11
module_desc.proto
\x12\x11
paddle_hub_module
\"\x8
f\x02\n\x06
KVData
\x12\x37\n\x07
keyType
\x18\x01
\x03
(
\x0b\x32
&.paddle_hub_module.KVData.KeyTypeEntry
\x12\x31\n\x04\x64\x61
ta
\x18\x02
\x03
(
\x0b\x32
#.paddle_hub_module.KVData.DataEntry
\x1a
K
\n\x0c
KeyTypeEntry
\x12\x0b\n\x03
key
\x18\x01
\x01
(
\t\x12
*
\n\x05
value
\x18\x02
\x01
(
\x0e\x32\x1b
.paddle_hub_module.DataType:
\x02\x38\x01\x1a
L
\n\t
DataEntry
\x12\x0b\n\x03
key
\x18\x01
\x01
(
\t\x12
.
\n\x05
value
\x18\x02
\x01
(
\x0b\x32\x1f
.paddle_hub_module.FlexibleData:
\x02\x38\x01\"\xa5\x02\n\x0c\x46
lexibleData
\x12
)
\n\x04
type
\x18\x01
\x01
(
\x0e\x32\x1b
.paddle_hub_module.DataType
\x12\x0c\n\x04
name
\x18\x02
\x01
(
\t\x12\t\n\x01
i
\x18\x03
\x01
(
\x03\x12\t\n\x01\x66\x18\x04
\x01
(
\x01\x12\t\n\x01\x62\x18\x05
\x01
(
\x08\x12\t\n\x01
s
\x18\x06
\x01
(
\t\x12
&
\n\x03
map
\x18\x07
\x01
(
\x0b\x32\x19
.paddle_hub_module.KVData
\x12\'\n\x04
list
\x18\x08
\x01
(
\x0b\x32\x19
.paddle_hub_module.KVData
\x12
&
\n\x03
set
\x18\t
\x01
(
\x0b\x32\x19
.paddle_hub_module.KVData
\x12
)
\n\x06
object
\x18\n
\x01
(
\x0b\x32\x19
.paddle_hub_module.KVData
\x12\x0c\n\x04
info
\x18\x0b
\x01
(
\t\"
+
\n\x08\x46\x65\x65\x64\x44\x65
sc
\x12\x10\n\x08
var_name
\x18\x01
\x01
(
\t\x12\r\n\x05\x61
lias
\x18\x02
\x01
(
\t\"
,
\n\t
FetchDesc
\x12\x10\n\x08
var_name
\x18\x01
\x01
(
\t\x12\r\n\x05\x61
lias
\x18\x02
\x01
(
\t\"
m
\n\t
ModuleVar
\x12\x30\n\n
fetch_desc
\x18\x01
\x03
(
\x0b\x32\x1c
.paddle_hub_module.FetchDesc
\x12
.
\n\t
feed_desc
\x18\x02
\x03
(
\x0b\x32\x1b
.paddle_hub_module.FeedDesc
\"
7
\n\x08\x41
uthInfo
\x12\x16\n\x0e
paddle_version
\x18\x01
\x01
(
\t\x12\x13\n\x0b
hub_version
\x18\x02
\x01
(
\t\"\xbb\x02\n\n
ModuleDesc
\x12\x0c\n\x04
name
\x18\x01
\x01
(
\t\x12
=
\n\x08
sign2var
\x18\x02
\x03
(
\x0b\x32
+.paddle_hub_module.ModuleDesc.Sign2varEntry
\x12\x14\n\x0c
return_numpy
\x18\x03
\x01
(
\x08\x12\x16\n\x0e\x63
ontain_assets
\x18\x04
\x01
(
\x08\x12
.
\n\t
auth_info
\x18\x05
\x01
(
\x0b\x32\x1b
.paddle_hub_module.AuthInfo
\x12\x33\n\n
extra_info
\x18\x06
\x01
(
\x0b\x32\x1f
.paddle_hub_module.FlexibleData
\x1a
M
\n\r
Sign2varEntry
\x12\x0b\n\x03
key
\x18\x01
\x01
(
\t\x12
+
\n\x05
value
\x18\x02
\x01
(
\x0b\x32\x1c
.paddle_hub_module.ModuleVar:
\x02\x38\x01
*i
\n\x08\x44\x61
taType
\x12\x08\n\x04
NONE
\x10\x00\x12\x07\n\x03
INT
\x10\x01\x12\t\n\x05\x46
LOAT
\x10\x02\x12\n\n\x06
STRING
\x10\x03\x12\x0b\n\x07\x42
OOLEAN
\x10\x04\x12\x08\n\x04
LIST
\x10\x05\x12\x07\n\x03
MAP
\x10\x06\x12\x07\n\x03
SET
\x10\x07\x12\n\n\x06
OBJECT
\x10\x08\x42\x02
H
\x03\x62\x06
proto3'
'
\n\x11
module_desc.proto
\x12\x11
paddle_hub_module
\"\x8
e\x02\n\x06
KVData
\x12\x38\n\x08
key_type
\x18\x01
\x03
(
\x0b\x32
&.paddle_hub_module.KVData.KeyTypeEntry
\x12\x31\n\x04\x64\x61
ta
\x18\x02
\x03
(
\x0b\x32
#.paddle_hub_module.KVData.DataEntry
\x1a
K
\n\x0c
KeyTypeEntry
\x12\x0b\n\x03
key
\x18\x01
\x01
(
\t\x12
*
\n\x05
value
\x18\x02
\x01
(
\x0e\x32\x1b
.paddle_hub_module.DataType:
\x02\x38\x01\x1a
J
\n\t
DataEntry
\x12\x0b\n\x03
key
\x18\x01
\x01
(
\t\x12
,
\n\x05
value
\x18\x02
\x01
(
\x0b\x32\x1d
.paddle_hub_module.ModuleAttr:
\x02\x38\x01\"\xa3\x02\n\n
ModuleAttr
\x12
)
\n\x04
type
\x18\x01
\x01
(
\x0e\x32\x1b
.paddle_hub_module.DataType
\x12\t\n\x01
i
\x18\x02
\x01
(
\x03\x12\t\n\x01\x66\x18\x03
\x01
(
\x01\x12\t\n\x01\x62\x18\x04
\x01
(
\x08\x12\t\n\x01
s
\x18\x05
\x01
(
\t\x12
&
\n\x03
map
\x18\x06
\x01
(
\x0b\x32\x19
.paddle_hub_module.KVData
\x12\'\n\x04
list
\x18\x07
\x01
(
\x0b\x32\x19
.paddle_hub_module.KVData
\x12
&
\n\x03
set
\x18\x08
\x01
(
\x0b\x32\x19
.paddle_hub_module.KVData
\x12
)
\n\x06
object
\x18\t
\x01
(
\x0b\x32\x19
.paddle_hub_module.KVData
\x12\x0c\n\x04
name
\x18\n
\x01
(
\t\x12\x0c\n\x04
info
\x18\x0b
\x01
(
\t\"
+
\n\x08\x46\x65\x65\x64\x44\x65
sc
\x12\x10\n\x08
var_name
\x18\x01
\x01
(
\t\x12\r\n\x05\x61
lias
\x18\x02
\x01
(
\t\"
,
\n\t
FetchDesc
\x12\x10\n\x08
var_name
\x18\x01
\x01
(
\t\x12\r\n\x05\x61
lias
\x18\x02
\x01
(
\t\"
m
\n\t
ModuleVar
\x12\x30\n\n
fetch_desc
\x18\x01
\x03
(
\x0b\x32\x1c
.paddle_hub_module.FetchDesc
\x12
.
\n\t
feed_desc
\x18\x02
\x03
(
\x0b\x32\x1b
.paddle_hub_module.FeedDesc
\"
7
\n\x08\x41
uthInfo
\x12\x16\n\x0e
paddle_version
\x18\x01
\x01
(
\t\x12\x13\n\x0b
hub_version
\x18\x02
\x01
(
\t\"\xc7\x01\n\n
ModuleDesc
\x12
=
\n\x08
sign2var
\x18\x02
\x03
(
\x0b\x32
+.paddle_hub_module.ModuleDesc.Sign2varEntry
\x12
+
\n\x04\x61
ttr
\x18\x03
\x01
(
\x0b\x32\x1d
.paddle_hub_module.ModuleAttr
\x1a
M
\n\r
Sign2varEntry
\x12\x0b\n\x03
key
\x18\x01
\x01
(
\t\x12
+
\n\x05
value
\x18\x02
\x01
(
\x0b\x32\x1c
.paddle_hub_module.ModuleVar:
\x02\x38\x01
*i
\n\x08\x44\x61
taType
\x12\x08\n\x04
NONE
\x10\x00\x12\x07\n\x03
INT
\x10\x01\x12\t\n\x05\x46
LOAT
\x10\x02\x12\n\n\x06
STRING
\x10\x03\x12\x0b\n\x07\x42
OOLEAN
\x10\x04\x12\x08\n\x04
LIST
\x10\x05\x12\x07\n\x03
MAP
\x10\x06\x12\x07\n\x03
SET
\x10\x07\x12\n\n\x06
OBJECT
\x10\x08\x42\x02
H
\x03\x62\x06
proto3'
))
_sym_db
.
RegisterFileDescriptor
(
DESCRIPTOR
)
...
...
@@ -49,8 +49,8 @@ _DATATYPE = _descriptor.EnumDescriptor(
],
containing_type
=
None
,
options
=
None
,
serialized_start
=
1
187
,
serialized_end
=
1
292
,
serialized_start
=
1
068
,
serialized_end
=
1
173
,
)
_sym_db
.
RegisterEnumDescriptor
(
_DATATYPE
)
...
...
@@ -114,8 +114,8 @@ _KVDATA_KEYTYPEENTRY = _descriptor.Descriptor(
syntax
=
'proto3'
,
extension_ranges
=
[],
oneofs
=
[],
serialized_start
=
1
59
,
serialized_end
=
23
4
,
serialized_start
=
1
60
,
serialized_end
=
23
5
,
)
_KVDATA_DATAENTRY
=
_descriptor
.
Descriptor
(
...
...
@@ -167,8 +167,8 @@ _KVDATA_DATAENTRY = _descriptor.Descriptor(
syntax
=
'proto3'
,
extension_ranges
=
[],
oneofs
=
[],
serialized_start
=
23
6
,
serialized_end
=
31
2
,
serialized_start
=
23
7
,
serialized_end
=
31
1
,
)
_KVDATA
=
_descriptor
.
Descriptor
(
...
...
@@ -179,8 +179,8 @@ _KVDATA = _descriptor.Descriptor(
containing_type
=
None
,
fields
=
[
_descriptor
.
FieldDescriptor
(
name
=
'key
T
ype'
,
full_name
=
'paddle_hub_module.KVData.key
T
ype'
,
name
=
'key
_t
ype'
,
full_name
=
'paddle_hub_module.KVData.key
_t
ype'
,
index
=
0
,
number
=
1
,
type
=
11
,
...
...
@@ -223,19 +223,19 @@ _KVDATA = _descriptor.Descriptor(
extension_ranges
=
[],
oneofs
=
[],
serialized_start
=
41
,
serialized_end
=
31
2
,
serialized_end
=
31
1
,
)
_
FLEXIBLEDATA
=
_descriptor
.
Descriptor
(
name
=
'
FlexibleData
'
,
full_name
=
'paddle_hub_module.
FlexibleData
'
,
_
MODULEATTR
=
_descriptor
.
Descriptor
(
name
=
'
ModuleAttr
'
,
full_name
=
'paddle_hub_module.
ModuleAttr
'
,
filename
=
None
,
file
=
DESCRIPTOR
,
containing_type
=
None
,
fields
=
[
_descriptor
.
FieldDescriptor
(
name
=
'type'
,
full_name
=
'paddle_hub_module.
FlexibleData
.type'
,
full_name
=
'paddle_hub_module.
ModuleAttr
.type'
,
index
=
0
,
number
=
1
,
type
=
14
,
...
...
@@ -250,15 +250,15 @@ _FLEXIBLEDATA = _descriptor.Descriptor(
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'
name
'
,
full_name
=
'paddle_hub_module.
FlexibleData.name
'
,
name
=
'
i
'
,
full_name
=
'paddle_hub_module.
ModuleAttr.i
'
,
index
=
1
,
number
=
2
,
type
=
9
,
cpp_type
=
9
,
type
=
3
,
cpp_type
=
2
,
label
=
1
,
has_default_value
=
False
,
default_value
=
_b
(
""
).
decode
(
'utf-8'
)
,
default_value
=
0
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
...
...
@@ -266,15 +266,15 @@ _FLEXIBLEDATA = _descriptor.Descriptor(
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'
i
'
,
full_name
=
'paddle_hub_module.
FlexibleData.i
'
,
name
=
'
f
'
,
full_name
=
'paddle_hub_module.
ModuleAttr.f
'
,
index
=
2
,
number
=
3
,
type
=
3
,
cpp_type
=
2
,
type
=
1
,
cpp_type
=
5
,
label
=
1
,
has_default_value
=
False
,
default_value
=
0
,
default_value
=
float
(
0
)
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
...
...
@@ -282,15 +282,15 @@ _FLEXIBLEDATA = _descriptor.Descriptor(
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'
f
'
,
full_name
=
'paddle_hub_module.
FlexibleData.f
'
,
name
=
'
b
'
,
full_name
=
'paddle_hub_module.
ModuleAttr.b
'
,
index
=
3
,
number
=
4
,
type
=
1
,
cpp_type
=
5
,
type
=
8
,
cpp_type
=
7
,
label
=
1
,
has_default_value
=
False
,
default_value
=
float
(
0
)
,
default_value
=
False
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
...
...
@@ -298,15 +298,15 @@ _FLEXIBLEDATA = _descriptor.Descriptor(
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'
b
'
,
full_name
=
'paddle_hub_module.
FlexibleData.b
'
,
name
=
'
s
'
,
full_name
=
'paddle_hub_module.
ModuleAttr.s
'
,
index
=
4
,
number
=
5
,
type
=
8
,
cpp_type
=
7
,
type
=
9
,
cpp_type
=
9
,
label
=
1
,
has_default_value
=
False
,
default_value
=
False
,
default_value
=
_b
(
""
).
decode
(
'utf-8'
)
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
...
...
@@ -314,15 +314,15 @@ _FLEXIBLEDATA = _descriptor.Descriptor(
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'
s
'
,
full_name
=
'paddle_hub_module.
FlexibleData.s
'
,
name
=
'
map
'
,
full_name
=
'paddle_hub_module.
ModuleAttr.map
'
,
index
=
5
,
number
=
6
,
type
=
9
,
cpp_type
=
9
,
type
=
11
,
cpp_type
=
10
,
label
=
1
,
has_default_value
=
False
,
default_value
=
_b
(
""
).
decode
(
'utf-8'
)
,
default_value
=
None
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
...
...
@@ -330,8 +330,8 @@ _FLEXIBLEDATA = _descriptor.Descriptor(
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'
map
'
,
full_name
=
'paddle_hub_module.
FlexibleData.map
'
,
name
=
'
list
'
,
full_name
=
'paddle_hub_module.
ModuleAttr.list
'
,
index
=
6
,
number
=
7
,
type
=
11
,
...
...
@@ -346,8 +346,8 @@ _FLEXIBLEDATA = _descriptor.Descriptor(
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'
lis
t'
,
full_name
=
'paddle_hub_module.
FlexibleData.lis
t'
,
name
=
'
se
t'
,
full_name
=
'paddle_hub_module.
ModuleAttr.se
t'
,
index
=
7
,
number
=
8
,
type
=
11
,
...
...
@@ -362,8 +362,8 @@ _FLEXIBLEDATA = _descriptor.Descriptor(
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'
se
t'
,
full_name
=
'paddle_hub_module.
FlexibleData.se
t'
,
name
=
'
objec
t'
,
full_name
=
'paddle_hub_module.
ModuleAttr.objec
t'
,
index
=
8
,
number
=
9
,
type
=
11
,
...
...
@@ -378,15 +378,15 @@ _FLEXIBLEDATA = _descriptor.Descriptor(
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'
object
'
,
full_name
=
'paddle_hub_module.
FlexibleData.object
'
,
name
=
'
name
'
,
full_name
=
'paddle_hub_module.
ModuleAttr.name
'
,
index
=
9
,
number
=
10
,
type
=
11
,
cpp_type
=
10
,
type
=
9
,
cpp_type
=
9
,
label
=
1
,
has_default_value
=
False
,
default_value
=
None
,
default_value
=
_b
(
""
).
decode
(
'utf-8'
)
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
...
...
@@ -395,7 +395,7 @@ _FLEXIBLEDATA = _descriptor.Descriptor(
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'info'
,
full_name
=
'paddle_hub_module.
FlexibleData
.info'
,
full_name
=
'paddle_hub_module.
ModuleAttr
.info'
,
index
=
10
,
number
=
11
,
type
=
9
,
...
...
@@ -418,8 +418,8 @@ _FLEXIBLEDATA = _descriptor.Descriptor(
syntax
=
'proto3'
,
extension_ranges
=
[],
oneofs
=
[],
serialized_start
=
31
5
,
serialized_end
=
60
8
,
serialized_start
=
31
4
,
serialized_end
=
60
5
,
)
_FEEDDESC
=
_descriptor
.
Descriptor
(
...
...
@@ -470,8 +470,8 @@ _FEEDDESC = _descriptor.Descriptor(
syntax
=
'proto3'
,
extension_ranges
=
[],
oneofs
=
[],
serialized_start
=
6
10
,
serialized_end
=
65
3
,
serialized_start
=
6
07
,
serialized_end
=
65
0
,
)
_FETCHDESC
=
_descriptor
.
Descriptor
(
...
...
@@ -522,8 +522,8 @@ _FETCHDESC = _descriptor.Descriptor(
syntax
=
'proto3'
,
extension_ranges
=
[],
oneofs
=
[],
serialized_start
=
65
5
,
serialized_end
=
69
9
,
serialized_start
=
65
2
,
serialized_end
=
69
6
,
)
_MODULEVAR
=
_descriptor
.
Descriptor
(
...
...
@@ -574,8 +574,8 @@ _MODULEVAR = _descriptor.Descriptor(
syntax
=
'proto3'
,
extension_ranges
=
[],
oneofs
=
[],
serialized_start
=
701
,
serialized_end
=
8
10
,
serialized_start
=
698
,
serialized_end
=
8
07
,
)
_AUTHINFO
=
_descriptor
.
Descriptor
(
...
...
@@ -626,8 +626,8 @@ _AUTHINFO = _descriptor.Descriptor(
syntax
=
'proto3'
,
extension_ranges
=
[],
oneofs
=
[],
serialized_start
=
8
12
,
serialized_end
=
86
7
,
serialized_start
=
8
09
,
serialized_end
=
86
4
,
)
_MODULEDESC_SIGN2VARENTRY
=
_descriptor
.
Descriptor
(
...
...
@@ -679,8 +679,8 @@ _MODULEDESC_SIGN2VARENTRY = _descriptor.Descriptor(
syntax
=
'proto3'
,
extension_ranges
=
[],
oneofs
=
[],
serialized_start
=
1108
,
serialized_end
=
1
185
,
serialized_start
=
989
,
serialized_end
=
1
066
,
)
_MODULEDESC
=
_descriptor
.
Descriptor
(
...
...
@@ -690,26 +690,10 @@ _MODULEDESC = _descriptor.Descriptor(
file
=
DESCRIPTOR
,
containing_type
=
None
,
fields
=
[
_descriptor
.
FieldDescriptor
(
name
=
'name'
,
full_name
=
'paddle_hub_module.ModuleDesc.name'
,
index
=
0
,
number
=
1
,
type
=
9
,
cpp_type
=
9
,
label
=
1
,
has_default_value
=
False
,
default_value
=
_b
(
""
).
decode
(
'utf-8'
),
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'sign2var'
,
full_name
=
'paddle_hub_module.ModuleDesc.sign2var'
,
index
=
1
,
index
=
0
,
number
=
2
,
type
=
11
,
cpp_type
=
10
,
...
...
@@ -723,58 +707,10 @@ _MODULEDESC = _descriptor.Descriptor(
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'
return_numpy
'
,
full_name
=
'paddle_hub_module.ModuleDesc.
return_numpy
'
,
index
=
2
,
name
=
'
attr
'
,
full_name
=
'paddle_hub_module.ModuleDesc.
attr
'
,
index
=
1
,
number
=
3
,
type
=
8
,
cpp_type
=
7
,
label
=
1
,
has_default_value
=
False
,
default_value
=
False
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'contain_assets'
,
full_name
=
'paddle_hub_module.ModuleDesc.contain_assets'
,
index
=
3
,
number
=
4
,
type
=
8
,
cpp_type
=
7
,
label
=
1
,
has_default_value
=
False
,
default_value
=
False
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'auth_info'
,
full_name
=
'paddle_hub_module.ModuleDesc.auth_info'
,
index
=
4
,
number
=
5
,
type
=
11
,
cpp_type
=
10
,
label
=
1
,
has_default_value
=
False
,
default_value
=
None
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'extra_info'
,
full_name
=
'paddle_hub_module.ModuleDesc.extra_info'
,
index
=
5
,
number
=
6
,
type
=
11
,
cpp_type
=
10
,
label
=
1
,
...
...
@@ -797,30 +733,29 @@ _MODULEDESC = _descriptor.Descriptor(
syntax
=
'proto3'
,
extension_ranges
=
[],
oneofs
=
[],
serialized_start
=
8
70
,
serialized_end
=
1
185
,
serialized_start
=
8
67
,
serialized_end
=
1
066
,
)
_KVDATA_KEYTYPEENTRY
.
fields_by_name
[
'value'
].
enum_type
=
_DATATYPE
_KVDATA_KEYTYPEENTRY
.
containing_type
=
_KVDATA
_KVDATA_DATAENTRY
.
fields_by_name
[
'value'
].
message_type
=
_
FLEXIBLEDATA
_KVDATA_DATAENTRY
.
fields_by_name
[
'value'
].
message_type
=
_
MODULEATTR
_KVDATA_DATAENTRY
.
containing_type
=
_KVDATA
_KVDATA
.
fields_by_name
[
'key
T
ype'
].
message_type
=
_KVDATA_KEYTYPEENTRY
_KVDATA
.
fields_by_name
[
'key
_t
ype'
].
message_type
=
_KVDATA_KEYTYPEENTRY
_KVDATA
.
fields_by_name
[
'data'
].
message_type
=
_KVDATA_DATAENTRY
_
FLEXIBLEDATA
.
fields_by_name
[
'type'
].
enum_type
=
_DATATYPE
_
FLEXIBLEDATA
.
fields_by_name
[
'map'
].
message_type
=
_KVDATA
_
FLEXIBLEDATA
.
fields_by_name
[
'list'
].
message_type
=
_KVDATA
_
FLEXIBLEDATA
.
fields_by_name
[
'set'
].
message_type
=
_KVDATA
_
FLEXIBLEDATA
.
fields_by_name
[
'object'
].
message_type
=
_KVDATA
_
MODULEATTR
.
fields_by_name
[
'type'
].
enum_type
=
_DATATYPE
_
MODULEATTR
.
fields_by_name
[
'map'
].
message_type
=
_KVDATA
_
MODULEATTR
.
fields_by_name
[
'list'
].
message_type
=
_KVDATA
_
MODULEATTR
.
fields_by_name
[
'set'
].
message_type
=
_KVDATA
_
MODULEATTR
.
fields_by_name
[
'object'
].
message_type
=
_KVDATA
_MODULEVAR
.
fields_by_name
[
'fetch_desc'
].
message_type
=
_FETCHDESC
_MODULEVAR
.
fields_by_name
[
'feed_desc'
].
message_type
=
_FEEDDESC
_MODULEDESC_SIGN2VARENTRY
.
fields_by_name
[
'value'
].
message_type
=
_MODULEVAR
_MODULEDESC_SIGN2VARENTRY
.
containing_type
=
_MODULEDESC
_MODULEDESC
.
fields_by_name
[
'sign2var'
].
message_type
=
_MODULEDESC_SIGN2VARENTRY
_MODULEDESC
.
fields_by_name
[
'auth_info'
].
message_type
=
_AUTHINFO
_MODULEDESC
.
fields_by_name
[
'extra_info'
].
message_type
=
_FLEXIBLEDATA
_MODULEDESC
.
fields_by_name
[
'attr'
].
message_type
=
_MODULEATTR
DESCRIPTOR
.
message_types_by_name
[
'KVData'
]
=
_KVDATA
DESCRIPTOR
.
message_types_by_name
[
'
FlexibleData'
]
=
_FLEXIBLEDATA
DESCRIPTOR
.
message_types_by_name
[
'
ModuleAttr'
]
=
_MODULEATTR
DESCRIPTOR
.
message_types_by_name
[
'FeedDesc'
]
=
_FEEDDESC
DESCRIPTOR
.
message_types_by_name
[
'FetchDesc'
]
=
_FETCHDESC
DESCRIPTOR
.
message_types_by_name
[
'ModuleVar'
]
=
_MODULEVAR
...
...
@@ -856,15 +791,15 @@ _sym_db.RegisterMessage(KVData)
_sym_db
.
RegisterMessage
(
KVData
.
KeyTypeEntry
)
_sym_db
.
RegisterMessage
(
KVData
.
DataEntry
)
FlexibleData
=
_reflection
.
GeneratedProtocolMessageType
(
'
FlexibleData
'
,
ModuleAttr
=
_reflection
.
GeneratedProtocolMessageType
(
'
ModuleAttr
'
,
(
_message
.
Message
,
),
dict
(
DESCRIPTOR
=
_
FLEXIBLEDATA
,
DESCRIPTOR
=
_
MODULEATTR
,
__module__
=
'module_desc_pb2'
# @@protoc_insertion_point(class_scope:paddle_hub_module.
FlexibleData
)
# @@protoc_insertion_point(class_scope:paddle_hub_module.
ModuleAttr
)
))
_sym_db
.
RegisterMessage
(
FlexibleData
)
_sym_db
.
RegisterMessage
(
ModuleAttr
)
FeedDesc
=
_reflection
.
GeneratedProtocolMessageType
(
'FeedDesc'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录