README.md 5.9 KB
Newer Older
D
Dong Daxiang 已提交
1 2
<p align="center">
    <br>
D
Dong Daxiang 已提交
3
<img src='https://paddle-serving.bj.bcebos.com/imdb-demo%2FLogoMakr-3Bd2NM-300dpi.png' width = "600" height = "130">
D
Dong Daxiang 已提交
4 5 6 7 8
    <br>
<p>
    
<p align="center">
    <br>
B
barrierye 已提交
9 10 11
    <a href="https://travis-ci.com/PaddlePaddle/Serving">
        <img alt="Build Status" src="https://img.shields.io/travis/com/PaddlePaddle/Serving/develop">
    </a>
D
Dong Daxiang 已提交
12 13 14 15
    <img alt="Release" src="https://img.shields.io/badge/Release-0.0.3-yellowgreen">
    <img alt="Issues" src="https://img.shields.io/github/issues/PaddlePaddle/Serving">
    <img alt="License" src="https://img.shields.io/github/license/PaddlePaddle/Serving">
    <img alt="Slack" src="https://img.shields.io/badge/Join-Slack-green">
D
Dong Daxiang 已提交
16 17
    <br>
<p>
D
Dong Daxiang 已提交
18

D
Dong Daxiang 已提交
19
<h2 align="center">Motivation</h2>
D
Dong Daxiang 已提交
20

D
Dong Daxiang 已提交
21
Paddle Serving helps deep learning developers deploy an online inference service without much effort. **The goal of this project**: once you have trained a deep neural nets with [Paddle](https://github.com/PaddlePaddle/Paddle), you already have a model inference service. A demo of serving is as follows:
D
Dong Daxiang 已提交
22
<p align="center">
D
Dong Daxiang 已提交
23
    <img src="doc/demo.gif" width="700">
D
Dong Daxiang 已提交
24
</p>
D
Dong Daxiang 已提交
25

D
Dong Daxiang 已提交
26 27
<h2 align="center">Key Features</h2>

D
Dong Daxiang 已提交
28
- Integrate with Paddle training pipeline seemlessly, most paddle models can be deployed **with one line command**.
D
Dong Daxiang 已提交
29 30 31
- **Industrial serving features** supported, such as models management, online loading, online A/B testing etc.
- **Distributed Key-Value indexing** supported that is especially useful for large scale sparse features as model inputs.
- **Highly concurrent and efficient communication** between clients and servers.
D
Dong Daxiang 已提交
32
- **Multiple programming languages** supported on client side, such as Golang, C++ and python
D
Dong Daxiang 已提交
33
- **Extensible framework design** that can support model serving beyond Paddle.
D
Dong Daxiang 已提交
34

D
Dong Daxiang 已提交
35
<h2 align="center">Installation</h2>
D
Dong Daxiang 已提交
36

D
Dong Daxiang 已提交
37 38
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)

D
Dong Daxiang 已提交
39 40 41 42 43
```shell
pip install paddle-serving-client
pip install paddle-serving-server
```

D
Dong Daxiang 已提交
44
<h2 align="center">Quick Start Example</h2>
D
Dong Daxiang 已提交
45

D
Dong Daxiang 已提交
46
### Boston House Price Prediction model
D
Dong Daxiang 已提交
47
``` shell
D
Dong Daxiang 已提交
48
wget --no-check-certificate https://paddle-serving.bj.bcebos.com/uci_housing.tar.gz
D
Dong Daxiang 已提交
49
tar -xzf uci_housing.tar.gz
D
Dong Daxiang 已提交
50
```
D
Dong Daxiang 已提交
51

D
Dong Daxiang 已提交
52 53
Paddle Serving provides HTTP and RPC based service for users to access

D
Dong Daxiang 已提交
54
### HTTP service
D
Dong Daxiang 已提交
55 56

``` shell
D
Dong Daxiang 已提交
57
python -m paddle_serving_server.web_serve --model uci_housing_model --thread 10 --port 9292 --name uci
D
Dong Daxiang 已提交
58
```
D
Dong Daxiang 已提交
59 60
<center>

D
Dong Daxiang 已提交
61 62 63
| Argument | Type | Default | Description |
|--------------|------|-----------|--------------------------------|
| `thread` | int | `10` | Concurrency of current service |
D
Dong Daxiang 已提交
64
| `port` | int | `9292` | Exposed port of current service to users|
D
Dong Daxiang 已提交
65 66
| `name` | str | `""` | Service name, can be used to generate HTTP request url |
| `model` | str | `""` | Path of paddle model directory to be served |
D
Dong Daxiang 已提交
67 68 69

</center>

D
Dong Daxiang 已提交
70 71 72
``` shell
curl -H "Content-Type:application/json" -X POST -d '{"x": [0.0137, -0.1136, 0.2553, -0.0692, 0.0582, -0.0727, -0.1583, -0.0584, 0.6283, 0.4919, 0.1856, 0.0795, -0.0332], "fetch":["price"]}' http://127.0.0.1:9292/uci/prediction
```
D
Dong Daxiang 已提交
73

D
Dong Daxiang 已提交
74
### RPC service
D
Dong Daxiang 已提交
75 76 77 78

