简体   繁体   English

如何在 Vertex AI 管道中获取 model id?

[英]How do I get a model id in a a Vertex AI pipeline?

Part of my pipeline:我的管道的一部分:

    training_op = gcc_aip.AutoMLTabularTrainingJobRunOp(
        project=project,
        display_name=display_name,
        optimization_prediction_type="classification",
        budget_milli_node_hours=1000,
        column_transformations=[ ... ],
        dataset=dataset_create_op.outputs["dataset"],
        target_column="Class",
    )
    model_to_evaluate= training_op.outputs["model"]

    model_id=model_to_evaluate.name

This works except model_id is set to 'model'.除了model_id设置为“model”外,此方法有效。 I want the underlying model id ie the bit at the end of a model's resource name:我想要底层 model id,即模型资源名称末尾的位:

model_resource_name= f'projects/{PROJECT}/locations/{LOCATION}/models/{model_id}'

What you're looking for is available in the metadata of the model artifact, with key name resourceName .您要查找的内容在 model 工件的metadata中可用,键名为resourceName Try model_to_evaluate.metadata['resourceName'] .尝试model_to_evaluate.metadata['resourceName']

You can also parse model_to_evalue.uri to get the model id.您还可以解析model_to_evalue.uri以获取 model id。 The URI is in format https://{LOCATION}-aiplatform.googleapis.com/v1/projects/{PROJECT}/locations/{LOCATION}/models/{model_id} URI 的格式为https://{LOCATION}-aiplatform.googleapis.com/v1/projects/{PROJECT}/locations/{LOCATION}/models/{model_id}

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

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