Deploying custom model on Azure ML Studio

你离开我真会死。 提交于 2021-01-28 19:55:29

问题


In Azure ML Studio, we have the option of choosing a number of inbuilt ML models like Classification, Regression, etc. , which we can drag and drop to our workflow.

My question is, can I upload a custom ML model that I have built locally on my system in Python, and add it to the workflow?


回答1:


  1. Take the model.pkl file, zip it, and upload it into Azure Machine Learning Studio. Click the “New” icon in the bottom left:
  2. In the pane that comes up, click on dataset, and then “From Local File”:
  3. Select the zip file where you stored your serialized model and click the tick. You expirement should look like this:
  4. Put the following code to run your classification experiment:
import pandas as pd
import sys
import pickle

def azureml_main(dataframe1 = None, dataframe2 = None):
    sys.path.insert(0,".\Script Bundle")
    model = pickle.load(open(".\Script Bundle\model.pkl", 'rb'))
    pred = model.predict(dataframe1)
    return pd.DataFrame([pred[0]])

Update If you want to declare this experiment as an API you need to add web input and output to the Python script module.




回答2:


You might be able to achieve this using the "Execute Python Code" module. See here for documentation: https://docs.microsoft.com/en-us/azure/machine-learning/studio-module-reference/execute-python-script

There you can upload contents in a zip bundle file. If you include your trained model there, you might be good to go.



来源:https://stackoverflow.com/questions/57488706/deploying-custom-model-on-azure-ml-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!