From 271a88a69ef28ceb669870af703e88e2afb3889b Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Tue, 23 Mar 2021 15:27:19 +0800 Subject: [PATCH] fix readme --- deploy/hubserving/readme.md | 2 +- deploy/hubserving/readme_en.md | 2 +- deploy/{pdserver => pdserving}/README.md | 12 +++++++++++- deploy/{pdserver => pdserving}/README_CN.md | 12 +++++++++++- deploy/{pdserver => pdserving}/__init__.py | 0 deploy/{pdserver => pdserving}/config.yml | 0 .../imgs/cpp_infer_pred_12.png | Bin deploy/{pdserver => pdserving}/imgs/demo.png | Bin deploy/{pdserver => pdserving}/imgs/results.png | Bin .../{pdserver => pdserving}/imgs/start_server.png | Bin deploy/{pdserver => pdserving}/ocr_reader.py | 0 .../{pdserver => pdserving}/pipeline_http_client.py | 0 .../{pdserver => pdserving}/pipeline_rpc_client.py | 0 deploy/{pdserver => pdserving}/web_service.py | 0 14 files changed, 24 insertions(+), 4 deletions(-) rename deploy/{pdserver => pdserving}/README.md (87%) rename deploy/{pdserver => pdserving}/README_CN.md (84%) rename deploy/{pdserver => pdserving}/__init__.py (100%) rename deploy/{pdserver => pdserving}/config.yml (100%) rename deploy/{pdserver => pdserving}/imgs/cpp_infer_pred_12.png (100%) rename deploy/{pdserver => pdserving}/imgs/demo.png (100%) rename deploy/{pdserver => pdserving}/imgs/results.png (100%) rename deploy/{pdserver => pdserving}/imgs/start_server.png (100%) rename deploy/{pdserver => pdserving}/ocr_reader.py (100%) rename deploy/{pdserver => pdserving}/pipeline_http_client.py (100%) rename deploy/{pdserver => pdserving}/pipeline_rpc_client.py (100%) rename deploy/{pdserver => pdserving}/web_service.py (100%) diff --git a/deploy/hubserving/readme.md b/deploy/hubserving/readme.md index ce55b0f0..88f33581 100755 --- a/deploy/hubserving/readme.md +++ b/deploy/hubserving/readme.md @@ -2,7 +2,7 @@ PaddleOCR提供2种服务部署方式: - 基于PaddleHub Serving的部署:代码路径为"`./deploy/hubserving`",按照本教程使用; -- (coming soon)基于PaddleServing的部署:代码路径为"`./deploy/pdserving`",使用方法参考[文档](../../deploy/pdserving/readme.md)。 +- 基于PaddleServing的部署:代码路径为"`./deploy/pdserving`",使用方法参考[文档](../../deploy/pdserving/README_CN.md)。 # 基于PaddleHub Serving的服务部署 diff --git a/deploy/hubserving/readme_en.md b/deploy/hubserving/readme_en.md index 95223ffd..c948fed1 100755 --- a/deploy/hubserving/readme_en.md +++ b/deploy/hubserving/readme_en.md @@ -2,7 +2,7 @@ English | [简体中文](readme.md) PaddleOCR provides 2 service deployment methods: - Based on **PaddleHub Serving**: Code path is "`./deploy/hubserving`". Please follow this tutorial. -- (coming soon)Based on **PaddleServing**: Code path is "`./deploy/pdserving`". Please refer to the [tutorial](../../deploy/pdserving/readme.md) for usage. +- Based on **PaddleServing**: Code path is "`./deploy/pdserving`". Please refer to the [tutorial](../../deploy/pdserving/README.md) for usage. # Service deployment based on PaddleHub Serving diff --git a/deploy/pdserver/README.md b/deploy/pdserving/README.md similarity index 87% rename from deploy/pdserver/README.md rename to deploy/pdserving/README.md index 80a14fc1..9dcc7123 100644 --- a/deploy/pdserver/README.md +++ b/deploy/pdserving/README.md @@ -4,7 +4,8 @@ This document will introduce how to use the [PaddleServing](https://github.com/PaddlePaddle/Serving/blob/develop/README_CN.md) to deploy the PPOCR dynamic graph model as a pipeline online service. -**note**: Paddle Serving service deployment framework introduction and tutorial reference [document](https://aistudio.baidu.com/aistudio/projectdetail/1550674). +Compared with hubserving deployment, PaddleServing supports high concurrency and efficient communication between the client and the server. +The introduction and tutorial of Paddle Serving service deployment framework reference [document](https://aistudio.baidu.com/aistudio/projectdetail/1550674). ## Contents @@ -42,8 +43,17 @@ pip3 install paddle-serving-client-gpu==0.5.0 # for GPU 3. Install serving-app ``` pip3 install paddle-serving-app==0.3.0 +# fix local_predict to support load dynamic model +# find the install directoory of paddle_serving_app +vim /usr/local/lib/python3.7/site-packages/paddle_serving_app/local_predict.py +# replace line 85 of local_predict.py config = AnalysisConfig(model_path) with: +if os.path.exists(os.path.join(model_path, "__params__")): + config = AnalysisConfig(os.path.join(model_path, "__model__"), os.path.join(model_path, "__params__")) +else: + config = AnalysisConfig(model_path) ``` + **note:** If you want to install the latest version of PaddleServing, refer to [link](https://github.com/PaddlePaddle/Serving/blob/develop/doc/LATEST_PACKAGES.md). diff --git a/deploy/pdserver/README_CN.md b/deploy/pdserving/README_CN.md similarity index 84% rename from deploy/pdserver/README_CN.md rename to deploy/pdserving/README_CN.md index 9f503310..d8f6095c 100644 --- a/deploy/pdserver/README_CN.md +++ b/deploy/pdserving/README_CN.md @@ -5,7 +5,7 @@ 本文档将介绍如何使用[PaddleServing](https://github.com/PaddlePaddle/Serving/blob/develop/README_CN.md)工具部署PPOCR 动态图模型的pipeline在线服务。 -**note**: Paddle Serving服务化部署框架介绍和使用教程参考[文档](https://aistudio.baidu.com/aistudio/projectdetail/1550674)。 +相比较于hubserving部署,PaddleServing支持客户端和服务端之间 高并发和高效通信,更多有关Paddle Serving服务化部署框架介绍和使用教程参考[文档](https://aistudio.baidu.com/aistudio/projectdetail/1550674)。 ## 目录 - 环境准备 @@ -44,6 +44,16 @@ pip3 install paddle-serving-client-gpu==0.5.0 # for GPU ``` pip3 install paddle-serving-app==0.3.0 ``` +**note:** 安装0.3.0版本的serving-app后,为了能加载动态图模型,需要修改serving_app的源码,具体为: +``` +# 找到paddle_serving_app的安装目录,找到并编辑local_predict.py文件 +vim /usr/local/lib/python3.7/site-packages/paddle_serving_app/local_predict.py +# 将local_predict.py 的第85行 config = AnalysisConfig(model_path) 替换为: +if os.path.exists(os.path.join(model_path, "__params__")): + config = AnalysisConfig(os.path.join(model_path, "__model__"), os.path.join(model_path, "__params__")) +else: + config = AnalysisConfig(model_path) +``` **note:** 如果要安装最新版本的PaddleServing参考[链接](https://github.com/PaddlePaddle/Serving/blob/develop/doc/LATEST_PACKAGES.md)。 diff --git a/deploy/pdserver/__init__.py b/deploy/pdserving/__init__.py similarity index 100% rename from deploy/pdserver/__init__.py rename to deploy/pdserving/__init__.py diff --git a/deploy/pdserver/config.yml b/deploy/pdserving/config.yml similarity index 100% rename from deploy/pdserver/config.yml rename to deploy/pdserving/config.yml diff --git a/deploy/pdserver/imgs/cpp_infer_pred_12.png b/deploy/pdserving/imgs/cpp_infer_pred_12.png similarity index 100% rename from deploy/pdserver/imgs/cpp_infer_pred_12.png rename to deploy/pdserving/imgs/cpp_infer_pred_12.png diff --git a/deploy/pdserver/imgs/demo.png b/deploy/pdserving/imgs/demo.png similarity index 100% rename from deploy/pdserver/imgs/demo.png rename to deploy/pdserving/imgs/demo.png diff --git a/deploy/pdserver/imgs/results.png b/deploy/pdserving/imgs/results.png similarity index 100% rename from deploy/pdserver/imgs/results.png rename to deploy/pdserving/imgs/results.png diff --git a/deploy/pdserver/imgs/start_server.png b/deploy/pdserving/imgs/start_server.png similarity index 100% rename from deploy/pdserver/imgs/start_server.png rename to deploy/pdserving/imgs/start_server.png diff --git a/deploy/pdserver/ocr_reader.py b/deploy/pdserving/ocr_reader.py similarity index 100% rename from deploy/pdserver/ocr_reader.py rename to deploy/pdserving/ocr_reader.py diff --git a/deploy/pdserver/pipeline_http_client.py b/deploy/pdserving/pipeline_http_client.py similarity index 100% rename from deploy/pdserver/pipeline_http_client.py rename to deploy/pdserving/pipeline_http_client.py diff --git a/deploy/pdserver/pipeline_rpc_client.py b/deploy/pdserving/pipeline_rpc_client.py similarity index 100% rename from deploy/pdserver/pipeline_rpc_client.py rename to deploy/pdserving/pipeline_rpc_client.py diff --git a/deploy/pdserver/web_service.py b/deploy/pdserving/web_service.py similarity index 100% rename from deploy/pdserver/web_service.py rename to deploy/pdserving/web_service.py -- GitLab