diff --git a/paddle/trainer/TrainerConfigHelper.cpp b/paddle/trainer/TrainerConfigHelper.cpp index 98197e7988517..761b28dfcdcb8 100644 --- a/paddle/trainer/TrainerConfigHelper.cpp +++ b/paddle/trainer/TrainerConfigHelper.cpp @@ -17,6 +17,8 @@ limitations under the License. */ #include "TrainerConfig.pb.h" #include "paddle/utils/Flags.h" #include "paddle/utils/PythonUtil.h" +#include +#include P_DECLARE_string(config); P_DECLARE_string(init_model_path); @@ -56,7 +58,13 @@ TrainerConfigHelper::TrainerConfigHelper(const std::string &configFilePath) std::string configProtoStr = callPythonFunc(kConfigParserModuleName, kConfigParserFuncName, {configFilePath, configArgs.str()}); - CHECK(m->conf.ParseFromString(configProtoStr)); + + google::protobuf::io::ArrayInputStream input(configProtoStr.data(), + configProtoStr.size()); + google::protobuf::io::CodedInputStream decoder(&input); + // total_bytes_limit is 1024MB, and warning_threshold is 64MB + decoder.SetTotalBytesLimit(1024 * 1024 * 1024, 64 * 1024 * 1024); + CHECK(m->conf.ParseFromCodedStream(&decoder)); } TrainerConfigHelper::TrainerConfigHelper(const TrainerConfig& config)