提交 14535dd4 编写于 作者: W wuzewu

update module desc proto

上级 6f41ac4a
......@@ -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\")" %
......
......@@ -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.keyType[str(key)] = get_keyed_type_of_pyobj(key)
module_attr.map.key_type[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.keyType[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_type[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
......
......@@ -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):
......
......@@ -31,22 +31,25 @@ enum DataType {
}
message KVData {
map<string, DataType> keyType = 1;
map<string, FlexibleData> data = 2;
map<string, DataType> key_type = 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;
};
......@@ -18,7 +18,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
package='paddle_hub_module',
syntax='proto3',
serialized_pb=_b(
'\n\x11module_desc.proto\x12\x11paddle_hub_module\"\x8f\x02\n\x06KVData\x12\x37\n\x07keyType\x18\x01 \x03(\x0b\x32&.paddle_hub_module.KVData.KeyTypeEntry\x12\x31\n\x04\x64\x61ta\x18\x02 \x03(\x0b\x32#.paddle_hub_module.KVData.DataEntry\x1aK\n\x0cKeyTypeEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12*\n\x05value\x18\x02 \x01(\x0e\x32\x1b.paddle_hub_module.DataType:\x02\x38\x01\x1aL\n\tDataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.paddle_hub_module.FlexibleData:\x02\x38\x01\"\xa5\x02\n\x0c\x46lexibleData\x12)\n\x04type\x18\x01 \x01(\x0e\x32\x1b.paddle_hub_module.DataType\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\t\n\x01i\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\x01s\x18\x06 \x01(\t\x12&\n\x03map\x18\x07 \x01(\x0b\x32\x19.paddle_hub_module.KVData\x12\'\n\x04list\x18\x08 \x01(\x0b\x32\x19.paddle_hub_module.KVData\x12&\n\x03set\x18\t \x01(\x0b\x32\x19.paddle_hub_module.KVData\x12)\n\x06object\x18\n \x01(\x0b\x32\x19.paddle_hub_module.KVData\x12\x0c\n\x04info\x18\x0b \x01(\t\"+\n\x08\x46\x65\x65\x64\x44\x65sc\x12\x10\n\x08var_name\x18\x01 \x01(\t\x12\r\n\x05\x61lias\x18\x02 \x01(\t\",\n\tFetchDesc\x12\x10\n\x08var_name\x18\x01 \x01(\t\x12\r\n\x05\x61lias\x18\x02 \x01(\t\"m\n\tModuleVar\x12\x30\n\nfetch_desc\x18\x01 \x03(\x0b\x32\x1c.paddle_hub_module.FetchDesc\x12.\n\tfeed_desc\x18\x02 \x03(\x0b\x32\x1b.paddle_hub_module.FeedDesc\"7\n\x08\x41uthInfo\x12\x16\n\x0epaddle_version\x18\x01 \x01(\t\x12\x13\n\x0bhub_version\x18\x02 \x01(\t\"\xbb\x02\n\nModuleDesc\x12\x0c\n\x04name\x18\x01 \x01(\t\x12=\n\x08sign2var\x18\x02 \x03(\x0b\x32+.paddle_hub_module.ModuleDesc.Sign2varEntry\x12\x14\n\x0creturn_numpy\x18\x03 \x01(\x08\x12\x16\n\x0e\x63ontain_assets\x18\x04 \x01(\x08\x12.\n\tauth_info\x18\x05 \x01(\x0b\x32\x1b.paddle_hub_module.AuthInfo\x12\x33\n\nextra_info\x18\x06 \x01(\x0b\x32\x1f.paddle_hub_module.FlexibleData\x1aM\n\rSign2varEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12+\n\x05value\x18\x02 \x01(\x0b\x32\x1c.paddle_hub_module.ModuleVar:\x02\x38\x01*i\n\x08\x44\x61taType\x12\x08\n\x04NONE\x10\x00\x12\x07\n\x03INT\x10\x01\x12\t\n\x05\x46LOAT\x10\x02\x12\n\n\x06STRING\x10\x03\x12\x0b\n\x07\x42OOLEAN\x10\x04\x12\x08\n\x04LIST\x10\x05\x12\x07\n\x03MAP\x10\x06\x12\x07\n\x03SET\x10\x07\x12\n\n\x06OBJECT\x10\x08\x42\x02H\x03\x62\x06proto3'
'\n\x11module_desc.proto\x12\x11paddle_hub_module\"\x8e\x02\n\x06KVData\x12\x38\n\x08key_type\x18\x01 \x03(\x0b\x32&.paddle_hub_module.KVData.KeyTypeEntry\x12\x31\n\x04\x64\x61ta\x18\x02 \x03(\x0b\x32#.paddle_hub_module.KVData.DataEntry\x1aK\n\x0cKeyTypeEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12*\n\x05value\x18\x02 \x01(\x0e\x32\x1b.paddle_hub_module.DataType:\x02\x38\x01\x1aJ\n\tDataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.paddle_hub_module.ModuleAttr:\x02\x38\x01\"\xa3\x02\n\nModuleAttr\x12)\n\x04type\x18\x01 \x01(\x0e\x32\x1b.paddle_hub_module.DataType\x12\t\n\x01i\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\x01s\x18\x05 \x01(\t\x12&\n\x03map\x18\x06 \x01(\x0b\x32\x19.paddle_hub_module.KVData\x12\'\n\x04list\x18\x07 \x01(\x0b\x32\x19.paddle_hub_module.KVData\x12&\n\x03set\x18\x08 \x01(\x0b\x32\x19.paddle_hub_module.KVData\x12)\n\x06object\x18\t \x01(\x0b\x32\x19.paddle_hub_module.KVData\x12\x0c\n\x04name\x18\n \x01(\t\x12\x0c\n\x04info\x18\x0b \x01(\t\"+\n\x08\x46\x65\x65\x64\x44\x65sc\x12\x10\n\x08var_name\x18\x01 \x01(\t\x12\r\n\x05\x61lias\x18\x02 \x01(\t\",\n\tFetchDesc\x12\x10\n\x08var_name\x18\x01 \x01(\t\x12\r\n\x05\x61lias\x18\x02 \x01(\t\"m\n\tModuleVar\x12\x30\n\nfetch_desc\x18\x01 \x03(\x0b\x32\x1c.paddle_hub_module.FetchDesc\x12.\n\tfeed_desc\x18\x02 \x03(\x0b\x32\x1b.paddle_hub_module.FeedDesc\"7\n\x08\x41uthInfo\x12\x16\n\x0epaddle_version\x18\x01 \x01(\t\x12\x13\n\x0bhub_version\x18\x02 \x01(\t\"\xc7\x01\n\nModuleDesc\x12=\n\x08sign2var\x18\x02 \x03(\x0b\x32+.paddle_hub_module.ModuleDesc.Sign2varEntry\x12+\n\x04\x61ttr\x18\x03 \x01(\x0b\x32\x1d.paddle_hub_module.ModuleAttr\x1aM\n\rSign2varEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12+\n\x05value\x18\x02 \x01(\x0b\x32\x1c.paddle_hub_module.ModuleVar:\x02\x38\x01*i\n\x08\x44\x61taType\x12\x08\n\x04NONE\x10\x00\x12\x07\n\x03INT\x10\x01\x12\t\n\x05\x46LOAT\x10\x02\x12\n\n\x06STRING\x10\x03\x12\x0b\n\x07\x42OOLEAN\x10\x04\x12\x08\n\x04LIST\x10\x05\x12\x07\n\x03MAP\x10\x06\x12\x07\n\x03SET\x10\x07\x12\n\n\x06OBJECT\x10\x08\x42\x02H\x03\x62\x06proto3'
))
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
......@@ -49,8 +49,8 @@ _DATATYPE = _descriptor.EnumDescriptor(
],
containing_type=None,
options=None,
serialized_start=1187,
serialized_end=1292,
serialized_start=1068,
serialized_end=1173,
)
_sym_db.RegisterEnumDescriptor(_DATATYPE)
......@@ -114,8 +114,8 @@ _KVDATA_KEYTYPEENTRY = _descriptor.Descriptor(
syntax='proto3',
extension_ranges=[],
oneofs=[],
serialized_start=159,
serialized_end=234,
serialized_start=160,
serialized_end=235,
)
_KVDATA_DATAENTRY = _descriptor.Descriptor(
......@@ -167,8 +167,8 @@ _KVDATA_DATAENTRY = _descriptor.Descriptor(
syntax='proto3',
extension_ranges=[],
oneofs=[],
serialized_start=236,
serialized_end=312,
serialized_start=237,
serialized_end=311,
)
_KVDATA = _descriptor.Descriptor(
......@@ -179,8 +179,8 @@ _KVDATA = _descriptor.Descriptor(
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='keyType',
full_name='paddle_hub_module.KVData.keyType',
name='key_type',
full_name='paddle_hub_module.KVData.key_type',
index=0,
number=1,
type=11,
......@@ -223,19 +223,19 @@ _KVDATA = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[],
serialized_start=41,
serialized_end=312,
serialized_end=311,
)
_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='list',
full_name='paddle_hub_module.FlexibleData.list',
name='set',
full_name='paddle_hub_module.ModuleAttr.set',
index=7,
number=8,
type=11,
......@@ -362,8 +362,8 @@ _FLEXIBLEDATA = _descriptor.Descriptor(
extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='set',
full_name='paddle_hub_module.FlexibleData.set',
name='object',
full_name='paddle_hub_module.ModuleAttr.object',
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=315,
serialized_end=608,
serialized_start=314,
serialized_end=605,
)
_FEEDDESC = _descriptor.Descriptor(
......@@ -470,8 +470,8 @@ _FEEDDESC = _descriptor.Descriptor(
syntax='proto3',
extension_ranges=[],
oneofs=[],
serialized_start=610,
serialized_end=653,
serialized_start=607,
serialized_end=650,
)
_FETCHDESC = _descriptor.Descriptor(
......@@ -522,8 +522,8 @@ _FETCHDESC = _descriptor.Descriptor(
syntax='proto3',
extension_ranges=[],
oneofs=[],
serialized_start=655,
serialized_end=699,
serialized_start=652,
serialized_end=696,
)
_MODULEVAR = _descriptor.Descriptor(
......@@ -574,8 +574,8 @@ _MODULEVAR = _descriptor.Descriptor(
syntax='proto3',
extension_ranges=[],
oneofs=[],
serialized_start=701,
serialized_end=810,
serialized_start=698,
serialized_end=807,
)
_AUTHINFO = _descriptor.Descriptor(
......@@ -626,8 +626,8 @@ _AUTHINFO = _descriptor.Descriptor(
syntax='proto3',
extension_ranges=[],
oneofs=[],
serialized_start=812,
serialized_end=867,
serialized_start=809,
serialized_end=864,
)
_MODULEDESC_SIGN2VARENTRY = _descriptor.Descriptor(
......@@ -679,8 +679,8 @@ _MODULEDESC_SIGN2VARENTRY = _descriptor.Descriptor(
syntax='proto3',
extension_ranges=[],
oneofs=[],
serialized_start=1108,
serialized_end=1185,
serialized_start=989,
serialized_end=1066,
)
_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=870,
serialized_end=1185,
serialized_start=867,
serialized_end=1066,
)
_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['keyType'].message_type = _KVDATA_KEYTYPEENTRY
_KVDATA.fields_by_name['key_type'].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.
先完成此消息的编辑!
想要评论请 注册