Menentukan konfigurasi mesin untuk langkah pipeline
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Komponen pipeline Kubeflow adalah fungsi factory yang membuat langkah-langkah pipeline. Setiap komponen menjelaskan input, output, dan implementasi komponen. Misalnya, train_op adalah komponen dalam contoh kode berikut.
Misalnya, komponen pelatihan dapat mengambil file CSV sebagai input dan menggunakannya untuk melatih model. Dengan menetapkan parameter jenis mesin pada langkah pipeline, Anda dapat mengelola persyaratan dari setiap langkah di pipeline. Jika memiliki dua langkah pelatihan dan satu langkah pelatihan file data besar, dan langkah kedua adalah pelatihan file data kecil, Anda dapat mengalokasikan lebih banyak memori dan CPU ke tugas pertama, dan lebih sedikit resource ke tugas kedua.
Secara default, komponen akan berjalan sebagai Vertex AI CustomJob menggunakan mesin e2-standard-4, dengan 4 CPU inti dan memori 16 GB. Untuk mengetahui informasi selengkapnya tentang pemilihan salah satu resource mesin khusus Google Cloudyang tercantum dalam Jenis mesin, lihat Meminta resource mesin Google Cloud dengan Vertex AI Pipelines.
Contoh berikut menunjukkan cara menyetel setelan konfigurasi CPU, memori, dan GPU untuk satu langkah:
CPU_LIMIT: Batas CPU maksimum untuk operator ini. Nilai string ini dapat berupa angka (nilai integer untuk jumlah CPU), atau angka yang diikuti "m", yang berarti 1/1000. Anda dapat menentukan maksimal 96 CPU.
MEMORY_LIMIT: Batas memori maksimum untuk operator ini. Nilai string ini dapat berupa angka, atau angka yang diikuti oleh "K" (kilobyte), "M" (megabyte), atau "G" (gigabyte).
Dukungan maksimal 624 GB.
SELECTOR_CONSTRAINT: Setiap batasan adalah label pasangan nilai kunci.
Agar container memenuhi syarat untuk dijalankan di sebuah node, node harus memiliki setiap batasan sebagai label. Contoh: 'cloud.google.com/gke-accelerator', 'NVIDIA_TESLA_T4'
ACCELERATOR_LIMIT: Batas akselerator (GPU atau TPU) untuk
operator. Anda dapat menentukan bilangan bulat positif. Untuk mengetahui informasi selengkapnya tentang GPU yang tersedia dan cara mengonfigurasinya, lihat GPU. Untuk mengetahui informasi selengkapnya tentang TPU yang tersedia dan cara mengonfigurasinya, lihat TPU.
CustomJob mendukung jenis mesin tertentu yang membatasi Anda hingga maksimum 96 CPU dan memori 624 GB. Berdasarkan konfigurasi CPU, memori, dan akselerator yang Anda tentukan, Vertex AI Pipelines otomatis memilih yang paling cocok dari jenis mesin yang didukung.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 UTC."],[],[],null,["# Specify the machine configuration for a pipeline step\n\nKubeflow pipeline components are factory functions that create pipeline\nsteps. Each component describes the inputs, outputs, and implementation of the\ncomponent. For example, `train_op` is a component in the following code sample.\n\nFor example, a training component could take a CSV file as an input and use it\nto train a model. By setting the machine type parameters on the pipeline step,\nyou can manage the requirements of each step in your pipeline. If you have two\ntraining steps and one step trains on a huge data file and the second step\ntrains on a small data file, you can allocate more memory and CPU to the first\ntask, and fewer resources to the second task.\n\nBy default, the component will run on as a Vertex AI\n[`CustomJob`](/vertex-ai/docs/reference/rest/v1/projects.locations.customJobs)\nusing an **e2-standard-4** machine, with 4 core CPUs and 16GB memory. For more information about selecting one of the Google Cloud-specific machine resources listed in [Machine types](/vertex-ai/docs/training/configure-compute#machine-types), see [Request Google Cloud machine resources with Vertex AI Pipelines](/vertex-ai/docs/pipelines/request-gcp-machine-resources).\n\nThe following sample shows you how to set CPU, memory, and GPU configuration\nsettings for a step:\n**Note:** If you want to specify the disk space in the machine configuration, you must [create a custom training job from a component by requesting Google Cloud machine resources](/vertex-ai/docs/pipelines/request-gcp-machine-resources#create-customtrainingjob-from-component) instead. \n\n from kfp import dsl\n\n @dsl.pipeline(name='custom-container-pipeline')\n def pipeline():\n generate = generate_op()\n train = (\n train_op(\n training_data=generate.outputs['training_data'],\n test_data=generate.outputs['test_data'],\n config_file=generate.outputs['config_file'])\n .set_cpu_limit('\u003cvar translate=\"no\"\u003eCPU_LIMIT\u003c/var\u003e')\n .set_memory_limit('\u003cvar translate=\"no\"\u003eMEMORY_LIMIT\u003c/var\u003e')\n .add_node_selector_constraint(\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eSELECTOR_CONSTRAINT\u003c/span\u003e\u003c/var\u003e)\n .set_accelerator_limit(\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eACCELERATOR_LIMIT\u003c/span\u003e\u003c/var\u003e))\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eCPU_LIMIT\u003c/var\u003e: The maximum CPU limit for this operator. This string\n value can be a number (integer value for number of CPUs), or a number\n followed by \"m\", which means 1/1000. You can specify at most 96 CPUs.\n\n- \u003cvar translate=\"no\"\u003eMEMORY_LIMIT\u003c/var\u003e: The maximum memory limit for this operator. This\n string value can be a number, or a number followed by\n \"K\" (kilobyte), \"M\" (megabyte), or \"G\" (gigabyte).\n At most 624GB is supported.\n\n | **Note:** Vertex AI Pipelines does not support calling [`set_memory_request`](https://kubeflow-pipelines.readthedocs.io/page/source/dsl.html#kfp.dsl.PipelineTask.set_memory_request) on an operator ; you must use [`set_memory_limit`](https://kubeflow-pipelines.readthedocs.io/page/source/dsl.html#kfp.dsl.PipelineTask.set_memory_request) to request a specific memory amount.\n- \u003cvar translate=\"no\"\u003eSELECTOR_CONSTRAINT\u003c/var\u003e: Each constraint is a key-value pair label.\n For the container to be eligible to run on a node, the node must have each\n constraint as a label. For example:\n `'cloud.google.com/gke-accelerator', 'NVIDIA_TESLA_T4'`\n\n The following constraints are available:\n - `NVIDIA_GB200`^+^ (includes [GPUDirect-RDMA](/vertex-ai/docs/training/configure-compute#gpudirect-rdma))\n - `NVIDIA_B200`^\\*^ (includes [GPUDirect-RDMA](/vertex-ai/docs/training/configure-compute#gpudirect-rdma))\n - `NVIDIA_H100_MEGA_80GB`^\\*^ (includes [GPUDirect-TCPXO](/vertex-ai/docs/training/configure-compute#gpudirect-tcpxo))\n - `NVIDIA_H100_80GB`\n - `NVIDIA_H200_141GB`^\\*^ (includes [GPUDirect-RDMA](/vertex-ai/docs/training/configure-compute#gpudirect-rdma))\n - `NVIDIA_A100_80GB`\n - `NVIDIA_TESLA_A100` (NVIDIA A100 40GB)\n - `NVIDIA_TESLA_P4`\n - `NVIDIA_TESLA_P100`\n - `NVIDIA_TESLA_T4`\n - `NVIDIA_TESLA_V100`\n - `NVIDIA_L4`\n\n \u003cbr /\u003e\n\n - `TPU_V2`\n - `TPU_V3`\n- \u003cvar translate=\"no\"\u003eACCELERATOR_LIMIT\u003c/var\u003e: The accelerator (GPU or TPU) limit for the\n operator. You can specify a positive integer. For more information about the\n available GPUs and how to configure them, see\n [GPUs](/vertex-ai/docs/training/configure-compute#specifying_gpus). For more information\n about the available TPUs and how to configure them, see\n [TPUs](/vertex-ai/docs/training/configure-compute#tpu).\n\n | **Note:** TPUs are only available in specific locations. For more information, see [Using accelerators](/vertex-ai/docs/general/locations#accelerators).\n\n`CustomJob` supports specific machine types that limit you to a maximum of 96 CPUs and 624GB of memory. Based on the CPU, memory, and accelerator configuration that you specify, Vertex AI Pipelines automatically selects the closest match from the supported machine types."]]