BentoML使用流程
BentoML 基本流程: train.py训练模型 使用bentoml保存模型 构建service.py,创建相应的服务 创建bentofile.yaml文件 使用命令行bentoml build 构建Bento 将构建好的Bento推送到Yatai上部署 / 在本地使用命令启动服务 发送预测请求 一、使用BentoML保存模型 如果想要开始使用BentoML服务,首先需要将训练的模型使用BentoML的API在本地进行保存。 bentoml.(framename).save_model(modelname, model) framename取决于你构建机器学习模型时使用的框架。 modelname为模型保存后的名字,并且会自动生成一个版本字段,用于检索模型。 model为你所构建的模型的变量名 假如我此前已经定义了两个变量: mnist_clf = 'tensorflow_mnist' mnist_model = tf.keras.models.load_model('models/mnist_model.h5') 那么有以下保存模型的例子: bentoml.tensorflow.save_model(mnist_clf, mnist_model) e.g. 基于sklearn实现的iris数据集模型: import bentoml from sklearn import svm from sklearn import datasets # Load training data set iris = datasets.load_iris() X, y = iris.data, iris.target # Train the model clf = svm.SVC(gamma='scale') clf.fit(X, y) # Save model to the BentoML local model store saved_model = bentoml....