diff --git a/python/paddle_serving_server_gpu/__init__.py b/python/paddle_serving_server_gpu/__init__.py index 44733b154096255c3ce06e1be29d50d3e662269a..cc736a52e82637509d7d2a49efe9685f47c99e16 100644 --- a/python/paddle_serving_server_gpu/__init__.py +++ b/python/paddle_serving_server_gpu/__init__.py @@ -68,6 +68,10 @@ def serve_args(): type=int, default=512 * 1024 * 1024, help="Limit sizes of messages") + parser.add_argument( + "--use_multilang", + action='store_true', + help="Use Multi-language-service") return parser.parse_args() diff --git a/python/paddle_serving_server_gpu/serve.py b/python/paddle_serving_server_gpu/serve.py index 309896a876bda5fc9b1baceb089242baa6d77dc5..0769039ef9955aea69af7ab84142a1f735ce4697 100644 --- a/python/paddle_serving_server_gpu/serve.py +++ b/python/paddle_serving_server_gpu/serve.py @@ -54,17 +54,26 @@ def start_gpu_card_model(index, gpuid, args): # pylint: disable=doc-string-miss op_seq_maker.add_op(general_infer_op) op_seq_maker.add_op(general_response_op) - server = serving.Server() - server.set_op_sequence(op_seq_maker.get_op_sequence()) - server.set_num_threads(thread_num) - server.set_memory_optimize(mem_optim) - server.set_ir_optimize(ir_optim) - server.set_max_body_size(max_body_size) - - server.load_model_config(model) - server.prepare_server(workdir=workdir, port=port, device=device) - if gpuid >= 0: - server.set_gpuid(gpuid) + use_multilang = args.use_multilang + if use_multilang: + server = serving.MultiLangServer() + server.set_op_sequence(op_seq_maker.get_op_sequence()) + server.load_model_config(model) + server.prepare_server(workdir=workdir, port=port, device=device) + if gpuid >= 0: + raise ValueError("gpuid can not >= 0 in MultiLangServer") + else: + server = serving.Server() + server.set_op_sequence(op_seq_maker.get_op_sequence()) + server.set_num_threads(thread_num) + server.set_memory_optimize(mem_optim) + server.set_ir_optimize(ir_optim) + server.set_max_body_size(max_body_size) + + server.load_model_config(model) + server.prepare_server(workdir=workdir, port=port, device=device) + if gpuid >= 0: + server.set_gpuid(gpuid) server.run_server()