fate serving(fate推理框架安装)

只适合fate serving

1.安装Java、Redis、zookeeper、maven四个组件

  • Java版本高于1.8
  • Redis高于1.0.6
  • zookeeper高于3.4.5
  • Maven 3.6.3

2 安装fate-serving

1 serving-server的部署

采取以下的步骤

  1. 从github上克隆代码git clone https://github.com/FederatedAI/FATE-Serving.git

  2. 执行 cd FATE-Serving ,进入源码的根目录。

  3. 执行 mvn clean package命令

  4. 拷贝 serving-server/target/fate-serving-server-{version}-release.zip 到想要部署的路径下,并解压。(version为当前版本)

  5. 修改部署目录下 serving-server.properties文件,具体的配置项解释见 serving-server配置解释

  6. sh service.sh restart 启动应用(windows 脚本暂时不 支持,如有需要可自行编写)

加粗样式host serving-server.properties端配置:

#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
ip=192.168.0.1
port=8000
#serviceRoleName=serving
#inferenceWorkerThreadNum=10
# cache
#remoteModelInferenceResultCacheSwitch=true
# in-process cache
#modelCacheMaxSize=100
#remoteModelInferenceResultCacheTTL=300
#remoteModelInferenceResultCacheMaxSize=10000
#inferenceResultCacheTTL=30
#inferenceResultCacheCacheMaxSize=1000
# external cache
redis.ip=192.168.0.1
redis.port=6379
#redis.password=fate_dev
#redis.timeout=10
#redis.maxTotal=100
#redis.maxIdle=100
#external.remoteModelInferenceResultCacheTTL=86400
#external.remoteModelInferenceResultCacheDBIndex=0
#external.inferenceResultCacheTTL=300
#external.inferenceResultCacheDBIndex=0
#canCacheRetcode=0,102
#external.processCacheDBIndex=0

# adapter
OnlineDataAccessAdapter=MockAdapter
InferencePostProcessingAdapter=PassPostProcessing
InferencePreProcessingAdapter=PassPreProcessing
# external subsystem

# model transfer
model.transfer.url=http://192.168.0.1:9380/v1/model/transfer
# zk router
zk.url=zookeeper://localhost:2181?backup=localhost:2182,localhost:2183
#useRegister=false
#useZkRouter=false
# zk acl
#acl.enable=false
#acl.username=
#acl.password=

#proxy=127.0.0.1:8879

加粗样式guest serving-server.properties:

#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
ip=192.168.0.2
port=8000
#serviceRoleName=serving
#inferenceWorkerThreadNum=10
# cache
remoteModelInferenceResultCacheSwitch=false
# in-process cache
#modelCacheMaxSize=100
#remoteModelInferenceResultCacheTTL=300
#remoteModelInferenceResultCacheMaxSize=10000
#inferenceResultCacheTTL=30
#inferenceResultCacheCacheMaxSize=1000
# external cache
redis.ip=192.168.0.2
redis.port=6379
#redis.password=fate_dev
#redis.timeout=10
#redis.maxTotal=100
#redis.maxIdle=100
#external.remoteModelInferenceResultCacheTTL=86400
#external.remoteModelInferenceResultCacheDBIndex=0
#external.inferenceResultCacheTTL=300
#external.inferenceResultCacheDBIndex=0
#canCacheRetcode=0,102
#external.processCacheDBIndex=0

# adapter
OnlineDataAccessAdapter=MockAdapter
InferencePostProcessingAdapter=PassPostProcessing
InferencePreProcessingAdapter=PassPreProcessing
# external subsystem

# model transfer
model.transfer.url=http://192.168.0.2:9380/v1/model/transfer
# zk router
zk.url=zookeeper://localhost:2181?backup=localhost:2182,localhost:2183
#useRegister=false
#useZkRouter=false
# zk acl
#acl.enable=false
#acl.username=
#acl.password=

#proxy=127.0.0.1:8879

2.erving-proxy的部署

