I am following the procedure as described here.
I am trying to register models and deploy them in Azure machine learning. I have the following script:
import pandas as pd
import sklearn
from sklearn.svm import SVC
import pickle
import joblib
from sklearn.model_selection import train_test_split
dataset = pd.read_csv("https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data", header = None, names= colnames )
dataset = dataset.replace({"class": {"Iris-setosa":1,"Iris-versicolor":2, "Iris-virginica":3}})
X = dataset.drop(['class'], axis=1)[:,0]
y = dataset['class']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.25, random_state = 0)
classifier = SVC(kernel = 'linear', random_state = 0)
#Fit the model on training data
classifier.fit(X_train, y_train)
#Make the prediction
y_pred = classifier.predict(X_test)
## Save as a pickle file
filename= 'final_mod_v1.pkl'
joblib.dump(classifier,open(filename, 'wb'))
In the models tab I registered the model. Then I tried to deploy the model as web service. The following is the scoring script file.
import json
import numpy as np
import os
import pickle
import joblib
from sklearn.svm import SVC
from azureml.core import Model
def init():
global model
model_name = 'classifier'
path = Model.get_model_path(model_name)
model = joblib.load(path)
def run(data):
try:
data = json.loads(data)
result = model.predict(data['data'])
return {'data' : result.tolist() , 'message' : "Successfully classified Iris"}
except Exception as e:
error = str(e)
return {'data' : error , 'message' : 'Failed to classify iris'}
The following is the conda_dependencies.yml:
channels:
- anaconda
- conda-forge
dependencies:
- python=3.6.2
- pip:
- pandas==1.1.5
- azureml-defaults
- joblib==0.17.0
- scikit-learn==0.23.2
name: azureml_2d0fd20031db3baaed8684d5f08fe619
I am confused about the last line in the above script azureml_2d0fd20031db3baaed8684d5f08fe619
name: azureml_2d0fd20031db3baaed8684d5f08fe619
The deployment is failing. Deployment log shows:
container "classifier" in pod "wk-caas-9a4c565844b043cfa9d8ba246af11ff5-517e6d8f74175a01ffc43147e5dd8133-pod" is waiting to start: PodInitializing
It would be helpful if I can get a guidance on this.