@@ -35,13 +35,28 @@ We consider deploying deep learning inference service online to be a user-facing
...
@@ -35,13 +35,28 @@ We consider deploying deep learning inference service online to be a user-facing
<h2align="center">Installation</h2>
<h2align="center">Installation</h2>
We highly recommend you to run Paddle Serving in Docker, please visit [Run in Docker](https://github.com/PaddlePaddle/Serving/blob/develop/doc/RUN_IN_DOCKER.md)
We highly recommend you to run Paddle Serving in Docker, please visit [Run in Docker](https://github.com/PaddlePaddle/Serving/blob/develop/doc/RUN_IN_DOCKER.md)
nvidia-docker run -p 9292:9292 --name test -dit hub.baidubce.com/paddlepaddle/serving:0.2.0-gpu
nvidia-docker exec -it test bash
```
```shell
```shell
pip install paddle-serving-client
pip install paddle-serving-client
pip install paddle-serving-server
pip install paddle-serving-server # CPU
pip install paddle-serving-server-gpu # GPU
```
```
You may need to use a domestic mirror source (in China, you can use the Tsinghua mirror source) to speed up the download.
You may need to use a domestic mirror source (in China, you can use the Tsinghua mirror source, add `-i https://pypi.tuna.tsinghua.edu.cn/simple` to pip command) to speed up the download.
Client package support Centos 7 and Ubuntu 18, or you can use HTTP service without install client.
The following Python code will process the data `test_data/part-0` and write to the `processed.data` file.
The following Python code will process the data `test_data/part-0` and write to the `processed.data` file.
[//file]:#process.py
``` python
``` python
fromimdb_readerimportIMDBDataset
fromimdb_readerimportIMDBDataset
imdb_dataset=IMDBDataset()
imdb_dataset=IMDBDataset()
...
@@ -59,7 +60,8 @@ exit
...
@@ -59,7 +60,8 @@ exit
Run the following Python code on the host computer to start client. Make sure that the host computer is installed with the `paddle-serving-client` package.
Run the following Python code on the host computer to start client. Make sure that the host computer is installed with the `paddle-serving-client` package.
``` go
[//file]:#ab_client.py
``` python
frompaddle_serving_clientimportClient
frompaddle_serving_clientimportClient
client=Client()
client=Client()
...
@@ -94,3 +96,24 @@ When making prediction on the client side, if the parameter `need_variant_tag=Tr
...
@@ -94,3 +96,24 @@ When making prediction on the client side, if the parameter `need_variant_tag=Tr
It is recommended to use Docker to prepare the compilation environment for the Paddle service: [CPU Dockerfile.devel](../tools/Dockerfile.devel), [GPU Dockerfile.gpu.devel](../tools/Dockerfile.gpu.devel)
It is recommended to use Docker for compilation. We have prepared the Paddle Serving compilation environment for you:
This document will take Python2 as an example to show how to compile Paddle Serving. If you want to compile with Python 3, just adjust the Python options of cmake.
Docker (GPU version requires nvidia-docker to be installed on the GPU machine)
Docker (GPU version requires nvidia-docker to be installed on the GPU machine)
This document takes Python2 as an example to show how to run Paddle Serving in docker. You can also use Python3 to run related commands by replacing `python` with `python3`.
check_cmd "curl -H "Content-Type:application/json" -X POST -d '{"words": "i am very sad | 0", "fetch":["prediction"]}' http://127.0.0.1:9292/imdb/prediction"