diff --git a/doc/RUN_IN_DOCKER.md b/doc/RUN_IN_DOCKER.md index e7b25362d113b18f6e779ccb9b92a3e3c8d13343..327176297518ff65d788e3e59b23db27f1e7178c 100644 --- a/doc/RUN_IN_DOCKER.md +++ b/doc/RUN_IN_DOCKER.md @@ -53,12 +53,6 @@ pip install paddle-serving-server -i https://pypi.tuna.tsinghua.edu.cn/simple ### Test example -Before running the GPU version of the Server side code, you need to set the `CUDA_VISIBLE_DEVICES` environment variable to specify which GPUs the prediction service uses. The following example specifies two GPUs with indexes 0 and 1: - -```bash -export CUDA_VISIBLE_DEVICES=0,1 -``` - Get the trained Boston house price prediction model by the following command: ```bash @@ -71,13 +65,13 @@ tar -xzf uci_housing.tar.gz Running on the Server side (inside the container): ```bash - python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --port 9292 --name uci &>std.log 2>err.log & + python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --port 9292 --name uci >std.log 2>err.log & ``` Running on the Client side (inside or outside the container): ```bash - 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 + curl -H "Content-Type:application/json" -X POST -d '{"feed":{"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 ``` - Test RPC service @@ -85,7 +79,7 @@ tar -xzf uci_housing.tar.gz Running on the Server side (inside the container): ```bash - python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --port 9292 &>std.log 2>err.log & + python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --port 9292 >std.log 2>err.log & ``` Running following Python code on the Client side (inside or outside the container, The `paddle-serving-client` package needs to be installed): @@ -176,7 +170,7 @@ tar -xzf uci_housing.tar.gz Running on the Client side (inside or outside the container): ```bash - 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 + curl -H "Content-Type:application/json" -X POST -d '{"feed":{"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 ``` - Test RPC service diff --git a/doc/RUN_IN_DOCKER_CN.md b/doc/RUN_IN_DOCKER_CN.md index 3e84cf08c015b7fda0d957bf621173ec18c19498..4a995f9acf611c550e866ed12502734220a2e71c 100644 --- a/doc/RUN_IN_DOCKER_CN.md +++ b/doc/RUN_IN_DOCKER_CN.md @@ -65,13 +65,13 @@ tar -xzf uci_housing.tar.gz 在Server端(容器内)运行: ```bash - python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --port 9292 --name uci &>std.log 2>err.log & + python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --port 9292 --name uci >std.log 2>err.log & ``` 在Client端(容器内或容器外)运行: ```bash - 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 + curl -H "Content-Type:application/json" -X POST -d '{"feed":{"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 ``` - 测试RPC服务 @@ -79,7 +79,7 @@ tar -xzf uci_housing.tar.gz 在Server端(容器内)运行: ```bash - python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --port 9292 &>std.log 2>err.log & + python -m paddle_serving_server.serve --model uci_housing_model --thread 10 --port 9292 >std.log 2>err.log & ``` 在Client端(容器内或容器外,需要安装`paddle-serving-client`包)运行下面Python代码: @@ -168,7 +168,7 @@ tar -xzf uci_housing.tar.gz 在Client端(容器内或容器外)运行: ```bash - 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 + curl -H "Content-Type:application/json" -X POST -d '{"feed":{"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 ``` - 测试RPC服务 diff --git a/doc/TRAIN_TO_SERVICE.md b/doc/TRAIN_TO_SERVICE.md index 40d5dd95e4d7aad3b198898559321419b4b17833..90046b03ebc4af1394fb85fb41fccf1d844f6917 100644 --- a/doc/TRAIN_TO_SERVICE.md +++ b/doc/TRAIN_TO_SERVICE.md @@ -350,12 +350,12 @@ In the above command, the first parameter is the saved server-side model and con After starting the HTTP prediction service, you can make prediction with a single command: ``` -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 +curl -H "Content-Type:application/json" -X POST -d '{"feed":[{"words": "i am very sad | 0"}], "fetch":["prediction"]}' http://127.0.0.1:9292/imdb/prediction ``` When the inference process is normal, the prediction probability is returned, as shown below. ``` -{"prediction": [0.5592559576034546,0.44074398279190063]} +{"result":{"prediction":[[0.4389057457447052,0.561094343662262]]}} ``` **Note**: The effect of each model training may be slightly different, and the inferred probability value using the trained model may not be consistent with the example. diff --git a/doc/TRAIN_TO_SERVICE_CN.md b/doc/TRAIN_TO_SERVICE_CN.md index ad2a43c30b1cd0d4701ebb3c8b3a46a4b07c1bda..1c8a2848bcc198c66e617be145c43d2651b7f885 100644 --- a/doc/TRAIN_TO_SERVICE_CN.md +++ b/doc/TRAIN_TO_SERVICE_CN.md @@ -353,12 +353,12 @@ python text_classify_service.py imdb_cnn_model/ workdir/ 9292 imdb.vocab 启动完HTTP预测服务,即可通过一行命令进行预测: ``` -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 +curl -H "Content-Type:application/json" -X POST -d '{"feed":[{"words": "i am very sad | 0"}], "fetch":["prediction"]}' http://127.0.0.1:9292/imdb/prediction ``` 预测流程正常时,会返回预测概率,示例如下。 ``` -{"prediction":[0.5592559576034546,0.44074398279190063]} +{"result":{"prediction":[[0.4389057457447052,0.561094343662262]]}} ``` **注意**:每次模型训练的效果可能略有不同,使用训练出的模型预测概率数值可能与示例不一致。