AzureML data_collector不是ManagedOnlineDeployment类的已知属性,将被忽略

woobm2wo  于 2023-03-31  发布在  其他
关注(0)|答案(1)|浏览(97)
online_endpoint_name = "p2b-sample-endpoint"

# create an online endpoint
endpoint = ManagedOnlineEndpoint(
    name=online_endpoint_name,
    description="this is a sample online endpoint",
    auth_mode="key",
    tags={"foo": "bar"},
)
ml_client.online_endpoints.begin_create_or_update(endpoint)
blue_deployment = ManagedOnlineDeployment(
    name="blue",
    endpoint_name=online_endpoint_name,
    model=model,
    environment=env,
    code_configuration=CodeConfiguration(
        code="./", scoring_script="score.py"
    ),
    instance_type="Standard_DS2_v2",
    instance_count=1,
)
ml_client.online_deployments.begin_create_or_update(blue_deployment)

发出警告
data_collector不是类的已知属性,将被忽略
PS:实际上部署失败并抛出了一个不同的错误,但我猜这个警告是否导致了主要错误

3htmauhk

3htmauhk1#

我在自己的环境中尝试,得到了以下结果:

AzureML data_collector不是ManagedOnlineDeployment类的已知属性,将被忽略
上面的声明是一个警告,它不是一个错误。
我遵循这个MS-document通过python sdk创建了一个在线端点和部署。

代码:

from azure.ai.ml import MLClient
from azure.ai.ml.entities import (
    ManagedOnlineEndpoint,
    ManagedOnlineDeployment,
    Model,
    CodeConfiguration,
    Environment,
)
from azure.identity import DefaultAzureCredential

subscription_id = "your-subscription-id"
resource_group = "yourresourcegrp"
workspace_name = "Testendpoint326"

credential = DefaultAzureCredential()
ml_client = MLClient(
    credential,
    subscription_id=subscription_id,
    resource_group_name=resource_group,
    workspace_name=workspace_name,
)
online_endpoint_name = "demo-endpoints326"

#create an online endpoint
endpoint = ManagedOnlineEndpoint(
    name=online_endpoint_name,
    description="this is a sample online endpoint",
    auth_mode="key",
    tags={"foo": "bar"},
)
ml_client.online_endpoints.begin_create_or_update(endpoint)

model = Model(...endpoints\\online\\model-1\\model\\sklearn_regression_model.pkl")
env = Environment(
    conda_file="...endpoints\\online\\model-1\\environment\\conda.yml",
    image="mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.04:latest",
)

blue_deployment = ManagedOnlineDeployment(
    name="blue",
    endpoint_name=online_endpoint_name,
    model=model,
    environment=env,
    code_configuration=CodeConfiguration(
        code="...endpoints\\online\\model-1\\onlinescoring", scoring_script="score.py"
    ),
    instance_type="Standard_DS2_v2",
    instance_count=1,
)

ml_client.online_deployments.begin_create_or_update(
    deployment=blue_deployment)

print("Online deployments created successfully")

上述操作已成功执行,并创建了端点和部署。

输出:

Check: endpoint demo-endpoints326 exists
Uploading onlinescoring (0.0 MBs): 100%|########################################################| 4999/4999 [00:01<00:00, 4969.10it/s] 

Uploading sklearn_regression_model.pkl (< 1 MB): 100%|###############################################| 756/756 [00:00<00:00, 2.88kB/s] 

#warning
data_collector is not a known attribute of class <class 'azure.ai.ml._restclient.v2022_02_01_preview.models._models_py3.ManagedOnlineDeployment'> and will be ignored
Online deployments created successfully

工作区:

相关问题