Activa un recurso compartido de NFS para el entrenamiento personalizado
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Puedes configurar los trabajos de entrenamiento personalizados para activar los recursos compartidos del sistema de archivos de red (NFS) en el contenedor en el que se ejecuta el código. Esto permite que los trabajos accedan a archivos remotos como si fueran locales, lo que permite una alta capacidad de procesamiento y una latencia baja.
En esta guía, se muestra cómo activar un recurso compartido de NFS cuando se ejecuta un trabajo de entrenamiento personalizado.
Antes de comenzar
Crea un recurso compartido de NFS en una nube privada virtual (VPC). El recurso compartido debe ser accesible sin autenticación.
Puedes usar una instancia de Filestore como tu recurso compartido de NFS.
Si usas Filestore, selecciona Acceso privado al servicio como el modo de conexión cuando crees una instancia. Para ver un ejemplo, consulta Crea instancias en la documentación de Filestore.
Información de NFS para el entrenamiento personalizado
Cuando creas un trabajo de entrenamiento personalizado que activa un recurso compartido de NFS, debes especificar lo siguiente:
El nombre de la red a la que accede Vertex AI. La forma en que especificas el nombre de la red varía según el tipo de trabajo de entrenamiento personalizado. Para obtener más información, consulta Realiza entrenamientos personalizados.
Tu configuración de NFS en el campo WorkerPoolSpec.
Incluye los siguientes campos:
Campo
Descripción
nfsMounts.server
La dirección IP de tu servidor NFS. Debe ser una dirección privada en tu VPC.
nfsMounts.path
La ruta del recurso compartido de NFS. Esta debe ser una ruta de acceso absoluta que comience con /.
nfsMounts.mountPoint
El punto de activación local. Debe ser un nombre de directorio UNIX válido. Por ejemplo, si el punto de activación local es sourceData, especifica la ruta de acceso /mnt/nfs/sourceData de tu instancia de VM de entrenamiento.
Crea un archivo llamado config.yaml que describa la configuración de activación de NFS y de red para tu trabajo de entrenamiento. Usa el siguiente formato:
PROJECT_NUMBER: El ID del proyecto de tu proyecto de Google Cloud.
NETWORK_NAME: es el nombre de tu VPC privada o compartida.
MACHINE_TYPE: es el identificador de tu tipo de máquina virtual.
PYTHON_PACKAGE_EXECUTOR_IMAGE_URI or PRE_BUILT_CONTAINER_IMAGE_URI: es el URI de una imagen de contenedor en Artifact Registry que ejecutará el paquete de Python proporcionado. Vertex AI proporciona una amplia variedad de imágenes de ejecutores con paquetes preinstalados para satisfacer los diversos casos de uso de los usuarios.
PYTHON_PACKAGE_URIS: es una lista separada por comas de URI de Cloud Storage que especifican los archivos de paquetes de Python que conforman el programa de entrenamiento y sus paquetes dependientes. La cantidad máxima de URI de paquete es 100.
PYTHON_MODULE: es el nombre del módulo de Python que se ejecutará después de instalar los paquetes.
NFS_SERVER_IP: es la dirección IP de tu servidor NFS.
NFS_SHARE_NAME: es la ruta del recurso compartido de NFS, que es una ruta de acceso absoluta que comienza con /.
LOCAL_FOLDER: es el punto de activación local (nombre del directorio de UNIX).
Asegúrate de que el nombre de tu red tenga el formato correcto y de que el recurso compartido de NFS exista en la red especificada.
Crea tu trabajo personalizado y pasa tu archivo config.yaml al parámetro --config.
LOCATION: Especifica la región en la que se creará el trabajo.
JOB_NAME: es un nombre para el trabajo personalizado.
Limitaciones
Debes activar el recurso compartido de NFS mediante una dirección IP que sea interna de la VPC; no se permite el uso de URL públicas.
Los trabajos de entrenamiento activan los recursos compartidos de NFS sin autenticación y fallarán si se requieren un nombre de usuario y una contraseña.
Para proteger tus datos, establece permisos en el recurso compartido de NFS. Si usas Filestore, consulta Control de acceso en la documentación de Filestore.
No puedes ejecutar dos trabajos de entrenamiento que activen recursos compartidos de NFS desde diferentes redes de VPC al mismo tiempo. Esto se debe a la restricción de intercambio de tráfico entre redes.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2024-11-21 (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)."]]