提交 dac98ee7 编写于 作者: G guru4elephant

fix general model compile problem

上级 ad7c458a
...@@ -41,6 +41,9 @@ DEFINE_int32(reload_interval_s, 10, ""); ...@@ -41,6 +41,9 @@ DEFINE_int32(reload_interval_s, 10, "");
DEFINE_bool(enable_model_toolkit, false, "enable model toolkit"); DEFINE_bool(enable_model_toolkit, false, "enable model toolkit");
DEFINE_string(enable_protocol_list, "baidu_std", "set protocol list"); DEFINE_string(enable_protocol_list, "baidu_std", "set protocol list");
DEFINE_bool(enable_cube, false, "enable cube"); DEFINE_bool(enable_cube, false, "enable cube");
DEFINE_string(general_model_path, "./conf", "");
DEFINE_string(general_model_file, "general_model.prototxt", "");
DEFINE_bool(enable_general_model, false, "enable general model");
const char* START_OP_NAME = "startup_op"; const char* START_OP_NAME = "startup_op";
} // namespace predictor } // namespace predictor
......
...@@ -21,7 +21,7 @@ namespace paddle_serving { ...@@ -21,7 +21,7 @@ namespace paddle_serving {
namespace predictor { namespace predictor {
using configure::ResourceConf; using configure::ResourceConf;
using configure::GeneralModelConf; using configure::GeneralModelConfig;
using configure::Shape; using configure::Shape;
using rec::mcube::CubeAPI; using rec::mcube::CubeAPI;
// __thread bool p_thread_initialized = false; // __thread bool p_thread_initialized = false;
...@@ -104,29 +104,29 @@ int Resource::general_model_initialize( ...@@ -104,29 +104,29 @@ int Resource::general_model_initialize(
return 0; return 0;
} }
GeneralModelConf model_config; GeneralModelConfig model_config;
if (configure::read_proto_conf(path, file, &model_config) != 0) { if (configure::read_proto_conf(path, file, &model_config) != 0) {
LOG(ERROR) << "Failed initialize resource from: " << path << "/" << file; LOG(ERROR) << "Failed initialize resource from: " << path << "/" << file;
return -1; return -1;
} }
_config.reset(new PaddleGeneralModelConfig()); _config.reset(new PaddleGeneralModelConfig());
_config->_feed_type.resize(model_config.is_feed_type_size()); _config->_feed_type.resize(model_config.feed_type_size());
_config->_is_lod_feed.resize(model_config.is_lod_feed_size()); _config->_is_lod_feed.resize(model_config.is_lod_feed_size());
_config->_capacity.resize(model_config.feed_shape_size()); _config->_capacity.resize(model_config.feed_shape_size());
_config->_feed_shape.resize(model_config.feed_shape_size()); _config->_feed_shape.resize(model_config.feed_shape_size());
for (int i = 0; i < model_config.is_lod_feed_size(); ++i) { for (int i = 0; i < model_config.is_lod_feed_size(); ++i) {
_config->feed_type[i] = model_config.feed_type(i); _config->_feed_type[i] = model_config.feed_type(i);
if (model_config.is_lod_feed(i)) { if (model_config.is_lod_feed(i)) {
_config->_feed_shape[i] = {-1}; _config->_feed_shape[i] = {-1};
_config->_is_lod_feed[i] = true; _config->_is_lod_feed[i] = true;
} else { } else {
_config->capacity[i] = 1; _config->_capacity[i] = 1;
_config->_is_lod_feed[i] = false; _config->_is_lod_feed[i] = false;
for (int j = 0; j < model_config.feed_shape(i).shape_size(); ++j) { for (int j = 0; j < model_config.feed_shape(i).shape_size(); ++j) {
int dim = model_cnofig.feed_shape(i).shape(j); int dim = model_config.feed_shape(i).shape(j);
_config->_feed_shape[i].push_back(dim); _config->_feed_shape[i].push_back(dim);
_config->capacity[i] *= dim; _config->_capacity[i] *= dim;
} }
} }
} }
......
...@@ -27,11 +27,10 @@ namespace paddle_serving { ...@@ -27,11 +27,10 @@ namespace paddle_serving {
namespace predictor { namespace predictor {
class PaddleGeneralModelConfig { class PaddleGeneralModelConfig {
PaddleGeneralModelConfig(); public:
PaddleGeneralModelConfig() {}
~PaddleGeneralModelConfig();
void load_config(std::string); ~PaddleGeneralModelConfig() {}
public: public:
......
...@@ -45,6 +45,8 @@ using baidu::paddle_serving::predictor::FLAGS_logger_path; ...@@ -45,6 +45,8 @@ using baidu::paddle_serving::predictor::FLAGS_logger_path;
using baidu::paddle_serving::predictor::FLAGS_logger_file; using baidu::paddle_serving::predictor::FLAGS_logger_file;
using baidu::paddle_serving::predictor::FLAGS_resource_path; using baidu::paddle_serving::predictor::FLAGS_resource_path;
using baidu::paddle_serving::predictor::FLAGS_resource_file; using baidu::paddle_serving::predictor::FLAGS_resource_file;
using baidu::paddle_serving::predictor::FLAGS_general_model_path;
using baidu::paddle_serving::predictor::FLAGS_general_model_file;
using baidu::paddle_serving::predictor::FLAGS_reload_interval_s; using baidu::paddle_serving::predictor::FLAGS_reload_interval_s;
using baidu::paddle_serving::predictor::FLAGS_port; using baidu::paddle_serving::predictor::FLAGS_port;
...@@ -225,7 +227,7 @@ int main(int argc, char** argv) { ...@@ -225,7 +227,7 @@ int main(int argc, char** argv) {
return -1; return -1;
} }
LOG(INFO) << "Succ initialize general model" LOG(INFO) << "Succ initialize general model";
// FATAL messages are output to stderr // FATAL messages are output to stderr
FLAGS_stderrthreshold = 3; FLAGS_stderrthreshold = 3;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册