From 7077b6e36beaa60fd05ec4dee64cc7a500849333 Mon Sep 17 00:00:00 2001 From: MRXLT Date: Tue, 9 Jun 2020 07:00:16 +0000 Subject: [PATCH 1/6] fix mem_optim ir_optim use_mkl arguments --- README.md | 6 +++--- README_CN.md | 6 +++--- doc/BERT_10_MINS.md | 2 +- doc/BERT_10_MINS_CN.md | 2 +- python/paddle_serving_server/serve.py | 10 +++++++--- python/paddle_serving_server_gpu/__init__.py | 7 +++++-- 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index f209e58b6..e7d9fa03f 100644 --- a/README.md +++ b/README.md @@ -111,9 +111,9 @@ python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --po | `port` | int | `9292` | Exposed port of current service to users| | `name` | str | `""` | Service name, can be used to generate HTTP request url | | `model` | str | `""` | Path of paddle model directory to be served | -| `mem_optim` | bool | `False` | Enable memory / graphic memory optimization | -| `ir_optim` | bool | `False` | Enable analysis and optimization of calculation graph | -| `use_mkl` (Only for cpu version) | bool | `False` | Run inference with MKL | +| `mem_optim` | - | - | Enable memory / graphic memory optimization | +| `ir_optim` | - | - | Enable analysis and optimization of calculation graph | +| `use_mkl` (Only for cpu version) | - | - | Run inference with MKL | Here, we use `curl` to send a HTTP POST request to the service we just started. Users can use any python library to send HTTP POST as well, e.g, [requests](https://requests.readthedocs.io/en/master/). diff --git a/README_CN.md b/README_CN.md index 05d3ad210..3eeb5c2b5 100644 --- a/README_CN.md +++ b/README_CN.md @@ -115,9 +115,9 @@ python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --po | `port` | int | `9292` | Exposed port of current service to users| | `name` | str | `""` | Service name, can be used to generate HTTP request url | | `model` | str | `""` | Path of paddle model directory to be served | -| `mem_optim` | bool | `False` | Enable memory optimization | -| `ir_optim` | bool | `False` | Enable analysis and optimization of calculation graph | -| `use_mkl` (Only for cpu version) | bool | `False` | Run inference with MKL | +| `mem_optim` | - | - | Enable memory optimization | +| `ir_optim` | - | - | Enable analysis and optimization of calculation graph | +| `use_mkl` (Only for cpu version) | - | - | Run inference with MKL | 我们使用 `curl` 命令来发送HTTP POST请求给刚刚启动的服务。用户也可以调用python库来发送HTTP POST请求,请参考英文文档 [requests](https://requests.readthedocs.io/en/master/)。 diff --git a/doc/BERT_10_MINS.md b/doc/BERT_10_MINS.md index 71f6f065f..53e51768d 100644 --- a/doc/BERT_10_MINS.md +++ b/doc/BERT_10_MINS.md @@ -59,7 +59,7 @@ the script of client side bert_client.py is as follow: import os import sys from paddle_serving_client import Client -from paddle_serving_app import ChineseBertReader +from paddle_serving_app.reader import ChineseBertReader reader = ChineseBertReader() fetch = ["pooled_output"] diff --git a/doc/BERT_10_MINS_CN.md b/doc/BERT_10_MINS_CN.md index b7a5180da..e4904d86b 100644 --- a/doc/BERT_10_MINS_CN.md +++ b/doc/BERT_10_MINS_CN.md @@ -52,7 +52,7 @@ pip install paddle_serving_app ``` python import sys from paddle_serving_client import Client -from paddle_serving_app import ChineseBertReader +from paddle_serving_app.reader import ChineseBertReader reader = ChineseBertReader() fetch = ["pooled_output"] diff --git a/python/paddle_serving_server/serve.py b/python/paddle_serving_server/serve.py index 894b0c5b1..e75240dfa 100644 --- a/python/paddle_serving_server/serve.py +++ b/python/paddle_serving_server/serve.py @@ -40,10 +40,14 @@ def parse_args(): # pylint: disable=doc-string-missing parser.add_argument( "--device", type=str, default="cpu", help="Type of device") parser.add_argument( - "--mem_optim", type=bool, default=False, help="Memory optimize") + "--mem_optim", + default=False, + action="store_true", + help="Memory optimize") parser.add_argument( - "--ir_optim", type=bool, default=False, help="Graph optimize") - parser.add_argument("--use_mkl", type=bool, default=False, help="Use MKL") + "--ir_optim", default=False, action="store_true", help="Graph optimize") + parser.add_argument( + "--use_mkl", default=False, action="store_true", help="Use MKL") parser.add_argument( "--max_body_size", type=int, diff --git a/python/paddle_serving_server_gpu/__init__.py b/python/paddle_serving_server_gpu/__init__.py index e40c0fa48..ace490553 100644 --- a/python/paddle_serving_server_gpu/__init__.py +++ b/python/paddle_serving_server_gpu/__init__.py @@ -47,9 +47,12 @@ def serve_args(): parser.add_argument( "--name", type=str, default="None", help="Default service name") parser.add_argument( - "--mem_optim", type=bool, default=False, help="Memory optimize") + "--mem_optim", + default=False, + action="store_true", + help="Memory optimize") parser.add_argument( - "--ir_optim", type=bool, default=False, help="Graph optimize") + "--ir_optim", default=False, action="store_true", help="Graph optimize") parser.add_argument( "--max_body_size", type=int, From 4613d0ff2c5606f98314ac000fb8ea7ee26723ee Mon Sep 17 00:00:00 2001 From: MRXLT Date: Tue, 9 Jun 2020 07:14:33 +0000 Subject: [PATCH 2/6] fix readme --- README.md | 6 +++--- README_CN.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e7d9fa03f..b32848243 100644 --- a/README.md +++ b/README.md @@ -61,9 +61,9 @@ Packages of Paddle Serving support Centos 6/7 and Ubuntu 16/18, or you can use H

Chinese Word Segmentation

``` shell -> python -m paddle_serving_app.package -get_model lac +> python -m paddle_serving_app.package --get_model lac > tar -xzf lac.tar.gz -> python lac_web_service.py 9292 & +> python lac_web_service.py 9393 & > curl -H "Content-Type:application/json" -X POST -d '{"feed":[{"words": "我爱北京天安门"}], "fetch":["word_seg"]}' http://127.0.0.1:9393/lac/prediction {"result":[{"word_seg":"我|爱|北京|天安门"}]} ``` @@ -77,7 +77,7 @@ Packages of Paddle Serving support Centos 6/7 and Ubuntu 16/18, or you can use H

``` shell -> python -m paddle_serving_app.package -get_model resnet_v2_50_imagenet +> python -m paddle_serving_app.package --get_model resnet_v2_50_imagenet > tar -xzf resnet_v2_50_imagenet.tar.gz > python resnet50_imagenet_classify.py resnet50_serving_model & > curl -H "Content-Type:application/json" -X POST -d '{"feed":[{"image": "https://paddle-serving.bj.bcebos.com/imagenet-example/daisy.jpg"}], "fetch": ["score"]}' http://127.0.0.1:9292/image/prediction diff --git a/README_CN.md b/README_CN.md index 3eeb5c2b5..60fe26b8a 100644 --- a/README_CN.md +++ b/README_CN.md @@ -62,9 +62,9 @@ Paddle Serving安装包支持Centos 6/7和Ubuntu 16/18,或者您可以使用HT

中文分词

``` shell -> python -m paddle_serving_app.package -get_model lac +> python -m paddle_serving_app.package --get_model lac > tar -xzf lac.tar.gz -> python lac_web_service.py 9292 & +> python lac_web_service.py 9393 & > curl -H "Content-Type:application/json" -X POST -d '{"feed":[{"words": "我爱北京天安门"}], "fetch":["word_seg"]}' http://127.0.0.1:9393/lac/prediction {"result":[{"word_seg":"我|爱|北京|天安门"}]} ``` @@ -78,7 +78,7 @@ Paddle Serving安装包支持Centos 6/7和Ubuntu 16/18,或者您可以使用HT

``` shell -> python -m paddle_serving_app.package -get_model resnet_v2_50_imagenet +> python -m paddle_serving_app.package --get_model resnet_v2_50_imagenet > tar -xzf resnet_v2_50_imagenet.tar.gz > python resnet50_imagenet_classify.py resnet50_serving_model & > curl -H "Content-Type:application/json" -X POST -d '{"feed":[{"image": "https://paddle-serving.bj.bcebos.com/imagenet-example/daisy.jpg"}], "fetch": ["score"]}' http://127.0.0.1:9292/image/prediction From 0ff947faa684d122cbe84bf2046d19ae759c10f9 Mon Sep 17 00:00:00 2001 From: MRXLT Date: Tue, 9 Jun 2020 07:25:37 +0000 Subject: [PATCH 3/6] update doc --- README.md | 4 ++-- README_CN.md | 2 +- doc/PERFORMANCE_OPTIM.md | 4 ++-- doc/PERFORMANCE_OPTIM_CN.md | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b32848243..c15ee9b86 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Packages of Paddle Serving support Centos 6/7 and Ubuntu 16/18, or you can use H ``` shell > python -m paddle_serving_app.package --get_model lac > tar -xzf lac.tar.gz -> python lac_web_service.py 9393 & +> python lac_web_service.py lac_model/ lac_workdir 9393 & > curl -H "Content-Type:application/json" -X POST -d '{"feed":[{"words": "我爱北京天安门"}], "fetch":["word_seg"]}' http://127.0.0.1:9393/lac/prediction {"result":[{"word_seg":"我|爱|北京|天安门"}]} ``` @@ -170,7 +170,7 @@ Here, `client.predict` function has two arguments. `feed` is a `python dict` wit ### About Efficiency - [How to profile Paddle Serving latency?](python/examples/util) -- [How to optimize performance?(Chinese)](doc/PERFORMANCE_OPTIM_CN.md) +- [How to optimize performance?](doc/PERFORMANCE_OPTIM.md) - [Deploy multi-services on one GPU(Chinese)](doc/MULTI_SERVICE_ON_ONE_GPU_CN.md) - [CPU Benchmarks(Chinese)](doc/BENCHMARKING.md) - [GPU Benchmarks(Chinese)](doc/GPU_BENCHMARKING.md) diff --git a/README_CN.md b/README_CN.md index 60fe26b8a..f76dd21e6 100644 --- a/README_CN.md +++ b/README_CN.md @@ -64,7 +64,7 @@ Paddle Serving安装包支持Centos 6/7和Ubuntu 16/18,或者您可以使用HT ``` shell > python -m paddle_serving_app.package --get_model lac > tar -xzf lac.tar.gz -> python lac_web_service.py 9393 & +> python lac_web_service.py lac_model/ lac_workdir 9393 & > curl -H "Content-Type:application/json" -X POST -d '{"feed":[{"words": "我爱北京天安门"}], "fetch":["word_seg"]}' http://127.0.0.1:9393/lac/prediction {"result":[{"word_seg":"我|爱|北京|天安门"}]} ``` diff --git a/doc/PERFORMANCE_OPTIM.md b/doc/PERFORMANCE_OPTIM.md index eae128c40..651be1c13 100644 --- a/doc/PERFORMANCE_OPTIM.md +++ b/doc/PERFORMANCE_OPTIM.md @@ -16,5 +16,5 @@ Parameters for performance optimization: | Parameters | Type | Default | Description | | ---------- | ---- | ------- | ------------------------------------------------------------ | -| mem_optim | bool | False | Enable memory / graphic memory optimization | -| ir_optim | bool | Fasle | Enable analysis and optimization of calculation graph,including OP fusion, etc | +| mem_optim | - | - | Enable memory / graphic memory optimization | +| ir_optim | - | - | Enable analysis and optimization of calculation graph,including OP fusion, etc | diff --git a/doc/PERFORMANCE_OPTIM_CN.md b/doc/PERFORMANCE_OPTIM_CN.md index 1a2c38409..c35ea7a11 100644 --- a/doc/PERFORMANCE_OPTIM_CN.md +++ b/doc/PERFORMANCE_OPTIM_CN.md @@ -16,5 +16,5 @@ | 参数 | 类型 | 默认值 | 含义 | | --------- | ---- | ------ | -------------------------------- | -| mem_optim | bool | False | 开启内存/显存优化 | -| ir_optim | bool | Fasle | 开启计算图分析优化,包括OP融合等 | +| mem_optim | - | - | 开启内存/显存优化 | +| ir_optim | - | - | 开启计算图分析优化,包括OP融合等 | From 65f199362a95f4946aebcabcbde36c4adc296ca7 Mon Sep 17 00:00:00 2001 From: MRXLT Date: Tue, 9 Jun 2020 07:40:59 +0000 Subject: [PATCH 4/6] update doc --- doc/IMDB_GO_CLIENT_CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/IMDB_GO_CLIENT_CN.md b/doc/IMDB_GO_CLIENT_CN.md index 86355bd53..5067d1ef7 100644 --- a/doc/IMDB_GO_CLIENT_CN.md +++ b/doc/IMDB_GO_CLIENT_CN.md @@ -99,7 +99,7 @@ func main() { ### 基于IMDB测试集的预测 ```python -go run imdb_client.go serving_client_conf / serving_client_conf.stream.prototxt test.data> result +go run imdb_client.go serving_client_conf/serving_client_conf.stream.prototxt test.data> result ``` ### 计算精度 From 6ad85fef867c129c59e0eff9e5f41911dfff1270 Mon Sep 17 00:00:00 2001 From: MRXLT Date: Tue, 9 Jun 2020 08:17:30 +0000 Subject: [PATCH 5/6] add FAQ --- README.md | 2 +- README_CN.md | 2 +- doc/FAQ.md | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 doc/FAQ.md diff --git a/README.md b/README.md index c15ee9b86..04634afeb 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ Here, `client.predict` function has two arguments. `feed` is a `python dict` wit - [GPU Benchmarks(Chinese)](doc/GPU_BENCHMARKING.md) ### FAQ -- [FAQ(Chinese)](doc/deprecated/FAQ.md) +- [FAQ(Chinese)](doc/FAQ.md) ### Design diff --git a/README_CN.md b/README_CN.md index f76dd21e6..7a42e6cd9 100644 --- a/README_CN.md +++ b/README_CN.md @@ -181,7 +181,7 @@ print(fetch_map) - [GPU版Benchmarks](doc/GPU_BENCHMARKING.md) ### FAQ -- [常见问答](doc/deprecated/FAQ.md) +- [常见问答](doc/FAQ.md) ### 设计文档 - [Paddle Serving设计文档](doc/DESIGN_DOC_CN.md) diff --git a/doc/FAQ.md b/doc/FAQ.md new file mode 100644 index 000000000..07531fd31 --- /dev/null +++ b/doc/FAQ.md @@ -0,0 +1,13 @@ +# FAQ + +- Q:如何调整RPC服务的等待时间,避免超时? +A:使用set_rpc_timeout_ms设置更长的等待时间,单位为毫秒,默认时间为20秒 +示例: +``` +from paddle_serving_client import Client + +client = Client() +client.load_client_config(sys.argv[1]) +client.set_rpc_timeout_ms(100000) +client.connect(["127.0.0.1:9393"]) +``` From 81fe3fe25984aa905c29a5249d16f521daba5f95 Mon Sep 17 00:00:00 2001 From: MRXLT Date: Tue, 9 Jun 2020 16:19:43 +0800 Subject: [PATCH 6/6] Update FAQ.md --- doc/FAQ.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/doc/FAQ.md b/doc/FAQ.md index 07531fd31..3bdd2dfd4 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -1,13 +1,15 @@ # FAQ - Q:如何调整RPC服务的等待时间,避免超时? -A:使用set_rpc_timeout_ms设置更长的等待时间,单位为毫秒,默认时间为20秒 -示例: -``` -from paddle_serving_client import Client -client = Client() -client.load_client_config(sys.argv[1]) -client.set_rpc_timeout_ms(100000) -client.connect(["127.0.0.1:9393"]) -``` + A:使用set_rpc_timeout_ms设置更长的等待时间,单位为毫秒,默认时间为20秒。 + + 示例: + ``` + from paddle_serving_client import Client + + client = Client() + client.load_client_config(sys.argv[1]) + client.set_rpc_timeout_ms(100000) + client.connect(["127.0.0.1:9393"]) + ```