用泡菜装载用天蓝色automl训练的模型

问题描述

我有一个注册的数据集(基于泰坦尼克号),并且用azure automl训练了一个模型:

from azureml.train.automl import AutoMLConfig

automl_config = AutoMLConfig(name='Automated ML Experiment on titanic dataset',task='classification',compute_target=compute_target,enable_local_managed=True,training_data = train_ds,validation_data = test_ds,label_column_name='Survived',iterations=6,primary_metric = 'AUC_weighted',max_concurrent_iterations=4,featurization='auto'
                             )

print("Ready for Auto ML run.")

from azureml.core.experiment import Experiment
from azureml.widgets import RunDetails

print('Submitting Auto ML experiment...')
automl_experiment = Experiment(ws,'titanic_automl')
automl_run = automl_experiment.submit(automl_config)
RunDetails(automl_run).show()
automl_run.wait_for_completion(show_output=True)

best_run,fitted_model = automl_run.get_output()

from azureml.core import Model

# Register model
best_run.register_model(model_path='outputs/model.pkl',model_name='titanic_model_automl',tags={'Training context':'Auto ML'},properties={'AUC': best_run_metrics['AUC_weighted'],'Accuracy': best_run_metrics['accuracy']})

然后我想通过使用以下命令在另一个笔记本中加载该模型:

import pickle

filename = 'model/azure-automl.pkl'
model = pickle.load(open(filename,'rb'))

但是我无法确定它可以在本地还是在Azure计算实例上工作。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)