커스텀 컨테이너는 학습 애플리케이션을 실행하기 위해 만드는 Docker 이미지입니다. 머신러닝(ML) 학습 작업을 커스텀 컨테이너에서 실행하면, Vertex AI에서는 달리 지원되지 않는 ML 프레임워크, ML 외의 종속 항목, 라이브러리, 바이너리를 사용할 수 있습니다.
컨테이너로 학습하는 방법
선택한 ML 프레임워크로 구현된 학습 애플리케이션은 학습 프로세스의 핵심 요소입니다.
선택한 ML 프레임워크를 사용하여 모델을 학습하는 애플리케이션을 만듭니다.
커스텀 컨테이너를 사용할지 여부를 결정합니다. 이미 종속 항목을 지원하는 사전 빌드된 컨테이너가 있을 수 있습니다. 그렇지 않으면 학습 작업을 위한 커스텀 컨테이너를 빌드해야 합니다. 커스텀 컨테이너에서 학습 애플리케이션과 모든 종속 항목을 학습 작업을 실행하는 데 사용되는 이미지에 사전 설치합니다.
Vertex AI에서 액세스할 수 있는 소스에 학습 및 확인 데이터를 저장합니다. 인증을 간소화하고 지연 시간을 줄이려면 Vertex AI에 사용하는 것과 동일한 Google Cloud 프로젝트와 리전에 있는 Cloud Storage, Bigtable 또는 다른Google Cloud 스토리지 서비스에 데이터를 저장합니다. Vertex AI에서 데이터를 로드하는 방법에 대해 자세히 알아보세요.
애플리케이션을 실행할 수 있게 되면 Docker 이미지를 빌드하여 Artifact Registry 또는 Docker Hub에 푸시하여 Vertex AI가 레지스트리에 액세스할 수 있는지 확인해야 합니다.
Vertex AI는 작업에 필요한 리소스를 설정합니다. 작업 구성을 기반으로 가상 머신(학습 인스턴스라고 함)을 하나 이상 할당합니다. 커스텀 학습 작업 제출 시 WorkerPoolSpec 객체의 일부로 지정하는 커스텀 컨테이너를 사용하여 학습 인스턴스를 설정합니다.
Vertex AI는 학습 작업 생성 시 지정한 명령줄 인수를 통해 Docker 이미지를 실행합니다.
학습 작업이 성공하거나 복구 불가 오류가 발생하는 경우 Vertex AI는 모든 작업 프로세스를 중지하고 리소스를 삭제합니다.
커스텀 컨테이너의 이점
커스텀 컨테이너를 사용하면 애플리케이션에 필요한 모든 종속 항목을 지정하여 사전에 설치할 수 있습니다.
더욱 빨라진 구동 시간. 종속 항목이 사전 설치되어 있는 커스텀 컨테이너를 사용하는 경우, 시작 시 종속 항목을 설치하기 위해 학습 애플리케이션이 필요로 하는 시간을 절약할 수 있습니다.
원하는 ML 프레임워크 사용. 사용하려는 ML 프레임워크로 Vertex AI 사전 빌드 컨테이너를 찾을 수 없다면 선택한 프레임워크로 커스텀 컨테이너를 빌드하고 이를 사용하여 Vertex AI에서 작업을 실행하면 됩니다. 예를 들어 고객 컨테이너를 사용하여 PyTorch로 학습시킬 수 있습니다.
분산 학습에 대한 지원 확대. 커스텀 컨테이너를 사용하면 ML 프레임워크를 사용하여 분산 학습을 수행할 수 있습니다.
최신 버전 사용. ML 프레임워크의 최신 빌드 또는 부 버전을 사용할 수도 있습니다. 예를 들어 커스텀 컨테이너를 빌드하여 tf-nightly로 학습시킬 수 있습니다.
커스텀 컨테이너로 초매개변수 미세 조정
Vertex AI에서 초매개변수 조정을 수행하려면 목표 측정항목과 각 측정항목을 최소화 또는 최대화할지 지정합니다.
예를 들어 모델 정확성을 최대화하거나 모델 손실을 최소화하려 할 수 있습니다. 또한 각 초매개변수에 허용되는 값의 범위와 함께 조정할 초매개변수를 나열합니다. Vertex AI는 학습 애플리케이션을 여러 번 시도하고, 시도가 끝날 때마다 초매개변수를 추적 및 조정합니다. 초매개변수 미세 조정 작업이 완료되면 Vertex AI는 가장 효과적인 초매개변수 구성 값과 각 시도 결과의 요약을 보고합니다.
GPU 학습을 위해서는 커스텀 컨테이너가 몇 가지 특수한 요구사항을 충족해야 합니다. CPU를 사용한 학습에 사용하는 Docker 이미지와 다른 Docker 이미지를 빌드해야 합니다.
Docker 이미지에 CUDA 도구와 cuDNN을 사전에 설치합니다. GPU를 지원하는 커스텀 컨테이너를 빌드하는 권장 방법은 nvidia/cuda 이미지를 커스텀 컨테이너의 기본 이미지로 사용하는 것입니다. nvidia/cuda 컨테이너 이미지에는 CUDA 도구와 cuDNN이 사전 설치되어 있고 관련 환경 변수를 올바르게 설정하는 데 유용합니다.
Docker 이미지에 필요한 ML 프레임워크 및 기타 종속 항목과 함께 학습 애플리케이션을 설치합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-05(UTC)"],[],[],null,["# Custom containers overview\n\nA custom container is a Docker image that you create to run\nyour training application. By running your machine learning (ML) training job\nin a *custom container*, you can use ML frameworks, non-ML dependencies,\nlibraries, and binaries that are not otherwise supported\non Vertex AI.\n\nHow training with containers works\n----------------------------------\n\nYour training application, implemented in the ML framework of your choice,\nis the core of the training process.\n\n1. Create an application that trains your model, using the ML framework\n of your choice.\n\n2. Decide whether to use a custom container. There could be a\n [prebuilt container](/vertex-ai/docs/training/pre-built-containers) that already supports\n your dependencies. Otherwise, you need to [build a custom container for\n your training job](/vertex-ai/docs/training/create-custom-container). In your custom container, you\n pre-install your training application and all its dependencies onto an\n image that is used to run your training job.\n\n3. Store your training and verification data in a source that\n Vertex AI can access. To simplify authentication and reduce\n latency, store your data in Cloud Storage, Bigtable, or another\n Google Cloud storage service in the same Google Cloud project\n and region that you are using for Vertex AI. Learn more about\n [the ways Vertex AI can load your data](/vertex-ai/docs/training/code-requirements#loading-data).\n\n4. When your application is ready to run, you must build your Docker image and\n push it to Artifact Registry or Docker Hub, making sure that\n [Vertex AI can access your registry](/vertex-ai/docs/training/create-custom-container#manage-container-registry-permissions).\n\n5. Submit your custom training job by [creating a custom\n job](/vertex-ai/docs/training/create-custom-job) or [creating a custom training\n pipeline](/vertex-ai/docs/training/create-training-pipeline).\n\n6. Vertex AI sets up resources for your job. It allocates one or\n more virtual machines (called *training instances* ) based on your job\n configuration. You set up a training instance by using the custom container\n you specify as part of the [`WorkerPoolSpec`](/vertex-ai/docs/reference/rest/v1/CustomJobSpec#workerpoolspec) object when\n you [submit your custom training\n job](/vertex-ai/docs/training/create-custom-job).\n\n7. Vertex AI runs your Docker image, passing through any\n command-line arguments you specify when you create the training job.\n\n8. When your training job succeeds or encounters an unrecoverable error,\n Vertex AI halts all job processes and cleans up the\n resources.\n\nAdvantages of custom containers\n-------------------------------\n\nCustom containers let you specify and pre-install all the dependencies\nneeded for your application.\n\n- **Faster start-up time.** If you use a custom container with your dependencies pre-installed, you can save the time that your training application would otherwise take to install dependencies when starting up.\n- **Use the ML framework of your choice.** If you can't find an Vertex AI prebuilt container with the ML framework you want to use, you can build a custom container with your chosen framework and use it to run jobs on Vertex AI. For example, you can use a customer container to train with PyTorch.\n- **Extended support for distributed training.** With custom containers, you can do distributed training using any ML framework.\n- **Use the newest version.** You can also use the latest build or minor version of an ML framework. For example, you can build a custom container to train with `tf-nightly`.\n\nHyperparameter tuning with custom containers\n--------------------------------------------\n\nTo do [hyperparameter tuning](/vertex-ai/docs/training/hyperparameter-tuning-overview) on Vertex AI, you\nspecify goal metrics, along with whether to minimize or maximize each metric.\nFor example, you might want to maximize your model accuracy, or minimize your\nmodel loss. You also list the hyperparameters you'd like to tune, along with\nthe range of acceptable values for each hyperparameter. Vertex AI\ndoes multiple *trials* of your training application, tracking and adjusting the\nhyperparameters after each trial. When the hyperparameter tuning job is\ncomplete, Vertex AI reports values for the most effective\nconfiguration of your hyperparameters, and a summary for each trial.\n\nTo do hyperparameter tuning with custom containers, you need to make\nthe following adjustments:\n\n- In your Dockerfile: install [`cloudml-hypertune`](https://github.com/GoogleCloudPlatform/cloudml-hypertune).\n- In your training code:\n - Use `cloudml-hypertune` to report the results of each trial by calling its helper function, [`report_hyperparameter_tuning_metric`](https://github.com/GoogleCloudPlatform/cloudml-hypertune/blob/master/hypertune/hypertune.py#L49).\n - Add command-line arguments for each hyperparameter, and handle the argument parsing with an argument parser such as [`argparse`](https://docs.python.org/3/library/argparse.html).\n\nSee how to [configure a hyperparameter tuning job that uses custom\ncontainers](/vertex-ai/docs/training/using-hyperparameter-tuning) or learn more about\n[how hyperparameter tuning works on Vertex AI](/vertex-ai/docs/training/hyperparameter-tuning-overview).\n\nGPUs in custom containers\n-------------------------\n\nFor training with GPUs, your custom container needs to meet a few special\nrequirements. You must build a different Docker image than what you'd use for\ntraining with CPUs.\n\n- Pre-install the CUDA toolkit and cuDNN in your Docker image. The recommended way to build a custom container with support for GPUs is to use the [`nvidia/cuda`](https://hub.docker.com/r/nvidia/cuda/) image as your base image for your custom container. The `nvidia/cuda` container image has matching versions of CUDA toolkit and cuDNN pre-installed, and it helps you set up the related environment variables correctly.\n- Install your training application, along with your required ML framework and other dependencies in your Docker image.\n\nSee an [example Dockerfile for training with GPUs](https://github.com/GoogleCloudPlatform/cloudml-samples/blob/master/pytorch/containers/quickstart/mnist/Dockerfile-gpu).\n\nWhat's next\n-----------\n\n- Learn more about how to [create a custom container for your training\n job](/vertex-ai/docs/training/create-custom-container)."]]