Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Cloud Storage FUSE ti consente di caricare i dati di addestramento
in un bucket Cloud Storage e di accedervi dal tuo job di addestramento personalizzato
come a un file system montato. L'utilizzo di Cloud Storage FUSE offre i seguenti vantaggi:
I dati di addestramento vengono trasmessi in streaming al job di addestramento anziché scaricati nelle repliche, il che può velocizzare le attività di caricamento e configurazione dei dati quando il job inizia a essere eseguito.
I job di addestramento possono gestire input e output su larga scala senza effettuare chiamate API, gestire le risposte o integrarsi con le librerie lato client.
Cloud Storage FUSE offre un elevato throughput per le letture sequenziali di file di grandi dimensioni
e in scenari di addestramento distribuito.
Casi d'uso
Consigliamo di utilizzare Cloud Storage per l'archiviazione dei dati di addestramento nelle seguenti situazioni:
I dati di addestramento sono dati non strutturati, come immagini, testo e video.
I dati di addestramento sono dati strutturati in un formato come TFRecord.
I dati di addestramento contengono file di grandi dimensioni, ad esempio video non elaborati.
Utilizzi l'addestramento distribuito.
Come funziona
I job di addestramento personalizzato possono accedere ai bucket Cloud Storage come sottodirectory della directory principale /gcs. Ad esempio, se i dati di addestramento si trovano ings://example-bucket/data.csv, puoi leggere e scrivere nel bucket dalla tua applicazione di addestramento Python come segue:
Per impostazione predefinita, un job di addestramento personalizzato può accedere a qualsiasi bucket Cloud Storage
all'interno dello stesso Google Cloud progetto utilizzando l'agente di servizio del codice personalizzato Vertex AI.
Per controllare l'accesso ai bucket, puoi assegnare al job un
account di servizio personalizzato. In questo caso, l'accesso a un bucket Cloud Storage viene concesso in base alle autorizzazioni associate ai ruoli Cloud Storage dell'account di servizio personalizzato.
Ad esempio, se vuoi assegnare al job di addestramento personalizzato l'accesso in lettura e scrittura al bucket A, ma solo l'accesso in lettura al bucket B, puoi assegnare al job un account di servizio personalizzato con i seguenti ruoli:
roles/storage.objectAdmin per il bucket A
roles/storage.objectViewer per il bucket B
Se il job di addestramento tenta di scrivere nel bucket B, viene restituito un errore "autorizzazione negata".
Evita di rinominare le directory. Un'operazione di rinominazione non è atomica in Cloud Storage FUSE. Se l'operazione viene interrotta, alcuni file rimangono nella vecchia directory.
Evita di chiudere (close()) o svuotare la cache dei file (flush()) inutilmente. La chiusura o lo svuotamento della cache dei file comporta il trasferimento del file in Cloud Storage, con un costo.
Linee guida per l'ottimizzazione delle prestazioni
Per ottenere una velocità in lettura ottimale quando utilizzi Cloud Storage come file system, consigliamo di implementare le seguenti linee guida:
Per ridurre la latenza introdotta dalla ricerca e dall'apertura di oggetti in un
secchio, archivia i dati in file più grandi e meno numerosi.
[[["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,["# Use Cloud Storage as a mounted file system\n\n[Cloud Storage FUSE](/storage/docs/gcs-fuse) lets you load training data to a Cloud Storage bucket and access that data from your custom training job like a mounted file system. Using Cloud Storage FUSE has the following benefits:\n\n\u003cbr /\u003e\n\n- Training data is streamed to your training job instead of downloaded to replicas, which can make data loading and setup tasks faster when the job starts running.\n- Training jobs can handle input and output at scale without making API calls, handling responses, or integrating with client-side libraries.\n- Cloud Storage FUSE provides high throughput for large file sequential reads and in distributed training scenarios.\n\nUse cases\n---------\n\nWe recommend using Cloud Storage for storing training data in the following\nsituations:\n\n- Your training data is unstructured data, such as image, text, and video.\n- Your training data is structured data in a format such as TFRecord.\n- Your training data contains large files, such as raw video.\n- You use distributed training.\n\nHow it works\n------------\n\nCustom training jobs can access your Cloud Storage buckets as subdirectories\nof the root `/gcs` directory. For example, if your training data is located at\n`gs://example-bucket/data.csv`, you can read and write to the bucket from your\nPython training application as follows:\n\n**Read to the bucket** \n\n with open('/gcs/example-bucket/data.csv', 'r') as f:\n lines = f.readlines()\n\n**Write to the bucket** \n\n with open('/gcs/example-bucket/epoch3.log', 'a') as f:\n f.write('success!\\n')\n\nBucket access permissions\n-------------------------\n\nBy default, a custom training job can access any Cloud Storage bucket\nwithin the same Google Cloud project by using the\n[Vertex AI Custom Code Service Agent](/vertex-ai/docs/general/access-control#service-agents).\nTo control access to buckets, you can assign a\n[custom service account](/vertex-ai/docs/general/custom-service-account)\nto the job. In this case, access to a Cloud Storage bucket is granted based\non the permissions associated with the Cloud Storage roles of the custom\nservice account.\n\nFor example, if you want to give the custom training job read and write access\nto Bucket-A but only read access to Bucket-B, you can assign a custom service\naccount that has the following roles to the job:\n\n- `roles/storage.objectAdmin` for Bucket-A\n- `roles/storage.objectViewer` for Bucket-B\n\nIf the training job attempts to write to Bucket-B, a \"permission denied\" error\nis returned.\n\nFor more information on Cloud Storage roles, see\n[IAM roles for Cloud Storage](/storage/docs/access-control/iam-roles).\n\nBest practices\n--------------\n\n- Avoid renaming directories. A renaming operation is not atomic in Cloud Storage FUSE. If the operation is interrupted, some files remain in the old directory.\n- Avoid unnecessarily closing (`close()`) or flushing files (`flush()`). Closing or flushing files pushes the file to Cloud Storage, which incurs a cost.\n\n### Performance optimization guidelines\n\nTo get optimal read throughput when using Cloud Storage as a file system, we\nrecommend implementing the following guidelines:\n\n- To reduce the latency introduced by looking up and opening objects in a bucket, store data in larger and fewer files.\n- Use [distributed training](/vertex-ai/docs/training/distributed-training) to maximize bandwidth utilization.\n- Cache frequently accessed files to improve read performance. For details, see [Overview of caching in Cloud Storage FUSE](/storage/docs/gcsfuse-cache).\n- Use local storage for checkpointing and logs instead of Cloud Storage.\n\nLimitations\n-----------\n\nTo learn about the limitations of Cloud Storage FUSE, including the differences\nbetween Cloud Storage FUSE and POSIX file systems, see\n[Limitations and differences from POSIX file systems](/storage/docs/gcs-fuse#differences-and-limitations).\n\nUse Cloud Storage FUSE\n----------------------\n\nTo use Cloud Storage FUSE for custom training, do the following:\n\n1. [Create a Cloud Storage bucket](/storage/docs/creating-buckets). Note that dual-region and multi-region buckets are not supported for custom training.\n2. Upload your training data to the bucket. For details, see\n [Uploads](/storage/docs/uploads-downloads#uploads).\n\n To learn about other options for transferring data to Cloud Storage, see\n [Data transfer options](/storage-transfer/docs/transfer-options).\n3. [Install Cloud Storage FUSE](/storage/docs/gcsfuse-install).\n\n4. [Mount the bucket in your training application](#how_it_works).\n\nWhat's next\n-----------\n\n- [See Cloud Storage FUSE documentation](/storage/docs/gcs-fuse).\n- [Learn about Cloud Storage FUSE pricing](/storage/docs/gcs-fuse#charges).\n- [Prepare your training application](/vertex-ai/docs/training/code-requirements) for use on Vertex AI."]]