diff --git a/python/examples/bert/prepare_model.py b/python/examples/bert/prepare_model.py index b5f80a78feb07a0617bec3833bbe1cf3884d7dea..5a7c5893d9dfc9473c5fabb8f111f6798a6a20d3 100644 --- a/python/examples/bert/prepare_model.py +++ b/python/examples/bert/prepare_model.py @@ -14,11 +14,12 @@ import paddlehub as hub import paddle.fluid as fluid +import sys import paddle_serving_client.io as serving_io model_name = "bert_chinese_L-12_H-768_A-12" module = hub.Module(model_name) -inputs, outputs, program = module.context(trainable=True, max_seq_len=20) +inputs, outputs, program = module.context(trainable=True, max_seq_len=int(sys.argv[1])) place = fluid.core_avx.CPUPlace() exe = fluid.Executor(place) input_ids = inputs["input_ids"] @@ -34,7 +35,7 @@ feed_var_names = [ target_vars = [pooled_output, sequence_output] -serving_io.save_model("serving_server_model", "serving_client_conf", { +serving_io.save_model("bert_seq{}_model".format(sys.argv[1]), "bert_seq{}_client".format(sys.argv[1]), { "input_ids": input_ids, "position_ids": position_ids, "segment_ids": segment_ids, diff --git a/python/paddle_serving_server/web_service.py b/python/paddle_serving_server/web_service.py index 00c060f1b207a2de3f45a46483819ef4ff9aa5c9..d54dc7765656f726397a6553498b4d6da72e59dd 100755 --- a/python/paddle_serving_server/web_service.py +++ b/python/paddle_serving_server/web_service.py @@ -60,6 +60,8 @@ class WebService(object): if "fetch" not in request.json: abort(400) feed, fetch = self.preprocess(request.json, request.json["fetch"]) + if "fetch" in feed: + del feed["fetch"] fetch_map = client_service.predict(feed=feed, fetch=fetch) fetch_map = self.postprocess(feed=request.json, fetch=fetch, fetch_map=fetch_map) return fetch_map