首页 文章

如何在Azure ML群集webservice上安装xgboost?

提问于
浏览
0

我正在使用新的Azure ML Workbench和一组模型管理服务来执行常规的Python(而不是Pyspark)项目 . 我有一个conda_dependencies.yml文件,如下所示:

name: project_environment
channels: 
  - conda-forge
dependencies:
  # The python interpreter version.
  # Currently Azure ML Workbench only supports 3.5.2.
  - python=3.5.2
  - scikit-learn  
  - xgboost

我们部署到我的Azure群集似乎永远不会安装xgboost,因此在部署Web服务时我总是会收到此错误

File "/var/azureml-app/score.py", line 31, in init
    import xgboost
ImportError: No module named 'xgboost'

在它调用我的score.py来加载我保存的xgboost模型 . 有人可以向我解释如何为此安装xgboost吗?无论我是逐步创建环境还是通过单个命令创建环境,如下例所示:https://docs.microsoft.com/en-us/azure/machine-learning/preview/tutorial-classifying-iris-part-3

这是导致错误的命令(集群已经配置和设置):

az ml manifest create --manifest-name oapmodelv1manifest -f score.py -r python -i <modelid> -s schema.json
az ml image create -n oapv1image --manifest-id <manifestid> -c aml_config\conda_dependencies.yml
az ml service create realtime --image-id <imageid> -n oapmlapp --collect-model-data true --debug

2 回答

  • 0

    将以下内容添加到conda_dependencies.yml(适用于我):

    channels: 
      - conda-forge
    dependencies:
      - python=3.5.2
      - scikit-learn
      - py-xgboost
    
  • 1

    我正在看这个,看到了this code,所以我想知道你是否将 pip 放在 pip 部分下工作,如下所示:

    dependencies:
      - python=3.5.2
      - scikit-learn
      - pip:
        - notebook
        - xgboost
    

相关问题