
如果正在寻找一种将机器学习模型部署为生产Web服务的工具,那么 “ Cortex” 可能是一个不错的选择。这个开源平台是使用AWS SageMaker服务模型或通过AWS服务(例如Elastic Container Service(ECS),Elastic Kubernetes Service(EKS)和Elastic Compute Cloud(EC2)甚至是开放式)创建自己的模型部署平台的替代方案。Docker,Kubernetes和TensorFlow等源项目。
主要特征
多种框架: Cortex支持多种框架,包括TensorFlow,PyTorch,scikit-learn,XGBoost等。
自动缩放: Cortex自动为API进行负载平衡以处理生产工作负载。
基础架构: Cortex可以在CPU或GPU基础架构上运行推理。
滚动更新: Cortex部署后无需中断即可更新API。
Cortex部署示例
https://github.com/cortexlabs/cortex/tree/0.11/examples/tensorflow/sentiment-analyzer
https://github.com/cortexlabs/cortex/tree/0.11/examples/tensorflow/image-classifier
安装
前提条件(从https://www.cortex.dev/install复制)
https://docs.docker.com/install
https://www.marktechpost.com/cluster-management/aws
# install the CLI on your machine
bash -c "$(curl -sS https://raw.githubusercontent.com/cortexlabs/cortex/0.11/get-cli.sh)"
# provision infrastructure on AWS and spin up a cluster
cortex cluster up部署模型
# clone the Cortex repository
git clone -b 0.11 https://github.com/cortexlabs/cortex.git
# navigate to the iris classifier example
cd cortex/examples/sklearn/iris-classifier
# deploy the model to the cluster
cortex deploy
# view the status of the deployment
cortex get --watch
# get the API's endpoint
cortex get classifier
# classify a sample
curl -X POST -H "Content-Type: application/json" \
-d '{ "sepal_length": 5.2, "sepal_width": 3.6, "petal_length": 1.4, "petal_width": 0.3 }' \
<API endpoint>GitHub:https://github.com/cortexlabs/cortex
网址:https://www.cortex.dev
教程:https://www.cortex.dev/iris-classifier
范例:https://github.com/cortexlabs/cortex/tree/0.11/examples