1

新しい ML サービス SDK を使用して、Azure Container Instance の Web サービスにイメージをデプロイしようとしています。このWebservice.deploy_from_imageメソッドは、次のメッセージで失敗しています。

> Traceback (most recent call last):   File
> "c:/Users/chrcam/git/amlIrisClassification/deploy_iris_to_aci.py",
> line 18, in <module>
>     workspace = ws)   File "C:\Users\chrcam\AppData\Local\Programs\Python\Python36\lib\site-packages\azureml\core\webservice\webservice.py",
> line 258, in deploy_from_image
>     return deployment_config._webservice_type._deploy(workspace, name, image, deployment_config)   File
> "C:\Users\chrcam\AppData\Local\Programs\Python\Python36\lib\site-packages\azureml\core\webservice\aci.py",
> line 121, in _deploy
>     deployment_config.validate_image(image)   File "C:\Users\chrcam\AppData\Local\Programs\Python\Python36\lib\site-packages\azureml\core\webservice\webservice.py",
> line 883, in validate_image
>     if image.creation_state != 'Succeeded': AttributeError: 'str' object has no attribute 'creation_state'

SDK の 1.68 リリースから始めて、1.80 にアップグレードしたところ、同じ結果になりました。

モデルと画像は両方とも my ワークスペースに登録されています。

コードはかなり単純です。フィードバックや指示は役に立ちます。

from azureml.core import Workspace
from azureml.core.webservice import Webservice
from azureml.core.webservice import AciWebservice

ws = Workspace.from_config()

image_name = 'irisimage'
service_name = 'aciiris'

aciconfig = AciWebservice.deploy_configuration(cpu_cores = 1, 
                                               memory_gb = 1, 
                                               tags = {"data": "iris", "type": "classification"},
                                               description = 'Iris Classification')

service = Webservice.deploy_from_image(deployment_config = aciconfig,
                                            image = image_name,
                                            name = service_name,
                                            workspace = ws)

service.wait_for_deployment(show_output = True)
print(service.state)
4

2 に答える 2

5

私はそれを考え出した。多分これは他の誰かを助けるでしょう。deploy_from_image メソッドには、パラメーターとしてイメージ名ではなく、Image オブジェクトが必要です。エラー メッセージは誤解を招きやすく、SDK にバグがあるのではないかと考えていました。

更新されたコードは次のとおりです。

from azureml.core import Workspace
from azureml.core import Image
from azureml.core.webservice import Webservice
from azureml.core.webservice import AciWebservice

ws = Workspace.from_config()

image_name = 'irisimage'
service_name = 'aciiris'

image = Image(name=image_name, workspace=ws)

aciconfig = AciWebservice.deploy_configuration(cpu_cores = 1, 
                                               memory_gb = 1, 
                                               tags = {"data": "iris", "type": "classification"},
                                               description = 'Iris Classification')

service = Webservice.deploy_from_image(deployment_config = aciconfig,
                                            image = image,
                                            name = service_name,
                                            workspace = ws)

service.wait_for_deployment(show_output = True)
print(service.state)
于 2018-11-29T22:25:13.413 に答える