简体   繁体   English

问题:使用 Azure 机器学习服务部署模型

[英]Issue: Deploying a Model using Azure Machine Learning Service

I created a classifier model using Azure Machine Learning service, after successfully registering a model i built the correct environment for container instance providing scoring file, environment file and configuration file Unfortunately when I am deploying my solution it's giving me the error, however here is my deployment service logs to get more details:我使用 Azure 机器学习服务创建了一个分类器模型,在成功注册模型后,我为容器实例构建了正确的环境,提供评分文件、环境文件和配置文件不幸的是,当我部署我的解决方案时,它给了我错误,但这是我的部署服务日志以获取更多详细信息:

service Logs服务日志

2020-02-07T06:21:10,612616835+00:00 - rsyslog/run 
2020-02-07T06:21:10,616528746+00:00 - iot-server/run 
2020-02-07T06:21:10,617958751+00:00 - gunicorn/run 
2020-02-07T06:21:10,627065178+00:00 - nginx/run 
EdgeHubConnectionString and IOTEDGE_IOTHUBHOSTNAME are not set. Exiting...
2020-02-07T06:21:11,108893523+00:00 - iot-server/finish 1 0
2020-02-07T06:21:11,116794547+00:00 - Exit code 1 is normal. Not restarting iot-server.
Starting gunicorn 19.9.0
Listening at: http://127.0.0.1:31311 (12)
Using worker: sync
worker timeout is set to 300
Booting worker with pid: 45
Initializing logger
Starting up app insights client
Starting up request id generator
Starting up app insight hooks
Invoking user's init function
2020-02-07 06:21:15,494 | azureml.core.run | DEBUG | Could not load run context RunEnvironmentException:
    Message: Could not load a submitted run, if outside of an execution context, use experiment.start_logging to initialize an azureml.core.Run.
    InnerException None
    ErrorResponse 
{
    "error": {
        "message": "Could not load a submitted run, if outside of an execution context, use experiment.start_logging to initialize an azureml.core.Run."
    }
}, switching offline: False
2020-02-07 06:21:15,495 | azureml.core.run | DEBUG | Could not load the run context and allow_offline set to False
2020-02-07 06:21:15,495 | azureml.core.model | DEBUG | Checking root for demo_Model.pkl because candidate dir azureml-models had 1 nodes: azureml-models/demomodel/8/demo_Model.pkl
User's init function failed
Encountered Exception Traceback (most recent call last):
  File "/var/azureml-server/aml_blueprint.py", line 163, in register
    main.init()
  File "/var/azureml-app/main.py", line 88, in init
    driver_module.init()
  File "score.py", line 13, in init
    model_path = Model.get_model_path('demo_Model.pkl')
  File "/opt/miniconda/lib/python3.6/site-packages/azureml/core/model.py", line 697, in get_model_path
    return Model._get_model_path_local(model_name, version)
  File "/opt/miniconda/lib/python3.6/site-packages/azureml/core/model.py", line 718, in _get_model_path_local
    return Model._get_model_path_local_from_root(model_name)
  File "/opt/miniconda/lib/python3.6/site-packages/azureml/core/model.py", line 761, in _get_model_path_local_from_root
    "set logging level to DEBUG.".format(candidate_model_path))
azureml.exceptions._azureml_exception.ModelNotFoundException: ModelNotFoundException:
    Message: Model not found in cache or in root at ./demo_Model.pkl. For more info,set logging level to DEBUG.
    InnerException None
    ErrorResponse 
{
    "error": {
        "message": "Model not found in cache or in root at ./demo_Model.pkl. For more info,set logging level to DEBUG."
    }
}

/opt/miniconda/lib/python3.6/site-packages/sklearn/externals/joblib/__init__.py:15: FutureWarning: sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib. If this warning is raised when loading pickled models, you may need to re-serialize those models with scikit-learn 0.21+.
  warnings.warn(msg, category=FutureWarning)
Worker exiting (pid: 45)
Shutting down: Master
Reason: Worker failed to boot.
2020-02-07T06:21:15,663509630+00:00 - gunicorn/finish 3 0
2020-02-07T06:21:15,664398433+00:00 - Exit code 3 is not normal. Killing image.

Error Running..............................................................................................................................................................................................................................................运行出错................................................ ………………………………………………………………………………………………………………………………………………………… ………………………………………………………………………………………………………………………………………………………… ………………………………………………………………………………………………………………………………………………………… ………………………………………………………………………………………………………………………………………………

TimedOut

ERROR - Service deployment polling reached non-successful terminal state, current service state: Unhealthy
More information can be found using '.get_logs()'
Error:
{
  "code": "DeploymentTimedOut",
  "statusCode": 504,
  "message": "The deployment operation polling has TimedOut. The service creation is taking longer than our normal time. We are still trying to achieve the desired state for the web service. Please check the webservice state for the current webservice health. From SDK you can run print(service.state) to know the current state of the webservice."
}

ERROR - Service deployment polling reached non-successful terminal state, current service state: Unhealthy
More information can be found using '.get_logs()'
Error:
{
  "code": "DeploymentTimedOut",
  "statusCode": 504,
  "message": "The deployment operation polling has TimedOut. The service creation is taking longer than our normal time. We are still trying to achieve the desired state for the web service. Please check the webservice state for the current webservice health. From SDK you can run print(service.state) to know the current state of the webservice."
}

---------------------------------------------------------------------------
WebserviceException                       Traceback (most recent call last)
~/anaconda3_501/lib/python3.6/site-packages/azureml/core/webservice/webservice.py in wait_for_deployment(self, show_output)
    530                                           'Error:\n'
