简体   繁体   中英

Azure Machine learning fails when trying to deploy model

I'm currently trying to deploy a model on azure and expose it's endpoint to my application but I kept running into errors

DEPLOYMENT CODE

model = run.register_model(model_name='pytorch-modeloldage', model_path="outputs/model") print("Starting.........")

inference_config = InferenceConfig(runtime= "python", 
                                   entry_script="pytorchscore.py",
                                   conda_file="myenv.yml")

aciconfig = AciWebservice.deploy_configuration(cpu_cores=1,auth_enabled=True,
                                               memory_gb=1, 
                                               tags={'name':'oldageml', 'framework': 'pytorch'},
                                               description='oldageml training')

service = Model.deploy(workspace=ws, 
                           name='pytorch-olageml-run', 
                           models=[model], 
                           inference_config=inference_config,
                           overwrite=True,
                           deployment_config=aciconfig)

service.wait_for_deployment(True)
# print(service.get_logs()) print("bruh did you run", service.scoring_uri) print(service.state)

ERROR

ERROR - Service deployment polling reached non-successful terminal state, current service state: Transitioning
More information can be found here: 
Error:
{
  "code": "EnvironmentBuildFailed",
  "statusCode": 400,
  "message": "Failed Building the Environment."
}

I had this error, too, and I was convinced it was working a few days ago! Anyway, I realised that I was using python 3.5 in my environment definition. I changed that to 3.6 and it works! I notice that there was a new release of azureml-code on 9 Dec 2019.

This is my code for changing the environment; I add the environment for a variable rather than a file as you do, so that's a bit different.

myenv=Environment(name="env-keras")
conda_packages = ['numpy']
pip_packages = ['tensorflow==2.0.0', 'keras==2.3.1', 'azureml-sdk','azureml-defaults']
mycondaenv = CondaDependencies.create(conda_packages=conda_packages, pip_packages=pip_packages, python_version='3.6.2')
myenv.python.conda_dependencies=mycondaenv
myenv.register(workspace=ws)

inference_config = InferenceConfig(entry_script='score.py',source_directory='.',environment=myenv)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM