Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

increase protobuffer message size #170

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion paddle/trainer/TrainerConfigHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License. */
#include "TrainerConfig.pb.h"
#include "paddle/utils/Flags.h"
#include "paddle/utils/PythonUtil.h"
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>

P_DECLARE_string(config);
P_DECLARE_string(init_model_path);
Expand Down Expand Up @@ -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)
Expand Down