``` shell
python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --port 9292
```
D
Dong Daxiang 已提交
79

D
Dong Daxiang 已提交
80
``` python
D
Dong Daxiang 已提交
81
# A user can visit rpc service through paddle_serving_client API
D
Dong Daxiang 已提交
82 83 84
from paddle_serving_client import Client

client = Client()
D
Dong Daxiang 已提交
85
client.load_client_config("uci_housing_client/serving_client_conf.prototxt")
D
Dong Daxiang 已提交
86
client.connect(["127.0.0.1:9292"])
D
Dong Daxiang 已提交
87
data = [0.0137, -0.1136, 0.2553, -0.0692, 0.0582, -0.0727,
D
Dong Daxiang 已提交
88
        -0.1583, -0.0584, 0.6283, 0.4919, 0.1856, 0.0795, -0.0332]
D
Dong Daxiang 已提交
89
fetch_map = client.predict(feed={"x": data}, fetch=["price"])
D
Dong Daxiang 已提交
90
print(fetch_map)
D
Dong Daxiang 已提交
91 92 93

```

D
Dong Daxiang 已提交
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
<h2 align="center"> Pre-built services with Paddle Serving</h2>

<h4 align="center">Chinese Word Segmentation</h4>

- Download: 
``` shell
wget --no-check-certificate https://paddle-serving.bj.bcebos.com/lac/lac_model_jieba_web.tar.gz
```
- Host web service: 
``` shell
tar -xzf lac_model_jieba_web.tar.gz
python lac_web_service.py jieba_server_model/ lac_workdir 9292
```
- Request sample: 
``` shell
curl -H "Content-Type:application/json" -X POST -d '{"words": "我爱北京天安门", "fetch":["crf_decode"]}' http://127.0.0.1:9292/lac/prediction
```
- Request result: 
``` shell
{"word_seg":"我|爱|北京|天安门"}
```


<h4 align="center">Chinese Sentence To Vector</h4>

<h4 align="center">Image To Vector</h4>

<h4 align="center">Image Classification</h4>
D
Dong Daxiang 已提交
122 123 124 125 126 127 128 129 130 131 132 133

<center>

|      Model Name      	|              Resnet50              	|
|:--------------------:	|:----------------------------------:	|
|      Package URL     	|           To be released           	|
|      Description     	| Get the representation of an image 	|
| Training Data Source 	|              Imagenet              	|

</center>


D
Dong Daxiang 已提交
134
<h2 align="center">Document</h2>
D
Dong Daxiang 已提交
135

D
Dong Daxiang 已提交
136
### New to Paddle Serving
D
Dong Daxiang 已提交
137 138 139
- [How to save a servable model?](doc/SAVE.md)
- [An end-to-end tutorial from training to serving](doc/END_TO_END.md)
- [Write Bert-as-Service in 10 minutes](doc/Bert_10_mins.md)
D
Dong Daxiang 已提交
140

D
Dong Daxiang 已提交
141
### Developers
D
Dong Daxiang 已提交
142 143 144 145
- [How to config Serving native operators on server side?](doc/SERVER_DAG.md)
- [How to develop a new Serving operator](doc/NEW_OPERATOR.md)
- [Golang client](doc/IMDB_GO_CLIENT.md)
- [Compile from source code(Chinese)](doc/COMPILE.md)
D
Dong Daxiang 已提交
146

D
Dong Daxiang 已提交
147
### About Efficiency
D
Dong Daxiang 已提交
148
- [How profile serving efficiency?(Chinese)](https://github.com/PaddlePaddle/Serving/tree/develop/python/examples/util)
D
Dong Daxiang 已提交
149

D
Dong Daxiang 已提交
150
### FAQ
D
Dong Daxiang 已提交
151
- [FAQ(Chinese)](doc/FAQ.md)
D
Dong Daxiang 已提交
152

D
Dong Daxiang 已提交
153
### Design
D
Dong Daxiang 已提交
154
- [Design Doc(Chinese)](doc/DESIGN.md)
D
Dong Daxiang 已提交
155

D
Dong Daxiang 已提交
156 157 158
<h2 align="center">Community</h2>

### Slack
D
Dong Daxiang 已提交
159

D
Dong Daxiang 已提交
160 161
To connect with other users and contributors, welcome to join our [Slack channel](https://paddleserving.slack.com/archives/CUBPKHKMJ)

D
Dong Daxiang 已提交
162
### Contribution
D
Dong Daxiang 已提交
163

D
Dong Daxiang 已提交
164
If you want to contribute code to Paddle Serving, please reference [Contribution Guidelines](doc/CONTRIBUTE.md)
D
Dong Daxiang 已提交
165 166

### Feedback
D
Dong Daxiang 已提交
167

D
Dong Daxiang 已提交
168 169
For any feedback or to report a bug, please propose a [GitHub Issue](https://github.com/PaddlePaddle/Serving/issues).

D
Dong Daxiang 已提交
170 171
### License

D
Dong Daxiang 已提交
172
[Apache 2.0 License](https://github.com/PaddlePaddle/Serving/blob/develop/LICENSE)