--> 531                                           '{}'.format(self.state, logs_response, error_response), logger=module_logger)
    532             print('{} service creation operation finished, operation "{}"'.format(self._webservice_type,

WebserviceException: WebserviceException:
    Message: Service deployment polling reached non-successful terminal state, current service state: Unhealthy
More information can be found using '.get_logs()'
Error:
{
  "code": "DeploymentTimedOut",
  "statusCode": 504,
  "message": "The deployment operation polling has TimedOut. The service creation is taking longer than our normal time. We are still trying to achieve the desired state for the web service. Please check the webservice state for the current webservice health. From SDK you can run print(service.state) to know the current state of the webservice."
}
    InnerException None
    ErrorResponse 
{
    "error": {
        "message": "Service deployment polling reached non-successful terminal state, current service state: Unhealthy\nMore information can be found using '.get_logs()'\nError:\n{\n  \"code\": \"DeploymentTimedOut\",\n  \"statusCode\": 504,\n  \"message\": \"The deployment operation polling has TimedOut. The service creation is taking longer than our normal time. We are still trying to achieve the desired state for the web service. Please check the webservice state for the current webservice health. From SDK you can run print(service.state) to know the current state of the webservice.\"\n}"
    }
}

During handling of the above exception, another exception occurred:

WebserviceException                       Traceback (most recent call last)
<timed exec> in <module>

~/anaconda3_501/lib/python3.6/site-packages/azureml/core/webservice/webservice.py in wait_for_deployment(self, show_output)
    538                                           'Current state is {}'.format(self.state), logger=module_logger)
    539             else:
--> 540                 raise WebserviceException(e.message, logger=module_logger)
    541 
    542     def _wait_for_operation_to_complete(self, show_output):

WebserviceException: WebserviceException:
    Message: Service deployment polling reached non-successful terminal state, current service state: Unhealthy
More information can be found using '.get_logs()'
Error:
{
  "code": "DeploymentTimedOut",
  "statusCode": 504,
  "message": "The deployment operation polling has TimedOut. The service creation is taking longer than our normal time. We are still trying to achieve the desired state for the web service. Please check the webservice state for the current webservice health. From SDK you can run print(service.state) to know the current state of the webservice."
}
    InnerException None
    ErrorResponse 
{
    "error": {
        "message": "Service deployment polling reached non-successful terminal state, current service state: Unhealthy\nMore information can be found using '.get_logs()'\nError:\n{\n  \"code\": \"DeploymentTimedOut\",\n  \"statusCode\": 504,\n  \"message\": \"The deployment operation polling has TimedOut. The service creation is taking longer than our normal time. We are still trying to achieve the desired state for the web service. Please check the webservice state for the current webservice health. From SDK you can run print(service.state) to know the current state of the webservice.\"\n}"
    }
}

That's how my webservice code look like:这就是我的网络服务代码的样子:

%%time
from azureml.core.webservice import Webservice
from azureml.core.model import Model
from azureml.core.model import InferenceConfig
from azureml.core.environment import Environment

myenv = Environment.from_conda_specification(name="myenv", file_path="myenv.yml")
inference_config = InferenceConfig(entry_script="score.py", environment=myenv)

service = Model.deploy(workspace=ws,
                       name='myimage',
                       models=[model], 
                       inference_config=inference_config,
                       deployment_config=aciconfig)

service.wait_for_deployment(show_output=True)

can anyone tell me what it actually means?谁能告诉我它到底是什么意思? How can i solve this?我该如何解决这个问题?

Thanks谢谢

Ahmad艾哈迈德

Updating the version of scikit-learn solved it in my environment.更新 scikit-learn 的版本在我的环境中解决了它。

Specify the version into myenv.yml as follows.将版本指定到myenv.yml ,如下所示。 (In my environment, 0.20.3 is initially installed, and solved by updating to 0.22.1) (在我的环境中,最初安装的是0.20.3,通过更新到0.22.1来解决)

name: project_environment
dependencies:
  # The python interpreter version.
  # Currently Azure ML only supports 3.5.2 and later.
- python=3.6.2

- pip:
  - azureml-defaults
- scikit-learn=0.22.1
channels:
- conda-forge

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Azure机器学习服务注册和下载fastText .bin模型失败 - Registering and downloading a fastText .bin model fails with Azure Machine Learning Service 使用 python 从 Azure 机器学习服务中删除并列出所有模型和部署服务 - Delete and list out the all models and deployment service from Azure Machine Learning Service using python 如何调用部署在 Azure 机器学习服务中的 Web 服务? - Ho do I call a webservice deployed in Azure Machine Learning Service? 如何将机器学习模型 pickle 存储到 azure blob 并检索它/ - How to store the machine learning model pickle to azure blob and retrieve it/ 将我的Python机器学习模型部署为Web服务 - To Deploy my Python machine learning model as web service 使用 Python 中的 Google Drive 链接阅读机器学习 Model - Read Machine Learning Model using a Google Drive Link in Python Azure 机器学习与 Python 的过拟合/欠拟合机器学习模型 - Overfitting/Underfitting Machine Learning Models with Azure Machine Learning vs Python Azure 机器学习服务中的数据源 - Data sources in Azure Machine Learning Services "为什么 SparseCategoricalCrossentropy 不适用于此机器学习模型?" - Why SparseCategoricalCrossentropy is not working with this machine learning model? 如何将机器学习 model 序列化为 JSON 文件 - How to serialize a machine learning model into a JSON file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM