diff --git a/doc/ABTEST_IN_PADDLE_SERVING.md b/doc/ABTEST_IN_PADDLE_SERVING.md index f2302e611bc68607ed68f45f81cd833a91938ae6..3ae23504bff2621c9a814a3ac15e5157626f8999 100644 --- a/doc/ABTEST_IN_PADDLE_SERVING.md +++ b/doc/ABTEST_IN_PADDLE_SERVING.md @@ -21,7 +21,7 @@ The following Python code will process the data `test_data/part-0` and write to [//file]:#process.py ``` python -from imdb_reader import IMDBDataset +from paddle_serving_app.reader import IMDBDataset imdb_dataset = IMDBDataset() imdb_dataset.load_resource('imdb.vocab') @@ -78,7 +78,7 @@ with open('processed.data') as f: feed = {"words": word_ids} fetch = ["acc", "cost", "prediction"] [fetch_map, tag] = client.predict(feed=feed, fetch=fetch, need_variant_tag=True) - if (float(fetch_map["prediction"][1]) - 0.5) * (float(label[0]) - 0.5) > 0: + if (float(fetch_map["prediction"][0][1]) - 0.5) * (float(label[0]) - 0.5) > 0: cnt[tag]['acc'] += 1 cnt[tag]['total'] += 1 @@ -88,7 +88,7 @@ with open('processed.data') as f: In the code, the function `client.add_variant(tag, clusters, variant_weight)` is to add a variant with label `tag` and flow weight `variant_weight`. In this example, a BOW variant with label of `bow` and flow weight of `10`, and an LSTM variant with label of `lstm` and a flow weight of `90` are added. The flow on the client side will be distributed to two variants according to the ratio of `10:90`. -When making prediction on the client side, if the parameter `need_variant_tag=True` is specified, the response will contains the variant tag corresponding to the distribution flow. +When making prediction on the client side, if the parameter `need_variant_tag=True` is specified, the response will contain the variant tag corresponding to the distribution flow. ### Expected Results diff --git a/doc/ABTEST_IN_PADDLE_SERVING_CN.md b/doc/ABTEST_IN_PADDLE_SERVING_CN.md index 7ba4e5d7dbe643d87fc15e783afea2955b98fa1e..43bb702bd8b0317d7449313c0e1362953ed87744 100644 --- a/doc/ABTEST_IN_PADDLE_SERVING_CN.md +++ b/doc/ABTEST_IN_PADDLE_SERVING_CN.md @@ -20,7 +20,7 @@ sh get_data.sh 下面Python代码将处理`test_data/part-0`的数据,写入`processed.data`文件中。 ```python -from imdb_reader import IMDBDataset +from paddle_serving_app.reader import IMDBDataset imdb_dataset = IMDBDataset() imdb_dataset.load_resource('imdb.vocab') @@ -76,7 +76,7 @@ with open('processed.data') as f: feed = {"words": word_ids} fetch = ["acc", "cost", "prediction"] [fetch_map, tag] = client.predict(feed=feed, fetch=fetch, need_variant_tag=True) - if (float(fetch_map["prediction"][1]) - 0.5) * (float(label[0]) - 0.5) > 0: + if (float(fetch_map["prediction"][0][1]) - 0.5) * (float(label[0]) - 0.5) > 0: cnt[tag]['acc'] += 1 cnt[tag]['total'] += 1 diff --git a/doc/PERFORMANCE_OPTIM.md b/doc/PERFORMANCE_OPTIM.md index 0de06c16988d14d8f92eced491db7dc423831afe..eae128c40c0b5d40c0fc50346ca3f6e6c4c02eb5 100644 --- a/doc/PERFORMANCE_OPTIM.md +++ b/doc/PERFORMANCE_OPTIM.md @@ -2,9 +2,9 @@ ([简体中文](./PERFORMANCE_OPTIM_CN.md)|English) -Due to different model structures, different prediction services consume different computing resources when performing predictions. For online prediction services, models that require less computing resources will have a higher proportion of communication time cost, which is called communication-intensive service. Models that require more computing resources have a higher time cost for inference calculations, which is called computationa-intensive services. +Due to different model structures, different prediction services consume different computing resources when performing predictions. For online prediction services, models that require less computing resources will have a higher proportion of communication time cost, which is called communication-intensive service. Models that require more computing resources have a higher time cost for inference calculations, which is called computation-intensive services. -For a prediction service, the easiest way to determine what type it is is to look at the time ratio. Paddle Serving provides [Timeline tool](../python/examples/util/README_CN.md), which can intuitively display the time spent in each stage of the prediction service. +For a prediction service, the easiest way to determine the type of service is to look at the time ratio. Paddle Serving provides [Timeline tool](../python/examples/util/README_CN.md), which can intuitively display the time spent in each stage of the prediction service. For communication-intensive prediction services, requests can be aggregated, and within a limit that can tolerate delay, multiple prediction requests can be combined into a batch for prediction. diff --git a/doc/SAVE.md b/doc/SAVE.md index 4fcdfa438574fac7de21c963f5bb173c69261210..54800fa06ab4b8c20c0ffe75d417e1b42ab6ebe6 100644 --- a/doc/SAVE.md +++ b/doc/SAVE.md @@ -34,7 +34,7 @@ for line in sys.stdin: ## Export from saved model files If you have saved model files using Paddle's `save_inference_model` API, you can use Paddle Serving's` inference_model_to_serving` API to convert it into a model file that can be used for Paddle Serving. -``` +```python import paddle_serving_client.io as serving_io serving_io.inference_model_to_serving(dirname, serving_server="serving_server", serving_client="serving_client", model_filename=None, params_filename=None ) ``` diff --git a/doc/SAVE_CN.md b/doc/SAVE_CN.md index 3ca715c024a38b6fdce5c973844e7d023eebffcc..aaf0647fd1c4e95584bb7aa42a6671620adeb6d0 100644 --- a/doc/SAVE_CN.md +++ b/doc/SAVE_CN.md @@ -35,7 +35,7 @@ for line in sys.stdin: ## 从已保存的模型文件中导出 如果已使用Paddle 的`save_inference_model`接口保存出预测要使用的模型,则可以通过Paddle Serving的`inference_model_to_serving`接口转换成可用于Paddle Serving的模型文件。 -``` +```python import paddle_serving_client.io as serving_io serving_io.inference_model_to_serving(dirname, serving_server="serving_server", serving_client="serving_client", model_filename=None, params_filename=None) ``` diff --git a/doc/UWSGI_DEPLOY.md b/doc/UWSGI_DEPLOY.md index 92b69fc1f3da6c791c1009d41bbb3a3ec6f30594..1aa9c1fce452d8f3525d3646133d90356fce25e6 100644 --- a/doc/UWSGI_DEPLOY.md +++ b/doc/UWSGI_DEPLOY.md @@ -18,7 +18,7 @@ http://10.127.3.150:9393/uci/prediction Here you will be prompted that the HTTP service started is in development mode and cannot be used for production deployment. The prediction service started by Flask is not stable enough to withstand the concurrency of a large number of requests. In the actual deployment process, WSGI (Web Server Gateway Interface) is used. -Next, we will show how to use the [uWSGI] (https://github.com/unbit/uwsgi) module to deploy HTTP prediction services for production environments. +Next, we will show how to use the [uWSGI](https://github.com/unbit/uwsgi) module to deploy HTTP prediction services for production environments. ```python diff --git a/python/examples/lac/lac_web_service.py b/python/examples/lac/lac_web_service.py index 9b1c6693b52393aee1294b521fe30fb1a9fd0d79..bed89f54b626c0cce55767f8edacc3dd33f0104c 100644 --- a/python/examples/lac/lac_web_service.py +++ b/python/examples/lac/lac_web_service.py @@ -19,7 +19,7 @@ from paddle_serving_app.reader import LACReader class LACService(WebService): def load_reader(self): - self.reader = LACReader("lac_dict") + self.reader = LACReader() def preprocess(self, feed={}, fetch=[]): feed_batch = [] diff --git a/python/examples/resnet_v2_50/resnet50_v2_tutorial.py b/python/examples/resnet_v2_50/resnet50_v2_tutorial.py index 8d916cbd8145cdc73424a05fdb2855412f4d4fe2..b249d2a6df85f87258f66c96aaa779eb2e299613 100644 --- a/python/examples/resnet_v2_50/resnet50_v2_tutorial.py +++ b/python/examples/resnet_v2_50/resnet50_v2_tutorial.py @@ -14,7 +14,7 @@ from paddle_serving_client import Client from paddle_serving_app.reader import Sequential, File2Image, Resize, CenterCrop -from apddle_serving_app.reader import RGB2BGR, Transpose, Div, Normalize +from paddle_serving_app.reader import RGB2BGR, Transpose, Div, Normalize client = Client() client.load_client_config( @@ -28,5 +28,5 @@ seq = Sequential([ image_file = "daisy.jpg" img = seq(image_file) -fetch_map = client.predict(feed={"image": img}, fetch=["feature_map"]) -print(fetch_map["feature_map"].reshape(-1)) +fetch_map = client.predict(feed={"image": img}, fetch=["score"]) +print(fetch_map["score"].reshape(-1)) diff --git a/python/examples/unet_for_image_seg/seg_client.py b/python/examples/unet_for_image_seg/seg_client.py index 9e76b060955ec74492312c8896efaf3946a3f7ab..44f634b6090159ee1bd37c176eebb7d2b7f37065 100644 --- a/python/examples/unet_for_image_seg/seg_client.py +++ b/python/examples/unet_for_image_seg/seg_client.py @@ -27,7 +27,8 @@ preprocess = Sequential( postprocess = SegPostprocess(2) -im = preprocess("N0060.jpg") +filename = "N0060.jpg" +im = preprocess(filename) fetch_map = client.predict(feed={"image": im}, fetch=["output"]) fetch_map["filename"] = filename postprocess(fetch_map) diff --git a/python/paddle_serving_app/README.md b/python/paddle_serving_app/README.md index 6757407939c150ca14a22427a488f41a24feb7ac..cb48ae376086ec4021af617337e43934dd5e5f6e 100644 --- a/python/paddle_serving_app/README.md +++ b/python/paddle_serving_app/README.md @@ -21,7 +21,7 @@ python -m paddle_serving_app.package --list_model python -m paddle_serving_app.package --get_model senta_bilstm ``` -10 pre-trained models are built into paddle_serving_app, covering 6 kinds of prediction tasks. +1 pre-trained models are built into paddle_serving_app, covering 6 kinds of prediction tasks. The model files can be directly used for deployment, and the `--tutorial` argument can be added to obtain the deployment method. | Prediction task | Model name | @@ -30,7 +30,7 @@ The model files can be directly used for deployment, and the `--tutorial` argume | SemanticRepresentation | 'ernie' | | ChineseWordSegmentation | 'lac' | | ObjectDetection | 'faster_rcnn' | -| ImageSegmentation | 'unet', 'deeplabv3' | +| ImageSegmentation | 'unet', 'deeplabv3','deeplabv3+cityscapes' | | ImageClassification | 'resnet_v2_50_imagenet', 'mobilenet_v2_imagenet' | ## Data preprocess API @@ -38,7 +38,8 @@ The model files can be directly used for deployment, and the `--tutorial` argume paddle_serving_app provides a variety of data preprocessing methods for prediction tasks in the field of CV and NLP. - class ChineseBertReader - + + Preprocessing for Chinese semantic representation task. - `__init__(vocab_file, max_seq_len=20)` @@ -54,7 +55,8 @@ Preprocessing for Chinese semantic representation task. [example](../examples/bert/bert_client.py) - class LACReader - + + Preprocessing for Chinese word segmentation task. - `__init__(dict_floder)` @@ -65,7 +67,7 @@ Preprocessing for Chinese word segmentation task. - words(st ):Original text input. - crf_decode(np.array):CRF code predicted by model. - [example](../examples/bert/lac_web_service.py) + [example](../examples/lac/lac_web_service.py) - class SentaReader diff --git a/python/paddle_serving_app/README_CN.md b/python/paddle_serving_app/README_CN.md index d29c3fd9fff3ba2ab34ec67b6fd15ad10e3cfd07..181037c55a2aae578cb189525030ccba87146f6e 100644 --- a/python/paddle_serving_app/README_CN.md +++ b/python/paddle_serving_app/README_CN.md @@ -20,7 +20,7 @@ python -m paddle_serving_app.package --list_model python -m paddle_serving_app.package --get_model senta_bilstm ``` -paddle_serving_app中内置了10种预训练模型,涵盖了6种预测任务。获取到的模型文件可以直接用于部署,添加`--tutorial`参数可以获取对应的部署方式。 +paddle_serving_app中内置了11种预训练模型,涵盖了6种预测任务。获取到的模型文件可以直接用于部署,添加`--tutorial`参数可以获取对应的部署方式。 | 预测服务类型 | 模型名称 | | ------------ | ------------------------------------------------ | @@ -28,7 +28,7 @@ paddle_serving_app中内置了10种预训练模型,涵盖了6种预测任务 | 语义理解 | 'ernie' | | 中文分词 | 'lac' | | 图像检测 | 'faster_rcnn' | -| 图像分割 | 'unet', 'deeplabv3' | +| 图像分割 | 'unet', 'deeplabv3', 'deeplabv3+cityscapes' | | 图像分类 | 'resnet_v2_50_imagenet', 'mobilenet_v2_imagenet' | ## 数据预处理API @@ -36,7 +36,7 @@ paddle_serving_app中内置了10种预训练模型,涵盖了6种预测任务 paddle_serving_app针对CV和NLP领域的模型任务,提供了多种常见的数据预处理方法。 - class ChineseBertReader - + 中文语义理解模型预处理 - `__init__(vocab_file, max_seq_len=20)` diff --git a/python/setup.py.server.in b/python/setup.py.server.in index 97f02078806b20f41e917e0c385983a767a4df8c..a7190ecf36c194e7d486f96e1bf8e219a7600dba 100644 --- a/python/setup.py.server.in +++ b/python/setup.py.server.in @@ -38,12 +38,9 @@ max_version, mid_version, min_version = python_version() REQUIRED_PACKAGES = [ 'six >= 1.10.0', 'protobuf >= 3.1.0', - 'paddle_serving_client', 'flask >= 1.1.1' + 'paddle_serving_client', 'flask >= 1.1.1', 'paddle_serving_app' ] -if not find_package("paddlepaddle") and not find_package("paddlepaddle-gpu"): - REQUIRED_PACKAGES.append("paddlepaddle") - packages=['paddle_serving_server', 'paddle_serving_server.proto'] diff --git a/python/setup.py.server_gpu.in b/python/setup.py.server_gpu.in index 6a651053391b30afb71996c5073d21a5620d3320..90db7addbcd8b1929342a893c8213a48f3c8e9e3 100644 --- a/python/setup.py.server_gpu.in +++ b/python/setup.py.server_gpu.in @@ -38,11 +38,9 @@ max_version, mid_version, min_version = python_version() REQUIRED_PACKAGES = [ 'six >= 1.10.0', 'protobuf >= 3.1.0', - 'paddle_serving_client', 'flask >= 1.1.1' + 'paddle_serving_client', 'flask >= 1.1.1', 'paddle_serving_app' ] -if not find_package("paddlepaddle") and not find_package("paddlepaddle-gpu"): - REQUIRED_PACKAGES.append("paddlepaddle") packages=['paddle_serving_server_gpu', 'paddle_serving_server_gpu.proto']