安装
$ sudo docker pull tensorflow/serving
Using default tag: latest
latest: Pulling from tensorflow/serving
d5×××××××××76: Pull complete
d2×××××××××9c: Pull complete
b3×××××××××0b: Pull complete
cd×××××××××73: Pull complete
79×××××××××8c: Pull complete
9d×××××××××e8: Pull complete
0f×××××××××d9: Pull complete
Digest: ×××××××××:******
Status: Downloaded newer image for tensorflow/serving:latest
$ sudo docker imag
es
REPOSITORY TAG IMAGE ID CREATED SIZE
tensorflow/serving latest 78×××××××××a4 7 weeks ago 298MB
测试:
$ curl http://localhost:8501/v1/models/xception
{
"model_version_status": [
{
"version": "1",
"state": "AVAILABLE",
"status": {
"error_code": "OK",
"error_message": ""
}
}
]
}
$ curl http://loca
lhost:8501/v1/models/xception/metadata
{
"model_spec":{
"name": "xception",
"signature_name": "",
"version": "1"
}
,
"metadata": {"signature_def": {
"signature_def": {
"serving_default": {
"inputs": {
"inputs": {
"dtype": "DT_FLOAT",
"tensor_shape": {
"dim": [
{
"size": "-1",
"name": ""
},
{
"size": "2",
"name": ""
}
],
"unknown_rank": false
},
"name": "serving_default_inputs:0"
}
},
"outputs": {
"outputs": {
"dtype": "DT_FLOAT",
"tensor_shape": {
"dim": [
{
"size": "-1",
"name": ""
},
{
"size": "1",
"name": ""
}
],
"unknown_rank": false
},
"name": "StatefulPartitionedCall:0"
}
},
"method_name": "tensorflow/serving/predict"
},
"__saved_model_init_op": {
"inputs": {},
"outputs": {
"__saved_model_init_op": {
"dtype": "DT_INVALID",
"tensor_shape": {
"dim": [],
"unknown_rank": true
},
"name": "NoOp"
}
},
"method_name": ""
}
}
}
}
}
$ curl -d '{"insta
nces": [1.0, 2.0, 5.0]}' -X POST http://localhost:8501/v1/models/xception:predict
{
"error": "In[0] is not a matrix. Instead it has shape [3]\n\t [[{{node functional_1/outputs/BiasAdd}}]]"