Hi, thanks for reaching out. Here's the workflow for deploying a model:
- Register the model
- Prepare an entry script
- Prepare an inference configuration
- Deploy the model locally to ensure everything works
- Choose a compute target
- Re-deploy the model to the cloud
- Test the resulting web service
You can perform the above steps through AML notebooks. However, you entry script and deployment configuration need to be in separate files. After deployment, you obtain an endpoint for calling the webservice. Model with extension .h5 is supported.
You can create new or reference an existing environment in your config, here's information on how to create/use software environments. Also, here's another example (Deploy the model in ACI section) of how to create a scoring script. Please review the following document for details on how to save and load Keras models.
%%writefile score.py
import json
import numpy as np
import os
import tensorflow as tf
from azureml.core.model import Model
def init():
global tf_model
model_root = os.getenv('AZUREML_MODEL_DIR')
# the name of the folder in which to look for tensorflow model files
tf_model_folder = 'model'
tf_model = tf.saved_model.load(os.path.join(model_root, tf_model_folder))
def run(raw_data):
data = np.array(json.loads(raw_data)['data'], dtype=np.float32)
# make prediction
out = tf_model(data)
y_hat = np.argmax(out, axis=1)
return y_hat.tolist()