首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >模型不支持Google顶点AI - 400 'dedicated_resources‘

模型不支持Google顶点AI - 400 'dedicated_resources‘
EN

Stack Overflow用户
提问于 2021-10-14 20:57:29
回答 1查看 670关注 0票数 0

我试图使用Python在Google平台上部署一个与顶点AI一起训练的文本分类模型。

代码语言:javascript
复制
from google.cloud import aiplatform

import os

os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "<key location>"

def create_endpoint(
    project_id: str,
    display_name: str,
    location: str,
    sync: bool = True,
):
    endpoint = aiplatform.Endpoint.create(
        display_name=display_name, project=project_id, location=location,
    )

    print(endpoint.display_name)
    print(endpoint.resource_name)
    return endpoint

def deploy_model(project_id, location, model_id):
    model_location = "projects/{}/locations/{}/models/{}".format(project_id, location, model_id)

    print("Initializing Vertex AI")
    aiplatform.init(project=project_id, location=location)

    print("Getting model from {}".format(model_location))
    model = aiplatform.Model(model_location)

    print("Creating endpoint.")
    endpoint = create_endpoint(project_id, "{}_endpoint".format(model_id), location)

    print("Deploying endpoint")
    endpoint.deploy(
        model,
        machine_type="n1-standard-4",
        min_replica_count=1,
        max_replica_count=5,
        accelerator_type='NVIDIA_TESLA_K80',
        accelerator_count=1
    )

    return endpoint

endpoint = deploy_model(
    "<project name>",
    "us-central1",
    "<model id>",
)

不幸的是,当我运行这段代码时,我会在触发endpoint.deploy之后收到这个错误:google.api_core.exceptions.InvalidArgument: 400 'dedicated_resources' is not supported for Model...,后面跟着模型位置。

注意我用<***>交换了值以隐藏本地工作区变量的位置。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-10-15 04:13:37

您会遇到错误,因为无法将自定义机器分配给文本分类模型。只有自定义模型和AutoML表格模型可以按照文档使用自定义机器。对于AutoML模型,除了表格模型之外,顶点AI会自动配置机器类型。

如果要使用经过自定义培训的模型或AutoML表格模型来提供在线预测,则必须在将模型资源部署为DeployedModel到终结点时指定计算机类型。对于其他automatically.模型的类型,顶点AI配置机器类型 AutoML

解决这一问题的方法是删除endpoint.deploy()上与机器相关的参数,您应该能够部署模型。

代码语言:javascript
复制
print("Deploying endpoint")
endpoint.deploy(model)
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69577270

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档