Vertex AI용 커넥터

워크플로 내에서 Vertex AI에 액세스하는 데 사용되는 기본 제공 함수를 정의하는 Workflows 커넥터입니다.

더 살펴보기

이 코드 샘플이 포함된 자세한 문서는 다음을 참조하세요.

코드 샘플

YAML

# This workflow demonstrates how to use the aiplatform (Vertex AI) connector.
# This workflow creates a Vertex AI custom Job and then deletes the
# job once the long-running operation of creating the job completes.
# Expected successful output: "SUCCESS"
main:
  steps:
    - init:
        assign:
          - location: ${sys.get_env("GOOGLE_CLOUD_LOCATION")}
          - project: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
          # Follow https://cloud.google.com/vertex-ai/docs/training/create-custom-container to build
          # a custom container image for training.
          - container_image_uri: "IMAGE_URI"
    - create_custom_job:
        call: googleapis.aiplatform.v1.projects.locations.customJobs.create
        args:
          parent: ${"projects/" + project + "/locations/" + location}
          region: ${location}
          body:
            displayName: "example-custom-job"
            jobSpec:
              workerPoolSpecs:
                - machineSpec:
                    machineType: "n1-standard-4"
                    acceleratorType: "NVIDIA_TESLA_V100"
                    acceleratorCount: 1
                  replicaCount: 1
                  containerSpec:
                    imageUri: ${container_image_uri}
                    command: []
                    args: []
        result: customJobsResponse
    - delete_custom_job:
        call: googleapis.aiplatform.v1.projects.locations.customJobs.delete
        args:
          name: ${customJobsResponse.name}
          region: ${location}
        result: deleteCustomJobResponse
    - return:
        return: "SUCCESS"

다음 단계

다른 Google Cloud 제품의 코드 샘플을 검색하고 필터링하려면 Google Cloud 샘플 브라우저를 참조하세요.