提交 058eeac0 编写于 作者: Y Yi Wang

Revert "Remove completely create_data_config_proto"

This reverts commit ab279bee.
上级 ab279bee
...@@ -894,6 +894,30 @@ class MaxOut(Cfg): ...@@ -894,6 +894,30 @@ class MaxOut(Cfg):
self.add_keys(locals()) self.add_keys(locals())
def create_data_config_proto(async_load_data=False,
constant_slots=None,
data_ratio=1,
is_main_data=True,
usage_ratio=None):
# default: all sub dataproviders are treat as "main data".
# see proto/DataConfig.proto for is_main_data
data_config = DataConfig()
data_config.async_load_data = async_load_data
if constant_slots:
data_config.constant_slots.extend(constant_slots)
data_config.data_ratio = data_ratio
data_config.is_main_data = is_main_data
usage_ratio = default(usage_ratio, settings_deprecated["usage_ratio"])
config_assert(usage_ratio >= 0 and usage_ratio <= 1,
"The range of usage_ratio is [0, 1]")
data_config.usage_ratio = usage_ratio
return data_config
@config_func @config_func
def SimpleData(files=None, def SimpleData(files=None,
feat_dim=None, feat_dim=None,
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
""" """
Data Sources are helpers to define paddle training data or testing data. Data Sources are helpers to define paddle training data or testing data.
""" """
import paddle.proto.DataConfig_pb2
from paddle.trainer.config_parser import * from paddle.trainer.config_parser import *
from .utils import deprecated from .utils import deprecated
...@@ -196,7 +195,7 @@ def define_py_data_sources2(train_list, test_list, module, obj, args=None): ...@@ -196,7 +195,7 @@ def define_py_data_sources2(train_list, test_list, module, obj, args=None):
def py_data2(files, load_data_module, load_data_object, load_data_args, def py_data2(files, load_data_module, load_data_object, load_data_args,
**kwargs): **kwargs):
data = paddle.proto.DataConfig_pb2.DataConfig() data = create_data_config_proto()
data.type = 'py2' data.type = 'py2'
data.files = files data.files = files
data.load_data_module = load_data_module data.load_data_module = load_data_module
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册