Export your trained model to the ONNX model format. Here is an example of an sklearn model being exported to ONNX:
from sklearn.linear_model import LogisticRegressionfrom onnxmltools import convert_sklearnfrom onnxconverter_common.data_types import FloatTensorType​...​logreg_model = LogisticRegression(solver="lbfgs", multi_class="multinomial")logreg_model.fit(X_train, y_train)​# Convert to ONNX model formatonnx_model = convert_sklearn(logreg_model, initial_types=[("input", FloatTensorType([1, 4]))])with open("sklearn.onnx", "wb") as f:f.write(onnx_model.SerializeToString())
Upload your exported model to Amazon S3 using the AWS web console or CLI:
aws s3 cp model.onnx s3://my-bucket/model.onnx
Reference your model in an api:
- kind: apiname: my-apionnx:model: s3://my-bucket/model.onnx