Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Puoi configurare i job di addestramento personalizzati per montare le condivisioni Network File System (NFS)
nel container in cui viene eseguito il codice. In questo modo i tuoi job possono accedere ai file remoti come se fossero locali, consentendo un'alta velocità effettiva e una bassa latenza.
Questa guida mostra come montare una condivisione Network File System durante l'esecuzione di un
job di addestramento personalizzato.
Prima di iniziare
Crea una condivisione NFS in un Virtual Private Cloud (VPC). La tua condivisione deve essere
accessibile senza autenticazione.
Puoi utilizzare un'istanza Filestore come condivisione NFS.
Se utilizzi Filestore e prevedi di utilizzare il peering VPC per Vertex AI nel passaggio successivo, seleziona accesso privato ai servizi come modalità di connessione quando crei un'istanza. Per un esempio, consulta
Crea istanze
nella documentazione di Filestore.
Informazioni sul Network File System per l'addestramento personalizzato
Quando crei un job di addestramento personalizzato che monta una condivisione NFS, devi
specificare quanto segue:
Il nome della rete a cui Vertex AI deve accedere. Il modo in cui
specificare il nome della rete varia a seconda del tipo di job di addestramento personalizzato. Per maggiori dettagli, vedi Eseguire l'addestramento personalizzato.
L'indirizzo IP del tuo server NFS. Deve essere un indirizzo privato nel tuo VPC.
nfsMounts.path
Il percorso della condivisione NFS. Deve essere un percorso assoluto che inizia con /.
nfsMounts.mountPoint
Il punto di montaggio locale. Deve essere un nome di directory UNIX valido. Ad esempio, se il punto di montaggio locale è sourceData, specifica il percorso /mnt/nfs/sourceData dalla VM di addestramento.
Crea un file denominato config.yaml che descriva le impostazioni di montaggio della configurazione dell'interfaccia PSA o Private Service Connect
per il job di addestramento. Utilizza uno dei seguenti formati:
Interfaccia Private Service Connect
Per utilizzare l'interfaccia Private Service Connect:
NETWORK_ATTACHMENT_NAME: il nome del collegamento di rete.
MACHINE_TYPE: l'identificatore del tipo di macchina virtuale.
PYTHON_PACKAGE_EXECUTOR_IMAGE_URI o PRE_BUILT_CONTAINER_IMAGE_URI:
L'URI di un'immagine container in Artifact Registry che eseguirà il pacchetto Python fornito. Vertex AI fornisce un'ampia gamma di immagini di executor con pacchetti preinstallati per soddisfare i vari casi d'uso degli utenti.
PYTHON_PACKAGE_URIS: un elenco separato da virgole di URI Cloud Storage che specificano i file del pacchetto Python che compongono il programma di addestramento e i relativi pacchetti dipendenti. Il numero massimo di URI dei pacchetti è 100.
PYTHON_MODULE: il nome del modulo Python da eseguire dopo l'installazione
dei pacchetti.
NFS_SERVER_IP: L'indirizzo IP del server NFS.
NFS_SHARE_NAME: il percorso della condivisione NFS, ovvero un percorso assoluto che inizia con /.
LOCAL_FOLDER: Il punto di montaggio locale (nome della directory UNIX).
Assicurati che il nome della rete sia formattato correttamente e che la condivisione NFS
esista nella rete specificata.
Crea il job personalizzato e passa il file config.yaml al parametro --config.
PROJECT_NUMBER: l'ID progetto del tuo Google Cloud progetto.
NETWORK_NAME: il nome del tuo VPC privato o condiviso.
MACHINE_TYPE: l'identificatore del tipo di macchina virtuale.
PYTHON_PACKAGE_EXECUTOR_IMAGE_URI or PRE_BUILT_CONTAINER_IMAGE_URI:
L'URI di un'immagine container in Artifact Registry che eseguirà il pacchetto Python fornito. Vertex AI fornisce un'ampia gamma di immagini di executor con pacchetti preinstallati per soddisfare i vari casi d'uso degli utenti.
PYTHON_PACKAGE_URIS: un elenco separato da virgole di URI Cloud Storage che specificano i file del pacchetto Python che compongono il programma di addestramento e i relativi pacchetti dipendenti. Il numero massimo di URI dei pacchetti è 100.
PYTHON_MODULE: il nome del modulo Python da eseguire dopo l'installazione
dei pacchetti.
NFS_SERVER_IP: L'indirizzo IP del server NFS.
NFS_SHARE_NAME: il percorso della condivisione NFS, ovvero un percorso assoluto che inizia con /.
LOCAL_FOLDER: Il punto di montaggio locale (nome della directory UNIX).
Assicurati che il nome della rete sia formattato correttamente e che la condivisione NFS
esista nella rete specificata.
Crea il job personalizzato e passa il file config.yaml al parametro --config.
LOCATION: specifica la regione in cui creare il job.
JOB_NAME: un nome per il job personalizzato.
Limitazioni
Devi montare la condivisione NFS utilizzando un indirizzo IP interno al tuo
VPC; l'utilizzo di URL pubblici non è consentito.
I job di addestramento montano le condivisioni NFS senza autenticazione e non andranno a buon fine
se sono richiesti un nome utente e una password.
Per proteggere i tuoi dati, imposta le autorizzazioni
sulla condivisione NFS. Se utilizzi Filestore, consulta il controllo dell'accesso nella documentazione di Filestore.
Non puoi eseguire contemporaneamente due job di addestramento che montano condivisioni NFS da reti VPC diverse. Ciò è dovuto alla
limitazione del peering di rete.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-10 UTC."],[],[],null,["# Mount a Network File System share\n\nYou can configure your custom training jobs to mount Network File System (NFS)\nshares to the container where your code is running. This lets your jobs\naccess remote files as if they were local, enabling high throughput and\nlow latency.\n\nThis guide shows how to mount a Network File System share when running a\ncustom training job.\n\nBefore you begin\n----------------\n\n1. Create an NFS share in a\n [Virtual Private Cloud (VPC)](/vpc/docs/vpc-peering). Your share must be\n accessible without authentication.\n\n You can use a Filestore instance as your NFS share.\n If you are using [Filestore](/filestore) and plan to use VPC\n peering for Vertex AI in the next step, select **private service\n access** as the connect mode when you create an instance. For an example, see\n [Create instances](/filestore/docs/creating-instances)\n in the Filestore documentation.\n2. To connect Vertex AI with the VPC that hosts your NFS share,\n follow the instructions in [Use Private Service Connect interface for Vertex AI](/vertex-ai/docs/training/psc-i-egress) (recommended), or [Set up VPC Network Peering](/vertex-ai/docs/general/vpc-peering).\n\nNetwork File System information for custom training\n---------------------------------------------------\n\nWhen you create a custom training job that mounts an NFS share, you must\nspecify the following:\n\n- The name of the network for Vertex AI to access. The way that you\n specify the network name differs depending on the type of custom training\n job. For details, see [Perform custom training](/vertex-ai/docs/training/using-private-ip#perform-custom-training).\n\n- Your NFS configuration in the [WorkerPoolSpec field](/vertex-ai/docs/reference/rest/v1/CustomJobSpec#workerpoolspec).\n Include the following fields:\n\n For more information, see [Where to specify compute resources](/vertex-ai/docs/training/configure-compute#where_to_specify_compute_resources).\n\nExample: create a custom job using the gcloud CLI\n-------------------------------------------------\n\n1. Follow the steps in\n [Create a Python training application for a prebuilt container](/vertex-ai/docs/training/create-python-pre-built-container)\n to build a training application to run on Vertex AI.\n\n2. Create a file named `config.yaml` that describes the PSA or Private Service Connect interface config\n mount settings for your training job. Use one of the following formats:\n\n### Private Service Connect interface\n\n\n| **Preview\n| --- Private Service Connect interface**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\n\u003cbr /\u003e\n\n1. To use Private Service Connect interface:\n\n pscInterfaceConfig:\n network_attachment: \u003cvar translate=\"no\"\u003eNETWORK_ATTACHMENT_NAME\u003c/var\u003e\n workerPoolSpecs:\n - machineSpec:\n machineType: \u003cvar translate=\"no\"\u003eMACHINE_TYPE\u003c/var\u003e\n replicaCount: 1\n pythonPackageSpec:\n executorImageUri: \u003cvar translate=\"no\"\u003ePYTHON_PACKAGE_EXECUTOR_IMAGE_URI\u003c/var\u003e or \u003cvar translate=\"no\"\u003ePRE_BUILT_CONTAINER_IMAGE_URI\u003c/var\u003e\n packageUris:\n - \u003cvar translate=\"no\"\u003ePYTHON_PACKAGE_URIS\u003c/var\u003e\n pythonModule: PYTHON_MODULE\n nfsMounts:\n - server: \u003cvar translate=\"no\"\u003eNFS_SERVER_IP\u003c/var\u003e\n path: \u003cvar translate=\"no\"\u003eNFS_SHARE_NAME\u003c/var\u003e\n mountPoint: LOCAL_FOLDER\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eNETWORK_ATTACHMENT_NAME\u003c/var\u003e: The name of your network attachment.\n\n - \u003cvar translate=\"no\"\u003eMACHINE_TYPE\u003c/var\u003e: The identifier of your virtual machine type.\n\n - \u003cvar translate=\"no\"\u003ePYTHON_PACKAGE_EXECUTOR_IMAGE_URI\u003c/var\u003e or \u003cvar translate=\"no\"\u003ePRE_BUILT_CONTAINER_IMAGE_URI\u003c/var\u003e:\n The URI of a container image in Artifact Registry that will run the provided\n Python package. Vertex AI provides a\n [wide range of executor images with pre-installed packages](/vertex-ai/docs/training/pre-built-containers)\n to meet users' various use cases.\n\n - \u003cvar translate=\"no\"\u003ePYTHON_PACKAGE_URIS\u003c/var\u003e: A comma-separated list of\n Cloud Storage URIs that specify the Python package files that\n make up the training program and its dependent packages. The maximum\n number of package URIs is 100.\n\n - \u003cvar translate=\"no\"\u003ePYTHON_MODULE\u003c/var\u003e: The Python module name to run after installing\n the packages.\n\n - \u003cvar translate=\"no\"\u003eNFS_SERVER_IP\u003c/var\u003e: The IP address of your NFS server.\n\n - \u003cvar translate=\"no\"\u003eNFS_SHARE_NAME\u003c/var\u003e: The NFS share path, which is an\n absolute path that begins with `/`.\n\n - \u003cvar translate=\"no\"\u003eLOCAL_FOLDER\u003c/var\u003e: The local mount point (UNIX directory name).\n\n Make sure that your network name is formatted correctly and that your NFS\n share exists in the specified network.\n2. Create your custom job and pass your `config.yaml` file to the `--config`\n parameter.\n\n gcloud ai custom-jobs create \\\n --region=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --display-name=\u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e \\\n --config=config.yaml\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: Specify the region to create the job in.\n\n - \u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e: A name for the custom job.\n\n### VPC peering\n\n1. Use VPC Peering if you want the job to use VPC Peering/PSA on the job\n or not.\n\n network: projects/\u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e/global/networks/\u003cvar translate=\"no\"\u003eNETWORK_NAME\u003c/var\u003e\n workerPoolSpecs:\n - machineSpec:\n machineType: \u003cvar translate=\"no\"\u003eMACHINE_TYPE\u003c/var\u003e\n replicaCount: 1\n pythonPackageSpec:\n executorImageUri: \u003cvar translate=\"no\"\u003ePYTHON_PACKAGE_EXECUTOR_IMAGE_URI\u003cspan class=\"devsite-syntax-w\"\u003e \u003c/span\u003eor\u003cspan class=\"devsite-syntax-w\"\u003e \u003c/span\u003e\n \u003cspan class=\"devsite-syntax-w\"\u003e \u003c/span\u003ePRE_BUILT_CONTAINER_IMAGE_URI\u003c/var\u003e\n packageUris:\n - \u003cvar translate=\"no\"\u003ePYTHON_PACKAGE_URIS\u003c/var\u003e\n pythonModule: \u003cvar translate=\"no\"\u003ePYTHON_MODULE\u003c/var\u003e\n nfsMounts:\n - server: \u003cvar translate=\"no\"\u003eNFS_SERVER_IP\u003c/var\u003e\n path: \u003cvar translate=\"no\"\u003eNFS_SHARE_NAME\u003c/var\u003e\n mountPoint: \u003cvar translate=\"no\"\u003eLOCAL_FOLDER\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e: The project ID of your Google Cloud project.\n\n - \u003cvar translate=\"no\"\u003eNETWORK_NAME\u003c/var\u003e: The name of your private or Shared VPC.\n\n - \u003cvar translate=\"no\"\u003eMACHINE_TYPE\u003c/var\u003e: The identifier of your virtual machine type.\n\n - \u003cvar translate=\"no\"\u003ePYTHON_PACKAGE_EXECUTOR_IMAGE_URI or PRE_BUILT_CONTAINER_IMAGE_URI\u003c/var\u003e:\n The URI of a container image in Artifact Registry that will run the provided\n Python package. Vertex AI provides a\n [wide range of executor images with pre-installed packages](/vertex-ai/docs/training/pre-built-containers)\n to meet users' various use cases.\n\n - \u003cvar translate=\"no\"\u003ePYTHON_PACKAGE_URIS\u003c/var\u003e: A comma-separated list of\n Cloud Storage URIs that specify the Python package files that\n make up the training program and its dependent packages. The maximum\n number of package URIs is 100.\n\n - \u003cvar translate=\"no\"\u003ePYTHON_MODULE\u003c/var\u003e: The Python module name to run after installing\n the packages.\n\n - \u003cvar translate=\"no\"\u003eNFS_SERVER_IP\u003c/var\u003e: The IP address of your NFS server.\n\n - \u003cvar translate=\"no\"\u003eNFS_SHARE_NAME\u003c/var\u003e: The NFS share path, which is an\n absolute path that begins with `/`.\n\n - \u003cvar translate=\"no\"\u003eLOCAL_FOLDER\u003c/var\u003e: The local mount point (UNIX directory name).\n\n Make sure that your network name is formatted correctly and that your NFS\n share exists in the specified network.\n2. Create your custom job and pass your `config.yaml` file to the `--config`\n parameter.\n\n gcloud ai custom-jobs create \\\n --region=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --display-name=\u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e \\\n --config=config.yaml\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: Specify the region to create the job in.\n\n- \u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e: A name for the custom job.\n\nLimitations\n-----------\n\n- You must mount your NFS share using an IP address that is internal to your\n VPC; using public URLs isn't allowed.\n\n- Training jobs mount NFS shares without authentication, and will fail\n if a username and password are required.\n\n To secure your data, set permissions\n on your NFS share. If you are using Filestore, see\n [access control](/filestore/docs/access-control) in the Filestore\n documentation.\n- You can't run two training jobs that mount NFS shares from different\n VPC networks at the same time. This is due to the\n [network peering restriction](/vertex-ai/docs/training/using-private-ip#run_jobs_on_different_networks)."]]