Azure Web 服务部署如何在本地工作?
How does Azure web service deployment work locally?
Azure ML 提供用于数据集管理和模型部署的客户端库(例如 Python 的 azureml)。据我了解,自定义算法将被序列化为 Pickle 文件,但我不确定之后会发生什么。如果我有一个具有深度神经网络架构的自定义模型,并设置了一个用于训练的 Web 服务和另一个用于评分的 Web 服务,我还需要为 Web 服务开发模型的机器 运行 吗?我在 azureml 文档中发现了这个很有帮助:
If a function has no source file associated with it (for example, you're developing inside of a REPL environment) then the functions byte code is serialized. If the function refers to any global variables those will also be serialized using Pickle. In this mode all of the state which you're referring to needs to be already defined (e.g. your published function should come after any other functions you are calling).
If a function is saved on disk then the entire module the function is defined in will be serialized and re-executed on the server to get the function back. In this mode the entire contents of the file is serialized and the order of the function definitions don't matter.
如果函数使用像 TensorFlow 或 Keras 这样的库怎么办?有人可以解释创建 Pickle 模型后会发生什么吗?
谢谢!
您需要获取 model.pkl 文件,将其压缩,然后将其作为新数据集上传到 Azure 机器学习工作室。然后添加 python 模块并将其连接到新生成的 zip。
您现在可以在 AML Studio 实验中使用它。要使用该模型,请在您的 python 模块中添加以下代码:
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]]),
Azure ML 提供用于数据集管理和模型部署的客户端库(例如 Python 的 azureml)。据我了解,自定义算法将被序列化为 Pickle 文件,但我不确定之后会发生什么。如果我有一个具有深度神经网络架构的自定义模型,并设置了一个用于训练的 Web 服务和另一个用于评分的 Web 服务,我还需要为 Web 服务开发模型的机器 运行 吗?我在 azureml 文档中发现了这个很有帮助:
If a function has no source file associated with it (for example, you're developing inside of a REPL environment) then the functions byte code is serialized. If the function refers to any global variables those will also be serialized using Pickle. In this mode all of the state which you're referring to needs to be already defined (e.g. your published function should come after any other functions you are calling).
If a function is saved on disk then the entire module the function is defined in will be serialized and re-executed on the server to get the function back. In this mode the entire contents of the file is serialized and the order of the function definitions don't matter.
如果函数使用像 TensorFlow 或 Keras 这样的库怎么办?有人可以解释创建 Pickle 模型后会发生什么吗?
谢谢!
您需要获取 model.pkl 文件,将其压缩,然后将其作为新数据集上传到 Azure 机器学习工作室。然后添加 python 模块并将其连接到新生成的 zip。
您现在可以在 AML Studio 实验中使用它。要使用该模型,请在您的 python 模块中添加以下代码:
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]]),