1. 从github上克隆代码git clone https://github.com/FederatedAI/FATE-Serving.git (若已执行过,则不需要再次执行)
2. 执行 cd FATE-Serving ,进入源码的根目录。
3. 执行 mvn clean package命令 (若已执行过,则不需要再次执行)
4. 拷贝 serving-proxy/target/fate-serving-proxy-{version}-release.zip 到想要部署的路径下,并解压。(version为当前版本)
5. 修改部署目录下 application.properties文件,具体的配置项解释见 [serving-proxy配置详解](https://github.com/FederatedAI/FATE-Serving/wiki/serving-proxy配置详解)
6. router_table.json文件,具体的配置项解释见 [路由表配置](https://github.com/FederatedAI/FATE-Serving/wiki/路由表)
7. sh service.sh restart 启动应用(windows 脚本暂时不 支持,如有需要可自行编写)

加粗样式guest和host application.properties

# same as partyid
coordinator=9999
server.port=8059
#inference.service.name=serving
## actuator
#management.server.port=10087
#management.endpoints.web.exposure.include=health,info,metrics

#random, consistent
#routeType=random

#route.table=/data/projects/fate-serving/serving-proxy/conf/route_table.json
#auth.file=/data/projects/fate-serving/serving-proxy/conf/auth_config.json

#useZkRouter=true
zk.url=zookeeper://localhost:2181

# zk acl
#acl.enable=false
#acl.username=
#acl.password=

# intra-partyid port
proxy.grpc.intra.port=8879
# inter-partyid port
proxy.grpc.inter.port=8869

#proxy.grpc.inference.timeout=3000
#proxy.grpc.inference.async.timeout=1000
#proxy.grpc.unaryCall.timeout=3000



#proxy.grpc.threadpool.coresize=50
#proxy.grpc.threadpool.maxsize=100
#proxy.grpc.threadpool.queuesize=10

#proxy.async.timeout=5000
#proxy.async.coresize=10
#proxy.async.maxsize=100

加粗样式host route_table.json:

{
  "route_table": {
    "9999": {
      "default": [
        {
          "ip": "192.168.0.2",
          "port": 8869
        }
      ]
    },
    "10000": {
      "default": [
        {
          "ip": "192.168.0.1",
          "port": 8059
        }
      ],
      "serving": [
        {
          "ip": "192.168.0.1",
          "port": 8000
        }
      ]
    }
  },
  "permission": {
    "default_allow": true
  }
}

加粗样式guest route_table.json

{
  "route_table": {
    "10000": {
      "default": [
        {
          "ip": "192.168.0.1",
          "port": 8869
        }
      ]
    },
    "9999": {
      "default": [
        {
          "ip": "192.168.0.2",
          "port": 8059
        }
      ],
      "serving": [
        {
          "ip": "192.168.0.2",
          "port": 8000
        }
      ]
    }
  },
  "permission": {
    "default_allow": true
  }
}
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Docker中安装Serving,您可以按照以下步骤进行操作: 1. 首先,确保已经装了Docker,并且已拉取了所需镜像。您可以使用以下命令拉取Serving的镜像: ``` docker pull tensorflow/serving ``` 2. 接下来,您需要创建一个运行Serving的Docker容器。您可以使用以下命令创建并启动一个容器: ``` docker run -p 8501:8501 --name=serving_container --mount type=bind,source=/path/to/model/directory,target=/models/model -e MODEL_NAME=model -t tensorflow/serving ``` 在上述命令中,您需要将`/path/to/model/directory`替换为存放模型的实际目录,将`model`替换为您希望为模型指定的名称。此命令将创建一个名为`serving_container`的容器,并将端口8501映射到主机上的8501端口。 3. 容器创建并启动后,您可以使用Serving的REST API或gRPC接口来请求和管理模型。您可以使用以下命令测试Serving是否正常运行: ``` curl -d '{"instances": [{"key": "1", "value": [1.0, 2.0, 3.0]}}' -H "Content-Type: application/json" -X POST http://localhost:8501/v1/models/model:predict ``` 此命令将向Serving的REST API发送一个预测请求,并返回预测结果。 请注意,上述步骤仅提供了一种示例方法来安装和运行Serving。根据您的需求和环境,可能需要进行适当的调整和配置。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [docker部署tf-serving](https://blog.csdn.net/SPESEG/article/details/125183150)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [docker安装redis Docker安装redis docker安装Redis 详细教程](https://blog.csdn.net/qq_40739917/article/details/130897572)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值