I am new to Azure ML and trying to deploy my model into Azure. My trained model is of classification in which text data is being first processed, then encoded using BERT model and then trained using catBoost. I have already registered my model; however, I am bit confused with the scoring.py script. This is what I using, but not working:
import json
import joblib
import numpy as np
import os
# Called when the service is loaded
def init():
global model
# Get the path to the registered model file and load it
model_path = os.path.join(os.getenv('AZUREML_MODEL_DIR'), 'nlp_cla.pkl')
model = joblib.load(model_path)
# Called when a request is received
def run(raw_data):
# Get the input data as a numpy array
data = np.array(json.loads(raw_data)['data'])
# Get a prediction from the model
predictions = model.predict(data)
# Return the predictions as any JSON serializable format
return predictions.tolist()
How I configure my this script so I could deploy on azure?
You can start debugging from the visual studio code as shown here and deployment sample with score.py.